LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2016

HPS-SVN March 2016

Subject:

r4278 - in /java/trunk: analysis/src/main/java/org/hps/analysis/dataquality/ analysis/src/main/java/org/hps/analysis/ecal/ analysis/src/main/java/org/hps/analysis/examples/ analysis/src/main/java/org/hps/analysis/trigger/ analysis/src/main/java/org/hps/analysis/trigger/data/ analysis/src/main/java/org/hps/analysis/trigger/event/ analysis/src/main/java/org/hps/analysis/trigger/util/ detector-data/detectors/HPS-EngRun2015-Nominal-v1-3/ detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/ detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/ detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-1/ detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-2/ detector-data/detectors/HPS-Proposal2014-v3-2pt2-0zOffset/ detector-data/detectors/HPS-TestRun-v5/ detector-data/detectors/HPS-TestRun-v6/ detector-data/detectors/HPS-TestRun-v7-2/ detector-data/detectors/HPS-TestRun-v7-3/ detector-data/detectors/HPS-TestRun-v7/ detector-data/detectors/HPS-TestRun-v8-4/ detector-data/detectors/HPS-TestRun-v8-5/ detector-data/detectors/HPS-TestRun-v8/ detector-data/detectors/HPSTestRunTracker2014-v0/ detector-model/src/main/java/org/lcsim/detector/converter/compact/ detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/ detector-model/src/main/java/org/lcsim/detector/tracker/silicon/ detector-model/src/main/java/org/lcsim/geometry/compact/converter/ detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/ detector-model/src/main/java/org/lcsim/geometry/subdetector/ detector-model/src/test/java/org/lcsim/detector/converter/compact/ detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/ detector-model/src/test/java/org/lcsim/geometry/subdetector/ detector-model/src/test/resources/org/lcsim/geometry/subdetector/ distribution/src/main/java/org/hps/ ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/ ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/ ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/ ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/ ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/ ecal-readout-sim/src/main/java/org/hps/readout/ecal/ ecal-recon/src/main/java/org/hps/recon/ecal/ ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ evio/src/main/java/org/hps/evio/ evio/src/test/java/org/hps/evio/ integration-tests/src/test/java/org/hps/test/it/ integration-tests/src/test/resources/org/hps/ecalreadoutsim/ integration-tests/src/test/resources/org/hps/steering/test/ monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/ monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/ monitoring-util/src/main/java/org/hps/monitoring/trigger/ parent/ recon/src/main/java/org/hps/recon/filtering/ recon/src/main/java/org/hps/recon/particle/ recon/src/main/java/org/hps/recon/utils/ recon/src/main/java/org/hps/recon/vertexing/ recon/src/test/java/org/hps/recon/particle/ record-util/src/main/java/org/hps/record/daqconfig/ record-util/src/main/java/org/hps/record/triggerbank/ steering-files/src/main/resources/org/hps/steering/analysis/ steering-files/src/main/resources/org/hps/steering/monitoring/ steering-files/src/main/resources/org/hps/steering/readout/ steering-files/src/main/resources/org/hps/steering/recon/ steering-files/src/main/resources/org/hps/steering/users/baltzell/ steering-files/src/main/resources/org/hps/steering/users/celentan/ steering-files/src/main/resources/org/hps/steering/users/holly/ steering-files/src/main/resources/org/hps/steering/users/meeg/ steering-files/src/main/resources/org/hps/steering/users/phansson/ steering-files/src/main/resources/org/hps/steering/users/rafo/ steering-files/src/main/resources/org/hps/steering/users/spaul/ tracking/src/main/java/org/hps/recon/tracking/ tracking/src/main/java/org/hps/recon/tracking/gbl/ tracking/src/main/java/org/hps/svt/alignment/ tracking/src/main/resources/org/hps/recon/tracking/strategies/ tracking/src/test/java/org/hps/recon/tracking/ users/src/main/java/org/hps/users/baltzell/ users/src/main/java/org/hps/users/celentan/ users/src/main/java/org/hps/users/holly/ users/src/main/java/org/hps/users/kmccarty/ users/src/main/java/org/hps/users/kmccarty/plots/ users/src/main/java/org/hps/users/kmccarty/plots/formatter/ users/src/main/java/org/hps/users/luca/ users/src/main/java/org/hps/users/meeg/ users/src/main/java/org/hps/users/mgraham/ users/src/main/java/org/hps/users/omoreno/ users/src/main/java/org/hps/users/phansson/ users/src/main/java/org/hps/users/phansson/gbl/ users/src/main/java/org/hps/users/phansson/testrun/ users/src/main/java/org/hps/users/phansson/tools/ users/src/main/java/org/hps/users/rafo/ users/src/main/java/org/hps/users/spaul/ users/src/main/java/org/hps/users/spaul/feecc/ users/src/main/java/org/hps/users/spaul/moller/ util/src/main/java/org/hps/util/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 9 Mar 2016 19:43:38 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (71056 lines)

Author: [log in to unmask]
Date: Wed Mar  9 11:43:24 2016
New Revision: 4278

Log:
[HPSJAVA-662] Remove tabs from java, xml and lcsim files.

Modified:
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalCellIDPrintDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalClusterPlots.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalHitPlots.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalFADCPlotsDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSMCParticlePlotsDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripGoldenEventsDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripMollerEventsDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/DataTriggerSimDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerData.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerModule.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerTurnOnDriver.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterEvent.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterMatchedPair.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterStatModule.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DetailedClusterEvent.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DiagnosticSnapshot.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/GeneralStatModule.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/RunDiagStats.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerDiagStats.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerEvent.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerStatModule.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/ComponentUtils.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/OutputLogger.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Pair.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/PairTrigger.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/SinglesTrigger.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Trigger.java
    java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/TriggerDiagnosticUtil.java
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-3/compact.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L2-3-4_tu_rw.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml
    java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-2/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-HPS-EngRun2015-Nominal-v1-4-1-100k-L456_L123_L234_L345_L123_L456_tu_rwIter0Iter1Iter2Iter3Iter4Iter5.xml
    java/trunk/detector-data/detectors/HPS-Proposal2014-v3-2pt2-0zOffset/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v5/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v6/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v7-2/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v7-3/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v7/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v8-4/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v8-5/compact.xml
    java/trunk/detector-data/detectors/HPS-TestRun-v8/compact.xml
    java/trunk/detector-data/detectors/HPSTestRunTracker2014-v0/compact.xml
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTrackerConverter.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/HpsTracker2.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/SvtStereoLayer.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerJavaBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerLCDDBuilder.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeVisualization.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SvtAlignmentConstantsReader.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSMuonCalorimeter2.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java
    java/trunk/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.java
    java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java
    java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDTest.java
    java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014LCDDTest.java
    java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1LCDDTest.java
    java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1SurveyLCDDTest.java
    java/trunk/detector-model/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java
    java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTest.xml
    java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml
    java/trunk/distribution/src/main/java/org/hps/HPSJavaProperties.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Association.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Cluster.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/EcalHit.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Event.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/EventManager.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/EventDisplayOutputDriver.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/LCIOBridgeDriver.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PDataEventViewer.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/Viewer.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/BooleanMap.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/ColorScale.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalEvent.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalListener.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/DatabaseCheck.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/GradientScale.java
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/MultiGradientScale.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ClockSingleton.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerVariableDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/MollerTriggerDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/OccupancyAnalysisDriver.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ReadoutTrigger.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/RingBuffer.java
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TimeEvolutionEcalReadoutDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalCalibrationsDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalConverterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverter.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPedestalCalculator.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTimeWalk.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterPositionCorrection.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterer.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterer.java
    java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java
    java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java
    java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/RfFitFunction.java
    java/trunk/evio/src/main/java/org/hps/evio/RfHit.java
    java/trunk/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java
    java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java
    java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java
    java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java
    java/trunk/integration-tests/src/test/resources/org/hps/ecalreadoutsim/EcalReadoutSimTest.lcsim
    java/trunk/integration-tests/src/test/resources/org/hps/steering/test/Dummy.lcsim
    java/trunk/integration-tests/src/test/resources/org/hps/steering/test/EcalReadoutSimTest.lcsim
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SvtTimingInPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/BasicMonitoringPlotsDriver.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplayWithRawWaveform.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalFeeMonitor.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalLedSequenceMonitor.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ComponentUtils.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TableTextModel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java
    java/trunk/parent/pom.xml
    java/trunk/recon/src/main/java/org/hps/recon/filtering/CosmicPMTFilter.java
    java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalGainCalibFilter.java
    java/trunk/recon/src/main/java/org/hps/recon/filtering/FEEFilterDriver.java
    java/trunk/recon/src/main/java/org/hps/recon/filtering/MinimumHitsFilter.java
    java/trunk/recon/src/main/java/org/hps/recon/filtering/PulserScalerAndEpicsFilter.java
    java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java
    java/trunk/recon/src/main/java/org/hps/recon/particle/SimpleParticleID.java
    java/trunk/recon/src/main/java/org/hps/recon/utils/TrackClusterMatcher.java
    java/trunk/recon/src/main/java/org/hps/recon/vertexing/BaseSimpleVertexer.java
    java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorVertex.java
    java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoLineVertexer.java
    java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java
    java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackFringeVertexer.java
    java/trunk/recon/src/test/java/org/hps/recon/particle/HpsReconParticleDriverTest.java
    java/trunk/record-util/src/main/java/org/hps/record/daqconfig/DAQConfigDriver.java
    java/trunk/record-util/src/main/java/org/hps/record/daqconfig/EvioDAQParser.java
    java/trunk/record-util/src/main/java/org/hps/record/daqconfig/FADCConfig.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPData.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPNumberedTrigger.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPPairTrigger.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPSinglesTrigger.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerModule.java
    java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/StarterAnalysis.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceMonitoringApp.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceStandalone.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringFinal.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringOnly.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SvtOnlineMonitoring.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/CommRun2014TightPairs.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutNoPileup.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutToEvio.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014TruthReadoutToLcio.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/LcioToEvio.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunNoPileup.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunReadoutToEvio.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EngineeringRun2015FullRecon.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedAnalysisFromEvio.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedOnlineOfflineComparison.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/ClusterRecon.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalFeeViewer.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalSimReadout.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngRun2015FullReconMC_FEE.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngineeringRun2015EcalOnly.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngineeringRun2015_FEEIter_Filter.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/QuickEcalReadout.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalScoring.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/HitTimes.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/PairsSkimmer.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/SmallHits.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/TridentMCSkim.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/ecal_fadc_bkgd.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/raw_triggers.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TestRunOfflineRecon.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/rafo/TestSteering.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/spaul/MollerBeamtilt.lcsim
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackResidualsData.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTimeData.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLEventData.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLStripClusterData.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblData.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblPoint.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblTrajectory.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblUtils.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/HpsGblRefitter.java
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java
    java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java
    java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildMillepedeCompact.java
    java/trunk/tracking/src/main/java/org/hps/svt/alignment/MillepedeCompactDump.java
    java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Test-All.xml
    java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java
    java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java
    java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitFunction.java
    java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitterDriver.java
    java/trunk/users/src/main/java/org/hps/users/baltzell/RfHit.java
    java/trunk/users/src/main/java/org/hps/users/celentan/LedOnlineOfflineComparisonDriver.java
    java/trunk/users/src/main/java/org/hps/users/celentan/RawPedestalComputator.java
    java/trunk/users/src/main/java/org/hps/users/celentan/StripChartTest.java
    java/trunk/users/src/main/java/org/hps/users/holly/ClusterDriver.java
    java/trunk/users/src/main/java/org/hps/users/holly/EcalClusterICPosition.java
    java/trunk/users/src/main/java/org/hps/users/holly/EcalClustererCosmics.java
    java/trunk/users/src/main/java/org/hps/users/holly/EcalRawConverter.java
    java/trunk/users/src/main/java/org/hps/users/holly/HPSEcalClusterIC.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/ClusterAnalysisDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/CountTriggersDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/EvioAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/FADCAnalysisDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/HPSEcalDataPlotsDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/InvariantMassPairDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/MTEAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/MTETriggerPlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/ParticleMCAnalysisDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/PlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/RafoAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/TridentTrackDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerPlotsModule.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerProcessAnalysisDriver.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot1D.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot2D.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotFormatModule.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/InvariantMassPlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTEPlotFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTETriggerPlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/ParticleMCAnalysisPlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/SingleTriggerPlotsFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TridentTrackFormatter.java
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TriggerPlotsFormat.java
    java/trunk/users/src/main/java/org/hps/users/luca/FADCVariableTriggerFEEDriver.java
    java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger.java
    java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger2.java
    java/trunk/users/src/main/java/org/hps/users/luca/LCIOReadScript.java
    java/trunk/users/src/main/java/org/hps/users/luca/rate.java
    java/trunk/users/src/main/java/org/hps/users/luca/ratesim.java
    java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalAnalogPrintDriver.java
    java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalDigitalPrintDriver.java
    java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java
    java/trunk/users/src/main/java/org/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java
    java/trunk/users/src/main/java/org/hps/users/meeg/LCIOTrackAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/mgraham/HPSTrackerHit.java
    java/trunk/users/src/main/java/org/hps/users/mgraham/SVTRawTrackerHitThresholdDriver.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/EcalScoringPlaneDriver.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/ExtrapolationAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/LheToStdhep.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/PlotUtils.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/ReconstructedParticleChecker.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SharedHitAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtClusterAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtDataRates.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitCorrelations.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java
    java/trunk/users/src/main/java/org/hps/users/omoreno/TestRunTrackReconEfficiency.java
    java/trunk/users/src/main/java/org/hps/users/phansson/FastTrackResidualDriver.java
    java/trunk/users/src/main/java/org/hps/users/phansson/GblResidualDriver.java
    java/trunk/users/src/main/java/org/hps/users/phansson/SimpleResiduals.java
    java/trunk/users/src/main/java/org/hps/users/phansson/gbl/GBLDriver.java
    java/trunk/users/src/main/java/org/hps/users/phansson/gbl/HpsGblFitter.java
    java/trunk/users/src/main/java/org/hps/users/phansson/testrun/TrigRateDriver.java
    java/trunk/users/src/main/java/org/hps/users/phansson/tools/TrackingGeometryChecker.java
    java/trunk/users/src/main/java/org/hps/users/rafo/test1.java
    java/trunk/users/src/main/java/org/hps/users/spaul/GetChargeFromScalersMultirun.java
    java/trunk/users/src/main/java/org/hps/users/spaul/HitrateHistograms.java
    java/trunk/users/src/main/java/org/hps/users/spaul/PulserFilter.java
    java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java
    java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/BinGenerator.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/CustomBinning.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/DisplayHistograms.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/EcalUtil.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FormFactor.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MottIntegral.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MultipleScattering.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinning.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java
    java/trunk/util/src/main/java/org/hps/util/ConvertToStdhep.java
    java/trunk/util/src/main/java/org/hps/util/DumpLHEEventsToASCII.java

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java	Wed Mar  9 11:43:24 2016
@@ -102,10 +102,10 @@
 
     @Override
     protected void detectorChanged(Detector detector) {
-    	BeamEnergyCollection beamEnergyCollection = 
-			this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
-		double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
-    	//this.getConditionsManager().getCachedConditions(org.hps.conditions.EcalChannelCollection.class, "ecal_channels").
+        BeamEnergyCollection beamEnergyCollection = 
+            this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
+        double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
+        //this.getConditionsManager().getCachedConditions(org.hps.conditions.EcalChannelCollection.class, "ecal_channels").
         LOGGER.info("EcalMonitoring::detectorChanged  Setting up the plotter");
         aida.tree().cd("/");
         if (fillHitPlots) {

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java	Wed Mar  9 11:43:24 2016
@@ -106,11 +106,11 @@
 
     @Override
     protected void detectorChanged(Detector detector) {
-    	BeamEnergyCollection beamEnergyCollection = 
-			this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
-		double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
-    	
-    	
+        BeamEnergyCollection beamEnergyCollection = 
+            this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
+        double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
+        
+        
         LOGGER.info("Setting up the plotter");
         aida.tree().cd("/");
           String trkType="SeedTrack/";

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java	Wed Mar  9 11:43:24 2016
@@ -322,8 +322,8 @@
         beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2);
 
         BeamEnergyCollection beamEnergyCollection = 
-			this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
-		ebeam = beamEnergyCollection.get(0).getBeamEnergy();
+            this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
+        ebeam = beamEnergyCollection.get(0).getBeamEnergy();
         aida.tree().cd("/");
         String trkType = "SeedTrack/";
         if (isGBL) {

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java	Wed Mar  9 11:43:24 2016
@@ -8,8 +8,8 @@
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
 import hep.aida.IPlotterStyle;
+import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.VecOp;
 
 import java.io.IOException;
@@ -18,6 +18,7 @@
 import java.util.Map.Entry;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import org.hps.conditions.beam.BeamEnergy.BeamEnergyCollection;
 import org.hps.recon.tracking.TrackType;
 import org.hps.recon.tracking.TrackUtils;
@@ -33,632 +34,730 @@
 import org.lcsim.recon.tracking.seedtracker.SeedTrack;
 
 /**
- * DQM driver V0 particles (i.e. e+e- pars) plots things like number of vertex
- * position an mass
+ * DQM driver V0 particles (i.e. e+e- pars) plots things like number of vertex position an mass
  *
  * @author mgraham on May 14, 2014
- *
  */
 public class V0Monitoring extends DataQualityMonitor {
 
-	private static Logger LOGGER = Logger.getLogger(V0Monitoring.class.getPackage().getName());
-
-	String finalStateParticlesColName = "FinalStateParticles";
-	String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates";
-	String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates";
-	String targetV0ConCandidatesColName = "TargetConstrainedV0Candidates";
-	String[] fpQuantNames = {"nV0_per_Event", "avg_BSCon_mass", "avg_BSCon_Vx", "avg_BSCon_Vy", "avg_BSCon_Vz", "sig_BSCon_Vx", "sig_BSCon_Vy", "sig_BSCon_Vz", "avg_BSCon_Chi2"};
-	//some counters
-	int nRecoEvents = 0;
-	int nTotV0 = 0;
-	int nTot2Ele = 0;
-	//some summers
-	double sumMass = 0.0;
-	double sumVx = 0.0;
-	double sumVy = 0.0;
-	double sumVz = 0.0;
-	double sumChi2 = 0.0;
-
-	/*  V0 Quantities   */
-	/*  Mass, vertex, chi^2 of fit */
-	/*  unconstrained */
-	IHistogram1D unconMass;
-	IHistogram1D unconVx;
-	IHistogram1D unconVy;
-	IHistogram1D unconVz;
-	IHistogram1D unconChi2;
-	IHistogram2D unconVzVsChi2;
-	IHistogram2D unconChi2VsTrkChi2;
-	/* beamspot constrained */
-
-	IHistogram1D nV0;
-
-	IHistogram1D v0Time;
-	IHistogram1D v0Dt;
-	IHistogram2D trigTimeV0Time;
-	IHistogram1D trigTime;
-
-	IHistogram1D bsconMass;
-	IHistogram1D bsconVx;
-	IHistogram1D bsconVy;
-	IHistogram1D bsconVz;
-	IHistogram1D bsconChi2;
-	IHistogram2D bsconVzVsChi2;
-	IHistogram2D bsconChi2VsTrkChi2;
-	/* target constrained */
-	IHistogram1D tarconMass;
-	IHistogram1D tarconVx;
-	IHistogram1D tarconVy;
-	IHistogram1D tarconVz;
-	IHistogram1D tarconChi2;
-	IHistogram2D tarconVzVsChi2;
-	IHistogram2D tarconChi2VsTrkChi2;
-
-	IHistogram2D pEleVspPos;
-	IHistogram1D pEle;
-	IHistogram1D pPos;
-
-	IHistogram2D pEleVspPosWithCut;
-	IHistogram2D pyEleVspyPos;
-	IHistogram2D pxEleVspxPos;
-
-	IHistogram2D VtxZVsMass;
-	IHistogram2D VtxYVsVtxZ;
-	IHistogram2D VtxXVsVtxZ;
-	IHistogram2D VtxXVsVtxY;
-	IHistogram2D VtxXVsVtxPx;
-	IHistogram2D VtxYVsVtxPy;
-	IHistogram2D VtxZVsVtxPx;
-	IHistogram2D VtxZVsVtxPy;
-	IHistogram2D VtxZVsVtxPz;
-
-	IHistogram2D VtxZVsL1Iso;
-	IHistogram2D VtxZVsTrkChi2;
-
-	IHistogram2D pEleVspEle;
-	IHistogram2D phiEleVsphiEle;
-	IHistogram2D pyEleVspyEle;
-	IHistogram2D pxEleVspxEle;
-	IHistogram2D pEleVspEleNoBeam;
-	IHistogram2D pyEleVspyEleNoBeam;
-	IHistogram2D pxEleVspxEleNoBeam;
-	IHistogram2D pEleVspEleMoller;
-	IHistogram2D pEleVsthetaMoller;
-	IHistogram2D thetaEleVsthetaMoller;
-	IHistogram2D pEleVspEleBeamBeam;
-	IHistogram2D pEleVsthetaBeamBeam;
-	IHistogram2D thetaEleVsthetaBeamBeam;
-
-	IHistogram1D mollerMass;
-	IHistogram1D mollerMassVtxCut;
-	IHistogram1D mollerVx;
-	IHistogram1D mollerVy;
-	IHistogram1D mollerVz;
-	IHistogram1D mollerVzVtxCut;
-	IHistogram2D mollerXVsVtxZ;
-	IHistogram2D mollerYVsVtxZ;
-	IHistogram2D mollerXVsVtxY;
-
-	IHistogram1D mollerUx;
-	IHistogram1D mollerUy;
-
-
-
-	IHistogram1D sumChargeHisto;
-	IHistogram1D numChargeHisto;
-
-	private final String plotDir = "V0Monitoring/";
-
-	private final BasicHep3Matrix beamAxisRotation = new BasicHep3Matrix();
-
-	double maxFactor = 1.25;
-
-
-	double thetaMax = 0.06;
-	double thetaMin = 0.015;
-
-
-
-	double feeMomentumCut, v0ESumMinCut, v0MaxPCut, v0ESumMaxCut,
-	molPSumMin, molPSumMax, beambeamCut;
-
-
-
-	@Override
-	protected void detectorChanged(Detector detector) {
-
-		BeamEnergyCollection beamEnergyCollection = 
-			this.getConditionsManager().getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();        
-		double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
-		feeMomentumCut = 0.75*beamEnergy; //GeV
-
-		v0ESumMinCut = 0.8 * beamEnergy;
-		v0ESumMaxCut = 1.25 * beamEnergy;
-		
-		v0MaxPCut = 1.05*beamEnergy;//GeV
-		molPSumMin = 0.80*beamEnergy;
-		molPSumMax = 1.25*beamEnergy;
-		beambeamCut = 0.80*beamEnergy;
-
-
-
-		beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2);
-
-		LOGGER.info("Setting up the plotter");
-		aida.tree().cd("/");
-		String xtra = "Extras";
-		String trkType = "SeedTrack/";
-		if (isGBL)
-			trkType = "GBLTrack/";
-
-		double maxMass = .2*beamEnergy;
-		double maxMassMoller = .1*Math.sqrt(beamEnergy);
-		/*  V0 Quantities   */
-		/*  Mass, vertex, chi^2 of fit */
-		/*  unconstrained */
-		unconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Invariant Mass (GeV)", 100, 0, maxMass);
-		unconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vx (mm)", 50, -10, 10);
-		unconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vy (mm)", 50, -10, 10);
-		unconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vz (mm)", 50, -50, 50);
-		unconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Chi2", 25, 0, 25);
-		unconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
-		unconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
-		/* beamspot constrained */
-		bsconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Mass (GeV)", 100, 0, maxMass);
-		bsconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vx (mm)", 50, -10, 10);
-		bsconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vy (mm)", 50, -10, 10);
-		bsconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vz (mm)", 50, -50, 50);
-		bsconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Chi2", 25, 0, 25);
-		bsconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
-		bsconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
-		/* target constrained */
-		tarconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Mass (GeV)", 100, 0, maxMass);
-		tarconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vx (mm)", 50, -1, 1);
-		tarconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vy (mm)", 50, -1, 1);
-		tarconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vz (mm)", 50, -10, 10);
-		tarconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Chi2", 25, 0, 25);
-		tarconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
-		tarconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
-
-		nV0 = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Number of V0 per event", 10, 0, 10);
-		v0Time = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "V0 mean time", 100, -25, 25);
-		v0Dt = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "V0 time difference", 100, -25, 25);
-		trigTimeV0Time = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Trigger phase vs. V0 mean time", 100, -25, 25, 6, 0, 24);
-		trigTime = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Trigger phase", 6, 0, 24);
-
-		pEleVspPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e) vs P(p)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
-
-
-		pEle = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e)", 50, 0, beamEnergy * maxFactor);
-		pPos = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(p)", 50, 0, beamEnergy * maxFactor);
-
-		pEleVspPosWithCut = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e) vs P(p): Radiative", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
-		pyEleVspyPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Py(e) vs Py(p)", 50, -0.04*beamEnergy, 0.04*beamEnergy, 50, -0.04*beamEnergy, 0.04*beamEnergy);
-		pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Px(e) vs Px(p)", 50, -0.04*beamEnergy, 0.04*beamEnergy, 50, -0.04*beamEnergy, 0.04*beamEnergy);
-		VtxZVsMass = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Mass", 50, 0, maxMass, 50, -50, 80);
-		VtxXVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vz", 100, -10, 10, 100, -50, 80);
-		VtxYVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Vz", 100, -5, 5, 100, -50, 80);
-		VtxXVsVtxY = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vy", 100, -10, 10, 100, -5, 5);
-		VtxXVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Px", 100, -0.1, 0.1, 100, -10, 10);
-		VtxYVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Py", 100, -0.1, 0.1, 100, -5, 5);
-		VtxZVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Px", 100, -0.1, 0.1, 100, -50, 80);
-		VtxZVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Py", 100, -0.1, 0.1, 100, -50, 80);
-		VtxZVsVtxPz = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Pz", 100, 0.0, beamEnergy * maxFactor, 100, -50, 80);
-		VtxZVsL1Iso = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs L1 Isolation", 100, 0.0, 5.0, 50, -50, 80);
-		VtxZVsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Track Chi2", 50, 0, 50, 50, -50, 80);
-		phiEleVsphiEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/phi(e) vs phi(e)", 50, -Math.PI, Math.PI, 50, -Math.PI, Math.PI);
-		pyEleVspyEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Py(e) vs Py(e)", 50, -0.04*beamEnergy, 0.04*beamEnergy, 50, -0.04*beamEnergy, 0.04*beamEnergy);
-		pxEleVspxEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Px(e) vs Px(e)", 50, -0.02*beamEnergy, 0.06*beamEnergy, 50, -0.02*beamEnergy, 0.06*beamEnergy);
-		
-		// electron vs electron momentum with different cuts
-		// 1) no cut
-		// 2) cut out FEE 
-		// 3) cut out FEE and also cut on momentum sum
-		// 4) cut out everything except FEE coincidentals
-		pEleVspEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
-		pEleVspEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e) NoBeam", 50, 0, beambeamCut, 50, 0, beambeamCut);
-		pEleVspEleMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e) Moller", 50, 0, beambeamCut, 50, 0, beambeamCut);
-		pEleVspEleBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e) BeamBeam", 50, beambeamCut, beamEnergy * maxFactor, 50, beambeamCut, beamEnergy * maxFactor);
-		
-		pyEleVspyEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Py(e) vs Py(e) NoBeam", 50, -0.04*beamEnergy, 0.04*beamEnergy, 50, -0.04*beamEnergy, 0.04*beamEnergy);
-		pxEleVspxEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Px(e) vs Px(e) NoBeam", 50, -0.02*beamEnergy, 0.06*beamEnergy, 50, -0.02*beamEnergy, 0.06*beamEnergy);
-		sumChargeHisto = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Total Charge of  Event", 5, -2, 3);
-		numChargeHisto = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Number of Charged Particles", 6, 0, 6);
-
-		pEleVsthetaMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs Theta Moller", 50, 0, beambeamCut, 50, thetaMin, thetaMax);
-		thetaEleVsthetaMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Theta vs Theta Moller", 50, thetaMin, thetaMax, 50, thetaMin, thetaMax);
-		pEleVsthetaBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs Theta BeamBeam", 50, beambeamCut, beamEnergy * maxFactor, 50, thetaMin, thetaMax);
-		thetaEleVsthetaBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Theta vs Theta BeamBeam", 50, thetaMin, thetaMax, 50, thetaMin, thetaMax);
-
-		mollerMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Mass (GeV)", 100, 0, maxMassMoller);
-		mollerMassVtxCut = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Mass (GeV): VtxCut", 100, 0, maxMassMoller);
-		mollerVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vx (mm)", 50, -10, 10);
-		mollerVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vy (mm)", 50, -2, 2);
-		mollerVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vz (mm)", 50, -50, 50);
-		mollerVzVtxCut = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vz (mm): VtxCut", 50, -50, 50);
-		mollerXVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vx vs Vz", 100, -5, 5, 100, -50, 50);
-		mollerYVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vy vs Vz", 100, -2, 2, 100, -50, 50);
-		mollerXVsVtxY = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vx vs Vy", 100, -5, 5, 100, -2, 2);
-
-		mollerUx = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Pair Momentum Direction Ux", 100, .015, .045);
-		mollerUy = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Pair Momentum Direction Uy", 100, -.01, .01);
-
-		mollerHiP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(high)", 100, 0, beamEnergy*maxFactor);
-		mollerLoP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(low)", 100, 0, beamEnergy*maxFactor);
-
-		mollerEitherP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(either)", 100, 0, beamEnergy*maxFactor);
-		mollerPsum = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Psum", 100, 0, beamEnergy*maxFactor);
-
-	}
-
-	IHistogram1D mollerHiP, mollerLoP, mollerEitherP, mollerPsum;
-
-	@Override
-	public void process(EventHeader event) {
-		/*  make sure everything is there */
-		if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName))
-			return;
-		if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName))
-			return;
-		if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName))
-			return;
-		if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName))
-			return;
-
-		//check to see if this event is from the correct trigger (or "all");
-		if (!matchTrigger(event))
-			return;
-
-		nRecoEvents++;
-
-		RelationalTable hitToStrips = TrackUtils.getHitToStripsTable(event);
-		RelationalTable hitToRotated = TrackUtils.getHitToRotatedTable(event);
-
-		List<ReconstructedParticle> unonstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName);
-		for (ReconstructedParticle uncV0 : unonstrainedV0List) {
-			if (isGBL != TrackType.isGBL(uncV0.getType()))
-				continue;
-			Vertex uncVert = uncV0.getStartVertex();
-			Hep3Vector pVtxRot = VecOp.mult(beamAxisRotation, uncV0.getMomentum());
-			Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, uncVert.getPosition());
-			double theta = Math.acos(pVtxRot.z() / pVtxRot.magnitude());
-			double phi = Math.atan2(pVtxRot.y(), pVtxRot.x());
-			unconVx.fill(vtxPosRot.x());
-			unconVy.fill(vtxPosRot.y());
-			unconVz.fill(vtxPosRot.z());
-			unconMass.fill(uncV0.getMass());
-			unconChi2.fill(uncVert.getChi2());
-			unconVzVsChi2.fill(uncVert.getChi2(), vtxPosRot.z());
-			unconChi2VsTrkChi2.fill(Math.max(uncV0.getParticles().get(0).getTracks().get(0).getChi2(), uncV0.getParticles().get(1).getTracks().get(0).getChi2()), uncVert.getChi2());
-
-			VtxZVsMass.fill(uncV0.getMass(), vtxPosRot.z());
-			VtxXVsVtxZ.fill(vtxPosRot.x(), vtxPosRot.z());
-			VtxYVsVtxZ.fill(vtxPosRot.y(), vtxPosRot.z());
-			VtxXVsVtxY.fill(vtxPosRot.x(), vtxPosRot.y());
-			VtxXVsVtxPx.fill(pVtxRot.x(), vtxPosRot.x());
-			VtxYVsVtxPy.fill(pVtxRot.y(), vtxPosRot.y());
-			VtxZVsVtxPx.fill(pVtxRot.x(), vtxPosRot.z());
-			VtxZVsVtxPy.fill(pVtxRot.y(), vtxPosRot.z());
-			VtxZVsVtxPz.fill(pVtxRot.z(), vtxPosRot.z());
-
-			//this always has 2 tracks. 
-			List<ReconstructedParticle> trks = uncV0.getParticles();
-			//            Track ele = trks.get(0).getTracks().get(0);
-			//            Track pos = trks.get(1).getTracks().get(0);
-			//            //if track #0 has charge>0 it's the electron!  This seems mixed up, but remember the track 
-			//            //charge is assigned assuming a positive B-field, while ours is negative
-			//            if (trks.get(0).getCharge() > 0) {
-			//                pos = trks.get(0).getTracks().get(0);
-			//                ele = trks.get(1).getTracks().get(0);
-			//            }
-			//            aida.histogram2D(plotDir + trkType + triggerType + "/" + "P(e) vs P(p)").fill(getMomentum(ele), getMomentum(pos));
-			//            aida.histogram2D(plotDir + trkType + triggerType + "/" + "Px(e) vs Px(p)").fill(ele.getTrackStates().get(0).getMomentum()[1], pos.getTrackStates().get(0).getMomentum()[1]);
-			//            aida.histogram2D(plotDir + trkType + triggerType + "/" + "Py(e) vs Py(p)").fill(ele.getTrackStates().get(0).getMomentum()[2], pos.getTrackStates().get(0).getMomentum()[2]);
-			ReconstructedParticle ele = trks.get(0);
-			ReconstructedParticle pos = trks.get(1);
-			//ReconParticles have the charge correct. 
-			if (trks.get(0).getCharge() > 0) {
-				pos = trks.get(0);
-				ele = trks.get(1);
-			}
-			if (ele.getCharge() < 0 && pos.getCharge() > 0) {
-				VtxZVsTrkChi2.fill(Math.max(uncV0.getParticles().get(0).getTracks().get(0).getChi2(), uncV0.getParticles().get(1).getTracks().get(0).getChi2()), uncVert.getPosition().z());
-
-				Double[] eleIso = TrackUtils.getIsolations(ele.getTracks().get(0), hitToStrips, hitToRotated);
-				Double[] posIso = TrackUtils.getIsolations(pos.getTracks().get(0), hitToStrips, hitToRotated);
-				if (eleIso[0] != null && posIso[0] != null) {
-					double eleL1Iso = Math.min(Math.abs(eleIso[0]), Math.abs(eleIso[1]));
-					double posL1Iso = Math.min(Math.abs(posIso[0]), Math.abs(posIso[1]));
-					double minL1Iso = Math.min(eleL1Iso, posL1Iso);
-					VtxZVsL1Iso.fill(minL1Iso, uncVert.getPosition().z());
-				}
-
-				double pe = ele.getMomentum().magnitude();
-				double pp = pos.getMomentum().magnitude();
-				Hep3Vector pEleRot = VecOp.mult(beamAxisRotation, ele.getMomentum());
-				Hep3Vector pPosRot = VecOp.mult(beamAxisRotation, pos.getMomentum());
-
-				pEleVspPos.fill(pe, pp);
-				pEle.fill(pe);
-				pPos.fill(pp);
-
-
-				pxEleVspxPos.fill(pEleRot.x(), pPosRot.x());
-				pyEleVspyPos.fill(pEleRot.y(), pPosRot.y());
-				if (pe < v0MaxPCut && pp < v0MaxPCut && (pe + pp) > v0ESumMinCut && (pe + pp) < v0ESumMaxCut)//enrich radiative-like events
-
-				pEleVspPosWithCut.fill(pe, pp);
-			}
-
-			double eleT = TrackUtils.getTrackTime(ele.getTracks().get(0), hitToStrips, hitToRotated);
-			double posT = TrackUtils.getTrackTime(pos.getTracks().get(0), hitToStrips, hitToRotated);
-			double meanT = (eleT + posT) / 2.0;
-			v0Time.fill(meanT);
-			v0Dt.fill(eleT - posT);
-			trigTimeV0Time.fill(meanT, event.getTimeStamp() % 24);
-			trigTime.fill(event.getTimeStamp() % 24);
-		}
-
-		List<ReconstructedParticle> beamConstrainedV0List = event.get(ReconstructedParticle.class, beamConV0CandidatesColName);
-		nV0.fill(beamConstrainedV0List.size());
-		for (ReconstructedParticle bsV0 : beamConstrainedV0List) {
-
-			if (isGBL != TrackType.isGBL(bsV0.getType()))
-				continue;
-			nTotV0++;
-			Vertex bsVert = bsV0.getStartVertex();
-			Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, bsVert.getPosition());
-			bsconVx.fill(vtxPosRot.x());
-			bsconVy.fill(vtxPosRot.y());
-			bsconVz.fill(vtxPosRot.z());
-			bsconMass.fill(bsV0.getMass());
-			bsconChi2.fill(bsVert.getChi2());
-			bsconVzVsChi2.fill(bsVert.getChi2(), vtxPosRot.z());
-			bsconChi2VsTrkChi2.fill(Math.max(bsV0.getParticles().get(0).getTracks().get(0).getChi2(), bsV0.getParticles().get(1).getTracks().get(0).getChi2()), bsVert.getChi2());
-			sumMass += bsV0.getMass();
-			sumVx += vtxPosRot.x();
-			sumVy += vtxPosRot.y();
-			sumVz += vtxPosRot.z();
-			sumChi2 += bsVert.getChi2();
-		}
-
-		List<ReconstructedParticle> targetConstrainedV0List = event.get(ReconstructedParticle.class, targetV0ConCandidatesColName);
-		for (ReconstructedParticle tarV0 : targetConstrainedV0List) {
-
-			if (isGBL != TrackType.isGBL(tarV0.getType()))
-				continue;
-
-			Vertex tarVert = tarV0.getStartVertex();
-			Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, tarVert.getPosition());
-			tarconVx.fill(vtxPosRot.x());
-			tarconVy.fill(vtxPosRot.y());
-			tarconVz.fill(vtxPosRot.z());
-			tarconMass.fill(tarV0.getMass());
-			tarconChi2.fill(tarVert.getChi2());
-			tarconVzVsChi2.fill(tarVert.getChi2(), vtxPosRot.z());
-			tarconChi2VsTrkChi2.fill(Math.max(tarV0.getParticles().get(0).getTracks().get(0).getChi2(), tarV0.getParticles().get(1).getTracks().get(0).getChi2()), tarVert.getChi2());
-		}
-		List<ReconstructedParticle> finalStateParticles = event.get(ReconstructedParticle.class, finalStateParticlesColName);
-		if (debug)
-			LOGGER.info("This events has " + finalStateParticles.size() + " final state particles");
-
-		ReconstructedParticle ele1 = null;
-		ReconstructedParticle ele2 = null;
-		int sumCharge = 0;
-		int numChargedParticles = 0;
-		for (ReconstructedParticle fsPart : finalStateParticles) {
-			if (isGBL != TrackType.isGBL(fsPart.getType()))
-				continue;
-			if (debug)
-				LOGGER.info("PDGID = " + fsPart.getParticleIDUsed() + "; charge = " + fsPart.getCharge() + "; pz = " + fsPart.getMomentum().x());
-			double charge = fsPart.getCharge();
-			sumCharge += charge;
-			if (charge != 0) {
-				numChargedParticles++;
-				if (charge < 1)
-					if (ele1 == null)
-						ele1 = fsPart;
-					else if (!hasSharedStrips(ele1, fsPart, hitToStrips, hitToRotated))
-						ele2 = fsPart;
-			}
-		}
-		sumChargeHisto.fill(sumCharge);
-		numChargeHisto.fill(numChargedParticles);
-
-		if (ele1 != null && ele2 != null) {
-			Hep3Vector p1 = VecOp.mult(beamAxisRotation, ele1.getMomentum());
-			Hep3Vector p2 = VecOp.mult(beamAxisRotation, ele2.getMomentum());
-			//            Hep3Vector beamAxis = new BasicHep3Vector(Math.sin(0.0305), 0, Math.cos(0.0305));
-			//            LOGGER.info(p1);
-			//            LOGGER.info(VecOp.mult(rot, p1));
-
-			double theta1 = Math.acos(p1.z() / p1.magnitude());
-			double theta2 = Math.acos(p2.z() / p2.magnitude());
-			double phi1 = Math.atan2(p1.y(), p1.x());
-			double phi2 = Math.atan2(p2.y(), p2.x());
-			phiEleVsphiEle.fill(phi1, phi2);
-			pEleVspEle.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
-			pyEleVspyEle.fill(ele1.getMomentum().y(), ele2.getMomentum().y());
-			pxEleVspxEle.fill(ele1.getMomentum().x(), ele2.getMomentum().x());
-			//remove beam electrons
-			if (ele1.getMomentum().magnitude() < beambeamCut && ele2.getMomentum().magnitude() < beambeamCut) {
-				pEleVspEleNoBeam.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
-				pyEleVspyEleNoBeam.fill(ele1.getMomentum().y(), ele2.getMomentum().y());
-				pxEleVspxEleNoBeam.fill(ele1.getMomentum().x(), ele2.getMomentum().x());
-			}
-			//look at beam-beam events
-			if (ele1.getMomentum().magnitude() > beambeamCut && ele2.getMomentum().magnitude() > beambeamCut) {
-				pEleVspEleBeamBeam.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
-				pEleVsthetaBeamBeam.fill(p1.magnitude(), theta1);
-				pEleVsthetaBeamBeam.fill(p2.magnitude(), theta2);
-				thetaEleVsthetaBeamBeam.fill(theta1, theta2);
-			}
-
-			//look at "Moller" events (if that's what they really are
-			if (ele1.getMomentum().magnitude() + ele2.getMomentum().magnitude() > molPSumMin
-					&& ele1.getMomentum().magnitude() + ele2.getMomentum().magnitude() < molPSumMax
-					&& (p1.magnitude() < beambeamCut && p2.magnitude() < beambeamCut)) {
-
-				Track ele1trk = ele1.getTracks().get(0);
-				Track ele2trk = ele2.getTracks().get(0);
-				SeedTrack stEle1 = TrackUtils.makeSeedTrackFromBaseTrack(ele1trk);
-				SeedTrack stEle2 = TrackUtils.makeSeedTrackFromBaseTrack(ele2trk);
-				BilliorTrack btEle1 = new BilliorTrack(stEle1.getSeedCandidate().getHelix());
-				BilliorTrack btEle2 = new BilliorTrack(stEle2.getSeedCandidate().getHelix());
-				BilliorVertex bv = fitVertex(btEle1, btEle2, TrackUtils.getBField(event.getDetector()).magnitude());
-				//                LOGGER.info("ee vertex: "+bv.toString());
-				double invMass = bv.getParameters().get("invMass");
-				mollerMass.fill(invMass);
-				mollerVx.fill(bv.getPosition().x());
-				mollerVy.fill(bv.getPosition().y());
-				mollerVz.fill(bv.getPosition().z());
-				mollerXVsVtxZ.fill(bv.getPosition().x(), bv.getPosition().z());
-				mollerYVsVtxZ.fill(bv.getPosition().y(), bv.getPosition().z());
-				mollerXVsVtxY.fill(bv.getPosition().x(), bv.getPosition().y());
-
-				double ux = (ele1.getMomentum().x()+ele2.getMomentum().x())/(ele1.getMomentum().z()+ele2.getMomentum().z());
-				double uy = (ele1.getMomentum().y()+ele2.getMomentum().y())/(ele1.getMomentum().z()+ele2.getMomentum().z());
-				mollerUx.fill(ux);
-				mollerUy.fill(uy);
-
-				//higher and lower energy electrons in moller pair
-				double pt1 = ele1.getMomentum().magnitude();
-				double pt2 = ele2.getMomentum().magnitude();
-				double ph = (pt1>pt2) ? pt1 : pt2;
-				double pl = (pt1>pt2) ? pt2 : pt1;
-
-				mollerHiP.fill(ph);
-				mollerLoP.fill(pl);
-
-				mollerEitherP.fill(ph);
-				mollerEitherP.fill(pl);
-				mollerPsum.fill(pt1+pt2);
-
-
-				if (Math.abs(bv.getPosition().x()) < 2
-						&& Math.abs(bv.getPosition().y()) < 0.5) {
-					mollerMassVtxCut.fill(invMass);
-					mollerVzVtxCut.fill(bv.getPosition().z());
-				}
-				pEleVspEleMoller.fill(p1.magnitude(), p2.magnitude());
-				pEleVsthetaMoller.fill(p1.magnitude(), theta1);
-				pEleVsthetaMoller.fill(p2.magnitude(), theta2);
-				thetaEleVsthetaMoller.fill(theta1, theta2);
-			}
-		}
-	}
-
-	@Override
-	public void printDQMData() {
-		LOGGER.info("V0Monitoring::printDQMData");
-		for (Entry<String, Double> entry : monitoredQuantityMap.entrySet())
-			LOGGER.info(entry.getKey() + " = " + entry.getValue());
-		LOGGER.info("*******************************");
-	}
-
-	/**
-	 * Calculate the averages here and fill the map
-	 */
-	@Override
-	public void calculateEndOfRunQuantities() {
-
-		IAnalysisFactory analysisFactory = IAnalysisFactory.create();
-		IFitFactory fitFactory = analysisFactory.createFitFactory();
-		IFitter fitter = fitFactory.createFitter("chi2");
-		double[] init = {50.0, 0.0, 0.2, 1.0, 0.0};
-		IFitResult resVx = fitVertexPosition(bsconVx, fitter, init, "range=\"(-0.5,0.5)\"");
-		double[] init2 = {50.0, 0.0, 0.04, 1.0, 0.0};
-		IFitResult resVy = fitVertexPosition(bsconVy, fitter, init2, "range=\"(-0.2,0.2)\"");
-		double[] init3 = {50.0, 0.0, 3.0, 1.0, 0.0};
-		IFitResult resVz = fitVertexPosition(bsconVz, fitter, init3, "range=\"(-6,6)\"");
-
-		if (resVx != null && resVy != null & resVz != null) {
-			double[] parsVx = resVx.fittedParameters();
-			double[] parsVy = resVy.fittedParameters();
-			double[] parsVz = resVz.fittedParameters();
-
-			for (int i = 0; i < 5; i++)
-				LOGGER.info("Vertex Fit Parameters:  " + resVx.fittedParameterNames()[i] + " = " + parsVx[i] + "; " + parsVy[i] + "; " + parsVz[i]);
-
-			IPlotter plotter = analysisFactory.createPlotterFactory().create("Vertex Position");
-			plotter.createRegions(1, 3);
-			IPlotterStyle pstyle = plotter.style();
-			pstyle.legendBoxStyle().setVisible(false);
-			pstyle.dataStyle().fillStyle().setColor("green");
-			pstyle.dataStyle().lineStyle().setColor("black");
-			plotter.region(0).plot(bsconVx);
-			plotter.region(0).plot(resVx.fittedFunction());
-			plotter.region(1).plot(bsconVy);
-			plotter.region(1).plot(resVy.fittedFunction());
-			plotter.region(2).plot(bsconVz);
-			plotter.region(2).plot(resVz.fittedFunction());
-			if (outputPlots)
-				try {
-					plotter.writeToFile(outputPlotDir + "vertex.png");
-				} catch (IOException ex) {
-					Logger.getLogger(V0Monitoring.class.getName()).log(Level.SEVERE, null, ex);
-				}
-
-				//        monitoredQuantityMap.put(fpQuantNames[2], sumVx / nTotV0);
-				//        monitoredQuantityMap.put(fpQuantNames[3], sumVy / nTotV0);
-				//        monitoredQuantityMap.put(fpQuantNames[4], sumVz / nTotV0);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[2], parsVx[1]);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[3], parsVy[1]);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[4], parsVz[1]);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[5], parsVx[2]);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[6], parsVy[2]);
-				monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[7], parsVz[2]);
-		}
-		monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[0], (double) nTotV0 / nRecoEvents);
-		monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[1], sumMass / nTotV0);
-		monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[8], sumChi2 / nTotV0);
-
-	}
-
-	@Override
-	public void printDQMStrings() {
-		for (int i = 0; i < 9; i++)//TODO:  do this in a smarter way...loop over the map
-			LOGGER.info("ALTER TABLE dqm ADD " + fpQuantNames[i] + " double;");
-	}
-
-	IFitResult fitVertexPosition(IHistogram1D h1d, IFitter fitter, double[] init, String range
-	) {
-		IFitResult ifr = null;
-		try {
-			ifr = fitter.fit(h1d, "g+p1", init, range);
-		} catch (RuntimeException ex) {
-			LOGGER.info(this.getClass().getSimpleName() + ":  caught exception in fitGaussian");
-		}
-		return ifr;
-	}
-
-	private BilliorVertex fitVertex(BilliorTrack electron, BilliorTrack positron, double bField) {
-		// Create a vertex fitter from the magnetic field.
-		double[] beamSize = {0.001, 0.2, 0.02};
-		BilliorVertexer vtxFitter = new BilliorVertexer(bField);
-		// TODO: The beam size should come from the conditions database.
-		vtxFitter.setBeamSize(beamSize);
-
-		// Perform the vertexing based on the specified constraint.
-		vtxFitter.doBeamSpotConstraint(false);
-
-		// Add the electron and positron tracks to a track list for
-		// the vertex fitter.
-		List<BilliorTrack> billiorTracks = new ArrayList<BilliorTrack>();
-
-		billiorTracks.add(electron);
-
-		billiorTracks.add(positron);
-
-		// Find and return a vertex based on the tracks.
-		return vtxFitter.fitVertex(billiorTracks);
-	}
-
-	private static boolean hasSharedStrips(ReconstructedParticle vertex, RelationalTable hittostrip, RelationalTable hittorotated) {
-		return hasSharedStrips(vertex.getParticles().get(0), vertex.getParticles().get(1), hittostrip, hittorotated);
-	}
-
-	private static boolean hasSharedStrips(ReconstructedParticle fs1, ReconstructedParticle fs2, RelationalTable hittostrip, RelationalTable hittorotated) {
-		return TrackUtils.hasSharedStrips(fs1.getTracks().get(0), fs2.getTracks().get(0), hittostrip, hittorotated);
-	}
+    private static Logger LOGGER = Logger.getLogger(V0Monitoring.class.getPackage().getName());
+
+    private static boolean hasSharedStrips(final ReconstructedParticle fs1, final ReconstructedParticle fs2,
+            final RelationalTable hittostrip, final RelationalTable hittorotated) {
+        return TrackUtils.hasSharedStrips(fs1.getTracks().get(0), fs2.getTracks().get(0), hittostrip, hittorotated);
+    }
+
+    private final BasicHep3Matrix beamAxisRotation = new BasicHep3Matrix();
+    private final String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates";
+    private IHistogram1D bsconChi2;
+    private IHistogram2D bsconChi2VsTrkChi2;
+    private IHistogram1D bsconMass;
+    private IHistogram1D bsconVx;
+    private IHistogram1D bsconVy;
+    private IHistogram1D bsconVz;
+    private IHistogram2D bsconVzVsChi2;
+    private final String finalStateParticlesColName = "FinalStateParticles";
+    private final String[] fpQuantNames = {"nV0_per_Event", "avg_BSCon_mass", "avg_BSCon_Vx", "avg_BSCon_Vy",
+            "avg_BSCon_Vz", "sig_BSCon_Vx", "sig_BSCon_Vy", "sig_BSCon_Vz", "avg_BSCon_Chi2"};
+
+    private final double maxFactor = 1.25;
+    private IHistogram1D mollerHiP, mollerLoP, mollerEitherP, mollerPsum;
+    private IHistogram1D mollerMass;
+    private IHistogram1D mollerMassVtxCut;
+    private IHistogram1D mollerUx;
+    private IHistogram1D mollerUy;
+    private IHistogram1D mollerVx;
+
+    private IHistogram1D mollerVy;
+
+    private IHistogram1D mollerVz;
+    private IHistogram1D mollerVzVtxCut;
+    private IHistogram2D mollerXVsVtxY;
+    private IHistogram2D mollerXVsVtxZ;
+
+    private IHistogram2D mollerYVsVtxZ;
+    // some counters
+    private int nRecoEvents = 0;
+    private int nTotV0 = 0;
+    private IHistogram1D numChargeHisto;
+    private IHistogram1D nV0;
+    private IHistogram1D pEle;
+    private IHistogram2D pEleVspEle;
+    private IHistogram2D pEleVspEleBeamBeam;
+    private IHistogram2D pEleVspEleMoller;
+    private IHistogram2D pEleVspEleNoBeam;
+    private IHistogram2D pEleVspPos;
+    private IHistogram2D pEleVspPosWithCut;
+    private IHistogram2D pEleVsthetaBeamBeam;
+    private IHistogram2D pEleVsthetaMoller;
+
+    private IHistogram2D phiEleVsphiEle;
+    private final String plotDir = "V0Monitoring/";
+    private IHistogram1D pPos;
+
+    private IHistogram2D pxEleVspxEle;
+    private IHistogram2D pxEleVspxEleNoBeam;
+    private IHistogram2D pxEleVspxPos;
+
+    private IHistogram2D pyEleVspyEle;
+    private IHistogram2D pyEleVspyEleNoBeam;
+    private IHistogram2D pyEleVspyPos;
+    private IHistogram1D sumChargeHisto;
+    private double sumChi2 = 0.0;
+    // some summers
+    private double sumMass = 0.0;
+    private double sumVx = 0.0;
+    private double sumVy = 0.0;
+    private double sumVz = 0.0;
+
+    private IHistogram1D tarconChi2;
+    private IHistogram2D tarconChi2VsTrkChi2;
+
+    /* target constrained */
+    private IHistogram1D tarconMass;
+    private IHistogram1D tarconVx;
+    private IHistogram1D tarconVy;
+    private IHistogram1D tarconVz;
+    private IHistogram2D tarconVzVsChi2;
+    private final String targetV0ConCandidatesColName = "TargetConstrainedV0Candidates";
+    private IHistogram2D thetaEleVsthetaBeamBeam;
+    private IHistogram2D thetaEleVsthetaMoller;
+    private final double thetaMax = 0.06;
+    private final double thetaMin = 0.015;
+    private IHistogram1D trigTime;
+    private IHistogram2D trigTimeV0Time;
+    private IHistogram1D unconChi2;
+
+    private IHistogram2D unconChi2VsTrkChi2;
+    /* beamspot constrained */
+    /* V0 Quantities */
+    /* Mass, vertex, chi^2 of fit */
+    /* unconstrained */
+    private IHistogram1D unconMass;
+    private final String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates";
+    private IHistogram1D unconVx;
+    private IHistogram1D unconVy;
+    private IHistogram1D unconVz;
+    private IHistogram2D unconVzVsChi2;
+    private IHistogram1D v0Dt;
+    private double v0ESumMinCut, v0MaxPCut, v0ESumMaxCut, molPSumMin, molPSumMax, beambeamCut;
+
+    private IHistogram1D v0Time;
+    private IHistogram2D VtxXVsVtxPx;
+
+    private IHistogram2D VtxXVsVtxY;
+    private IHistogram2D VtxXVsVtxZ;
+
+    private IHistogram2D VtxYVsVtxPy;
+
+    private IHistogram2D VtxYVsVtxZ;
+
+    private IHistogram2D VtxZVsL1Iso;
+
+    private IHistogram2D VtxZVsMass;
+    private IHistogram2D VtxZVsTrkChi2;
+
+    private IHistogram2D VtxZVsVtxPx;
+
+    private IHistogram2D VtxZVsVtxPy;
+
+    private IHistogram2D VtxZVsVtxPz;
+
+    /**
+     * Calculate the averages here and fill the map
+     */
+    @Override
+    public void calculateEndOfRunQuantities() {
+
+        final IAnalysisFactory analysisFactory = IAnalysisFactory.create();
+        final IFitFactory fitFactory = analysisFactory.createFitFactory();
+        final IFitter fitter = fitFactory.createFitter("chi2");
+        final double[] init = {50.0, 0.0, 0.2, 1.0, 0.0};
+        final IFitResult resVx = this.fitVertexPosition(bsconVx, fitter, init, "range=\"(-0.5,0.5)\"");
+        final double[] init2 = {50.0, 0.0, 0.04, 1.0, 0.0};
+        final IFitResult resVy = this.fitVertexPosition(bsconVy, fitter, init2, "range=\"(-0.2,0.2)\"");
+        final double[] init3 = {50.0, 0.0, 3.0, 1.0, 0.0};
+        final IFitResult resVz = this.fitVertexPosition(bsconVz, fitter, init3, "range=\"(-6,6)\"");
+
+        if (resVx != null && resVy != null & resVz != null) {
+            final double[] parsVx = resVx.fittedParameters();
+            final double[] parsVy = resVy.fittedParameters();
+            final double[] parsVz = resVz.fittedParameters();
+
+            for (int i = 0; i < 5; i++) {
+                LOGGER.info("Vertex Fit Parameters:  " + resVx.fittedParameterNames()[i] + " = " + parsVx[i] + "; "
+                        + parsVy[i] + "; " + parsVz[i]);
+            }
+
+            final IPlotter plotter = analysisFactory.createPlotterFactory().create("Vertex Position");
+            plotter.createRegions(1, 3);
+            final IPlotterStyle pstyle = plotter.style();
+            pstyle.legendBoxStyle().setVisible(false);
+            pstyle.dataStyle().fillStyle().setColor("green");
+            pstyle.dataStyle().lineStyle().setColor("black");
+            plotter.region(0).plot(bsconVx);
+            plotter.region(0).plot(resVx.fittedFunction());
+            plotter.region(1).plot(bsconVy);
+            plotter.region(1).plot(resVy.fittedFunction());
+            plotter.region(2).plot(bsconVz);
+            plotter.region(2).plot(resVz.fittedFunction());
+            if (outputPlots) {
+                try {
+                    plotter.writeToFile(outputPlotDir + "vertex.png");
+                } catch (final IOException ex) {
+                    Logger.getLogger(V0Monitoring.class.getName()).log(Level.SEVERE, null, ex);
+                }
+            }
+
+            // monitoredQuantityMap.put(fpQuantNames[2], sumVx / nTotV0);
+            // monitoredQuantityMap.put(fpQuantNames[3], sumVy / nTotV0);
+            // monitoredQuantityMap.put(fpQuantNames[4], sumVz / nTotV0);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[2], parsVx[1]);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[3], parsVy[1]);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[4], parsVz[1]);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[5], parsVx[2]);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[6], parsVy[2]);
+            monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[7], parsVz[2]);
+        }
+        monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[0],
+                (double) nTotV0 / nRecoEvents);
+        monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[1], sumMass
+                / nTotV0);
+        monitoredQuantityMap.put(beamConV0CandidatesColName + " " + triggerType + " " + fpQuantNames[8], sumChi2
+                / nTotV0);
+
+    }
+
+    @Override
+    protected void detectorChanged(final Detector detector) {
+
+        final BeamEnergyCollection beamEnergyCollection = this.getConditionsManager()
+                .getCachedConditions(BeamEnergyCollection.class, "beam_energies").getCachedData();
+        final double beamEnergy = beamEnergyCollection.get(0).getBeamEnergy();
+        v0ESumMinCut = 0.8 * beamEnergy;
+        v0ESumMaxCut = 1.25 * beamEnergy;
+
+        v0MaxPCut = 1.05 * beamEnergy;// GeV
+        molPSumMin = 0.80 * beamEnergy;
+        molPSumMax = 1.25 * beamEnergy;
+        beambeamCut = 0.80 * beamEnergy;
+
+        beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2);
+
+        // LOGGER.info("Setting up the plotter");
+        aida.tree().cd("/");
+        final String xtra = "Extras";
+        String trkType = "SeedTrack/";
+        if (isGBL) {
+            trkType = "GBLTrack/";
+        }
+
+        final double maxMass = .2 * beamEnergy;
+        final double maxMassMoller = .1 * Math.sqrt(beamEnergy);
+        /* V0 Quantities */
+        /* Mass, vertex, chi^2 of fit */
+        /* unconstrained */
+        unconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Invariant Mass (GeV)", 100, 0, maxMass);
+        unconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Vx (mm)", 50, -10, 10);
+        unconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Vy (mm)", 50, -10, 10);
+        unconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Vz (mm)", 50, -50, 50);
+        unconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Chi2", 25, 0, 25);
+        unconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/"
+                + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
+        unconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName
+                + "/" + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
+        /* beamspot constrained */
+        bsconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/"
+                + "Mass (GeV)", 100, 0, maxMass);
+        bsconVx = aida.histogram1D(
+                plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vx (mm)", 50, -10, 10);
+        bsconVy = aida.histogram1D(
+                plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vy (mm)", 50, -10, 10);
+        bsconVz = aida.histogram1D(
+                plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vz (mm)", 50, -50, 50);
+        bsconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Chi2",
+                25, 0, 25);
+        bsconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/"
+                + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
+        bsconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/"
+                + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
+        /* target constrained */
+        tarconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Mass (GeV)", 100, 0, maxMass);
+        tarconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Vx (mm)", 50, -1, 1);
+        tarconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Vy (mm)", 50, -1, 1);
+        tarconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Vz (mm)", 50, -10, 10);
+        tarconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Chi2", 25, 0, 25);
+        tarconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/"
+                + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50);
+        tarconChi2VsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName
+                + "/" + "Chi2 vs. total track chi2", 50, 0, 50, 50, 0, 25);
+
+        nV0 = aida
+                .histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Number of V0 per event", 10, 0, 10);
+        v0Time = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "V0 mean time", 100, -25, 25);
+        v0Dt = aida
+                .histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "V0 time difference", 100, -25, 25);
+        trigTimeV0Time = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "Trigger phase vs. V0 mean time", 100, -25, 25, 6, 0, 24);
+        trigTime = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Trigger phase", 6, 0, 24);
+
+        pEleVspPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e) vs P(p)", 50, 0,
+                beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
+
+        pEle = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e)", 50, 0, beamEnergy
+                * maxFactor);
+        pPos = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(p)", 50, 0, beamEnergy
+                * maxFactor);
+
+        pEleVspPosWithCut = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "P(e) vs P(p): Radiative", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
+        pyEleVspyPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Py(e) vs Py(p)", 50,
+                -0.04 * beamEnergy, 0.04 * beamEnergy, 50, -0.04 * beamEnergy, 0.04 * beamEnergy);
+        pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Px(e) vs Px(p)", 50,
+                -0.04 * beamEnergy, 0.04 * beamEnergy, 50, -0.04 * beamEnergy, 0.04 * beamEnergy);
+        VtxZVsMass = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Mass", 50, 0,
+                maxMass, 50, -50, 80);
+        VtxXVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vz", 100, -10, 10,
+                100, -50, 80);
+        VtxYVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Vz", 100, -5, 5, 100,
+                -50, 80);
+        VtxXVsVtxY = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vy", 100, -10, 10,
+                100, -5, 5);
+        VtxXVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Px", 100, -0.1, 0.1,
+                100, -10, 10);
+        VtxYVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Py", 100, -0.1, 0.1,
+                100, -5, 5);
+        VtxZVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Px", 100, -0.1, 0.1,
+                100, -50, 80);
+        VtxZVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Py", 100, -0.1, 0.1,
+                100, -50, 80);
+        VtxZVsVtxPz = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Pz", 100, 0.0,
+                beamEnergy * maxFactor, 100, -50, 80);
+        VtxZVsL1Iso = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs L1 Isolation", 100,
+                0.0, 5.0, 50, -50, 80);
+        VtxZVsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Track Chi2", 50,
+                0, 50, 50, -50, 80);
+        phiEleVsphiEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/phi(e) vs phi(e)", 50, -Math.PI, Math.PI, 50, -Math.PI, Math.PI);
+        pyEleVspyEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Py(e) vs Py(e)", 50, -0.04 * beamEnergy, 0.04 * beamEnergy, 50, -0.04 * beamEnergy,
+                0.04 * beamEnergy);
+        pxEleVspxEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Px(e) vs Px(e)", 50, -0.02 * beamEnergy, 0.06 * beamEnergy, 50, -0.02 * beamEnergy,
+                0.06 * beamEnergy);
+
+        // electron vs electron momentum with different cuts
+        // 1) no cut
+        // 2) cut out FEE
+        // 3) cut out FEE and also cut on momentum sum
+        // 4) cut out everything except FEE coincidentals
+        pEleVspEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e)",
+                50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor);
+        pEleVspEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/P(e) vs P(e) NoBeam", 50, 0, beambeamCut, 50, 0, beambeamCut);
+        pEleVspEleMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/P(e) vs P(e) Moller", 50, 0, beambeamCut, 50, 0, beambeamCut);
+        pEleVspEleBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/P(e) vs P(e) BeamBeam", 50, beambeamCut, beamEnergy * maxFactor, 50, beambeamCut,
+                beamEnergy * maxFactor);
+
+        pyEleVspyEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Py(e) vs Py(e) NoBeam", 50, -0.04 * beamEnergy, 0.04 * beamEnergy, 50,
+                -0.04 * beamEnergy, 0.04 * beamEnergy);
+        pxEleVspxEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Px(e) vs Px(e) NoBeam", 50, -0.02 * beamEnergy, 0.06 * beamEnergy, 50,
+                -0.02 * beamEnergy, 0.06 * beamEnergy);
+        sumChargeHisto = aida.histogram1D(
+                plotDir + trkType + triggerType + "/" + xtra + "/" + "Total Charge of  Event", 5, -2, 3);
+        numChargeHisto = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "Number of Charged Particles", 6, 0, 6);
+
+        pEleVsthetaMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/P(e) vs Theta Moller", 50, 0, beambeamCut, 50, thetaMin, thetaMax);
+        thetaEleVsthetaMoller = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Theta vs Theta Moller", 50, thetaMin, thetaMax, 50, thetaMin, thetaMax);
+        pEleVsthetaBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/P(e) vs Theta BeamBeam", 50, beambeamCut, beamEnergy * maxFactor, 50, thetaMin, thetaMax);
+        thetaEleVsthetaBeamBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Theta vs Theta BeamBeam", 50, thetaMin, thetaMax, 50, thetaMin, thetaMax);
+
+        mollerMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Mass (GeV)", 100, 0, maxMassMoller);
+        mollerMassVtxCut = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Mass (GeV): VtxCut", 100, 0, maxMassMoller);
+        mollerVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vx (mm)",
+                50, -10, 10);
+        mollerVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vy (mm)",
+                50, -2, 2);
+        mollerVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Moller Vz (mm)",
+                50, -50, 50);
+        mollerVzVtxCut = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Vz (mm): VtxCut", 50, -50, 50);
+        mollerXVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Vx vs Vz", 100, -5, 5, 100, -50, 50);
+        mollerYVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Vy vs Vz", 100, -2, 2, 100, -50, 50);
+        mollerXVsVtxY = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Vx vs Vy", 100, -5, 5, 100, -2, 2);
+
+        mollerUx = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Pair Momentum Direction Ux", 100, .015, .045);
+        mollerUy = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/"
+                + "2 Electron/Moller Pair Momentum Direction Uy", 100, -.01, .01);
+
+        mollerHiP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(high)", 100, 0,
+                beamEnergy * maxFactor);
+        mollerLoP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(low)", 100, 0,
+                beamEnergy * maxFactor);
+
+        mollerEitherP = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(either)",
+                100, 0, beamEnergy * maxFactor);
+        mollerPsum = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Psum", 100, 0,
+                beamEnergy * maxFactor);
+
+    }
+
+    private BilliorVertex fitVertex(final BilliorTrack electron, final BilliorTrack positron, final double bField) {
+        // Create a vertex fitter from the magnetic field.
+        final double[] beamSize = {0.001, 0.2, 0.02};
+        final BilliorVertexer vtxFitter = new BilliorVertexer(bField);
+        // TODO: The beam size should come from the conditions database.
+        vtxFitter.setBeamSize(beamSize);
+
+        // Perform the vertexing based on the specified constraint.
+        vtxFitter.doBeamSpotConstraint(false);
+
+        // Add the electron and positron tracks to a track list for
+        // the vertex fitter.
+        final List<BilliorTrack> billiorTracks = new ArrayList<BilliorTrack>();
+
+        billiorTracks.add(electron);
+
+        billiorTracks.add(positron);
+
+        // Find and return a vertex based on the tracks.
+        return vtxFitter.fitVertex(billiorTracks);
+    }
+
+    IFitResult fitVertexPosition(final IHistogram1D h1d, final IFitter fitter, final double[] init, final String range) {
+        IFitResult ifr = null;
+        try {
+            ifr = fitter.fit(h1d, "g+p1", init, range);
+        } catch (final RuntimeException ex) {
+            LOGGER.info(this.getClass().getSimpleName() + ":  caught exception in fitGaussian");
+        }
+        return ifr;
+    }
+
+    @Override
+    public void printDQMData() {
+        LOGGER.info("V0Monitoring::printDQMData");
+        for (final Entry<String, Double> entry : monitoredQuantityMap.entrySet()) {
+            LOGGER.info(entry.getKey() + " = " + entry.getValue());
+        }
+        LOGGER.info("*******************************");
+    }
+
+    @Override
+    public void printDQMStrings() {
+        for (int i = 0; i < 9; i++) {
+            LOGGER.info("ALTER TABLE dqm ADD " + fpQuantNames[i] + " double;");
+        }
+    }
+
+    @Override
+    public void process(final EventHeader event) {
+        /* make sure everything is there */
+        if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) {
+            return;
+        }
+        if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) {
+            return;
+        }
+        if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName)) {
+            return;
+        }
+        if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) {
+            return;
+        }
+
+        // check to see if this event is from the correct trigger (or "all");
+        if (!this.matchTrigger(event)) {
+            return;
+        }
+
+        nRecoEvents++;
+
+        final RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
+        final RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
+
+        final List<ReconstructedParticle> unonstrainedV0List = event.get(ReconstructedParticle.class,
+                unconstrainedV0CandidatesColName);
+        for (final ReconstructedParticle uncV0 : unonstrainedV0List) {
+            if (isGBL != TrackType.isGBL(uncV0.getType())) {
+                continue;
+            }
+            final Vertex uncVert = uncV0.getStartVertex();
+            final Hep3Vector pVtxRot = VecOp.mult(beamAxisRotation, uncV0.getMomentum());
+            final Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, uncVert.getPosition());
+            final double theta = Math.acos(pVtxRot.z() / pVtxRot.magnitude());
+            final double phi = Math.atan2(pVtxRot.y(), pVtxRot.x());
+            unconVx.fill(vtxPosRot.x());
+            unconVy.fill(vtxPosRot.y());
+            unconVz.fill(vtxPosRot.z());
+            unconMass.fill(uncV0.getMass());
+            unconChi2.fill(uncVert.getChi2());
+            unconVzVsChi2.fill(uncVert.getChi2(), vtxPosRot.z());
+            unconChi2VsTrkChi2.fill(
+                    Math.max(uncV0.getParticles().get(0).getTracks().get(0).getChi2(), uncV0.getParticles().get(1)
+                            .getTracks().get(0).getChi2()), uncVert.getChi2());
+
+            VtxZVsMass.fill(uncV0.getMass(), vtxPosRot.z());
+            VtxXVsVtxZ.fill(vtxPosRot.x(), vtxPosRot.z());
+            VtxYVsVtxZ.fill(vtxPosRot.y(), vtxPosRot.z());
+            VtxXVsVtxY.fill(vtxPosRot.x(), vtxPosRot.y());
+            VtxXVsVtxPx.fill(pVtxRot.x(), vtxPosRot.x());
+            VtxYVsVtxPy.fill(pVtxRot.y(), vtxPosRot.y());
+            VtxZVsVtxPx.fill(pVtxRot.x(), vtxPosRot.z());
+            VtxZVsVtxPy.fill(pVtxRot.y(), vtxPosRot.z());
+            VtxZVsVtxPz.fill(pVtxRot.z(), vtxPosRot.z());
+
+            // this always has 2 tracks.
+            final List<ReconstructedParticle> trks = uncV0.getParticles();
+            // Track ele = trks.get(0).getTracks().get(0);
+            // Track pos = trks.get(1).getTracks().get(0);
+            // //if track #0 has charge>0 it's the electron! This seems mixed up, but remember the track
+            // //charge is assigned assuming a positive B-field, while ours is negative
+            // if (trks.get(0).getCharge() > 0) {
+            // pos = trks.get(0).getTracks().get(0);
+            // ele = trks.get(1).getTracks().get(0);
+            // }
+            // aida.histogram2D(plotDir + trkType + triggerType + "/" + "P(e) vs P(p)").fill(getMomentum(ele),
+            // getMomentum(pos));
+            // aida.histogram2D(plotDir + trkType + triggerType + "/" +
+            // "Px(e) vs Px(p)").fill(ele.getTrackStates().get(0).getMomentum()[1],
+            // pos.getTrackStates().get(0).getMomentum()[1]);
+            // aida.histogram2D(plotDir + trkType + triggerType + "/" +
+            // "Py(e) vs Py(p)").fill(ele.getTrackStates().get(0).getMomentum()[2],
+            // pos.getTrackStates().get(0).getMomentum()[2]);
+            ReconstructedParticle ele = trks.get(0);
+            ReconstructedParticle pos = trks.get(1);
+            // ReconParticles have the charge correct.
+            if (trks.get(0).getCharge() > 0) {
+                pos = trks.get(0);
+                ele = trks.get(1);
+            }
+            if (ele.getCharge() < 0 && pos.getCharge() > 0) {
+                VtxZVsTrkChi2.fill(
+                        Math.max(uncV0.getParticles().get(0).getTracks().get(0).getChi2(), uncV0.getParticles().get(1)
+                                .getTracks().get(0).getChi2()), uncVert.getPosition().z());
+
+                final Double[] eleIso = TrackUtils.getIsolations(ele.getTracks().get(0), hitToStrips, hitToRotated);
+                final Double[] posIso = TrackUtils.getIsolations(pos.getTracks().get(0), hitToStrips, hitToRotated);
+                if (eleIso[0] != null && posIso[0] != null) {
+                    final double eleL1Iso = Math.min(Math.abs(eleIso[0]), Math.abs(eleIso[1]));
+                    final double posL1Iso = Math.min(Math.abs(posIso[0]), Math.abs(posIso[1]));
+                    final double minL1Iso = Math.min(eleL1Iso, posL1Iso);
+                    VtxZVsL1Iso.fill(minL1Iso, uncVert.getPosition().z());
+                }
+
+                final double pe = ele.getMomentum().magnitude();
+                final double pp = pos.getMomentum().magnitude();
+                final Hep3Vector pEleRot = VecOp.mult(beamAxisRotation, ele.getMomentum());
+                final Hep3Vector pPosRot = VecOp.mult(beamAxisRotation, pos.getMomentum());
+
+                pEleVspPos.fill(pe, pp);
+                pEle.fill(pe);
+                pPos.fill(pp);
+
+                pxEleVspxPos.fill(pEleRot.x(), pPosRot.x());
+                pyEleVspyPos.fill(pEleRot.y(), pPosRot.y());
+                if (pe < v0MaxPCut && pp < v0MaxPCut && pe + pp > v0ESumMinCut && pe + pp < v0ESumMaxCut) {
+                    pEleVspPosWithCut.fill(pe, pp);
+                }
+            }
+
+            final double eleT = TrackUtils.getTrackTime(ele.getTracks().get(0), hitToStrips, hitToRotated);
+            final double posT = TrackUtils.getTrackTime(pos.getTracks().get(0), hitToStrips, hitToRotated);
+            final double meanT = (eleT + posT) / 2.0;
+            v0Time.fill(meanT);
+            v0Dt.fill(eleT - posT);
+            trigTimeV0Time.fill(meanT, event.getTimeStamp() % 24);
+            trigTime.fill(event.getTimeStamp() % 24);
+        }
+
+        final List<ReconstructedParticle> beamConstrainedV0List = event.get(ReconstructedParticle.class,
+                beamConV0CandidatesColName);
+        nV0.fill(beamConstrainedV0List.size());
+        for (final ReconstructedParticle bsV0 : beamConstrainedV0List) {
+
+            if (isGBL != TrackType.isGBL(bsV0.getType())) {
+                continue;
+            }
+            nTotV0++;
+            final Vertex bsVert = bsV0.getStartVertex();
+            final Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, bsVert.getPosition());
+            bsconVx.fill(vtxPosRot.x());
+            bsconVy.fill(vtxPosRot.y());
+            bsconVz.fill(vtxPosRot.z());
+            bsconMass.fill(bsV0.getMass());
+            bsconChi2.fill(bsVert.getChi2());
+            bsconVzVsChi2.fill(bsVert.getChi2(), vtxPosRot.z());
+            bsconChi2VsTrkChi2.fill(
+                    Math.max(bsV0.getParticles().get(0).getTracks().get(0).getChi2(), bsV0.getParticles().get(1)
+                            .getTracks().get(0).getChi2()), bsVert.getChi2());
+            sumMass += bsV0.getMass();
+            sumVx += vtxPosRot.x();
+            sumVy += vtxPosRot.y();
+            sumVz += vtxPosRot.z();
+            sumChi2 += bsVert.getChi2();
+        }
+
+        final List<ReconstructedParticle> targetConstrainedV0List = event.get(ReconstructedParticle.class,
+                targetV0ConCandidatesColName);
+        for (final ReconstructedParticle tarV0 : targetConstrainedV0List) {
+
+            if (isGBL != TrackType.isGBL(tarV0.getType())) {
+                continue;
+            }
+
+            final Vertex tarVert = tarV0.getStartVertex();
+            final Hep3Vector vtxPosRot = VecOp.mult(beamAxisRotation, tarVert.getPosition());
+            tarconVx.fill(vtxPosRot.x());
+            tarconVy.fill(vtxPosRot.y());
+            tarconVz.fill(vtxPosRot.z());
+            tarconMass.fill(tarV0.getMass());
+            tarconChi2.fill(tarVert.getChi2());
+            tarconVzVsChi2.fill(tarVert.getChi2(), vtxPosRot.z());
+            tarconChi2VsTrkChi2.fill(
+                    Math.max(tarV0.getParticles().get(0).getTracks().get(0).getChi2(), tarV0.getParticles().get(1)
+                            .getTracks().get(0).getChi2()), tarVert.getChi2());
+        }
+        final List<ReconstructedParticle> finalStateParticles = event.get(ReconstructedParticle.class,
+                finalStateParticlesColName);
+        if (debug) {
+            LOGGER.info("This events has " + finalStateParticles.size() + " final state particles");
+        }
+
+        ReconstructedParticle ele1 = null;
+        ReconstructedParticle ele2 = null;
+        int sumCharge = 0;
+        int numChargedParticles = 0;
+        for (final ReconstructedParticle fsPart : finalStateParticles) {
+            if (isGBL != TrackType.isGBL(fsPart.getType())) {
+                continue;
+            }
+            if (debug) {
+                LOGGER.info("PDGID = " + fsPart.getParticleIDUsed() + "; charge = " + fsPart.getCharge() + "; pz = "
+                        + fsPart.getMomentum().x());
+            }
+            final double charge = fsPart.getCharge();
+            sumCharge += charge;
+            if (charge != 0) {
+                numChargedParticles++;
+                if (charge < 1) {
+                    if (ele1 == null) {
+                        ele1 = fsPart;
+                    } else if (!hasSharedStrips(ele1, fsPart, hitToStrips, hitToRotated)) {
+                        ele2 = fsPart;
+                    }
+                }
+            }
+        }
+        sumChargeHisto.fill(sumCharge);
+        numChargeHisto.fill(numChargedParticles);
+
+        if (ele1 != null && ele2 != null) {
+            final Hep3Vector p1 = VecOp.mult(beamAxisRotation, ele1.getMomentum());
+            final Hep3Vector p2 = VecOp.mult(beamAxisRotation, ele2.getMomentum());
+            // Hep3Vector beamAxis = new BasicHep3Vector(Math.sin(0.0305), 0, Math.cos(0.0305));
+            // LOGGER.info(p1);
+            // LOGGER.info(VecOp.mult(rot, p1));
+
+            final double theta1 = Math.acos(p1.z() / p1.magnitude());
+            final double theta2 = Math.acos(p2.z() / p2.magnitude());
+            final double phi1 = Math.atan2(p1.y(), p1.x());
+            final double phi2 = Math.atan2(p2.y(), p2.x());
+            phiEleVsphiEle.fill(phi1, phi2);
+            pEleVspEle.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
+            pyEleVspyEle.fill(ele1.getMomentum().y(), ele2.getMomentum().y());
+            pxEleVspxEle.fill(ele1.getMomentum().x(), ele2.getMomentum().x());
+            // remove beam electrons
+            if (ele1.getMomentum().magnitude() < beambeamCut && ele2.getMomentum().magnitude() < beambeamCut) {
+                pEleVspEleNoBeam.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
+                pyEleVspyEleNoBeam.fill(ele1.getMomentum().y(), ele2.getMomentum().y());
+                pxEleVspxEleNoBeam.fill(ele1.getMomentum().x(), ele2.getMomentum().x());
+            }
+            // look at beam-beam events
+            if (ele1.getMomentum().magnitude() > beambeamCut && ele2.getMomentum().magnitude() > beambeamCut) {
+                pEleVspEleBeamBeam.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude());
+                pEleVsthetaBeamBeam.fill(p1.magnitude(), theta1);
+                pEleVsthetaBeamBeam.fill(p2.magnitude(), theta2);
+                thetaEleVsthetaBeamBeam.fill(theta1, theta2);
+            }
+
+            // look at "Moller" events (if that's what they really are
+            if (ele1.getMomentum().magnitude() + ele2.getMomentum().magnitude() > molPSumMin
+                    && ele1.getMomentum().magnitude() + ele2.getMomentum().magnitude() < molPSumMax
+                    && p1.magnitude() < beambeamCut && p2.magnitude() < beambeamCut) {
+
+                final Track ele1trk = ele1.getTracks().get(0);
+                final Track ele2trk = ele2.getTracks().get(0);
+                final SeedTrack stEle1 = TrackUtils.makeSeedTrackFromBaseTrack(ele1trk);
+                final SeedTrack stEle2 = TrackUtils.makeSeedTrackFromBaseTrack(ele2trk);
+                final BilliorTrack btEle1 = new BilliorTrack(stEle1.getSeedCandidate().getHelix());
+                final BilliorTrack btEle2 = new BilliorTrack(stEle2.getSeedCandidate().getHelix());
+                final BilliorVertex bv = this.fitVertex(btEle1, btEle2, TrackUtils.getBField(event.getDetector())
+                        .magnitude());
+                // LOGGER.info("ee vertex: "+bv.toString());
+                final double invMass = bv.getParameters().get("invMass");
+                mollerMass.fill(invMass);
+                mollerVx.fill(bv.getPosition().x());
+                mollerVy.fill(bv.getPosition().y());
+                mollerVz.fill(bv.getPosition().z());
+                mollerXVsVtxZ.fill(bv.getPosition().x(), bv.getPosition().z());
+                mollerYVsVtxZ.fill(bv.getPosition().y(), bv.getPosition().z());
+                mollerXVsVtxY.fill(bv.getPosition().x(), bv.getPosition().y());
+
+                final double ux = (ele1.getMomentum().x() + ele2.getMomentum().x())
+                        / (ele1.getMomentum().z() + ele2.getMomentum().z());
+                final double uy = (ele1.getMomentum().y() + ele2.getMomentum().y())
+                        / (ele1.getMomentum().z() + ele2.getMomentum().z());
+                mollerUx.fill(ux);
+                mollerUy.fill(uy);
+
+                // higher and lower energy electrons in moller pair
+                final double pt1 = ele1.getMomentum().magnitude();
+                final double pt2 = ele2.getMomentum().magnitude();
+                final double ph = pt1 > pt2 ? pt1 : pt2;
+                final double pl = pt1 > pt2 ? pt2 : pt1;
+
+                mollerHiP.fill(ph);
+                mollerLoP.fill(pl);
+
+                mollerEitherP.fill(ph);
+                mollerEitherP.fill(pl);
+                mollerPsum.fill(pt1 + pt2);
+
+                if (Math.abs(bv.getPosition().x()) < 2 && Math.abs(bv.getPosition().y()) < 0.5) {
+                    mollerMassVtxCut.fill(invMass);
+                    mollerVzVtxCut.fill(bv.getPosition().z());
+                }
+                pEleVspEleMoller.fill(p1.magnitude(), p2.magnitude());
+                pEleVsthetaMoller.fill(p1.magnitude(), theta1);
+                pEleVsthetaMoller.fill(p2.magnitude(), theta2);
+                thetaEleVsthetaMoller.fill(theta1, theta2);
+            }
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalCellIDPrintDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalCellIDPrintDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalCellIDPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -19,63 +19,63 @@
  */
 public class EcalCellIDPrintDriver extends Driver {
 
-	Subdetector ecal;
-	IDDecoder dec;
-	String ecalName = "Ecal";
-	String ecalCollectionName = "EcalReadoutHits";
-	String outputFileName;
-	PrintWriter outputStream = null;
+    Subdetector ecal;
+    IDDecoder dec;
+    String ecalName = "Ecal";
+    String ecalCollectionName = "EcalReadoutHits";
+    String outputFileName;
+    PrintWriter outputStream = null;
 
-	public EcalCellIDPrintDriver() {
-	}
+    public EcalCellIDPrintDriver() {
+    }
 
-	public void setEcalCollectionName(String ecalCollectionName) {
-		this.ecalCollectionName = ecalCollectionName;
-	}
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
 
-	public void setEcalName(String ecalName) {
-		this.ecalName = ecalName;
-	}
+    public void setEcalName(String ecalName) {
+        this.ecalName = ecalName;
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	public void startOfData() {
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+    public void startOfData() {
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void detectorChanged(Detector detector) {
-		// Get the Subdetector.
-		ecal = (Subdetector) detector.getSubdetector(ecalName);
-		dec = ecal.getIDDecoder();
-	}
+    public void detectorChanged(Detector detector) {
+        // Get the Subdetector.
+        ecal = (Subdetector) detector.getSubdetector(ecalName);
+        dec = ecal.getIDDecoder();
+    }
 
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) {
-			List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
-			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (RawCalorimeterHit hit : hits) {
-				dec.setID(hit.getCellID());
-				outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
-			}
-		}
-		if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) {
-			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName);
-			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (RawTrackerHit hit : hits) {
-				dec.setID(hit.getCellID());
-				outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
-			}
-		}
-	}
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) {
+            List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
+            //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+            for (RawCalorimeterHit hit : hits) {
+                dec.setID(hit.getCellID());
+                outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
+            }
+        }
+        if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName);
+            //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+            for (RawTrackerHit hit : hits) {
+                dec.setID(hit.getCellID());
+                outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
+            }
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalClusterPlots.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalClusterPlots.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalClusterPlots.java	Wed Mar  9 11:43:24 2016
@@ -17,7 +17,7 @@
 
 public class EcalClusterPlots extends Driver {
 
-	//AIDAFrame plotterFrame;
+    //AIDAFrame plotterFrame;
     String inputCollection = "EcalClusters";
     AIDA aida = AIDA.defaultInstance();
     IPlotter plotter, plotter2, plotter3, plotter4;
@@ -47,7 +47,7 @@
     @Override
     protected void detectorChanged(Detector detector) {
 
-    	//plotterFrame = new AIDAFrame();
+        //plotterFrame = new AIDAFrame();
         //plotterFrame.setTitle("HPS ECal Cluster Plots");
 
         // Setup the plotter.
@@ -172,6 +172,6 @@
 
     @Override
     public void endOfData() {
-    	//plotterFrame.dispose();
+        //plotterFrame.dispose();
     }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalHitPlots.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalHitPlots.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/EcalHitPlots.java	Wed Mar  9 11:43:24 2016
@@ -192,8 +192,8 @@
                 } else if (AbstractIntData.getTag(data) == SSPData.BANK_TAG) {
                     //SSPData triggerData = new SSPData(data);
                     // TODO: TOP, BOTTOM, AND, and OR trigger are test
-                	// run-specific parameters and are not supported by
-                	// SSPData.
+                    // run-specific parameters and are not supported by
+                    // SSPData.
                     int orTrig = 0; //triggerData.getOrTrig();
                     if(orTrig != 0) {
                         for (int i = 0; i < 32; i++) {
@@ -237,7 +237,7 @@
             double botTime = Double.POSITIVE_INFINITY;
             double orTime = Double.POSITIVE_INFINITY;
             for (CalorimeterHit hit : hits) {
-            	/*
+                /*
                 if (hit.getIdentifierFieldValue("iy") > 0) {
                     topX.fill(hit.getIdentifierFieldValue("ix"),hit.getPosition()[0]);
                     topY.fill(hit.getIdentifierFieldValue("iy"),hit.getPosition()[1]);

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java	Wed Mar  9 11:43:24 2016
@@ -28,8 +28,8 @@
 */
 
 public class FEEClusterPlotter extends Driver {
-	
-	//private AIDAFrame plotterFrame;
+    
+    //private AIDAFrame plotterFrame;
     private AIDA aida = AIDA.defaultInstance();
     IPlotter plotter;
     IAnalysisFactory fac = aida.analysisFactory();
@@ -53,7 +53,7 @@
         aida.tree().cd("/");
         for (EcalChannel cc : ecalConditions.getChannelCollection()) {
             //aida.histogram1D(getHistoName(cc),200,0.5,1.3);
-        	aida.histogram1D(getHistoName(cc),200,0.9,2.8);	
+            aida.histogram1D(getHistoName(cc),200,0.9,2.8); 
         }
 
     }
@@ -67,39 +67,39 @@
 
         //only keep singles triggers:
         if (!event.hasCollection(GenericObject.class,"TriggerBank"))
-        	throw new Driver.NextEventException();
+            throw new Driver.NextEventException();
         boolean isSingles=false;
         for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
-        {	
-        	if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
-        	TIData tid = new TIData(gob);
-        	if (tid.isSingle0Trigger()  || tid.isSingle1Trigger())
-        	{
-        		isSingles=true;
-        		break;
-        	}
+        {   
+            if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
+            TIData tid = new TIData(gob);
+            if (tid.isSingle0Trigger()  || tid.isSingle1Trigger())
+            {
+                isSingles=true;
+                break;
+            }
         }
         
         if (isSingles){
-        	List<Cluster> clusters = event.get(Cluster.class, inputCollection);
-        	for (Cluster clus : clusters) {
-        		List<CalorimeterHit> hits = clus.getCalorimeterHits();
-        		CalorimeterHit seed = hits.get(0);
-        	
-        		double seedE = seed.getCorrectedEnergy();
-        		double clusE = clus.getEnergy();
-        		double time = seed.getTime();
-        		
-        		//if ((seedE/clusE > 0.6) && seedE >0.45 && time>30 && time <70){
-        		if ((seedE/clusE > 0.6) && seedE >0.65 && time>30 && time <70){
-        	
-        			EcalChannel cc = findChannel(seed);
-        			aida.histogram1D(getHistoName(cc)).fill(clusE);
-        		}
-        	}
+            List<Cluster> clusters = event.get(Cluster.class, inputCollection);
+            for (Cluster clus : clusters) {
+                List<CalorimeterHit> hits = clus.getCalorimeterHits();
+                CalorimeterHit seed = hits.get(0);
+            
+                double seedE = seed.getCorrectedEnergy();
+                double clusE = clus.getEnergy();
+                double time = seed.getTime();
+                
+                //if ((seedE/clusE > 0.6) && seedE >0.45 && time>30 && time <70){
+                if ((seedE/clusE > 0.6) && seedE >0.65 && time>30 && time <70){
+            
+                    EcalChannel cc = findChannel(seed);
+                    aida.histogram1D(getHistoName(cc)).fill(clusE);
+                }
+            }
         }
     }
-	
+    
     public void setOutputPlots(String output) {
         this.outputPlots = output;
     }
@@ -121,5 +121,5 @@
                 Logger.getLogger(FEEClusterPlotter.class.getName()).log(Level.SEVERE, null, ex);
             }
         }
-    }	
+    }   
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalFADCPlotsDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalFADCPlotsDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalFADCPlotsDriver.java	Wed Mar  9 11:43:24 2016
@@ -20,90 +20,90 @@
  */
 public class HPSEcalFADCPlotsDriver extends Driver {
 
-	String edepCollectionName = "EcalHits";
-	String rawCollectionName = null;
-	String ecalCollectionName = null;
-	String clusterCollectionName = "EcalClusters";
-	AIDA aida = AIDA.defaultInstance();
-	IHistogram1D edepE;
-	IHistogram1D rawE;
-	IHistogram1D ecalE;
-	IHistogram1D clusterE;
-	ICloud2D window_E;
-	double edepThreshold = 0.05;
+    String edepCollectionName = "EcalHits";
+    String rawCollectionName = null;
+    String ecalCollectionName = null;
+    String clusterCollectionName = "EcalClusters";
+    AIDA aida = AIDA.defaultInstance();
+    IHistogram1D edepE;
+    IHistogram1D rawE;
+    IHistogram1D ecalE;
+    IHistogram1D clusterE;
+    ICloud2D window_E;
+    double edepThreshold = 0.05;
 
-	public void setEdepThreshold(double edepThreshold) {
-		this.edepThreshold = edepThreshold;
-	}
+    public void setEdepThreshold(double edepThreshold) {
+        this.edepThreshold = edepThreshold;
+    }
 
-	public void setRawCollectionName(String rawCollectionName) {
-		this.rawCollectionName = rawCollectionName;
-	}
+    public void setRawCollectionName(String rawCollectionName) {
+        this.rawCollectionName = rawCollectionName;
+    }
 
-	public void setEcalCollectionName(String ecalCollectionName) {
-		this.ecalCollectionName = ecalCollectionName;
-	}
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
 
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
 
-	public void startOfData() {
-		edepE = aida.histogram1D(
-				"FADC plots: " + edepCollectionName + " : Hits",
-				500, 0.0, 5.0);
-		if (rawCollectionName != null) {
-			rawE = aida.histogram1D(
-					"FADC plots: " + rawCollectionName + " : Hits",
-					500, 0.0, 500.0);
-			window_E = aida.cloud2D("FADC plots: " + rawCollectionName + " : Window vs. E");
-		}
-		if (ecalCollectionName != null) {
-			ecalE = aida.histogram1D(
-					"FADC plots: " + ecalCollectionName + " : Hits",
-					500, 0.0, 5.0);
-		}
-		clusterE = aida.histogram1D(
-				"FADC plots: " + clusterCollectionName + " : Clusters",
-				500, 0.0, 5.0);
-	}
+    public void startOfData() {
+        edepE = aida.histogram1D(
+                "FADC plots: " + edepCollectionName + " : Hits",
+                500, 0.0, 5.0);
+        if (rawCollectionName != null) {
+            rawE = aida.histogram1D(
+                    "FADC plots: " + rawCollectionName + " : Hits",
+                    500, 0.0, 500.0);
+            window_E = aida.cloud2D("FADC plots: " + rawCollectionName + " : Window vs. E");
+        }
+        if (ecalCollectionName != null) {
+            ecalE = aida.histogram1D(
+                    "FADC plots: " + ecalCollectionName + " : Hits",
+                    500, 0.0, 5.0);
+        }
+        clusterE = aida.histogram1D(
+                "FADC plots: " + clusterCollectionName + " : Clusters",
+                500, 0.0, 5.0);
+    }
 
-	public void process(EventHeader event) {
-		List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
-		if (clusters == null)
-			throw new RuntimeException("Missing cluster collection!");
+    public void process(EventHeader event) {
+        List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
+        if (clusters == null)
+            throw new RuntimeException("Missing cluster collection!");
 
-		List<CalorimeterHit> edepHits = event.get(CalorimeterHit.class, edepCollectionName);
-		if (edepHits == null)
-			throw new RuntimeException("Missing hit collection!");
+        List<CalorimeterHit> edepHits = event.get(CalorimeterHit.class, edepCollectionName);
+        if (edepHits == null)
+            throw new RuntimeException("Missing hit collection!");
 
-		if (rawCollectionName != null) {
-			List<RawCalorimeterHit> rawHits = event.get(RawCalorimeterHit.class, rawCollectionName);
-			if (rawHits == null)
-				throw new RuntimeException("Missing hit collection!");
+        if (rawCollectionName != null) {
+            List<RawCalorimeterHit> rawHits = event.get(RawCalorimeterHit.class, rawCollectionName);
+            if (rawHits == null)
+                throw new RuntimeException("Missing hit collection!");
 
-			for (RawCalorimeterHit hit : rawHits) {
-				rawE.fill(hit.getAmplitude());
-				//window_E.fill(hit.getAmplitude(),hit.getWindowSize());
-			}
-		}
+            for (RawCalorimeterHit hit : rawHits) {
+                rawE.fill(hit.getAmplitude());
+                //window_E.fill(hit.getAmplitude(),hit.getWindowSize());
+            }
+        }
 
-		if (ecalCollectionName != null) {
-			List<CalorimeterHit> ecalHits = event.get(CalorimeterHit.class, ecalCollectionName);
-			if (ecalHits == null)
-				throw new RuntimeException("Missing hit collection!");
+        if (ecalCollectionName != null) {
+            List<CalorimeterHit> ecalHits = event.get(CalorimeterHit.class, ecalCollectionName);
+            if (ecalHits == null)
+                throw new RuntimeException("Missing hit collection!");
 
-			for (CalorimeterHit hit : ecalHits) {
-				ecalE.fill(hit.getRawEnergy());
-			}
-		}
+            for (CalorimeterHit hit : ecalHits) {
+                ecalE.fill(hit.getRawEnergy());
+            }
+        }
 
-		for (CalorimeterHit hit : edepHits) {
-			if (hit.getRawEnergy() > edepThreshold)
-				edepE.fill(hit.getRawEnergy());
-		}
-		for (Cluster cluster : clusters) {
-			clusterE.fill(cluster.getEnergy());
-		}
-	}
+        for (CalorimeterHit hit : edepHits) {
+            if (hit.getRawEnergy() > edepThreshold)
+                edepE.fill(hit.getRawEnergy());
+        }
+        for (Cluster cluster : clusters) {
+            clusterE.fill(cluster.getEnergy());
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSEcalTriggerPlotsDriver.java	Wed Mar  9 11:43:24 2016
@@ -23,7 +23,7 @@
  * Exp $
  */
 public class HPSEcalTriggerPlotsDriver extends Driver {
-	// LCSim collection names.
+    // LCSim collection names.
     String ecalCollectionName = "EcalHits";
     String clusterCollectionName = "EcalClusters";
     
@@ -55,46 +55,46 @@
     }
     
     public void startOfData() {
-    	// Initialize a hit histogram for each declared energy.
-    	for(int e = 0; e < energyCut.length; e++) {
-    		hitXYPlot[e] = aida.histogram2D("Trigger Plots: " + ecalCollectionName +
-    				" : Hits above " + energyCut[e] + " MeV", 46, -23, 23, 11, -5.5, 5.5);
-    	}
-    	// Initialize the remaining plots.
+        // Initialize a hit histogram for each declared energy.
+        for(int e = 0; e < energyCut.length; e++) {
+            hitXYPlot[e] = aida.histogram2D("Trigger Plots: " + ecalCollectionName +
+                    " : Hits above " + energyCut[e] + " MeV", 46, -23, 23, 11, -5.5, 5.5);
+        }
+        // Initialize the remaining plots.
         crystalDeadTime = aida.histogram2D("Trigger Plots: " + ecalCollectionName +
-        		" : Crystal dead time", 46, -23, 23, 11, -5.5, 5.5);
+                " : Crystal dead time", 46, -23, 23, 11, -5.5, 5.5);
         clusterHitXYPlot = aida.histogram2D("Trigger Plots: " + clusterCollectionName +
-        		" : Crystals in clusters", 47, -23.5, 23.5, 11, -5.5, 5.5);
+                " : Crystals in clusters", 47, -23.5, 23.5, 11, -5.5, 5.5);
         seedHitXYPlot = aida.histogram2D("Trigger Plots: " + clusterCollectionName +
-        		" : Seed hits", 47, -23.5, 23.5, 11, -5.5, 5.5);
+                " : Seed hits", 47, -23.5, 23.5, 11, -5.5, 5.5);
         triggerClusterHitXYPlot = aida.histogram2D("Trigger Plots: " + clusterCollectionName +
                 " : Crystals in clusters, with trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
         triggerSeedHitXYPlot = aida.histogram2D("Trigger Plots: " + clusterCollectionName +
-        		" : Seed hits, with trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+                " : Seed hits, with trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
     }
     
     public void process(EventHeader event) {
-    	// If the current event has the indicated hit collection,
-    	// use it as the hit list.
-    	List<CalorimeterHit> hits;
-    	if(event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
-    		hits = event.get(CalorimeterHit.class, ecalCollectionName);
-    	}
-    	// If it does not, then use an empty list to avoid crashing.
-    	else { hits = new ArrayList<CalorimeterHit>(0); }
-    	
-    	// If the current event has the indicated cluster collection,
-    	// use it as the cluster list.
-    	List<Cluster> clusters;
-    	if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-    		clusters = event.get(Cluster.class, clusterCollectionName);
-    	}
-    	// If it does not, then use an empty list to avoid crashing.
-    	else { clusters = new ArrayList<Cluster>(0); }
+        // If the current event has the indicated hit collection,
+        // use it as the hit list.
+        List<CalorimeterHit> hits;
+        if(event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
+            hits = event.get(CalorimeterHit.class, ecalCollectionName);
+        }
+        // If it does not, then use an empty list to avoid crashing.
+        else { hits = new ArrayList<CalorimeterHit>(0); }
+        
+        // If the current event has the indicated cluster collection,
+        // use it as the cluster list.
+        List<Cluster> clusters;
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            clusters = event.get(Cluster.class, clusterCollectionName);
+        }
+        // If it does not, then use an empty list to avoid crashing.
+        else { clusters = new ArrayList<Cluster>(0); }
         
         // Populate hit plots.
         for (CalorimeterHit hit : hits) {
-        	// Get the hit crystal position.
+            // Get the hit crystal position.
             int ix = hit.getIdentifierFieldValue("ix");
             int iy = hit.getIdentifierFieldValue("iy");
             double energy = hit.getRawEnergy();
@@ -102,9 +102,9 @@
             // Loop through the energy plots and fill them if the hit
             // is over the current energy threshold/
             for(int e = 0; e < energyCut.length; e++) {
-            	if(energy > energyCut[e] * EcalUtils.MeV) {
-            		hitXYPlot[e].fill(ix - 0.5 * Math.signum(ix), iy);
-            	}
+                if(energy > energyCut[e] * EcalUtils.MeV) {
+                    hitXYPlot[e].fill(ix - 0.5 * Math.signum(ix), iy);
+                }
             }
             
             // Generate the dead time plot.
@@ -121,8 +121,8 @@
         
         // Populate cluster based plots.
         for (Cluster cluster : clusters) {
-        	// Get the cluster's seed hit position.
-        	CalorimeterHit seed = cluster.getCalorimeterHits().get(0);
+            // Get the cluster's seed hit position.
+            CalorimeterHit seed = cluster.getCalorimeterHits().get(0);
             int ix = seed.getIdentifierFieldValue("ix");
             int iy = seed.getIdentifierFieldValue("iy");
             
@@ -135,7 +135,7 @@
             
             // Populate the component hit histogram.
             for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
-            	// Get the component hit location.
+                // Get the component hit location.
                 ix = hit.getIdentifierFieldValue("ix");
                 iy = hit.getIdentifierFieldValue("iy");
                 

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSMCParticlePlotsDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSMCParticlePlotsDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/ecal/HPSMCParticlePlotsDriver.java	Wed Mar  9 11:43:24 2016
@@ -25,138 +25,138 @@
  */
 public class HPSMCParticlePlotsDriver extends Driver {
 
-	AIDA aida = AIDA.defaultInstance();
+    AIDA aida = AIDA.defaultInstance();
         //private AIDAFrame pFrame;
         IAnalysisFactory af = aida.analysisFactory();
         public boolean _hideFrame = false;
         // MCParticle plots.
-	ICloud1D primaryEPlot;
-	ICloud1D fsCountPlot;
-	IHistogram1D fsCountVsEventPlot;
-	ICloud1D fsCountTypePlot;
-	ICloud1D fsCountEventTypePlot;
-	ICloud1D fsCountEventTypePlot2;
-	ICloud1D fsCountTypePlot500;
-	IHistogram1D fsEPlot;
-	IHistogram1D fsGammaEPlot;
-	IHistogram1D fsElectronEPlot;
-	IHistogram1D fsPositronEPlot;
-	IHistogram1D fsThetayPlot;
-	ICloud1D fsGammaThetaPlot;
-	IHistogram1D fsGammaThetayPlot;
-	IHistogram1D fsGammaThetayTrigPlot;
-	ICloud2D fsGammaThetayEPlot;
-	ICloud1D fsElectronThetaPlot;
-	IHistogram1D fsElectronThetayPlot;
-	IHistogram1D fsElectronThetayTrigPlot;
-	ICloud2D fsElectronThetayEPlot;
-	ICloud1D fsPositronThetaPlot;
-	IHistogram1D fsPositronThetayPlot;
-	IHistogram1D fsPositronThetayTrigPlot;
-	ICloud2D fsPositronThetayEPlot;
+    ICloud1D primaryEPlot;
+    ICloud1D fsCountPlot;
+    IHistogram1D fsCountVsEventPlot;
+    ICloud1D fsCountTypePlot;
+    ICloud1D fsCountEventTypePlot;
+    ICloud1D fsCountEventTypePlot2;
+    ICloud1D fsCountTypePlot500;
+    IHistogram1D fsEPlot;
+    IHistogram1D fsGammaEPlot;
+    IHistogram1D fsElectronEPlot;
+    IHistogram1D fsPositronEPlot;
+    IHistogram1D fsThetayPlot;
+    ICloud1D fsGammaThetaPlot;
+    IHistogram1D fsGammaThetayPlot;
+    IHistogram1D fsGammaThetayTrigPlot;
+    ICloud2D fsGammaThetayEPlot;
+    ICloud1D fsElectronThetaPlot;
+    IHistogram1D fsElectronThetayPlot;
+    IHistogram1D fsElectronThetayTrigPlot;
+    ICloud2D fsElectronThetayEPlot;
+    ICloud1D fsPositronThetaPlot;
+    IHistogram1D fsPositronThetayPlot;
+    IHistogram1D fsPositronThetayTrigPlot;
+    ICloud2D fsPositronThetayEPlot;
         ICloud1D eventEPlot;
 
-	class MCParticleEComparator implements Comparator<MCParticle> {
-
-		public int compare(MCParticle p1, MCParticle p2) {
-			double e1 = p1.getEnergy();
-			double e2 = p2.getEnergy();
-			if (e1 < e2) {
-				return -1;
-			} else if (e1 == e2) {
-				return 0;
-			} else {
-				return 1;
-			}
-		}
-	}
+    class MCParticleEComparator implements Comparator<MCParticle> {
+
+        public int compare(MCParticle p1, MCParticle p2) {
+            double e1 = p1.getEnergy();
+            double e2 = p2.getEnergy();
+            if (e1 < e2) {
+                return -1;
+            } else if (e1 == e2) {
+                return 0;
+            } else {
+                return 1;
+            }
+        }
+    }
 
         public void setHideFrame(boolean hideFrame) {
             this._hideFrame = hideFrame;
         }
         
         
-	@Override
-	public void startOfData() {
-		fsCountPlot = aida.cloud1D("MCParticle: Number of Final State Particles");
-		fsCountPlot.annotation().addItem("xAxisLabel", "Number of FS Particles");
+    @Override
+    public void startOfData() {
+        fsCountPlot = aida.cloud1D("MCParticle: Number of Final State Particles");
+        fsCountPlot.annotation().addItem("xAxisLabel", "Number of FS Particles");
                 
                 fsCountVsEventPlot = aida.histogram1D("MCParticle: Number of Final State Particles vs Event Nr", 501, -0.5, 500.5);
-		fsCountVsEventPlot.annotation().addItem("xAxisLabel", "Event Number");
+        fsCountVsEventPlot.annotation().addItem("xAxisLabel", "Event Number");
 
                 fsCountTypePlot = aida.cloud1D("MCParticle: Number of Final State Particles Type");
-		fsCountTypePlot.annotation().addItem("xAxisLabel", "Number of FS Particles of Type");
+        fsCountTypePlot.annotation().addItem("xAxisLabel", "Number of FS Particles of Type");
 
                 fsCountTypePlot500 = aida.cloud1D("MCParticle: Number of Final State Particles Type E>0.5GeV");
-		fsCountTypePlot500.annotation().addItem("xAxisLabel", "Number of FS Particles of Type E>0.5GeV");
+        fsCountTypePlot500.annotation().addItem("xAxisLabel", "Number of FS Particles of Type E>0.5GeV");
 
                 fsCountEventTypePlot = aida.cloud1D("MCParticle: Number of Final State Types");
-		fsCountEventTypePlot.annotation().addItem("xAxisLabel", "Number of FS Types");
+        fsCountEventTypePlot.annotation().addItem("xAxisLabel", "Number of FS Types");
 
                 fsCountEventTypePlot2 = aida.cloud1D("MCParticle: Number of Final State Types Gamma E>500");
-		fsCountEventTypePlot2.annotation().addItem("xAxisLabel", "Number of FS Types Gamma E>500");                
-                
-		fsEPlot = aida.histogram1D("MCParticle: FS Particle E",100,0,3);
-		fsEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
-
-		fsGammaEPlot = aida.histogram1D("MCParticle: FS Gamma E",100,0,3);
-		fsGammaEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
-
-		fsElectronEPlot = aida.histogram1D("MCParticle: FS Electron E",100,0,3);
-		fsElectronEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
-
-		fsPositronEPlot = aida.histogram1D("MCParticle: FS Positron E",100,0,3);
-		fsPositronEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
-
-		fsGammaThetaPlot = aida.cloud1D("MCParticle: FS Gamma Theta");
-		fsGammaThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
+        fsCountEventTypePlot2.annotation().addItem("xAxisLabel", "Number of FS Types Gamma E>500");                
+                
+        fsEPlot = aida.histogram1D("MCParticle: FS Particle E",100,0,3);
+        fsEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
+
+        fsGammaEPlot = aida.histogram1D("MCParticle: FS Gamma E",100,0,3);
+        fsGammaEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
+
+        fsElectronEPlot = aida.histogram1D("MCParticle: FS Electron E",100,0,3);
+        fsElectronEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
+
+        fsPositronEPlot = aida.histogram1D("MCParticle: FS Positron E",100,0,3);
+        fsPositronEPlot.annotation().addItem("xAxisLabel", "Particle E [GeV]");
+
+        fsGammaThetaPlot = aida.cloud1D("MCParticle: FS Gamma Theta");
+        fsGammaThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
 
                 fsThetayPlot = aida.histogram1D("MCParticle: FS Particle Thetay",100,0,0.1);
-		fsThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 
                 fsGammaThetayPlot = aida.histogram1D("MCParticle: FS Gamma Thetay",100,0,0.1);
-		fsGammaThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsGammaThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 fsGammaThetayTrigPlot = aida.histogram1D("MCParticle: FS Gamma Thetay Trig",100,0,0.1);
-		fsGammaThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsGammaThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
              
                 fsGammaThetayEPlot = aida.cloud2D("MCParticle: FS Gamma Thetay vs E");
-		fsGammaThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
-		fsGammaThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
-                
-		fsElectronThetaPlot = aida.cloud1D("MCParticle: FS Electron Theta");
-		fsElectronThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
+        fsGammaThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsGammaThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
+                
+        fsElectronThetaPlot = aida.cloud1D("MCParticle: FS Electron Theta");
+        fsElectronThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
 
                 fsElectronThetayPlot = aida.histogram1D("MCParticle: FS Electron Thetay",100,0,0.1);
-		fsElectronThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsElectronThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 fsElectronThetayTrigPlot = aida.histogram1D("MCParticle: FS Electron Thetay Trig",100,0,0.1);
-		fsElectronThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsElectronThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 fsElectronThetayEPlot = aida.cloud2D("MCParticle: FS Electron Thetay vs E");
-		fsElectronThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
-		fsElectronThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
-
-		fsPositronThetaPlot = aida.cloud1D("MCParticle: FS Positron Theta");
-		fsPositronThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
+        fsElectronThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsElectronThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
+
+        fsPositronThetaPlot = aida.cloud1D("MCParticle: FS Positron Theta");
+        fsPositronThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
 
                 fsPositronThetayPlot = aida.histogram1D("MCParticle: FS Positron Thetay",100,0,0.1);
-		fsPositronThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsPositronThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 fsPositronThetayTrigPlot = aida.histogram1D("MCParticle: FS Positron Thetay Trig",100,0,0.1);
-		fsPositronThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsPositronThetayTrigPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
 
                 fsPositronThetayEPlot = aida.cloud2D("MCParticle: FS Positron Thetay vs E");
-		fsPositronThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
-		fsPositronThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
-
-                
-		primaryEPlot = aida.cloud1D("MCParticle: Highest Primary E in Event");
-		primaryEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
-
-		eventEPlot = aida.cloud1D("MCParticle: Total Gen FS Electron E in Event");
-		eventEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
+        fsPositronThetayEPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
+        fsPositronThetayEPlot.annotation().addItem("yAxisLabel", "Particle Energy [GeV]");
+
+                
+        primaryEPlot = aida.cloud1D("MCParticle: Highest Primary E in Event");
+        primaryEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
+
+        eventEPlot = aida.cloud1D("MCParticle: Total Gen FS Electron E in Event");
+        eventEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
 
                 
                 //pFrame = new AIDAFrame();
@@ -205,19 +205,19 @@
                 
                 
                 
-	}
-
-	@Override
-	public void process(EventHeader event) {
-
-		// MCParticles
-		List<MCParticle> mcparticles = event.get(MCParticle.class).get(0);
-
-		// Final State particles.
-		List<MCParticle> fsParticles = makeGenFSParticleList(mcparticles);
-
-		//System.out.println("fsParticles="+fsParticles.size());
-		fsCountPlot.fill(fsParticles.size());
+    }
+
+    @Override
+    public void process(EventHeader event) {
+
+        // MCParticles
+        List<MCParticle> mcparticles = event.get(MCParticle.class).get(0);
+
+        // Final State particles.
+        List<MCParticle> fsParticles = makeGenFSParticleList(mcparticles);
+
+        //System.out.println("fsParticles="+fsParticles.size());
+        fsCountPlot.fill(fsParticles.size());
                 
                 for (int i=0;i<fsParticles.size();++i) fsCountVsEventPlot.fill(event.getEventNumber());
                 
@@ -229,69 +229,69 @@
                 int[] ngammas = {0,0};
                 int count = 0;
                 double trigThr = 0.2;
-		for (MCParticle fs : fsParticles) {
+        for (MCParticle fs : fsParticles) {
                         //System.out.println("Index " + count);
 
-			double fsE = fs.getEnergy();
-			double theta = Math.atan2(Math.sqrt(fs.getPX() * fs.getPX() + fs.getPY() * fs.getPY()), fs.getPZ());
-			double thetay = Math.atan2(fs.getPY(), fs.getPZ());
-			int fsPdg = fs.getPDGID();
-			fsEPlot.fill(fsE);
+            double fsE = fs.getEnergy();
+            double theta = Math.atan2(Math.sqrt(fs.getPX() * fs.getPX() + fs.getPY() * fs.getPY()), fs.getPZ());
+            double thetay = Math.atan2(fs.getPY(), fs.getPZ());
+            int fsPdg = fs.getPDGID();
+            fsEPlot.fill(fsE);
                         this.fsThetayPlot.fill(Math.abs(thetay));
                         fsCountTypePlot.fill(fsPdg);
                         if(fsE>0.5) fsCountTypePlot500.fill(fsPdg);
-			if (ParticleTypeClassifier.isElectron(fsPdg)) {
-				fsElectronEPlot.fill(fsE);
-				fsElectronThetaPlot.fill(theta);
-				fsElectronThetayPlot.fill(Math.abs(thetay));
-				if(fsE>trigThr) fsElectronThetayTrigPlot.fill(Math.abs(thetay));
-				fsElectronThetayEPlot.fill(Math.abs(thetay),fsE);
+            if (ParticleTypeClassifier.isElectron(fsPdg)) {
+                fsElectronEPlot.fill(fsE);
+                fsElectronThetaPlot.fill(theta);
+                fsElectronThetayPlot.fill(Math.abs(thetay));
+                if(fsE>trigThr) fsElectronThetayTrigPlot.fill(Math.abs(thetay));
+                fsElectronThetayEPlot.fill(Math.abs(thetay),fsE);
                                 nelectrons[0]++;
                                 if(fsGammaEmax>0.5) nelectrons[1]++; 
-			} else if (ParticleTypeClassifier.isPositron(fsPdg)) {
-				fsPositronEPlot.fill(fsE);
-				fsPositronThetaPlot.fill(theta);
-				fsPositronThetayPlot.fill(Math.abs(thetay));
-				if(fsE>trigThr) fsPositronThetayTrigPlot.fill(Math.abs(thetay));
-				fsPositronThetayEPlot.fill(Math.abs(thetay),fsE);
+            } else if (ParticleTypeClassifier.isPositron(fsPdg)) {
+                fsPositronEPlot.fill(fsE);
+                fsPositronThetaPlot.fill(theta);
+                fsPositronThetayPlot.fill(Math.abs(thetay));
+                if(fsE>trigThr) fsPositronThetayTrigPlot.fill(Math.abs(thetay));
+                fsPositronThetayEPlot.fill(Math.abs(thetay),fsE);
                                 npositrons[0]++;
                                 if(fsGammaEmax>0.5) npositrons[1]++; 
-			} else if (ParticleTypeClassifier.isPhoton(fsPdg)) {
-				fsGammaEPlot.fill(fsE);
-				fsGammaThetaPlot.fill(theta);
-				fsGammaThetayPlot.fill(Math.abs(thetay));
-				if(fsE>trigThr) fsGammaThetayTrigPlot.fill(Math.abs(thetay));
-				fsGammaThetayEPlot.fill(Math.abs(thetay),fsE);
+            } else if (ParticleTypeClassifier.isPhoton(fsPdg)) {
+                fsGammaEPlot.fill(fsE);
+                fsGammaThetaPlot.fill(theta);
+                fsGammaThetayPlot.fill(Math.abs(thetay));
+                if(fsE>trigThr) fsGammaThetayTrigPlot.fill(Math.abs(thetay));
+                fsGammaThetayEPlot.fill(Math.abs(thetay),fsE);
                                 ngammas[0]++;
                                 if(fsGammaEmax>0.5) {
                                     ngammas[1]++;
                                     //System.out.println("Counting high E gamma at count "+ count);
                                 } 
-			}
-		}
+            }
+        }
 
                 fsCountEventTypePlot.fill(getEventTypeId(nelectrons[0],npositrons[0],ngammas[0]));
                 fsCountEventTypePlot2.fill(getEventTypeId(nelectrons[1],npositrons[1],ngammas[1]));
 
-		// Sort MCParticles on energy.
-		//Collections.sort(fsParticles, new MCParticleEComparator());
-
-		// Energy of top two FS particles.
-		//double e2 = fsParticles.get(0).getEnergy() + fsParticles.get(1).getEnergy();
-
-		// Energy of top three FS particles.
-		//double e3 = e2 + fsParticles.get(2).getEnergy();
-
-		if (!fsParticles.isEmpty()) {
-			// primary particle with most E
-			double primaryE = getPrimary(fsParticles).getEnergy();
-			primaryEPlot.fill(primaryE);
-		}
-
-		// event electron energy
-		double eventE = getPrimaryElectronE(fsParticles);
-		eventEPlot.fill(eventE);
-	}
+        // Sort MCParticles on energy.
+        //Collections.sort(fsParticles, new MCParticleEComparator());
+
+        // Energy of top two FS particles.
+        //double e2 = fsParticles.get(0).getEnergy() + fsParticles.get(1).getEnergy();
+
+        // Energy of top three FS particles.
+        //double e3 = e2 + fsParticles.get(2).getEnergy();
+
+        if (!fsParticles.isEmpty()) {
+            // primary particle with most E
+            double primaryE = getPrimary(fsParticles).getEnergy();
+            primaryEPlot.fill(primaryE);
+        }
+
+        // event electron energy
+        double eventE = getPrimaryElectronE(fsParticles);
+        eventEPlot.fill(eventE);
+    }
 
         
         public int getEventTypeId(int ne, int np, int ng) {
@@ -314,57 +314,57 @@
             return 0;
         }
         
-	public double getHighestPhotonE(List<MCParticle> particles) {
-		double Emax = -1;
+    public double getHighestPhotonE(List<MCParticle> particles) {
+        double Emax = -1;
                 double E=0;
                 int count = 0;
-		for (MCParticle particle : particles) {
-			if (ParticleTypeClassifier.isPhoton(particle.getPDGID())) {
-				E = particle.getEnergy();
+        for (MCParticle particle : particles) {
+            if (ParticleTypeClassifier.isPhoton(particle.getPDGID())) {
+                E = particle.getEnergy();
                                 if(E>Emax) {
                                     Emax = E;
                                     //System.out.println("Emax from photon with index " + count);
                                 }
-			count++;
+            count++;
                         }
-		}
-		return Emax;
-	}
+        }
+        return Emax;
+    }
 
         private double getPrimaryElectronE(List<MCParticle> particles) {
-		double totalE = 0;
-		for (MCParticle particle : particles) {
-			if (Math.abs(particle.getPDGID()) == 11) {
-				totalE += particle.getEnergy();
-			}
-		}
-		return totalE;
-	}
-
-	private MCParticle getPrimary(List<MCParticle> particles) {
-		double maxE = 0;
-		MCParticle primary = null;
-		for (MCParticle particle : particles) {
-			if (particle.getEnergy() > maxE) {
-				maxE = particle.getEnergy();
-				primary = particle;
-			}
-		}
-		return primary;
-	}
-
-	public static List<MCParticle> makeGenFSParticleList(List<MCParticle> mcparticles) {
-		List<MCParticle> fsParticles = new ArrayList<MCParticle>();
-		for (MCParticle mcparticle : mcparticles) {
-			if (mcparticle.getGeneratorStatus() == MCParticle.FINAL_STATE) {
-				double theta = Math.atan2(Math.sqrt(mcparticle.getPX() * mcparticle.getPX() + mcparticle.getPY() * mcparticle.getPY()), mcparticle.getPZ());
-				if (theta > 1e-3) {
-					fsParticles.add(mcparticle);
-				}
-			}
-		}
-		return fsParticles;
-	}
+        double totalE = 0;
+        for (MCParticle particle : particles) {
+            if (Math.abs(particle.getPDGID()) == 11) {
+                totalE += particle.getEnergy();
+            }
+        }
+        return totalE;
+    }
+
+    private MCParticle getPrimary(List<MCParticle> particles) {
+        double maxE = 0;
+        MCParticle primary = null;
+        for (MCParticle particle : particles) {
+            if (particle.getEnergy() > maxE) {
+                maxE = particle.getEnergy();
+                primary = particle;
+            }
+        }
+        return primary;
+    }
+
+    public static List<MCParticle> makeGenFSParticleList(List<MCParticle> mcparticles) {
+        List<MCParticle> fsParticles = new ArrayList<MCParticle>();
+        for (MCParticle mcparticle : mcparticles) {
+            if (mcparticle.getGeneratorStatus() == MCParticle.FINAL_STATE) {
+                double theta = Math.atan2(Math.sqrt(mcparticle.getPX() * mcparticle.getPX() + mcparticle.getPY() * mcparticle.getPY()), mcparticle.getPZ());
+                if (theta > 1e-3) {
+                    fsParticles.add(mcparticle);
+                }
+            }
+        }
+        return fsParticles;
+    }
         
         
         public void endOfData() {

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripGoldenEventsDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripGoldenEventsDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripGoldenEventsDriver.java	Wed Mar  9 11:43:24 2016
@@ -27,7 +27,7 @@
         boolean skipEvent = false;
         if (event.hasCollection(ReconstructedParticle.class, "UnconstrainedV0Candidates")) {
             List<ReconstructedParticle> vertices = event.get(ReconstructedParticle.class, "UnconstrainedV0Candidates");
-	    //System.out.println("Thete are: "+vertices.size()+" Unconstrained V0 candidates");
+        //System.out.println("Thete are: "+vertices.size()+" Unconstrained V0 candidates");
             if (vertices.size() > 1 || vertices.isEmpty()) {
                 skipEvent = true;
             } else {
@@ -38,14 +38,14 @@
                     List<Track> trks = rp.getTracks();
                     // require each track to have six hits
                     if (trks.get(0).getTrackerHits().size() != 6) {
-			//System.out.println("Thete are: "+trks.get(0).getTrackerHits().size()+" hits on Track");
+            //System.out.println("Thete are: "+trks.get(0).getTrackerHits().size()+" hits on Track");
                         skipEvent = true;
                     }
                 }
                 // require no other tracks in the event
                 if (event.get(Track.class, "MatchedTracks").size() > 2) {
                     skipEvent = true;
-		    //System.out.println("Thete are: "+event.get(Track.class, "MatchedTracks").size()+" Matched tracks");
+            //System.out.println("Thete are: "+event.get(Track.class, "MatchedTracks").size()+" Matched tracks");
                 }
                 // require no other clusters in the event
                 if (event.get(Cluster.class, "EcalClustersGTP").size() > 2) {

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripMollerEventsDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripMollerEventsDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/StripMollerEventsDriver.java	Wed Mar  9 11:43:24 2016
@@ -94,7 +94,7 @@
                             skipEvent = false;
                         }
                     }
-		    //System.out.println("Thete are: "+event.get(Track.class, "MatchedTracks").size()+" Matched tracks");
+            //System.out.println("Thete are: "+event.get(Track.class, "MatchedTracks").size()+" Matched tracks");
                 }
             }
         }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/DataTriggerSimDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/DataTriggerSimDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/DataTriggerSimDriver.java	Wed Mar  9 11:43:24 2016
@@ -54,448 +54,448 @@
  * @see SimTriggerData
  */
 public class DataTriggerSimDriver extends Driver {
-	// Store the LCIO collection names for the needed objects.
-	private boolean filterUnverifiable = false;
-	private String bankCollectionName = "TriggerBank";
-	private String clusterCollectionName = "EcalClusters";
-	private String simTriggerCollectionName = "SimTriggers";
-	
-	// Store the SSP bank.
-	private SSPData sspBank = null;
-	
-	// Store cluster verifiability parameters.
-	private int nsa = 0;
-	private int nsb = 0;
-	private int windowWidth = 0;
-	
-	// Define trigger simulation modules.
-	private boolean[] pairTriggerEnabled = new boolean[2];
-	private boolean[] singlesTriggerEnabled = new boolean[2];
-	private boolean[][] pairCutsEnabled = new boolean[2][7];
-	private boolean[][] singlesCutsEnabled = new boolean[2][3];
-	private TriggerModule[] pairsTrigger = new TriggerModule[2];
-	private TriggerModule[] singlesTrigger = new TriggerModule[2];
-	
-	// Reference variables.
-	private static final int ENERGY_MIN   = TriggerDiagnosticUtil.SINGLES_ENERGY_MIN;
-	private static final int ENERGY_MAX   = TriggerDiagnosticUtil.SINGLES_ENERGY_MAX;
-	private static final int HIT_COUNT    = TriggerDiagnosticUtil.SINGLES_HIT_COUNT;
-	private static final int ENERGY_SUM   = TriggerDiagnosticUtil.PAIR_ENERGY_SUM;
-	private static final int ENERGY_DIFF  = TriggerDiagnosticUtil.PAIR_ENERGY_DIFF;
-	private static final int ENERGY_SLOPE = TriggerDiagnosticUtil.PAIR_ENERGY_SLOPE;
-	private static final int COPLANARITY  = TriggerDiagnosticUtil.PAIR_COPLANARITY;
-	
-	/**
-	 * Connects the driver to the the <code>ConfigurationManager</code>
-	 * in order to obtain the correct trigger information. Trigger
-	 * settings are stored in the <code>TriggerModule</code> objects.
-	 */
-	@Override
-	public void startOfData() {
-		// Define the first singles trigger.
-		singlesTrigger[0] = new TriggerModule();
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.500);
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		
-		// Define the second singles trigger.
-		singlesTrigger[1] = new TriggerModule();
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		
-		// Define the first pairs trigger.
-		pairsTrigger[0] = new TriggerModule();
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
-		
-		// Define the second pairs trigger.
-		pairsTrigger[1] = new TriggerModule();
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
-		
-		// Listen for the configuration manager to provide the real
-		// trigger settings.
-		ConfigurationManager.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// Get the DAQ configuration.
-				DAQConfig daq = ConfigurationManager.getInstance();
-				
-				// Get cluster verifiability parameters.
-				nsa = daq.getFADCConfig().getNSA();
-				nsb = daq.getFADCConfig().getNSB();
-				windowWidth = daq.getFADCConfig().getWindowWidth();
-				
-				// Load the DAQ settings from the configuration manager.
-				singlesTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getSingles1Config());
-				singlesTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getSingles2Config());
-				pairsTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getPair1Config());
-				pairsTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getPair2Config());
-				
-				// Get the trigger configurations from the DAQ.
-				SinglesTriggerConfig[] singles = { daq.getSSPConfig().getSingles1Config(),
-						daq.getSSPConfig().getSingles2Config() };
-				PairTriggerConfig[] pairs = { daq.getSSPConfig().getPair1Config(),
-						daq.getSSPConfig().getPair2Config() };
-				
-				// Update the enabled/disabled statuses.
-				for(int i = 0; i < 2; i++) {
-					// Set the trigger enabled status.
-					pairTriggerEnabled[i] = pairs[i].isEnabled();
-					singlesTriggerEnabled[i] = singles[i].isEnabled();
-					
-					// Set the singles cut statuses.
-					singlesCutsEnabled[i][ENERGY_MIN] = singles[i].getEnergyMinCutConfig().isEnabled();
-					singlesCutsEnabled[i][ENERGY_MAX] = singles[i].getEnergyMaxCutConfig().isEnabled();
-					singlesCutsEnabled[i][HIT_COUNT] = singles[i].getHitCountCutConfig().isEnabled();
-					
-					// Set the pair cut statuses.
-					pairCutsEnabled[i][ENERGY_MIN] = pairs[i].getEnergyMinCutConfig().isEnabled();
-					pairCutsEnabled[i][ENERGY_MAX] = pairs[i].getEnergyMaxCutConfig().isEnabled();
-					pairCutsEnabled[i][HIT_COUNT] = pairs[i].getHitCountCutConfig().isEnabled();
-					pairCutsEnabled[i][3 + ENERGY_SUM] = pairs[i].getEnergySumCutConfig().isEnabled();
-					pairCutsEnabled[i][3 + ENERGY_DIFF] = pairs[i].getEnergyDifferenceCutConfig().isEnabled();
-					pairCutsEnabled[i][3 + ENERGY_SLOPE] = pairs[i].getEnergySlopeCutConfig().isEnabled();
-					pairCutsEnabled[i][3 + COPLANARITY] = pairs[i].getCoplanarityCutConfig().isEnabled();
-				}
-			}
-		});
-	}
-	
-	/**
-	 * Processes an LCIO event and simulates triggers in the same manner
-	 * as the hardware for both <code>SSPCluster</code> objects as well
-	 * as <code>Cluster</code> objects reconstructed from FADC hits.
-	 * Triggers are then output to the data stream.
-	 * @param event - The <code>EventHeader</code> object representing
-	 * the current LCIO event.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		// If the DAQ configuration manager has not been initialized,
-		// then no action can be performed.
-		if(!ConfigurationManager.isInitialized()) {
-			// Put an empty trigger results module into the data stream.
-			SimTriggerData triggerData = new SimTriggerData();
-			List<SimTriggerData> dataList = new ArrayList<SimTriggerData>(1);
-			dataList.add(triggerData);
-			event.put(simTriggerCollectionName, dataList, SimTriggerData.class, 0);
-			
-			// Nothing further can be done, since trigger settings are
-			// not yet defined.
-			return;
-		}
-		
-		// Get the SSP bank.
-		if(event.hasCollection(GenericObject.class, bankCollectionName)) {
-			// Get the bank list.
-			List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-			
-			// Search through the banks and get the SSP and TI banks.
-			for(GenericObject obj : bankList) {
-				// If this is an SSP bank, parse it.
-				if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
-					sspBank = new SSPData(obj);
-				}
-			}
-		}
-		
-		// Get a list of SSPClusters.
-		List<SSPCluster> sspClusters = null;
-		if(sspBank != null) { sspClusters = sspBank.getClusters(); }
-		else { sspClusters = new ArrayList<SSPCluster>(0); }
-		
-		// Get reconstructed clusters.
-		List<Cluster> reconClusters = null;
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			reconClusters = event.get(Cluster.class, clusterCollectionName);
-		}
-		else { reconClusters = new ArrayList<Cluster>(0); }
-		
-		// If only "verifiable" clusters should be used, test all the
-		// reconstructed clusters for verifiability.
-		if(filterUnverifiable) {
-			// Create a list to store the verifiable clusters.
-			List<Cluster> goodClusters = new ArrayList<Cluster>();
-			
-			// Iterate over all the clusters and test them to see if
-			// they are verifiable.
-			for(Cluster cluster : reconClusters) {
-				if(TriggerDiagnosticUtil.isVerifiable(cluster, nsa, nsb, windowWidth)) {
-					goodClusters.add(cluster);
-				}
-			}
-			
-			// Replace the old cluster list with the new one.
-			reconClusters = goodClusters;
-		}
-		
-		// Generate simulated triggers.
-		SimTriggerModule<Cluster> reconModule = constructTriggers(reconClusters, Cluster.class);
-		SimTriggerModule<SSPCluster> sspModule = constructTriggers(sspClusters, SSPCluster.class);
-		
-		// Insert the trigger results in the data stream.
-		SimTriggerData triggerData = new SimTriggerData(reconModule, sspModule);
-		List<SimTriggerData> dataList = new ArrayList<SimTriggerData>(1);
-		dataList.add(triggerData);
-		event.put(simTriggerCollectionName, dataList, SimTriggerData.class, 0);
-	}
-	
-	/**
-	 * Constructs simulated triggers in the same manner as the hardware.
-	 * Method can accept either <code>Cluster</code> objects, any object
-	 * that is a subclass of <code>Cluster</code>, or objects of type
-	 * <code>SSPCluster</code>.
-	 * @param clusters - A <code>List</code> collection of the cluster
-	 * objects from which triggers are to be derived.
-	 * @param clusterType - The class of the cluster objects from which
-	 * triggers are to be derived. This can be <code>Cluster</code>,
-	 * <code>SSPCluster</code>, or a subclass thereof.
-	 * @return Returns a <code>SimTriggerModule</code> object containing
-	 * the simulated trigger results.
-	 * @throws IllegalArgumentException Occurs if the class of the
-	 * cluster objects is not of a supported type.
-	 * 
-	 */
-	private <E> SimTriggerModule<E> constructTriggers(List<E> clusters, Class<E> clusterType) throws IllegalArgumentException {
-		// Verify that the cluster type is supported.
-		if(!clusterType.equals(Cluster.class) && !clusterType.equals(SSPCluster.class)) {
-			throw new IllegalArgumentException("Class \"" + clusterType.getSimpleName() + "\" is not a supported cluster type.");
-		}
-		
-		// Store the singles and pair triggers.
-		List<List<PairTrigger<E[]>>> pairTriggers = new ArrayList<List<PairTrigger<E[]>>>(2);
-		pairTriggers.add(new ArrayList<PairTrigger<E[]>>());
-		pairTriggers.add(new ArrayList<PairTrigger<E[]>>());
-		List<List<SinglesTrigger<E>>> singlesTriggers = new ArrayList<List<SinglesTrigger<E>>>(2);
-		singlesTriggers.add(new ArrayList<SinglesTrigger<E>>());
-		singlesTriggers.add(new ArrayList<SinglesTrigger<E>>());
-		
-		// Run the clusters through the singles trigger to determine
-		// whether or not they pass it.
-		for(E cluster : clusters) {
-			// Simulate each of the cluster singles triggers.
-			triggerLoop:
-			for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-				// Track whether the cluster passed each singles cut.
-				boolean passSeedLow = true;
-				boolean passSeedHigh = true;
-				boolean passClusterLow = false;
-				boolean passClusterHigh = false;
-				boolean passHitCount = false;
-				
-				// Perform the trigger cuts appropriately for the type
-				// of cluster.
-				if(cluster instanceof Cluster) {
-					// Cast the cluster to the appropriate type.
-					Cluster c = (Cluster) cluster;
-					
-					// Perform each trigger cut.
-					passClusterLow = singlesTrigger[triggerNum].clusterTotalEnergyCutLow(c);
-					passClusterHigh = singlesTrigger[triggerNum].clusterTotalEnergyCutHigh(c);
-					passHitCount = singlesTrigger[triggerNum].clusterHitCountCut(c);
-				} else if(cluster instanceof SSPCluster) {
-					// Cast the cluster to the appropriate type.
-					SSPCluster c = (SSPCluster) cluster;
-					
-					// Perform each trigger cut.
-					passClusterLow = singlesTrigger[triggerNum].clusterTotalEnergyCutLow(c);
-					passClusterHigh = singlesTrigger[triggerNum].clusterTotalEnergyCutHigh(c);
-					passHitCount = singlesTrigger[triggerNum].clusterHitCountCut(c);
-				}
-				
-				// Make a trigger to store the results.
-				SinglesTrigger<E> trigger = new SinglesTrigger<E>(cluster, triggerNum);
-				trigger.setStateSeedEnergyLow(passSeedLow);
-				trigger.setStateSeedEnergyHigh(passSeedHigh);
-				trigger.setStateClusterEnergyLow(passClusterLow);
-				trigger.setStateClusterEnergyHigh(passClusterHigh);
-				trigger.setStateHitCount(passHitCount);
-				
-				// A trigger will only be reported by the SSP if it
-				// passes all of the enabled cuts for that trigger.
-				// Check whether this trigger meets these conditions.
-				if(singlesCutsEnabled[triggerNum][ENERGY_MIN] && !trigger.getStateClusterEnergyLow()) {
-					continue triggerLoop;
-				} if(singlesCutsEnabled[triggerNum][ENERGY_MAX] && !trigger.getStateClusterEnergyHigh()) {
-					continue triggerLoop;
-				} if(singlesCutsEnabled[triggerNum][HIT_COUNT] && !trigger.getStateHitCount()) {
-					continue triggerLoop;
-				}
-				
-				// Store the trigger.
-				singlesTriggers.get(triggerNum).add(trigger);
-			}
-		}
-		
-		// Store cluster pairs.
-		List<E[]> pairs = TriggerModule.getTopBottomPairs(clusters, clusterType);
-		
-		// Simulate the pair triggers and record the results.
-		for(E[] pair : pairs) {
-			// Simulate each of the cluster pair triggers.
-			pairTriggerLoop:
-			for(int triggerIndex = 0; triggerIndex < 2; triggerIndex++) {
-				// Track whether the cluster passed each singles cut.
-				boolean passSeedLow = true;
-				boolean passSeedHigh = true;
-				boolean passClusterLow = false;
-				boolean passClusterHigh = false;
-				boolean passHitCount = false;
-				boolean passPairEnergySumLow = false;
-				boolean passPairEnergySumHigh = false;
-				boolean passPairEnergyDifference = false;
-				boolean passPairEnergySlope = false;
-				boolean passPairCoplanarity = false;
-				boolean passTimeCoincidence = false;
-				
-				// Apply the trigger cuts appropriately according to the
-				// cluster type.
-				if(clusterType.equals(Cluster.class)) {
-					// Cast the cluster object.
-					Cluster[] reconPair = { (Cluster) pair[0], (Cluster) pair[1] };
-					
-					// Check that the pair passes the time coincidence cut.
-					// If it does not, it is not a valid pair and should be
-					// destroyed.
-					if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(reconPair)) {
-						continue pairTriggerLoop;
-					}
-					
-					passClusterLow = pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(reconPair[0])
-							&& pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(reconPair[1]);
-					passClusterHigh = pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(reconPair[0])
-							&& pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(reconPair[1]);
-					passHitCount = pairsTrigger[triggerIndex].clusterHitCountCut(reconPair[0])
-							&& pairsTrigger[triggerIndex].clusterHitCountCut(reconPair[1]);
-					passPairEnergySumLow = pairsTrigger[triggerIndex].pairEnergySumCutLow(reconPair);
-					passPairEnergySumHigh = pairsTrigger[triggerIndex].pairEnergySumCutHigh(reconPair);
-					passPairEnergyDifference = pairsTrigger[triggerIndex].pairEnergyDifferenceCut(reconPair);
-					passPairEnergySlope = pairsTrigger[triggerIndex].pairEnergySlopeCut(reconPair);
-					passPairCoplanarity = pairsTrigger[triggerIndex].pairCoplanarityCut(reconPair);
-					passTimeCoincidence = pairsTrigger[triggerIndex].pairTimeCoincidenceCut(reconPair);
-				} else if(clusterType.equals(SSPCluster.class)) {
-					// Cast the cluster object.
-					SSPCluster[] sspPair = { (SSPCluster) pair[0], (SSPCluster) pair[1] };
-					
-					// Check that the pair passes the time coincidence cut.
-					// If it does not, it is not a valid pair and should be
-					// destroyed.
-					if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(sspPair)) {
-						continue pairTriggerLoop;
-					}
-					
-					// Perform each trigger cut.
-					passClusterLow = pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(sspPair[0])
-							&& pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(sspPair[1]);
-					passClusterHigh = pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(sspPair[0])
-							&& pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(sspPair[1]);
-					passHitCount = pairsTrigger[triggerIndex].clusterHitCountCut(sspPair[0])
-							&& pairsTrigger[triggerIndex].clusterHitCountCut(sspPair[1]);
-					passPairEnergySumLow = pairsTrigger[triggerIndex].pairEnergySumCutLow(sspPair);
-					passPairEnergySumHigh = pairsTrigger[triggerIndex].pairEnergySumCutHigh(sspPair);
-					passPairEnergyDifference = pairsTrigger[triggerIndex].pairEnergyDifferenceCut(sspPair);
-					passPairEnergySlope = pairsTrigger[triggerIndex].pairEnergySlopeCut(sspPair);
-					passPairCoplanarity = pairsTrigger[triggerIndex].pairCoplanarityCut(sspPair);
-					passTimeCoincidence = pairsTrigger[triggerIndex].pairTimeCoincidenceCut(sspPair);
-				}
-				
-				// Create a trigger from the results.
-				PairTrigger<E[]> trigger = new PairTrigger<E[]>(pair, triggerIndex);
-				trigger.setStateSeedEnergyLow(passSeedLow);
-				trigger.setStateSeedEnergyHigh(passSeedHigh);
-				trigger.setStateClusterEnergyLow(passClusterLow);
-				trigger.setStateClusterEnergyHigh(passClusterHigh);
-				trigger.setStateHitCount(passHitCount);
-				trigger.setStateEnergySumLow(passPairEnergySumLow);
-				trigger.setStateEnergySumHigh(passPairEnergySumHigh);
-				trigger.setStateEnergyDifference(passPairEnergyDifference);
-				trigger.setStateEnergySlope(passPairEnergySlope);
-				trigger.setStateCoplanarity(passPairCoplanarity);
-				trigger.setStateTimeCoincidence(passTimeCoincidence);
-				
-				// A trigger will only be reported by the SSP if it
-				// passes all of the enabled cuts for that trigger.
-				// Check whether this trigger meets these conditions.
-				if(pairCutsEnabled[triggerIndex][ENERGY_MIN] && !trigger.getStateClusterEnergyLow()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][ENERGY_MAX] && !trigger.getStateClusterEnergyHigh()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][HIT_COUNT] && !trigger.getStateHitCount()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][3 + ENERGY_SUM] && !trigger.getStateEnergySum()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][3 + ENERGY_DIFF] && !trigger.getStateEnergyDifference()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][3 + ENERGY_SLOPE] && !trigger.getStateEnergySlope()) {
-					continue pairTriggerLoop;
-				} if(pairCutsEnabled[triggerIndex][3 + COPLANARITY] && !trigger.getStateCoplanarity()) {
-					continue pairTriggerLoop;
-				}
-				
-				// Add the trigger to the list.
-				pairTriggers.get(triggerIndex).add(trigger);
-			}
-		}
-		
-		// Create a new simulated trigger module to contain the results.
-		return new SimTriggerModule<E>(singlesTriggers.get(0), singlesTriggers.get(1),
-				pairTriggers.get(0), pairTriggers.get(1));
-	}
-	
-	/**
-	 * Sets the name of the LCIO collection containing the TI and SSP
-	 * banks.
-	 * @param bankCollectionName - The bank collection name.
-	 */
-	public void setBankCollectionName(String bankCollectionName) {
-		this.bankCollectionName = bankCollectionName;
-	}
-	
-	/**
-	 * Sets the name of the LCIO collection containing the simulated
-	 * reconstructed clusters.
-	 * @param clusterCollectionName - The cluster collection name.
-	 */
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
-	
-	/**
-	 * Sets whether or not triggers should be formed using all clusters,
-	 * or only those that where the integration window for the cluster
-	 * is completely within the bounds of the event window.
-	 * @param state - <code>true</code> means that only clusters where
-	 * the entire cluster integration window is within the event time
-	 * window will be used, while <code>false</code> means that all
-	 * clusters will be used.
-	 */
-	public void setFilterUnverifiableClusters(boolean state) {
-		this.filterUnverifiable = state;
-	}
-	
-	/**
-	 * Sets the name of the LCIO collection containing simulated triggers.
-	 * @param triggerCollection - The trigger collection name.
-	 */
-	public void setTriggerCollectionName(String triggerCollection) {
-		this.simTriggerCollectionName = triggerCollection;
-	}
+    // Store the LCIO collection names for the needed objects.
+    private boolean filterUnverifiable = false;
+    private String bankCollectionName = "TriggerBank";
+    private String clusterCollectionName = "EcalClusters";
+    private String simTriggerCollectionName = "SimTriggers";
+    
+    // Store the SSP bank.
+    private SSPData sspBank = null;
+    
+    // Store cluster verifiability parameters.
+    private int nsa = 0;
+    private int nsb = 0;
+    private int windowWidth = 0;
+    
+    // Define trigger simulation modules.
+    private boolean[] pairTriggerEnabled = new boolean[2];
+    private boolean[] singlesTriggerEnabled = new boolean[2];
+    private boolean[][] pairCutsEnabled = new boolean[2][7];
+    private boolean[][] singlesCutsEnabled = new boolean[2][3];
+    private TriggerModule[] pairsTrigger = new TriggerModule[2];
+    private TriggerModule[] singlesTrigger = new TriggerModule[2];
+    
+    // Reference variables.
+    private static final int ENERGY_MIN   = TriggerDiagnosticUtil.SINGLES_ENERGY_MIN;
+    private static final int ENERGY_MAX   = TriggerDiagnosticUtil.SINGLES_ENERGY_MAX;
+    private static final int HIT_COUNT    = TriggerDiagnosticUtil.SINGLES_HIT_COUNT;
+    private static final int ENERGY_SUM   = TriggerDiagnosticUtil.PAIR_ENERGY_SUM;
+    private static final int ENERGY_DIFF  = TriggerDiagnosticUtil.PAIR_ENERGY_DIFF;
+    private static final int ENERGY_SLOPE = TriggerDiagnosticUtil.PAIR_ENERGY_SLOPE;
+    private static final int COPLANARITY  = TriggerDiagnosticUtil.PAIR_COPLANARITY;
+    
+    /**
+     * Connects the driver to the the <code>ConfigurationManager</code>
+     * in order to obtain the correct trigger information. Trigger
+     * settings are stored in the <code>TriggerModule</code> objects.
+     */
+    @Override
+    public void startOfData() {
+        // Define the first singles trigger.
+        singlesTrigger[0] = new TriggerModule();
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.500);
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        
+        // Define the second singles trigger.
+        singlesTrigger[1] = new TriggerModule();
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        
+        // Define the first pairs trigger.
+        pairsTrigger[0] = new TriggerModule();
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
+        
+        // Define the second pairs trigger.
+        pairsTrigger[1] = new TriggerModule();
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
+        
+        // Listen for the configuration manager to provide the real
+        // trigger settings.
+        ConfigurationManager.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // Get the DAQ configuration.
+                DAQConfig daq = ConfigurationManager.getInstance();
+                
+                // Get cluster verifiability parameters.
+                nsa = daq.getFADCConfig().getNSA();
+                nsb = daq.getFADCConfig().getNSB();
+                windowWidth = daq.getFADCConfig().getWindowWidth();
+                
+                // Load the DAQ settings from the configuration manager.
+                singlesTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getSingles1Config());
+                singlesTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getSingles2Config());
+                pairsTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getPair1Config());
+                pairsTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getPair2Config());
+                
+                // Get the trigger configurations from the DAQ.
+                SinglesTriggerConfig[] singles = { daq.getSSPConfig().getSingles1Config(),
+                        daq.getSSPConfig().getSingles2Config() };
+                PairTriggerConfig[] pairs = { daq.getSSPConfig().getPair1Config(),
+                        daq.getSSPConfig().getPair2Config() };
+                
+                // Update the enabled/disabled statuses.
+                for(int i = 0; i < 2; i++) {
+                    // Set the trigger enabled status.
+                    pairTriggerEnabled[i] = pairs[i].isEnabled();
+                    singlesTriggerEnabled[i] = singles[i].isEnabled();
+                    
+                    // Set the singles cut statuses.
+                    singlesCutsEnabled[i][ENERGY_MIN] = singles[i].getEnergyMinCutConfig().isEnabled();
+                    singlesCutsEnabled[i][ENERGY_MAX] = singles[i].getEnergyMaxCutConfig().isEnabled();
+                    singlesCutsEnabled[i][HIT_COUNT] = singles[i].getHitCountCutConfig().isEnabled();
+                    
+                    // Set the pair cut statuses.
+                    pairCutsEnabled[i][ENERGY_MIN] = pairs[i].getEnergyMinCutConfig().isEnabled();
+                    pairCutsEnabled[i][ENERGY_MAX] = pairs[i].getEnergyMaxCutConfig().isEnabled();
+                    pairCutsEnabled[i][HIT_COUNT] = pairs[i].getHitCountCutConfig().isEnabled();
+                    pairCutsEnabled[i][3 + ENERGY_SUM] = pairs[i].getEnergySumCutConfig().isEnabled();
+                    pairCutsEnabled[i][3 + ENERGY_DIFF] = pairs[i].getEnergyDifferenceCutConfig().isEnabled();
+                    pairCutsEnabled[i][3 + ENERGY_SLOPE] = pairs[i].getEnergySlopeCutConfig().isEnabled();
+                    pairCutsEnabled[i][3 + COPLANARITY] = pairs[i].getCoplanarityCutConfig().isEnabled();
+                }
+            }
+        });
+    }
+    
+    /**
+     * Processes an LCIO event and simulates triggers in the same manner
+     * as the hardware for both <code>SSPCluster</code> objects as well
+     * as <code>Cluster</code> objects reconstructed from FADC hits.
+     * Triggers are then output to the data stream.
+     * @param event - The <code>EventHeader</code> object representing
+     * the current LCIO event.
+     */
+    @Override
+    public void process(EventHeader event) {
+        // If the DAQ configuration manager has not been initialized,
+        // then no action can be performed.
+        if(!ConfigurationManager.isInitialized()) {
+            // Put an empty trigger results module into the data stream.
+            SimTriggerData triggerData = new SimTriggerData();
+            List<SimTriggerData> dataList = new ArrayList<SimTriggerData>(1);
+            dataList.add(triggerData);
+            event.put(simTriggerCollectionName, dataList, SimTriggerData.class, 0);
+            
+            // Nothing further can be done, since trigger settings are
+            // not yet defined.
+            return;
+        }
+        
+        // Get the SSP bank.
+        if(event.hasCollection(GenericObject.class, bankCollectionName)) {
+            // Get the bank list.
+            List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+            
+            // Search through the banks and get the SSP and TI banks.
+            for(GenericObject obj : bankList) {
+                // If this is an SSP bank, parse it.
+                if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
+                    sspBank = new SSPData(obj);
+                }
+            }
+        }
+        
+        // Get a list of SSPClusters.
+        List<SSPCluster> sspClusters = null;
+        if(sspBank != null) { sspClusters = sspBank.getClusters(); }
+        else { sspClusters = new ArrayList<SSPCluster>(0); }
+        
+        // Get reconstructed clusters.
+        List<Cluster> reconClusters = null;
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            reconClusters = event.get(Cluster.class, clusterCollectionName);
+        }
+        else { reconClusters = new ArrayList<Cluster>(0); }
+        
+        // If only "verifiable" clusters should be used, test all the
+        // reconstructed clusters for verifiability.
+        if(filterUnverifiable) {
+            // Create a list to store the verifiable clusters.
+            List<Cluster> goodClusters = new ArrayList<Cluster>();
+            
+            // Iterate over all the clusters and test them to see if
+            // they are verifiable.
+            for(Cluster cluster : reconClusters) {
+                if(TriggerDiagnosticUtil.isVerifiable(cluster, nsa, nsb, windowWidth)) {
+                    goodClusters.add(cluster);
+                }
+            }
+            
+            // Replace the old cluster list with the new one.
+            reconClusters = goodClusters;
+        }
+        
+        // Generate simulated triggers.
+        SimTriggerModule<Cluster> reconModule = constructTriggers(reconClusters, Cluster.class);
+        SimTriggerModule<SSPCluster> sspModule = constructTriggers(sspClusters, SSPCluster.class);
+        
+        // Insert the trigger results in the data stream.
+        SimTriggerData triggerData = new SimTriggerData(reconModule, sspModule);
+        List<SimTriggerData> dataList = new ArrayList<SimTriggerData>(1);
+        dataList.add(triggerData);
+        event.put(simTriggerCollectionName, dataList, SimTriggerData.class, 0);
+    }
+    
+    /**
+     * Constructs simulated triggers in the same manner as the hardware.
+     * Method can accept either <code>Cluster</code> objects, any object
+     * that is a subclass of <code>Cluster</code>, or objects of type
+     * <code>SSPCluster</code>.
+     * @param clusters - A <code>List</code> collection of the cluster
+     * objects from which triggers are to be derived.
+     * @param clusterType - The class of the cluster objects from which
+     * triggers are to be derived. This can be <code>Cluster</code>,
+     * <code>SSPCluster</code>, or a subclass thereof.
+     * @return Returns a <code>SimTriggerModule</code> object containing
+     * the simulated trigger results.
+     * @throws IllegalArgumentException Occurs if the class of the
+     * cluster objects is not of a supported type.
+     * 
+     */
+    private <E> SimTriggerModule<E> constructTriggers(List<E> clusters, Class<E> clusterType) throws IllegalArgumentException {
+        // Verify that the cluster type is supported.
+        if(!clusterType.equals(Cluster.class) && !clusterType.equals(SSPCluster.class)) {
+            throw new IllegalArgumentException("Class \"" + clusterType.getSimpleName() + "\" is not a supported cluster type.");
+        }
+        
+        // Store the singles and pair triggers.
+        List<List<PairTrigger<E[]>>> pairTriggers = new ArrayList<List<PairTrigger<E[]>>>(2);
+        pairTriggers.add(new ArrayList<PairTrigger<E[]>>());
+        pairTriggers.add(new ArrayList<PairTrigger<E[]>>());
+        List<List<SinglesTrigger<E>>> singlesTriggers = new ArrayList<List<SinglesTrigger<E>>>(2);
+        singlesTriggers.add(new ArrayList<SinglesTrigger<E>>());
+        singlesTriggers.add(new ArrayList<SinglesTrigger<E>>());
+        
+        // Run the clusters through the singles trigger to determine
+        // whether or not they pass it.
+        for(E cluster : clusters) {
+            // Simulate each of the cluster singles triggers.
+            triggerLoop:
+            for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+                // Track whether the cluster passed each singles cut.
+                boolean passSeedLow = true;
+                boolean passSeedHigh = true;
+                boolean passClusterLow = false;
+                boolean passClusterHigh = false;
+                boolean passHitCount = false;
+                
+                // Perform the trigger cuts appropriately for the type
+                // of cluster.
+                if(cluster instanceof Cluster) {
+                    // Cast the cluster to the appropriate type.
+                    Cluster c = (Cluster) cluster;
+                    
+                    // Perform each trigger cut.
+                    passClusterLow = singlesTrigger[triggerNum].clusterTotalEnergyCutLow(c);
+                    passClusterHigh = singlesTrigger[triggerNum].clusterTotalEnergyCutHigh(c);
+                    passHitCount = singlesTrigger[triggerNum].clusterHitCountCut(c);
+                } else if(cluster instanceof SSPCluster) {
+                    // Cast the cluster to the appropriate type.
+                    SSPCluster c = (SSPCluster) cluster;
+                    
+                    // Perform each trigger cut.
+                    passClusterLow = singlesTrigger[triggerNum].clusterTotalEnergyCutLow(c);
+                    passClusterHigh = singlesTrigger[triggerNum].clusterTotalEnergyCutHigh(c);
+                    passHitCount = singlesTrigger[triggerNum].clusterHitCountCut(c);
+                }
+                
+                // Make a trigger to store the results.
+                SinglesTrigger<E> trigger = new SinglesTrigger<E>(cluster, triggerNum);
+                trigger.setStateSeedEnergyLow(passSeedLow);
+                trigger.setStateSeedEnergyHigh(passSeedHigh);
+                trigger.setStateClusterEnergyLow(passClusterLow);
+                trigger.setStateClusterEnergyHigh(passClusterHigh);
+                trigger.setStateHitCount(passHitCount);
+                
+                // A trigger will only be reported by the SSP if it
+                // passes all of the enabled cuts for that trigger.
+                // Check whether this trigger meets these conditions.
+                if(singlesCutsEnabled[triggerNum][ENERGY_MIN] && !trigger.getStateClusterEnergyLow()) {
+                    continue triggerLoop;
+                } if(singlesCutsEnabled[triggerNum][ENERGY_MAX] && !trigger.getStateClusterEnergyHigh()) {
+                    continue triggerLoop;
+                } if(singlesCutsEnabled[triggerNum][HIT_COUNT] && !trigger.getStateHitCount()) {
+                    continue triggerLoop;
+                }
+                
+                // Store the trigger.
+                singlesTriggers.get(triggerNum).add(trigger);
+            }
+        }
+        
+        // Store cluster pairs.
+        List<E[]> pairs = TriggerModule.getTopBottomPairs(clusters, clusterType);
+        
+        // Simulate the pair triggers and record the results.
+        for(E[] pair : pairs) {
+            // Simulate each of the cluster pair triggers.
+            pairTriggerLoop:
+            for(int triggerIndex = 0; triggerIndex < 2; triggerIndex++) {
+                // Track whether the cluster passed each singles cut.
+                boolean passSeedLow = true;
+                boolean passSeedHigh = true;
+                boolean passClusterLow = false;
+                boolean passClusterHigh = false;
+                boolean passHitCount = false;
+                boolean passPairEnergySumLow = false;
+                boolean passPairEnergySumHigh = false;
+                boolean passPairEnergyDifference = false;
+                boolean passPairEnergySlope = false;
+                boolean passPairCoplanarity = false;
+                boolean passTimeCoincidence = false;
+                
+                // Apply the trigger cuts appropriately according to the
+                // cluster type.
+                if(clusterType.equals(Cluster.class)) {
+                    // Cast the cluster object.
+                    Cluster[] reconPair = { (Cluster) pair[0], (Cluster) pair[1] };
+                    
+                    // Check that the pair passes the time coincidence cut.
+                    // If it does not, it is not a valid pair and should be
+                    // destroyed.
+                    if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(reconPair)) {
+                        continue pairTriggerLoop;
+                    }
+                    
+                    passClusterLow = pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(reconPair[0])
+                            && pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(reconPair[1]);
+                    passClusterHigh = pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(reconPair[0])
+                            && pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(reconPair[1]);
+                    passHitCount = pairsTrigger[triggerIndex].clusterHitCountCut(reconPair[0])
+                            && pairsTrigger[triggerIndex].clusterHitCountCut(reconPair[1]);
+                    passPairEnergySumLow = pairsTrigger[triggerIndex].pairEnergySumCutLow(reconPair);
+                    passPairEnergySumHigh = pairsTrigger[triggerIndex].pairEnergySumCutHigh(reconPair);
+                    passPairEnergyDifference = pairsTrigger[triggerIndex].pairEnergyDifferenceCut(reconPair);
+                    passPairEnergySlope = pairsTrigger[triggerIndex].pairEnergySlopeCut(reconPair);
+                    passPairCoplanarity = pairsTrigger[triggerIndex].pairCoplanarityCut(reconPair);
+                    passTimeCoincidence = pairsTrigger[triggerIndex].pairTimeCoincidenceCut(reconPair);
+                } else if(clusterType.equals(SSPCluster.class)) {
+                    // Cast the cluster object.
+                    SSPCluster[] sspPair = { (SSPCluster) pair[0], (SSPCluster) pair[1] };
+                    
+                    // Check that the pair passes the time coincidence cut.
+                    // If it does not, it is not a valid pair and should be
+                    // destroyed.
+                    if(!pairsTrigger[triggerIndex].pairTimeCoincidenceCut(sspPair)) {
+                        continue pairTriggerLoop;
+                    }
+                    
+                    // Perform each trigger cut.
+                    passClusterLow = pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(sspPair[0])
+                            && pairsTrigger[triggerIndex].clusterTotalEnergyCutLow(sspPair[1]);
+                    passClusterHigh = pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(sspPair[0])
+                            && pairsTrigger[triggerIndex].clusterTotalEnergyCutHigh(sspPair[1]);
+                    passHitCount = pairsTrigger[triggerIndex].clusterHitCountCut(sspPair[0])
+                            && pairsTrigger[triggerIndex].clusterHitCountCut(sspPair[1]);
+                    passPairEnergySumLow = pairsTrigger[triggerIndex].pairEnergySumCutLow(sspPair);
+                    passPairEnergySumHigh = pairsTrigger[triggerIndex].pairEnergySumCutHigh(sspPair);
+                    passPairEnergyDifference = pairsTrigger[triggerIndex].pairEnergyDifferenceCut(sspPair);
+                    passPairEnergySlope = pairsTrigger[triggerIndex].pairEnergySlopeCut(sspPair);
+                    passPairCoplanarity = pairsTrigger[triggerIndex].pairCoplanarityCut(sspPair);
+                    passTimeCoincidence = pairsTrigger[triggerIndex].pairTimeCoincidenceCut(sspPair);
+                }
+                
+                // Create a trigger from the results.
+                PairTrigger<E[]> trigger = new PairTrigger<E[]>(pair, triggerIndex);
+                trigger.setStateSeedEnergyLow(passSeedLow);
+                trigger.setStateSeedEnergyHigh(passSeedHigh);
+                trigger.setStateClusterEnergyLow(passClusterLow);
+                trigger.setStateClusterEnergyHigh(passClusterHigh);
+                trigger.setStateHitCount(passHitCount);
+                trigger.setStateEnergySumLow(passPairEnergySumLow);
+                trigger.setStateEnergySumHigh(passPairEnergySumHigh);
+                trigger.setStateEnergyDifference(passPairEnergyDifference);
+                trigger.setStateEnergySlope(passPairEnergySlope);
+                trigger.setStateCoplanarity(passPairCoplanarity);
+                trigger.setStateTimeCoincidence(passTimeCoincidence);
+                
+                // A trigger will only be reported by the SSP if it
+                // passes all of the enabled cuts for that trigger.
+                // Check whether this trigger meets these conditions.
+                if(pairCutsEnabled[triggerIndex][ENERGY_MIN] && !trigger.getStateClusterEnergyLow()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][ENERGY_MAX] && !trigger.getStateClusterEnergyHigh()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][HIT_COUNT] && !trigger.getStateHitCount()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][3 + ENERGY_SUM] && !trigger.getStateEnergySum()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][3 + ENERGY_DIFF] && !trigger.getStateEnergyDifference()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][3 + ENERGY_SLOPE] && !trigger.getStateEnergySlope()) {
+                    continue pairTriggerLoop;
+                } if(pairCutsEnabled[triggerIndex][3 + COPLANARITY] && !trigger.getStateCoplanarity()) {
+                    continue pairTriggerLoop;
+                }
+                
+                // Add the trigger to the list.
+                pairTriggers.get(triggerIndex).add(trigger);
+            }
+        }
+        
+        // Create a new simulated trigger module to contain the results.
+        return new SimTriggerModule<E>(singlesTriggers.get(0), singlesTriggers.get(1),
+                pairTriggers.get(0), pairTriggers.get(1));
+    }
+    
+    /**
+     * Sets the name of the LCIO collection containing the TI and SSP
+     * banks.
+     * @param bankCollectionName - The bank collection name.
+     */
+    public void setBankCollectionName(String bankCollectionName) {
+        this.bankCollectionName = bankCollectionName;
+    }
+    
+    /**
+     * Sets the name of the LCIO collection containing the simulated
+     * reconstructed clusters.
+     * @param clusterCollectionName - The cluster collection name.
+     */
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    /**
+     * Sets whether or not triggers should be formed using all clusters,
+     * or only those that where the integration window for the cluster
+     * is completely within the bounds of the event window.
+     * @param state - <code>true</code> means that only clusters where
+     * the entire cluster integration window is within the event time
+     * window will be used, while <code>false</code> means that all
+     * clusters will be used.
+     */
+    public void setFilterUnverifiableClusters(boolean state) {
+        this.filterUnverifiable = state;
+    }
+    
+    /**
+     * Sets the name of the LCIO collection containing simulated triggers.
+     * @param triggerCollection - The trigger collection name.
+     */
+    public void setTriggerCollectionName(String triggerCollection) {
+        this.simTriggerCollectionName = triggerCollection;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerData.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerData.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerData.java	Wed Mar  9 11:43:24 2016
@@ -13,47 +13,47 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class SimTriggerData {
-	private final SimTriggerModule<Cluster> reconTriggers;
-	private final SimTriggerModule<SSPCluster> sspTriggers;
-	
-	/**
-	 * Instantiates a new <code>SimTriggerData</code> object with empty
-	 * trigger results modules.
-	 */
-	SimTriggerData() {
-		reconTriggers = new SimTriggerModule<Cluster>();
-		sspTriggers = new SimTriggerModule<SSPCluster>();
-	}
-	
-	/**
-	 * Instantiates a new <code>SimTriggerData</code> object that will
-	 * contain the argument trigger modules.
-	 * @param reconTriggers - The simulated reconstructed cluster
-	 * triggers module.
-	 * @param sspTriggers - The simulated SSP cluster triggers module.
-	 */
-	SimTriggerData(SimTriggerModule<Cluster> reconTriggers, SimTriggerModule<SSPCluster> sspTriggers) {
-		this.reconTriggers = reconTriggers;
-		this.sspTriggers = sspTriggers;
-	}
-	
-	/**
-	 * Gets the module containing all simulated SSP trigger data for
-	 * each of the four primary triggers.
-	 * @return Returns the trigger data in a <code>SimTriggerModule</code>
-	 * object.
-	 */
-	public SimTriggerModule<SSPCluster> getSimSSPTriggers() {
-		return sspTriggers;
-	}
-	
-	/**
-	 * Gets the module containing all simulated LCSim trigger data for
-	 * each of the four primary triggers.
-	 * @return Returns the trigger data in a <code>SimTriggerModule</code>
-	 * object.
-	 */
-	public SimTriggerModule<Cluster> getSimReconTriggers() {
-		return reconTriggers;
-	}
+    private final SimTriggerModule<Cluster> reconTriggers;
+    private final SimTriggerModule<SSPCluster> sspTriggers;
+    
+    /**
+     * Instantiates a new <code>SimTriggerData</code> object with empty
+     * trigger results modules.
+     */
+    SimTriggerData() {
+        reconTriggers = new SimTriggerModule<Cluster>();
+        sspTriggers = new SimTriggerModule<SSPCluster>();
+    }
+    
+    /**
+     * Instantiates a new <code>SimTriggerData</code> object that will
+     * contain the argument trigger modules.
+     * @param reconTriggers - The simulated reconstructed cluster
+     * triggers module.
+     * @param sspTriggers - The simulated SSP cluster triggers module.
+     */
+    SimTriggerData(SimTriggerModule<Cluster> reconTriggers, SimTriggerModule<SSPCluster> sspTriggers) {
+        this.reconTriggers = reconTriggers;
+        this.sspTriggers = sspTriggers;
+    }
+    
+    /**
+     * Gets the module containing all simulated SSP trigger data for
+     * each of the four primary triggers.
+     * @return Returns the trigger data in a <code>SimTriggerModule</code>
+     * object.
+     */
+    public SimTriggerModule<SSPCluster> getSimSSPTriggers() {
+        return sspTriggers;
+    }
+    
+    /**
+     * Gets the module containing all simulated LCSim trigger data for
+     * each of the four primary triggers.
+     * @return Returns the trigger data in a <code>SimTriggerModule</code>
+     * object.
+     */
+    public SimTriggerModule<Cluster> getSimReconTriggers() {
+        return reconTriggers;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/SimTriggerModule.java	Wed Mar  9 11:43:24 2016
@@ -18,71 +18,71 @@
  * @see DataTriggerSimDriver
  */
 public class SimTriggerModule<E> {
-	private final List<SinglesTrigger<E>> singles0;
-	private final List<SinglesTrigger<E>> singles1;
-	private final List<PairTrigger<E[]>> pair0;
-	private final List<PairTrigger<E[]>> pair1;
-	
-	/**
-	 * Constructs a new <code>SimTriggerModule</code> with the no
-	 * triggers results for any triggers.
-	 */
-	SimTriggerModule() {
-		singles0 = new ArrayList<SinglesTrigger<E>>(0);
-		singles1 = new ArrayList<SinglesTrigger<E>>(0);
-		pair0    = new ArrayList<PairTrigger<E[]>>(0);
-		pair1    = new ArrayList<PairTrigger<E[]>>(0);
-	}
-	
-	/**
-	 * Constructs a new <code>SimTriggerModule</code> with the specified
-	 * trigger results for each of the four primary triggers.
-	 * @param singles0Triggers - The results for the singles 0 trigger.
-	 * @param singles1Triggers - The results for the singles 1 trigger.
-	 * @param pair0Triggers - The results for the pair 0 trigger.
-	 * @param pair1Triggers - The results for the pair 1 trigger.
-	 */
-	SimTriggerModule(List<SinglesTrigger<E>> singles0Triggers, List<SinglesTrigger<E>> singles1Triggers,
-			List<PairTrigger<E[]>> pair0Triggers, List<PairTrigger<E[]>> pair1Triggers) {
-		this.singles0 = singles0Triggers;
-		this.singles1 = singles1Triggers;
-		this.pair0    = pair0Triggers;
-		this.pair1    = pair1Triggers;
-	}
-	
-	/**
-	 * Gets the simulated trigger results for the singles 0 trigger.
-	 * @return Returns the trigger results as a <code>List</code> of
-	 * <code>SinglesTrigger</code> objects.
-	 */
-	public List<SinglesTrigger<E>> getSingles0Triggers() {
-		return singles0;
-	}
-	
-	/**
-	 * Gets the simulated trigger results for the singles 1 trigger.
-	 * @return Returns the trigger results as a <code>List</code> of
-	 * <code>SinglesTrigger</code> objects.
-	 */
-	public List<SinglesTrigger<E>> getSingles1Triggers() {
-		return singles1;
-	}
-	
-	/**
-	 * Gets the simulated trigger results for the pair 0 trigger.
-	 * @return Returns the trigger results as a <code>List</code> of
-	 * <code>PairTrigger</code> objects.
-	 */
-	public List<PairTrigger<E[]>> getPair0Triggers() {
-		return pair0;
-	}
-	
-	/**
-	 * Gets the simulated trigger results for the pair 1 trigger.
-	 * @return Returns the trigger results as a <code>List</code> of
-	 * <code>PairTrigger</code> objects.
-	 */
-	public List<PairTrigger<E[]>> getPair1Triggers() {
-		return pair1;
-	}
+    private final List<SinglesTrigger<E>> singles0;
+    private final List<SinglesTrigger<E>> singles1;
+    private final List<PairTrigger<E[]>> pair0;
+    private final List<PairTrigger<E[]>> pair1;
+    
+    /**
+     * Constructs a new <code>SimTriggerModule</code> with the no
+     * triggers results for any triggers.
+     */
+    SimTriggerModule() {
+        singles0 = new ArrayList<SinglesTrigger<E>>(0);
+        singles1 = new ArrayList<SinglesTrigger<E>>(0);
+        pair0    = new ArrayList<PairTrigger<E[]>>(0);
+        pair1    = new ArrayList<PairTrigger<E[]>>(0);
+    }
+    
+    /**
+     * Constructs a new <code>SimTriggerModule</code> with the specified
+     * trigger results for each of the four primary triggers.
+     * @param singles0Triggers - The results for the singles 0 trigger.
+     * @param singles1Triggers - The results for the singles 1 trigger.
+     * @param pair0Triggers - The results for the pair 0 trigger.
+     * @param pair1Triggers - The results for the pair 1 trigger.
+     */
+    SimTriggerModule(List<SinglesTrigger<E>> singles0Triggers, List<SinglesTrigger<E>> singles1Triggers,
+            List<PairTrigger<E[]>> pair0Triggers, List<PairTrigger<E[]>> pair1Triggers) {
+        this.singles0 = singles0Triggers;
+        this.singles1 = singles1Triggers;
+        this.pair0    = pair0Triggers;
+        this.pair1    = pair1Triggers;
+    }
+    
+    /**
+     * Gets the simulated trigger results for the singles 0 trigger.
+     * @return Returns the trigger results as a <code>List</code> of
+     * <code>SinglesTrigger</code> objects.
+     */
+    public List<SinglesTrigger<E>> getSingles0Triggers() {
+        return singles0;
+    }
+    
+    /**
+     * Gets the simulated trigger results for the singles 1 trigger.
+     * @return Returns the trigger results as a <code>List</code> of
+     * <code>SinglesTrigger</code> objects.
+     */
+    public List<SinglesTrigger<E>> getSingles1Triggers() {
+        return singles1;
+    }
+    
+    /**
+     * Gets the simulated trigger results for the pair 0 trigger.
+     * @return Returns the trigger results as a <code>List</code> of
+     * <code>PairTrigger</code> objects.
+     */
+    public List<PairTrigger<E[]>> getPair0Triggers() {
+        return pair0;
+    }
+    
+    /**
+     * Gets the simulated trigger results for the pair 1 trigger.
+     * @return Returns the trigger results as a <code>List</code> of
+     * <code>PairTrigger</code> objects.
+     */
+    public List<PairTrigger<E[]>> getPair1Triggers() {
+        return pair1;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerDiagnosticDriver.java	Wed Mar  9 11:43:24 2016
@@ -52,54 +52,54 @@
 import org.lcsim.util.aida.AIDA;
 
 public class TriggerDiagnosticDriver extends Driver {
-	// Store the LCIO collection names for the needed objects.
-	private String hitCollectionName = "EcalCalHits";
-	private String bankCollectionName = "TriggerBank";
-	private String clusterCollectionName = "EcalClusters";
-	private String diagnosticCollectionName = "DiagnosticSnapshot";
-	private static final int clusterCollectionFlag = 1 << LCIOConstants.CLBIT_HITS;
-	private String[] singlesCandidateCollectionName = { "Singles0TriggerCandidates", "Singles1TriggerCandidates" };
-	private String[] pairCandidateCollectionName = { "Pair0TriggerCandidates", "Pair1TriggerCandidates" };
-	
-	// Store the lists of parsed objects.
-	private TIData tiBank;
-	private SSPData sspBank;
-	private List<SSPCluster> sspClusters;
-	private List<Cluster> reconClusters = new ArrayList<Cluster>();
-	private SimTriggerData triggerData = null;
-	
-	// Trigger modules for performing trigger analysis.
-	//private int activeTrigger = -1;
-	private boolean[] tiFlags = new boolean[6];
-	private TriggerModule[] singlesTrigger = new TriggerModule[2];
-	private TriggerModule[] pairsTrigger = new TriggerModule[2];
-	private boolean[][] singlesCutsEnabled = new boolean[2][3];
-	private boolean[][] pairCutsEnabled = new boolean[2][7];
-	private boolean[] singlesTriggerEnabled = new boolean[2];
-	private boolean[] pairTriggerEnabled = new boolean[2];
-	
-	// Verification settings.
-	private int nsa = 100;
-	private int nsb = 20;
-	private int windowWidth = 200;
-	private int hitAcceptance = 1;
-	private int noiseThreshold = 50;
-	private double energyAcceptance = 0.003;
-	private boolean readDAQConfig = false;
-	private int localWindowThreshold = 1000000000;
-	private boolean performClusterVerification = true;
-	private boolean performSinglesTriggerVerification = true;
-	private boolean performPairTriggerVerification = true;
-	private boolean enforceTimeCompliance = false;
-	
-	// Efficiency tracking variables.
-	private RunDiagStats localStats = new RunDiagStats();
-	private RunDiagStats globalStats = new RunDiagStats();
-    
-	// Track which clusters/pairs are trigger candidates.
-	private List<List<Cluster>> singlesCandidates = new ArrayList<List<Cluster>>(2);
-	private List<List<LCRelation>> pairCandidates = new ArrayList<List<LCRelation>>(2);
-	
+    // Store the LCIO collection names for the needed objects.
+    private String hitCollectionName = "EcalCalHits";
+    private String bankCollectionName = "TriggerBank";
+    private String clusterCollectionName = "EcalClusters";
+    private String diagnosticCollectionName = "DiagnosticSnapshot";
+    private static final int clusterCollectionFlag = 1 << LCIOConstants.CLBIT_HITS;
+    private String[] singlesCandidateCollectionName = { "Singles0TriggerCandidates", "Singles1TriggerCandidates" };
+    private String[] pairCandidateCollectionName = { "Pair0TriggerCandidates", "Pair1TriggerCandidates" };
+    
+    // Store the lists of parsed objects.
+    private TIData tiBank;
+    private SSPData sspBank;
+    private List<SSPCluster> sspClusters;
+    private List<Cluster> reconClusters = new ArrayList<Cluster>();
+    private SimTriggerData triggerData = null;
+    
+    // Trigger modules for performing trigger analysis.
+    //private int activeTrigger = -1;
+    private boolean[] tiFlags = new boolean[6];
+    private TriggerModule[] singlesTrigger = new TriggerModule[2];
+    private TriggerModule[] pairsTrigger = new TriggerModule[2];
+    private boolean[][] singlesCutsEnabled = new boolean[2][3];
+    private boolean[][] pairCutsEnabled = new boolean[2][7];
+    private boolean[] singlesTriggerEnabled = new boolean[2];
+    private boolean[] pairTriggerEnabled = new boolean[2];
+    
+    // Verification settings.
+    private int nsa = 100;
+    private int nsb = 20;
+    private int windowWidth = 200;
+    private int hitAcceptance = 1;
+    private int noiseThreshold = 50;
+    private double energyAcceptance = 0.003;
+    private boolean readDAQConfig = false;
+    private int localWindowThreshold = 1000000000;
+    private boolean performClusterVerification = true;
+    private boolean performSinglesTriggerVerification = true;
+    private boolean performPairTriggerVerification = true;
+    private boolean enforceTimeCompliance = false;
+    
+    // Efficiency tracking variables.
+    private RunDiagStats localStats = new RunDiagStats();
+    private RunDiagStats globalStats = new RunDiagStats();
+    
+    // Track which clusters/pairs are trigger candidates.
+    private List<List<Cluster>> singlesCandidates = new ArrayList<List<Cluster>>(2);
+    private List<List<LCRelation>> pairCandidates = new ArrayList<List<LCRelation>>(2);
+    
     // Verbose settings.
     private boolean clusterFail = false;
     private boolean singlesEfficiencyFail = false;
@@ -115,2125 +115,2125 @@
     private int     statPrintInterval = Integer.MAX_VALUE;
 
     // Cut index arrays for trigger verification.
-	private static final int ENERGY_MIN   = TriggerDiagnosticUtil.SINGLES_ENERGY_MIN;
-	private static final int ENERGY_MAX   = TriggerDiagnosticUtil.SINGLES_ENERGY_MAX;
-	private static final int HIT_COUNT    = TriggerDiagnosticUtil.SINGLES_HIT_COUNT;
-	private static final int ENERGY_SUM   = TriggerDiagnosticUtil.PAIR_ENERGY_SUM;
-	private static final int ENERGY_DIFF  = TriggerDiagnosticUtil.PAIR_ENERGY_DIFF;
-	private static final int ENERGY_SLOPE = TriggerDiagnosticUtil.PAIR_ENERGY_SLOPE;
-	private static final int COPLANARITY  = TriggerDiagnosticUtil.PAIR_COPLANARITY;
-    
-	// Track the total run time.
-	private long startTime = -1;
-	private long endTime = -1;
-	
-	// Cut names for logging.
-	private static final String[][] cutNames = {
-			{ "E_min", "E_max", "hit count", "null" },
-			{ "E_sum", "E_diff", "E_slope", "coplanar" }
-	};
-	
-	// Temporary AIDA Plots
-	private TriggerPlotsModule globalTriggerPlots = new TriggerPlotsModule(0, 0);
-	private static final int RECON   = 0;
-	private static final int SSP     = 1;
-	private static final int ALL     = 0;
-	private static final int MATCHED = 1;
-	private static final int FAILED  = 2;
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[][] clusterHitPlot = {
-			{
-				aida.histogram1D("Clustering/Recon Cluster Hit Count (All)",     9, 0.5, 9.5),
-				aida.histogram1D("Clustering/Recon Cluster Hit Count (Matched)", 9, 0.5, 9.5),
-				aida.histogram1D("Clustering/Recon Cluster Hit Count (Failed)",  9, 0.5, 9.5)
-			},
-			{
-				aida.histogram1D("Clustering/SSP Cluster Hit Count (All)",     9, 0.5, 9.5),
-				aida.histogram1D("Clustering/SSP Cluster Hit Count (Matched)", 9, 0.5, 9.5),
-				aida.histogram1D("Clustering/SSP Cluster Hit Count (Failed)",  9, 0.5, 9.5)
-			}
-	};
-	private IHistogram1D[][] clusterEnergyPlot = {
-			{
-				aida.histogram1D("Clustering/Recon Cluster Energy (All)",     300, 0.0, 3.0),
-				aida.histogram1D("Clustering/Recon Cluster Energy (Matched)", 300, 0.0, 3.0),
-				aida.histogram1D("Clustering/Recon Cluster Energy (Failed)",  300, 0.0, 3.0)
-			},
-			{
-				aida.histogram1D("Clustering/SSP Cluster Energy (All)",     300, 0.0, 3.0),
-				aida.histogram1D("Clustering/SSP Cluster Energy (Matched)", 300, 0.0, 3.0),
-				aida.histogram1D("Clustering/SSP Cluster Energy (Failed)",  300, 0.0, 3.0)
-			}
-	};
-	private IHistogram1D[][] clusterTimePlot = {
-			{
-				aida.histogram1D("Clustering/Recon Cluster Time (All)",     115, 0, 460),
-				aida.histogram1D("Clustering/Recon Cluster Time (Matched)", 115, 0, 460),
-				aida.histogram1D("Clustering/Recon Cluster Time (Failed)",  115, 0, 460)
-			},
-			{
-				aida.histogram1D("Clustering/SSP Cluster Time (All)",     115, 0, 460),
-				aida.histogram1D("Clustering/SSP Cluster Time (Matched)", 115, 0, 460),
-				aida.histogram1D("Clustering/SSP Cluster Time (Failed)",  115, 0, 460)
-			}
-	};
-	private IHistogram2D[][] clusterPositionPlot = {
-			{
-				aida.histogram2D("Clustering/Recon Cluster Position (All)",     47, -23.5, 23.5, 11, -5.5, 5.5),
-				aida.histogram2D("Clustering/Recon Cluster Position (Matched)", 47, -23.5, 23.5, 11, -5.5, 5.5),
-				aida.histogram2D("Clustering/Recon Cluster Position (Failed)",  47, -23.5, 23.5, 11, -5.5, 5.5)
-			},
-			{
-				aida.histogram2D("Clustering/SSP Cluster Position (All)",     47, -23.5, 23.5, 11, -5.5, 5.5),
-				aida.histogram2D("Clustering/SSP Cluster Position (Matched)", 47, -23.5, 23.5, 11, -5.5, 5.5),
-				aida.histogram2D("Clustering/SSP Cluster Position (Failed)",  47, -23.5, 23.5, 11, -5.5, 5.5)
-			}
-	};
-	private IHistogram2D[] energyhitDiffPlot = {
-		aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (All)",     21, -0.010, 0.010, 6, -3, 3),
-		aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (Matched)", 21, -0.010, 0.010, 6, -3, 3),
-		aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (Failed)",  21, -0.010, 0.010, 6, -3, 3)
-	};
-	private ICloud2D[] efficiencyTimeHist = {
-			aida.cloud2D("Clustering/Cluster Efficiency vs. Time"),
-			aida.cloud2D("Singles Trigger 0/Cluster Efficiency vs. Time"),
-			aida.cloud2D("Singles Trigger 1/Cluster Efficiency vs. Time"),
-			aida.cloud2D("Pair Trigger 0/Cluster Efficiency vs. Time"),
-			aida.cloud2D("Pair Trigger 1/Cluster Efficiency vs. Time")
-	};
-	
-	/**
-	 * Define the trigger modules. This should be replaced by parsing
-	 * the DAQ configuration at some point.
-	 */
-	@Override
-	public void startOfData() {
-		// By default, all triggers and cuts are enabled.
-		for(int i = 0; i < 2; i++) {
-			// Enable the triggers.
-			pairTriggerEnabled[i] = true;
-			singlesTriggerEnabled[i] = true;
-			
-			// Enable the singles cuts.
-			for(int j = 0; j < singlesCutsEnabled.length; j++) {
-				singlesCutsEnabled[i][j] = true;
-			}
-			
-			// Enable the pair cuts.
-			for(int j = 0; j < pairCutsEnabled.length; j++) {
-				pairCutsEnabled[i][j] = true;
-			}
-		}
-		
-		// If the DAQ configuration should be read, attach a listener
-		// to track when it updates.
-		if(readDAQConfig) {
-			ConfigurationManager.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					// Get the DAQ configuration.
-					DAQConfig daq = ConfigurationManager.getInstance();
-					
-					// Update the plotting energy slope values.
-					globalTriggerPlots.setEnergySlopeParamF(0, daq.getSSPConfig().getPair1Config().getEnergySlopeCutConfig().getParameterF());
-					globalTriggerPlots.setEnergySlopeParamF(1, daq.getSSPConfig().getPair2Config().getEnergySlopeCutConfig().getParameterF());
-					
-					// Load the DAQ settings from the configuration manager.
-					singlesTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getSingles1Config());
-					singlesTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getSingles2Config());
-					pairsTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getPair1Config());
-					pairsTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getPair2Config());
-					nsa = daq.getFADCConfig().getNSA();
-					nsb = daq.getFADCConfig().getNSB();
-					windowWidth = daq.getFADCConfig().getWindowWidth();
-					
-					// Get the trigger configurations from the DAQ.
-					SinglesTriggerConfig[] singles = { daq.getSSPConfig().getSingles1Config(),
-							daq.getSSPConfig().getSingles2Config() };
-					PairTriggerConfig[] pairs = { daq.getSSPConfig().getPair1Config(),
-							daq.getSSPConfig().getPair2Config() };
-					
-					// Update the enabled/disabled statuses.
-					for(int i = 0; i < 2; i++) {
-						// Set the trigger enabled status.
-						pairTriggerEnabled[i] = pairs[i].isEnabled();
-						singlesTriggerEnabled[i] = singles[i].isEnabled();
-						
-						// Set the singles cut statuses.
-						singlesCutsEnabled[i][ENERGY_MIN] = singles[i].getEnergyMinCutConfig().isEnabled();
-						singlesCutsEnabled[i][ENERGY_MAX] = singles[i].getEnergyMaxCutConfig().isEnabled();
-						singlesCutsEnabled[i][HIT_COUNT] = singles[i].getHitCountCutConfig().isEnabled();
-						
-						// Set the pair cut statuses.
-						pairCutsEnabled[i][ENERGY_MIN] = pairs[i].getEnergyMinCutConfig().isEnabled();
-						pairCutsEnabled[i][ENERGY_MAX] = pairs[i].getEnergyMaxCutConfig().isEnabled();
-						pairCutsEnabled[i][HIT_COUNT] = pairs[i].getHitCountCutConfig().isEnabled();
-						pairCutsEnabled[i][3 + ENERGY_SUM] = pairs[i].getEnergySumCutConfig().isEnabled();
-						pairCutsEnabled[i][3 + ENERGY_DIFF] = pairs[i].getEnergyDifferenceCutConfig().isEnabled();
-						pairCutsEnabled[i][3 + ENERGY_SLOPE] = pairs[i].getEnergySlopeCutConfig().isEnabled();
-						pairCutsEnabled[i][3 + COPLANARITY] = pairs[i].getCoplanarityCutConfig().isEnabled();
-					}
-					
-					// Update the trigger plots values.
-					globalTriggerPlots.setEnergySlopeParamF(0, daq.getSSPConfig().getPair1Config().getEnergySlopeCutConfig().getParameterF());
-					globalTriggerPlots.setEnergySlopeParamF(1, daq.getSSPConfig().getPair2Config().getEnergySlopeCutConfig().getParameterF());
-					
-					// Print a DAQ configuration settings header.
-					System.out.println();
-					System.out.println();
-					System.out.println("======================================================================");
-					System.out.println("=== DAQ Configuration Settings =======================================");
-					System.out.println("======================================================================");
-					logSettings();
-				}
-			});
-		}
-		
-		// Print the cluster verification header.
-		System.out.println();
-		System.out.println();
-		System.out.println("======================================================================");
-		System.out.println("=== Cluster/Trigger Verification Settings ============================");
-		System.out.println("======================================================================");
-		
-		// Define the first singles trigger.
-		singlesTrigger[0] = new TriggerModule();
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.500);
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		
-		// Define the second singles trigger.
-		singlesTrigger[1] = new TriggerModule();
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		
-		// Define the first pairs trigger.
-		pairsTrigger[0] = new TriggerModule();
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
-		pairsTrigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
-		
-		// Define the second pairs trigger.
-		pairsTrigger[1] = new TriggerModule();
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
-		pairsTrigger[1].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
-		
-		// Print the initial settings.
-		logSettings();
-	}
-	
-	/**
-	 * Prints the total run statistics.
-	 */
-	@Override
-	public void endOfData() {
-		// Output the statistics.
-		logStatistics();
-		
-		/*
-		// Calculate the values needed for the efficiency histogram.
-		long totalTime = entryList.get(entryList.size()).time / 1000000000;
-		int entries = (int) (totalTime / (localWindowThreshold / 1000000000)) + 1;
-		
-		// Generate a histogram containing the efficiencies.
-		IHistogram1D[] efficiencyHist = new IHistogram1D[5];
-		for(int i = 0; i < 5; i++) {
-			efficiencyHist[i] = aida.histogram1D("Efficiency " + i, entries, 0.0, totalTime + (localWindowThreshold / 1000000000));
-		}
-		
-		// Input the efficiencies.
-		for(EfficiencyEntry entry : entryList) {
-			for(int i = 0; i < 5; i++) {
-				efficiencyHist[i].fill(entry.time / 1000000000, entry.efficiency[i]);
-			}
-		}
-		*/
-	}
-	
-	/**
-	 * Gets the banks and clusters from the event.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		// ==========================================================
-		// ==== Event Pre-Initialization ============================
-		// ==========================================================
-        
-		// If DAQ settings are to be used, check if they are initialized
-		// yet. If not, skip the event.
-		if(readDAQConfig) {
-			if(!ConfigurationManager.isInitialized()) {
-				return;
-			}
-		}
-		
-		// Reset the candidate cluster lists.
-		singlesCandidates.clear();
-		singlesCandidates.add(new ArrayList<Cluster>());
-		singlesCandidates.add(new ArrayList<Cluster>());
-		pairCandidates.clear();
-		pairCandidates.add(new ArrayList<LCRelation>());
-		pairCandidates.add(new ArrayList<LCRelation>());
-		
-		// Increment the total event count.
-		localStats.sawEvent(event.getTimeStamp());
-		globalStats.sawEvent(event.getTimeStamp());
-		
-		// Print the statistics every so often during a run.
-		if(globalStats.getEventCount() % statPrintInterval == 0) {
-			logStatistics();
-		}
-		
-		// Reset the output buffer and print flags.
-		clusterFail = false;
-		singlesInternalFail = false;
-		singlesEfficiencyFail = false;
-		pairInternalFail = false;
-		pairEfficiencyFail = false;
-		OutputLogger.clearLog();
-		
-		// Track the times.
-		if(startTime == -1) { startTime = event.getTimeStamp(); }
-		else { endTime = event.getTimeStamp(); }
-		
-		
-		
-		// ==========================================================
-		// ==== Output GTP Information ==============================
-		// ==========================================================
-		
+    private static final int ENERGY_MIN   = TriggerDiagnosticUtil.SINGLES_ENERGY_MIN;
+    private static final int ENERGY_MAX   = TriggerDiagnosticUtil.SINGLES_ENERGY_MAX;
+    private static final int HIT_COUNT    = TriggerDiagnosticUtil.SINGLES_HIT_COUNT;
+    private static final int ENERGY_SUM   = TriggerDiagnosticUtil.PAIR_ENERGY_SUM;
+    private static final int ENERGY_DIFF  = TriggerDiagnosticUtil.PAIR_ENERGY_DIFF;
+    private static final int ENERGY_SLOPE = TriggerDiagnosticUtil.PAIR_ENERGY_SLOPE;
+    private static final int COPLANARITY  = TriggerDiagnosticUtil.PAIR_COPLANARITY;
+    
+    // Track the total run time.
+    private long startTime = -1;
+    private long endTime = -1;
+    
+    // Cut names for logging.
+    private static final String[][] cutNames = {
+            { "E_min", "E_max", "hit count", "null" },
+            { "E_sum", "E_diff", "E_slope", "coplanar" }
+    };
+    
+    // Temporary AIDA Plots
+    private TriggerPlotsModule globalTriggerPlots = new TriggerPlotsModule(0, 0);
+    private static final int RECON   = 0;
+    private static final int SSP     = 1;
+    private static final int ALL     = 0;
+    private static final int MATCHED = 1;
+    private static final int FAILED  = 2;
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D[][] clusterHitPlot = {
+            {
+                aida.histogram1D("Clustering/Recon Cluster Hit Count (All)",     9, 0.5, 9.5),
+                aida.histogram1D("Clustering/Recon Cluster Hit Count (Matched)", 9, 0.5, 9.5),
+                aida.histogram1D("Clustering/Recon Cluster Hit Count (Failed)",  9, 0.5, 9.5)
+            },
+            {
+                aida.histogram1D("Clustering/SSP Cluster Hit Count (All)",     9, 0.5, 9.5),
+                aida.histogram1D("Clustering/SSP Cluster Hit Count (Matched)", 9, 0.5, 9.5),
+                aida.histogram1D("Clustering/SSP Cluster Hit Count (Failed)",  9, 0.5, 9.5)
+            }
+    };
+    private IHistogram1D[][] clusterEnergyPlot = {
+            {
+                aida.histogram1D("Clustering/Recon Cluster Energy (All)",     300, 0.0, 3.0),
+                aida.histogram1D("Clustering/Recon Cluster Energy (Matched)", 300, 0.0, 3.0),
+                aida.histogram1D("Clustering/Recon Cluster Energy (Failed)",  300, 0.0, 3.0)
+            },
+            {
+                aida.histogram1D("Clustering/SSP Cluster Energy (All)",     300, 0.0, 3.0),
+                aida.histogram1D("Clustering/SSP Cluster Energy (Matched)", 300, 0.0, 3.0),
+                aida.histogram1D("Clustering/SSP Cluster Energy (Failed)",  300, 0.0, 3.0)
+            }
+    };
+    private IHistogram1D[][] clusterTimePlot = {
+            {
+                aida.histogram1D("Clustering/Recon Cluster Time (All)",     115, 0, 460),
+                aida.histogram1D("Clustering/Recon Cluster Time (Matched)", 115, 0, 460),
+                aida.histogram1D("Clustering/Recon Cluster Time (Failed)",  115, 0, 460)
+            },
+            {
+                aida.histogram1D("Clustering/SSP Cluster Time (All)",     115, 0, 460),
+                aida.histogram1D("Clustering/SSP Cluster Time (Matched)", 115, 0, 460),
+                aida.histogram1D("Clustering/SSP Cluster Time (Failed)",  115, 0, 460)
+            }
+    };
+    private IHistogram2D[][] clusterPositionPlot = {
+            {
+                aida.histogram2D("Clustering/Recon Cluster Position (All)",     47, -23.5, 23.5, 11, -5.5, 5.5),
+                aida.histogram2D("Clustering/Recon Cluster Position (Matched)", 47, -23.5, 23.5, 11, -5.5, 5.5),
+                aida.histogram2D("Clustering/Recon Cluster Position (Failed)",  47, -23.5, 23.5, 11, -5.5, 5.5)
+            },
+            {
+                aida.histogram2D("Clustering/SSP Cluster Position (All)",     47, -23.5, 23.5, 11, -5.5, 5.5),
+                aida.histogram2D("Clustering/SSP Cluster Position (Matched)", 47, -23.5, 23.5, 11, -5.5, 5.5),
+                aida.histogram2D("Clustering/SSP Cluster Position (Failed)",  47, -23.5, 23.5, 11, -5.5, 5.5)
+            }
+    };
+    private IHistogram2D[] energyhitDiffPlot = {
+        aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (All)",     21, -0.010, 0.010, 6, -3, 3),
+        aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (Matched)", 21, -0.010, 0.010, 6, -3, 3),
+        aida.histogram2D("Clustering/Recon-SSP Energy-Hit Difference (Failed)",  21, -0.010, 0.010, 6, -3, 3)
+    };
+    private ICloud2D[] efficiencyTimeHist = {
+            aida.cloud2D("Clustering/Cluster Efficiency vs. Time"),
+            aida.cloud2D("Singles Trigger 0/Cluster Efficiency vs. Time"),
+            aida.cloud2D("Singles Trigger 1/Cluster Efficiency vs. Time"),
+            aida.cloud2D("Pair Trigger 0/Cluster Efficiency vs. Time"),
+            aida.cloud2D("Pair Trigger 1/Cluster Efficiency vs. Time")
+    };
+    
+    /**
+     * Define the trigger modules. This should be replaced by parsing
+     * the DAQ configuration at some point.
+     */
+    @Override
+    public void startOfData() {
+        // By default, all triggers and cuts are enabled.
+        for(int i = 0; i < 2; i++) {
+            // Enable the triggers.
+            pairTriggerEnabled[i] = true;
+            singlesTriggerEnabled[i] = true;
+            
+            // Enable the singles cuts.
+            for(int j = 0; j < singlesCutsEnabled.length; j++) {
+                singlesCutsEnabled[i][j] = true;
+            }
+            
+            // Enable the pair cuts.
+            for(int j = 0; j < pairCutsEnabled.length; j++) {
+                pairCutsEnabled[i][j] = true;
+            }
+        }
+        
+        // If the DAQ configuration should be read, attach a listener
+        // to track when it updates.
+        if(readDAQConfig) {
+            ConfigurationManager.addActionListener(new ActionListener() {
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    // Get the DAQ configuration.
+                    DAQConfig daq = ConfigurationManager.getInstance();
+                    
+                    // Update the plotting energy slope values.
+                    globalTriggerPlots.setEnergySlopeParamF(0, daq.getSSPConfig().getPair1Config().getEnergySlopeCutConfig().getParameterF());
+                    globalTriggerPlots.setEnergySlopeParamF(1, daq.getSSPConfig().getPair2Config().getEnergySlopeCutConfig().getParameterF());
+                    
+                    // Load the DAQ settings from the configuration manager.
+                    singlesTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getSingles1Config());
+                    singlesTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getSingles2Config());
+                    pairsTrigger[0].loadDAQConfiguration(daq.getSSPConfig().getPair1Config());
+                    pairsTrigger[1].loadDAQConfiguration(daq.getSSPConfig().getPair2Config());
+                    nsa = daq.getFADCConfig().getNSA();
+                    nsb = daq.getFADCConfig().getNSB();
+                    windowWidth = daq.getFADCConfig().getWindowWidth();
+                    
+                    // Get the trigger configurations from the DAQ.
+                    SinglesTriggerConfig[] singles = { daq.getSSPConfig().getSingles1Config(),
+                            daq.getSSPConfig().getSingles2Config() };
+                    PairTriggerConfig[] pairs = { daq.getSSPConfig().getPair1Config(),
+                            daq.getSSPConfig().getPair2Config() };
+                    
+                    // Update the enabled/disabled statuses.
+                    for(int i = 0; i < 2; i++) {
+                        // Set the trigger enabled status.
+                        pairTriggerEnabled[i] = pairs[i].isEnabled();
+                        singlesTriggerEnabled[i] = singles[i].isEnabled();
+                        
+                        // Set the singles cut statuses.
+                        singlesCutsEnabled[i][ENERGY_MIN] = singles[i].getEnergyMinCutConfig().isEnabled();
+                        singlesCutsEnabled[i][ENERGY_MAX] = singles[i].getEnergyMaxCutConfig().isEnabled();
+                        singlesCutsEnabled[i][HIT_COUNT] = singles[i].getHitCountCutConfig().isEnabled();
+                        
+                        // Set the pair cut statuses.
+                        pairCutsEnabled[i][ENERGY_MIN] = pairs[i].getEnergyMinCutConfig().isEnabled();
+                        pairCutsEnabled[i][ENERGY_MAX] = pairs[i].getEnergyMaxCutConfig().isEnabled();
+                        pairCutsEnabled[i][HIT_COUNT] = pairs[i].getHitCountCutConfig().isEnabled();
+                        pairCutsEnabled[i][3 + ENERGY_SUM] = pairs[i].getEnergySumCutConfig().isEnabled();
+                        pairCutsEnabled[i][3 + ENERGY_DIFF] = pairs[i].getEnergyDifferenceCutConfig().isEnabled();
+                        pairCutsEnabled[i][3 + ENERGY_SLOPE] = pairs[i].getEnergySlopeCutConfig().isEnabled();
+                        pairCutsEnabled[i][3 + COPLANARITY] = pairs[i].getCoplanarityCutConfig().isEnabled();
+                    }
+                    
+                    // Update the trigger plots values.
+                    globalTriggerPlots.setEnergySlopeParamF(0, daq.getSSPConfig().getPair1Config().getEnergySlopeCutConfig().getParameterF());
+                    globalTriggerPlots.setEnergySlopeParamF(1, daq.getSSPConfig().getPair2Config().getEnergySlopeCutConfig().getParameterF());
+                    
+                    // Print a DAQ configuration settings header.
+                    System.out.println();
+                    System.out.println();
+                    System.out.println("======================================================================");
+                    System.out.println("=== DAQ Configuration Settings =======================================");
+                    System.out.println("======================================================================");
+                    logSettings();
+                }
+            });
+        }
+        
+        // Print the cluster verification header.
+        System.out.println();
+        System.out.println();
+        System.out.println("======================================================================");
+        System.out.println("=== Cluster/Trigger Verification Settings ============================");
+        System.out.println("======================================================================");
+        
+        // Define the first singles trigger.
+        singlesTrigger[0] = new TriggerModule();
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.500);
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        singlesTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        
+        // Define the second singles trigger.
+        singlesTrigger[1] = new TriggerModule();
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        singlesTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        
+        // Define the first pairs trigger.
+        pairsTrigger[0] = new TriggerModule();
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
+        pairsTrigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
+        
+        // Define the second pairs trigger.
+        pairsTrigger[1] = new TriggerModule();
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, 0);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 8.191);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, 0.000);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, 0.001);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, 180);
+        pairsTrigger[1].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, 8);
+        
+        // Print the initial settings.
+        logSettings();
+    }
+    
+    /**
+     * Prints the total run statistics.
+     */
+    @Override
+    public void endOfData() {
+        // Output the statistics.
+        logStatistics();
+        
+        /*
+        // Calculate the values needed for the efficiency histogram.
+        long totalTime = entryList.get(entryList.size()).time / 1000000000;
+        int entries = (int) (totalTime / (localWindowThreshold / 1000000000)) + 1;
+        
+        // Generate a histogram containing the efficiencies.
+        IHistogram1D[] efficiencyHist = new IHistogram1D[5];
+        for(int i = 0; i < 5; i++) {
+            efficiencyHist[i] = aida.histogram1D("Efficiency " + i, entries, 0.0, totalTime + (localWindowThreshold / 1000000000));
+        }
+        
+        // Input the efficiencies.
+        for(EfficiencyEntry entry : entryList) {
+            for(int i = 0; i < 5; i++) {
+                efficiencyHist[i].fill(entry.time / 1000000000, entry.efficiency[i]);
+            }
+        }
+        */
+    }
+    
+    /**
+     * Gets the banks and clusters from the event.
+     */
+    @Override
+    public void process(EventHeader event) {
+        // ==========================================================
+        // ==== Event Pre-Initialization ============================
+        // ==========================================================
+        
+        // If DAQ settings are to be used, check if they are initialized
+        // yet. If not, skip the event.
+        if(readDAQConfig) {
+            if(!ConfigurationManager.isInitialized()) {
+                return;
+            }
+        }
+        
+        // Reset the candidate cluster lists.
+        singlesCandidates.clear();
+        singlesCandidates.add(new ArrayList<Cluster>());
+        singlesCandidates.add(new ArrayList<Cluster>());
+        pairCandidates.clear();
+        pairCandidates.add(new ArrayList<LCRelation>());
+        pairCandidates.add(new ArrayList<LCRelation>());
+        
+        // Increment the total event count.
+        localStats.sawEvent(event.getTimeStamp());
+        globalStats.sawEvent(event.getTimeStamp());
+        
+        // Print the statistics every so often during a run.
+        if(globalStats.getEventCount() % statPrintInterval == 0) {
+            logStatistics();
+        }
+        
+        // Reset the output buffer and print flags.
+        clusterFail = false;
+        singlesInternalFail = false;
+        singlesEfficiencyFail = false;
+        pairInternalFail = false;
+        pairEfficiencyFail = false;
+        OutputLogger.clearLog();
+        
+        // Track the times.
+        if(startTime == -1) { startTime = event.getTimeStamp(); }
+        else { endTime = event.getTimeStamp(); }
+        
+        
+        
+        // ==========================================================
+        // ==== Output GTP Information ==============================
+        // ==========================================================
+        
         // Print the verification header.
-		OutputLogger.printNewLine(2);
-		OutputLogger.println("======================================================================");
-		OutputLogger.println("==== FADC/GTP Readout ================================================");
-		OutputLogger.println("======================================================================");
-		
-		OutputLogger.println("FADC Hits:");
-		for(CalorimeterHit hit : event.get(CalorimeterHit.class, "EcalCalHits")) {
-			int ix = hit.getIdentifierFieldValue("ix");
-			int iy = hit.getIdentifierFieldValue("iy");
-			OutputLogger.printf("\tHit at (%3d, %3d) with %7.3f GeV at time %3.0f ns%n", ix, iy, hit.getCorrectedEnergy(), hit.getTime());
-		}
-		OutputLogger.printNewLine(2);
-		OutputLogger.println("GTP Clusters:");
-		for(Cluster cluster : event.get(Cluster.class, clusterCollectionName)) {
-			OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(cluster));
-			for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
-				int ix = hit.getIdentifierFieldValue("ix");
-				int iy = hit.getIdentifierFieldValue("iy");
-				OutputLogger.printf("\t\t> (%3d, %3d) :: %7.3f GeV%n", ix, iy, hit.getCorrectedEnergy());
-			}
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Initialize the Event ================================
-		// ==========================================================
-		
+        OutputLogger.printNewLine(2);
+        OutputLogger.println("======================================================================");
+        OutputLogger.println("==== FADC/GTP Readout ================================================");
+        OutputLogger.println("======================================================================");
+        
+        OutputLogger.println("FADC Hits:");
+        for(CalorimeterHit hit : event.get(CalorimeterHit.class, "EcalCalHits")) {
+            int ix = hit.getIdentifierFieldValue("ix");
+            int iy = hit.getIdentifierFieldValue("iy");
+            OutputLogger.printf("\tHit at (%3d, %3d) with %7.3f GeV at time %3.0f ns%n", ix, iy, hit.getCorrectedEnergy(), hit.getTime());
+        }
+        OutputLogger.printNewLine(2);
+        OutputLogger.println("GTP Clusters:");
+        for(Cluster cluster : event.get(Cluster.class, clusterCollectionName)) {
+            OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(cluster));
+            for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
+                int ix = hit.getIdentifierFieldValue("ix");
+                int iy = hit.getIdentifierFieldValue("iy");
+                OutputLogger.printf("\t\t> (%3d, %3d) :: %7.3f GeV%n", ix, iy, hit.getCorrectedEnergy());
+            }
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Initialize the Event ================================
+        // ==========================================================
+        
         // Print the verification header.
-		OutputLogger.printNewLine(2);
-		OutputLogger.println("======================================================================");
-		OutputLogger.println("==== Cluster/Trigger Verification ====================================");
-		OutputLogger.println("======================================================================");
-		
-		
-		
-		// ==========================================================
-		// ==== Obtain SSP and TI Banks =============================
-		// ==========================================================
-		
-		// Get the SSP clusters.
-		if(event.hasCollection(GenericObject.class, bankCollectionName)) {
-			// Get the bank list.
-			List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-			
-			// Search through the banks and get the SSP and TI banks.
-			for(GenericObject obj : bankList) {
-				// If this is an SSP bank, parse it.
-				if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
-					sspBank = new SSPData(obj);
-				}
-				
-				// Otherwise, if this is a TI bank, parse it.
-				else if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
-					tiBank = new TIData(obj);
-					
-					tiFlags = new boolean[6];
-					if(tiBank.isPulserTrigger()) {
-						OutputLogger.println("Trigger type :: Pulser");
-						tiFlags[TriggerDiagStats.PULSER] = true;
-					} else if(tiBank.isSingle0Trigger()) {
-						OutputLogger.println("Trigger type :: Singles 1");
-						tiFlags[TriggerDiagStats.SINGLES0] = true;
-					} else if(tiBank.isSingle1Trigger()) {
-						OutputLogger.println("Trigger type :: Singles 2");
-						tiFlags[TriggerDiagStats.SINGLES1] = true;
-					} else if(tiBank.isPair0Trigger()) {
-						OutputLogger.println("Trigger type :: Pair 1");
-						tiFlags[TriggerDiagStats.PAIR0] = true;
-					} else if(tiBank.isPair1Trigger()) {
-						OutputLogger.println("Trigger type :: Pair 2");
-						tiFlags[TriggerDiagStats.PAIR1] = true;
-					} else if(tiBank.isCalibTrigger()) {
-						OutputLogger.println("Trigger type :: Cosmic");
-						tiFlags[TriggerDiagStats.COSMIC] = true;
-					} else {
-						System.err.println("TriggerDiagnosticDriver: Skipping event; no TI trigger source found.");
-						return;
-					}
-					
-					// Pass the TI triggers to the run statistical data
-					// manager object.
-					localStats.getTriggerStats().sawTITriggers(tiFlags);
-					globalStats.getTriggerStats().sawTITriggers(tiFlags);
-				}
-			}
-			
-			// If there is an SSP bank, get the list of SSP clusters.
-			if(sspBank != null) {
-				sspClusters = sspBank.getClusters();
-				if(sspClusters.size() == 1) {
-					OutputLogger.println("1 SSP cluster found.");
-				} else {
-					OutputLogger.printf("%d SSP clusters found.%n", sspClusters.size());
-				}
-			}
-		}
-		
-		// Make sure that both an SSP bank and a TI bank were found.
-		if(tiBank == null || sspBank == null) {
-			System.err.println("TriggerDiagnosticDriver :: SEVERE WARNING :: TI bank or SSP bank missing from event!");
-			return;
-		}
-		
-		// Output the event number and information.
-		OutputLogger.printf("Event Number %d (%d)%n", sspBank.getEventNumber(), event.getEventNumber());
-		
-		
-		
-		// ==========================================================
-		// ==== Establish Event Integrity ===========================
-		// ==========================================================
-		
-		// Check that all of the required objects are present.
-		if(sspBank == null) {
-			OutputLogger.println("No SSP bank found for this event. No verification will be performed.");
-			if(verbose) { OutputLogger.printLog(); }
-			return;
-		} if(tiBank == null) {
-			OutputLogger.println("No TI bank found for this event. No verification will be performed.");
-			if(verbose) { OutputLogger.printLog(); }
-			return;
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Check the Noise Level ===============================
-		// ==========================================================
-		
-		// Check if there are hits.
-		if(event.hasCollection(CalorimeterHit.class, hitCollectionName)) {
-			// Check if there are more hits than the noise threshold.
-			if(event.get(CalorimeterHit.class, hitCollectionName).size() >= noiseThreshold) {
-				localStats.sawNoiseEvent();
-				globalStats.sawNoiseEvent();
-				OutputLogger.println("Noise event detected. Skipping event...");
-				if(verbose) { OutputLogger.printLog(); }
-				return;
-			}
-		}
-        
-        
-        
-		// ==========================================================
-		// ==== Obtain Reconstructed Clusters =======================
-		// ==========================================================
-		
-		// Get the reconstructed clusters.
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Get the reconstructed clusters.
-			List<Cluster> allClusters = event.get(Cluster.class, clusterCollectionName);
-			
-			// Keep only the clusters that can be verified.
-			OutputLogger.println();
-			OutputLogger.println("Process cluster for verifiability:");
-			reconClusters.clear();
-			for(Cluster reconCluster : allClusters) {
-				// Check that the cluster is within the safe region of the
-				// FADC readout window. If it is not, it will likely have
-				// inaccurate energy or hit values and may not produce the
-				// expected results.
-				OutputLogger.printf("\t%s", TriggerDiagnosticUtil.clusterToString(reconCluster));
-				if(isVerifiable(reconCluster)) {
-					reconClusters.add(reconCluster);
-					OutputLogger.println(" [  verifiable  ]");
-				} else { OutputLogger.println(" [ unverifiable ]"); }
-			}
-			
-			// Output the number of verifiable clusters found.
-			if(reconClusters.size() == 1) { OutputLogger.println("1 verifiable reconstructed cluster found."); }
-			else { OutputLogger.printf("%d verifiable reconstructed clusters found.%n", reconClusters.size()); }
-			
-			// Output the number of unverifiable clusters found.
-			int unverifiableClusters = allClusters.size() - reconClusters.size();
-			if(unverifiableClusters == 1) { OutputLogger.println("1 unverifiable reconstructed cluster found."); }
-			else { OutputLogger.printf("%d unverifiable reconstructed clusters found.%n", unverifiableClusters); }
-		} else {
-			reconClusters = new ArrayList<Cluster>(0);
-			OutputLogger.printf("No reconstructed clusters were found for collection \"%s\" in this event.%n", clusterCollectionName);
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Perform Event Verification ==========================
-		// ==========================================================
-		
-		// Perform the cluster verification step.
-		if(performClusterVerification) { clusterVerification(); }
-		
-		// Get the simulated triggers.
-		if(event.hasCollection(SimTriggerData.class, "SimTriggers")) {
-			List<SimTriggerData> stdList = event.get(SimTriggerData.class, "SimTriggers");
-			triggerData = stdList.get(0);
-		}
-		
-		// Construct lists of triggers for the SSP clusters and the
-		// reconstructed clusters.
-		if(performSinglesTriggerVerification) {
-			singlesTriggerVerification();
-		}
-		if(performPairTriggerVerification) {
-			pairTriggerVerification();
-		}
-		
-		// Track how many events failed due to each type of verification.
-		if(clusterFail) {
-			localStats.failedClusterEvent();
-			globalStats.failedClusterEvent();
-		} if(pairInternalFail || pairEfficiencyFail) {
-			localStats.failedPairEvent();
-			globalStats.failedPairEvent();
-		} if(singlesInternalFail || singlesEfficiencyFail) {
-			localStats.failedSinglesEvent();
-			globalStats.failedSinglesEvent();
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Perform Event Write-Out =============================
-		// ==========================================================
-		
-		if(verbose ||(clusterFail && printClusterFail) ||
-				(singlesInternalFail && printSinglesTriggerInternalFail) ||
-				(singlesEfficiencyFail && printSinglesTriggerEfficiencyFail) ||
-				(pairInternalFail && printPairTriggerInternalFail) ||
-				(pairEfficiencyFail && printPairTriggerEfficiencyFail)) {
-			OutputLogger.printLog();
-		}	
-		
-		
-				
-		// ==========================================================
-		// ==== Process Local Tracked Variables =====================
-		// ==========================================================
-		if(localStats.getDuration() > localWindowThreshold) {
-			// Write a snapshot of the driver to the event stream.
-			List<DiagnosticSnapshot> snapshotList = new ArrayList<DiagnosticSnapshot>(2);
-			snapshotList.add(localStats.getSnapshot());
-			snapshotList.add(globalStats.getSnapshot());
-			
-			// Push the snapshot to the data stream.
-			event.put(diagnosticCollectionName, snapshotList);
-			
-			// Store values needed to calculate efficiency.
-			int[] matched = {
-					localStats.getClusterStats().getMatches(),
-					localStats.getTriggerStats().getSingles0Stats().getMatchedReconSimulatedTriggers(),
-					localStats.getTriggerStats().getSingles1Stats().getMatchedReconSimulatedTriggers(),
-					localStats.getTriggerStats().getPair0Stats().getMatchedReconSimulatedTriggers(),
-					localStats.getTriggerStats().getPair1Stats().getMatchedReconSimulatedTriggers()
-			};
-			int[] total = {
-					localStats.getClusterStats().getReconClusterCount(),
-					localStats.getTriggerStats().getSingles0Stats().getReconSimulatedTriggers(),
-					localStats.getTriggerStats().getSingles1Stats().getReconSimulatedTriggers(),
-					localStats.getTriggerStats().getPair0Stats().getReconSimulatedTriggers(),
-					localStats.getTriggerStats().getPair1Stats().getReconSimulatedTriggers()
-			};
-			
-			// Calculate the efficiencies and upper/lower errors.
-			double[] efficiency = new double[5];
-			for(int i = 0; i < 5; i++) {
-				efficiency[i] = 1.0 * matched[i] / total[i];
-			}
-			
-			// Get the time for the current snapshot. This is the total
-			// run time before the snapshot plus half of the snapshot.
-			long time = globalStats.getDuration() - (localStats.getDuration() / 2);
-			
-			// Add them to the appropriate cloud plot.
-			for(int i = 0; i < 5; i++) { efficiencyTimeHist[i].fill(time, efficiency[i]); }
-			
-			// Clear the local statistical data.
-			localStats.clear();
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Write the Candidate Triggers ========================
-		// ==========================================================
-		
-		// Write the candidates to a collection.
-		event.put(pairCandidateCollectionName[0], pairCandidates.get(0), LCRelation.class, 0);
-		event.put(pairCandidateCollectionName[1], pairCandidates.get(1), LCRelation.class, 0);
-		event.put(singlesCandidateCollectionName[0], singlesCandidates.get(0), Cluster.class, clusterCollectionFlag);
-		event.put(singlesCandidateCollectionName[1], singlesCandidates.get(1), Cluster.class, clusterCollectionFlag);
-	}
+        OutputLogger.printNewLine(2);
+        OutputLogger.println("======================================================================");
+        OutputLogger.println("==== Cluster/Trigger Verification ====================================");
+        OutputLogger.println("======================================================================");
+        
+        
+        
+        // ==========================================================
+        // ==== Obtain SSP and TI Banks =============================
+        // ==========================================================
+        
+        // Get the SSP clusters.
+        if(event.hasCollection(GenericObject.class, bankCollectionName)) {
+            // Get the bank list.
+            List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+            
+            // Search through the banks and get the SSP and TI banks.
+            for(GenericObject obj : bankList) {
+                // If this is an SSP bank, parse it.
+                if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
+                    sspBank = new SSPData(obj);
+                }
+                
+                // Otherwise, if this is a TI bank, parse it.
+                else if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
+                    tiBank = new TIData(obj);
+                    
+                    tiFlags = new boolean[6];
+                    if(tiBank.isPulserTrigger()) {
+                        OutputLogger.println("Trigger type :: Pulser");
+                        tiFlags[TriggerDiagStats.PULSER] = true;
+                    } else if(tiBank.isSingle0Trigger()) {
+                        OutputLogger.println("Trigger type :: Singles 1");
+                        tiFlags[TriggerDiagStats.SINGLES0] = true;
+                    } else if(tiBank.isSingle1Trigger()) {
+                        OutputLogger.println("Trigger type :: Singles 2");
+                        tiFlags[TriggerDiagStats.SINGLES1] = true;
+                    } else if(tiBank.isPair0Trigger()) {
+                        OutputLogger.println("Trigger type :: Pair 1");
+                        tiFlags[TriggerDiagStats.PAIR0] = true;
+                    } else if(tiBank.isPair1Trigger()) {
+                        OutputLogger.println("Trigger type :: Pair 2");
+                        tiFlags[TriggerDiagStats.PAIR1] = true;
+                    } else if(tiBank.isCalibTrigger()) {
+                        OutputLogger.println("Trigger type :: Cosmic");
+                        tiFlags[TriggerDiagStats.COSMIC] = true;
+                    } else {
+                        System.err.println("TriggerDiagnosticDriver: Skipping event; no TI trigger source found.");
+                        return;
+                    }
+                    
+                    // Pass the TI triggers to the run statistical data
+                    // manager object.
+                    localStats.getTriggerStats().sawTITriggers(tiFlags);
+                    globalStats.getTriggerStats().sawTITriggers(tiFlags);
+                }
+            }
+            
+            // If there is an SSP bank, get the list of SSP clusters.
+            if(sspBank != null) {
+                sspClusters = sspBank.getClusters();
+                if(sspClusters.size() == 1) {
+                    OutputLogger.println("1 SSP cluster found.");
+                } else {
+                    OutputLogger.printf("%d SSP clusters found.%n", sspClusters.size());
+                }
+            }
+        }
+        
+        // Make sure that both an SSP bank and a TI bank were found.
+        if(tiBank == null || sspBank == null) {
+            System.err.println("TriggerDiagnosticDriver :: SEVERE WARNING :: TI bank or SSP bank missing from event!");
+            return;
+        }
+        
+        // Output the event number and information.
+        OutputLogger.printf("Event Number %d (%d)%n", sspBank.getEventNumber(), event.getEventNumber());
+        
+        
+        
+        // ==========================================================
+        // ==== Establish Event Integrity ===========================
+        // ==========================================================
+        
+        // Check that all of the required objects are present.
+        if(sspBank == null) {
+            OutputLogger.println("No SSP bank found for this event. No verification will be performed.");
+            if(verbose) { OutputLogger.printLog(); }
+            return;
+        } if(tiBank == null) {
+            OutputLogger.println("No TI bank found for this event. No verification will be performed.");
+            if(verbose) { OutputLogger.printLog(); }
+            return;
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Check the Noise Level ===============================
+        // ==========================================================
+        
+        // Check if there are hits.
+        if(event.hasCollection(CalorimeterHit.class, hitCollectionName)) {
+            // Check if there are more hits than the noise threshold.
+            if(event.get(CalorimeterHit.class, hitCollectionName).size() >= noiseThreshold) {
+                localStats.sawNoiseEvent();
+                globalStats.sawNoiseEvent();
+                OutputLogger.println("Noise event detected. Skipping event...");
+                if(verbose) { OutputLogger.printLog(); }
+                return;
+            }
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Obtain Reconstructed Clusters =======================
+        // ==========================================================
+        
+        // Get the reconstructed clusters.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the reconstructed clusters.
+            List<Cluster> allClusters = event.get(Cluster.class, clusterCollectionName);
+            
+            // Keep only the clusters that can be verified.
+            OutputLogger.println();
+            OutputLogger.println("Process cluster for verifiability:");
+            reconClusters.clear();
+            for(Cluster reconCluster : allClusters) {
+                // Check that the cluster is within the safe region of the
+                // FADC readout window. If it is not, it will likely have
+                // inaccurate energy or hit values and may not produce the
+                // expected results.
+                OutputLogger.printf("\t%s", TriggerDiagnosticUtil.clusterToString(reconCluster));
+                if(isVerifiable(reconCluster)) {
+                    reconClusters.add(reconCluster);
+                    OutputLogger.println(" [  verifiable  ]");
+                } else { OutputLogger.println(" [ unverifiable ]"); }
+            }
+            
+            // Output the number of verifiable clusters found.
+            if(reconClusters.size() == 1) { OutputLogger.println("1 verifiable reconstructed cluster found."); }
+            else { OutputLogger.printf("%d verifiable reconstructed clusters found.%n", reconClusters.size()); }
+            
+            // Output the number of unverifiable clusters found.
+            int unverifiableClusters = allClusters.size() - reconClusters.size();
+            if(unverifiableClusters == 1) { OutputLogger.println("1 unverifiable reconstructed cluster found."); }
+            else { OutputLogger.printf("%d unverifiable reconstructed clusters found.%n", unverifiableClusters); }
+        } else {
+            reconClusters = new ArrayList<Cluster>(0);
+            OutputLogger.printf("No reconstructed clusters were found for collection \"%s\" in this event.%n", clusterCollectionName);
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Perform Event Verification ==========================
+        // ==========================================================
+        
+        // Perform the cluster verification step.
+        if(performClusterVerification) { clusterVerification(); }
+        
+        // Get the simulated triggers.
+        if(event.hasCollection(SimTriggerData.class, "SimTriggers")) {
+            List<SimTriggerData> stdList = event.get(SimTriggerData.class, "SimTriggers");
+            triggerData = stdList.get(0);
+        }
+        
+        // Construct lists of triggers for the SSP clusters and the
+        // reconstructed clusters.
+        if(performSinglesTriggerVerification) {
+            singlesTriggerVerification();
+        }
+        if(performPairTriggerVerification) {
+            pairTriggerVerification();
+        }
+        
+        // Track how many events failed due to each type of verification.
+        if(clusterFail) {
+            localStats.failedClusterEvent();
+            globalStats.failedClusterEvent();
+        } if(pairInternalFail || pairEfficiencyFail) {
+            localStats.failedPairEvent();
+            globalStats.failedPairEvent();
+        } if(singlesInternalFail || singlesEfficiencyFail) {
+            localStats.failedSinglesEvent();
+            globalStats.failedSinglesEvent();
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Perform Event Write-Out =============================
+        // ==========================================================
+        
+        if(verbose ||(clusterFail && printClusterFail) ||
+                (singlesInternalFail && printSinglesTriggerInternalFail) ||
+                (singlesEfficiencyFail && printSinglesTriggerEfficiencyFail) ||
+                (pairInternalFail && printPairTriggerInternalFail) ||
+                (pairEfficiencyFail && printPairTriggerEfficiencyFail)) {
+            OutputLogger.printLog();
+        }   
+        
+        
+                
+        // ==========================================================
+        // ==== Process Local Tracked Variables =====================
+        // ==========================================================
+        if(localStats.getDuration() > localWindowThreshold) {
+            // Write a snapshot of the driver to the event stream.
+            List<DiagnosticSnapshot> snapshotList = new ArrayList<DiagnosticSnapshot>(2);
+            snapshotList.add(localStats.getSnapshot());
+            snapshotList.add(globalStats.getSnapshot());
+            
+            // Push the snapshot to the data stream.
+            event.put(diagnosticCollectionName, snapshotList);
+            
+            // Store values needed to calculate efficiency.
+            int[] matched = {
+                    localStats.getClusterStats().getMatches(),
+                    localStats.getTriggerStats().getSingles0Stats().getMatchedReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getSingles1Stats().getMatchedReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getPair0Stats().getMatchedReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getPair1Stats().getMatchedReconSimulatedTriggers()
+            };
+            int[] total = {
+                    localStats.getClusterStats().getReconClusterCount(),
+                    localStats.getTriggerStats().getSingles0Stats().getReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getSingles1Stats().getReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getPair0Stats().getReconSimulatedTriggers(),
+                    localStats.getTriggerStats().getPair1Stats().getReconSimulatedTriggers()
+            };
+            
+            // Calculate the efficiencies and upper/lower errors.
+            double[] efficiency = new double[5];
+            for(int i = 0; i < 5; i++) {
+                efficiency[i] = 1.0 * matched[i] / total[i];
+            }
+            
+            // Get the time for the current snapshot. This is the total
+            // run time before the snapshot plus half of the snapshot.
+            long time = globalStats.getDuration() - (localStats.getDuration() / 2);
+            
+            // Add them to the appropriate cloud plot.
+            for(int i = 0; i < 5; i++) { efficiencyTimeHist[i].fill(time, efficiency[i]); }
+            
+            // Clear the local statistical data.
+            localStats.clear();
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Write the Candidate Triggers ========================
+        // ==========================================================
+        
+        // Write the candidates to a collection.
+        event.put(pairCandidateCollectionName[0], pairCandidates.get(0), LCRelation.class, 0);
+        event.put(pairCandidateCollectionName[1], pairCandidates.get(1), LCRelation.class, 0);
+        event.put(singlesCandidateCollectionName[0], singlesCandidates.get(0), Cluster.class, clusterCollectionFlag);
+        event.put(singlesCandidateCollectionName[1], singlesCandidates.get(1), Cluster.class, clusterCollectionFlag);
+    }
 
-	public void setPrintResultsEveryNEvents(int n) {
-		statPrintInterval = n;
-	}
-	
-	public void setPrintOnClusterFailure(boolean state) {
-		printClusterFail = state;
-	}
-	
-	public void setPrintOnSinglesEfficiencyFailure(boolean state) {
-		printSinglesTriggerEfficiencyFail = state;
-	}
-	
-	public void setPrintOnSinglesSSPFailure(boolean state) {
-		printSinglesTriggerInternalFail = state;
-	}
-	
-	public void setPrintOnPairEfficiencyFailure(boolean state) {
-		printPairTriggerEfficiencyFail = state;
-	}
-	
-	public void setPrintOnPairSSPFailure(boolean state) {
-		printPairTriggerInternalFail = state;
-	}
-	
-	public void setVerbose(boolean state) {
-		verbose = state;
-	}
-	
-	public void setHitCollectionName(String hitCollectionName) {
-		this.hitCollectionName = hitCollectionName;
-	}
-	
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
-	
-	public void setBankCollectionName(String bankCollectionName) {
-		this.bankCollectionName = bankCollectionName;
-	}
-	
-	public void setNoiseThresholdCount(int noiseHits) {
-		noiseThreshold = noiseHits;
-	}
-	
-	public void setHitAcceptanceWindow(int window) {
-		hitAcceptance = window;
-	}
-	
-	public void setEnergyAcceptanceWindow(double window) {
-		energyAcceptance = window;
-	}
-	
-	public void setEnforceStrictTimeCompliance(boolean state) {
-		enforceTimeCompliance = state;
-	}
-	
-	public void setReadDAQConfig(boolean state) {
-		readDAQConfig = state;
-	}
-	
-	public void setLocalWindowThresholdMilliseconds(int localWindowThreshold) {
-	    this.localWindowThreshold = localWindowThreshold;
-	}
-	
-	/**
-	 * Attempts to match all reconstructed clusters that are safely
-	 * within the integration window with clusters reported by the SSP.
-	 * Method also tracks the ratio of valid reconstructed clusters to
-	 * matches found.<br/>
-	 * <br/>
-	 * Note that unmatched SSP clusters are ignored. Since these may
-	 * or may not correspond to reconstructed clusters that occur in
-	 * the forbidden time region, it is impossible to say whether or
-	 * not these legitimately failed to match or not.
-	 */
-	private void clusterVerification() {
-		// ==========================================================
-		// ==== Initialize Cluster Verification =====================
-		// ==========================================================
-		
-		// Print the cluster verification header.
-		OutputLogger.printNewLine(2);
-		OutputLogger.println("======================================================================");
-		OutputLogger.println("=== Cluster Verification =============================================");
-		OutputLogger.println("======================================================================");
-		
-		
-		
-		// ==========================================================
-		// ==== Perform Cluster Matching ============================
-		// ==========================================================
-		
-		// Track the number of cluster pairs that were matched and that
-		// failed by failure type.
-		DetailedClusterEvent event;
-		
-		if(enforceTimeCompliance) {
-			event = matchClustersTimeCompliant(reconClusters, sspClusters, energyAcceptance, hitAcceptance);
-		} else {
-			event = matchClusters(reconClusters, sspClusters, energyAcceptance, hitAcceptance);
-		}
-		
-		// Add the event results to the global results.
-		localStats.getClusterStats().addEvent(event);
-		globalStats.getClusterStats().addEvent(event);
-		localStats.getClusterStats().sawSSPClusters(sspClusters.size());
-		globalStats.getClusterStats().sawSSPClusters(sspClusters.size());
-		localStats.getClusterStats().sawReconClusters(reconClusters.size());
-		globalStats.getClusterStats().sawReconClusters(reconClusters.size());
-		
-		
-		
-		// ==========================================================
-		// ==== Output Event Summary ================================
-		// ==========================================================
-		
-		// Print the valid reconstructed clusters and populate their
-		// distribution graphs.
-		OutputLogger.println();
-		OutputLogger.println("Verified Reconstructed Clusters:");
-		if(!reconClusters.isEmpty()) {
-			for(Cluster reconCluster : reconClusters) {
-				OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(reconCluster));
-			}
-		} else { OutputLogger.println("\tNone"); }
-		
-		// Print the SSP clusters and populate their distribution graphs.
-		OutputLogger.println("SSP Clusters:");
-		if(!sspClusters.isEmpty()) {
-			for(SSPCluster sspCluster : sspClusters) {
-				OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(sspCluster));
-			}
-		} else { OutputLogger.println("\tNone"); }
-		
-		// Print the matched clusters.
-		OutputLogger.println("Matched Clusters:");
-		if(event.getMatches() != 0) {
-			// Iterate over the matched pairs.
-			for(ClusterMatchedPair pair : event.getClusterPairs()) {
-				// If the pair is a match, print it out.
-				if(pair.isMatch()) {
-					OutputLogger.printf("\t%s --> %s%n",
-							TriggerDiagnosticUtil.clusterToString(pair.getReconstructedCluster()),
-							TriggerDiagnosticUtil.clusterToString(pair.getSSPCluster()));
-				}
-			}
-		}
-		 else { OutputLogger.println("\tNone"); }
-		
-		// Print event statistics.
-		OutputLogger.println();
-		OutputLogger.println("Event Statistics:");
-		OutputLogger.printf("\tRecon Clusters     :: %d%n", reconClusters.size());
-		OutputLogger.printf("\tClusters Matched   :: %d%n", event.getMatches());
-		OutputLogger.printf("\tFailed (Position)  :: %d%n", event.getPositionFailures());
-		OutputLogger.printf("\tFailed (Time)      :: %d%n", event.getTimeFailures());
-		OutputLogger.printf("\tFailed (Energy)    :: %d%n", event.getEnergyFailures());
-		OutputLogger.printf("\tFailed (Hit Count) :: %d%n", event.getHitCountFailures());
-		OutputLogger.printf("\tCluster Efficiency :: %3.0f%%%n", 100.0 * event.getMatches() / reconClusters.size());
-		
-		// Note whether there was a cluster match failure.
-		if(event.isFailState() || event.getMatches() - reconClusters.size() != 0) {
-			clusterFail = true;
-		}
-		
-		
-		
-		// TEMP :: Populate the cluster diagnostic plots.
-		
-		// Populate the ALL cluster plots.
-		for(Cluster cluster : reconClusters) {
-			clusterHitPlot[RECON][ALL].fill(cluster.getCalorimeterHits().size());
-			clusterEnergyPlot[RECON][ALL].fill(cluster.getEnergy());
-			clusterTimePlot[RECON][ALL].fill(cluster.getCalorimeterHits().get(0).getTime());
-			Point position = TriggerDiagnosticUtil.getClusterPosition(cluster);
-			clusterPositionPlot[RECON][ALL].fill(position.x, position.y);
-		}
-		for(SSPCluster cluster : sspClusters) {
-			clusterHitPlot[SSP][ALL].fill(cluster.getHitCount());
-			clusterEnergyPlot[SSP][ALL].fill(cluster.getEnergy());
-			clusterTimePlot[SSP][ALL].fill(cluster.getTime());
-			clusterPositionPlot[SSP][ALL].fill(cluster.getXIndex(), cluster.getYIndex());
-		}
-		
-		// Populate the matched and failed plots.
-		for(ClusterMatchedPair pair : event.getClusterPairs()) {
-			 if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
-				double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
-				int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
-				energyhitDiffPlot[ALL].fill(energyDiff, hitDiff);
-			 }
-			
-			if(pair.isMatch()) {
-				if(pair.getFirstElement() != null) {
-					clusterHitPlot[RECON][MATCHED].fill(pair.getFirstElement().getCalorimeterHits().size());
-					clusterEnergyPlot[RECON][MATCHED].fill(pair.getFirstElement().getEnergy());
-					clusterTimePlot[RECON][MATCHED].fill(pair.getFirstElement().getCalorimeterHits().get(0).getTime());
-					Point position = TriggerDiagnosticUtil.getClusterPosition(pair.getFirstElement());
-					clusterPositionPlot[RECON][MATCHED].fill(position.x, position.y);
-				} if(pair.getSecondElement() != null) {
-					clusterHitPlot[SSP][MATCHED].fill(pair.getSecondElement().getHitCount());
-					clusterEnergyPlot[SSP][MATCHED].fill(pair.getSecondElement().getEnergy());
-					clusterTimePlot[SSP][MATCHED].fill(pair.getSecondElement().getTime());
-					clusterPositionPlot[SSP][MATCHED].fill(pair.getSecondElement().getXIndex(), pair.getSecondElement().getYIndex());
-				} if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
-					double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
-					int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
-					energyhitDiffPlot[MATCHED].fill(energyDiff, hitDiff);
-				}
-			} else {
-				if(pair.getFirstElement() != null) {
-					clusterHitPlot[RECON][FAILED].fill(pair.getFirstElement().getCalorimeterHits().size());
-					clusterEnergyPlot[RECON][FAILED].fill(pair.getFirstElement().getEnergy());
-					clusterTimePlot[RECON][FAILED].fill(pair.getFirstElement().getCalorimeterHits().get(0).getTime());
-					Point position = TriggerDiagnosticUtil.getClusterPosition(pair.getFirstElement());
-					clusterPositionPlot[RECON][FAILED].fill(position.x, position.y);
-				} if(pair.getSecondElement() != null) {
-					clusterHitPlot[SSP][FAILED].fill(pair.getSecondElement().getHitCount());
-					clusterEnergyPlot[SSP][FAILED].fill(pair.getSecondElement().getEnergy());
-					clusterTimePlot[SSP][FAILED].fill(pair.getSecondElement().getTime());
-					clusterPositionPlot[SSP][FAILED].fill(pair.getSecondElement().getXIndex(), pair.getSecondElement().getYIndex());
-				} if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
-					double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
-					int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
-					energyhitDiffPlot[FAILED].fill(energyDiff, hitDiff);
-				}
-			}
-		}
-	}
-	
-	/**
+    public void setPrintResultsEveryNEvents(int n) {
+        statPrintInterval = n;
+    }
+    
+    public void setPrintOnClusterFailure(boolean state) {
+        printClusterFail = state;
+    }
+    
+    public void setPrintOnSinglesEfficiencyFailure(boolean state) {
+        printSinglesTriggerEfficiencyFail = state;
+    }
+    
+    public void setPrintOnSinglesSSPFailure(boolean state) {
+        printSinglesTriggerInternalFail = state;
+    }
+    
+    public void setPrintOnPairEfficiencyFailure(boolean state) {
+        printPairTriggerEfficiencyFail = state;
+    }
+    
+    public void setPrintOnPairSSPFailure(boolean state) {
+        printPairTriggerInternalFail = state;
+    }
+    
+    public void setVerbose(boolean state) {
+        verbose = state;
+    }
+    
+    public void setHitCollectionName(String hitCollectionName) {
+        this.hitCollectionName = hitCollectionName;
+    }
+    
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    public void setBankCollectionName(String bankCollectionName) {
+        this.bankCollectionName = bankCollectionName;
+    }
+    
+    public void setNoiseThresholdCount(int noiseHits) {
+        noiseThreshold = noiseHits;
+    }
+    
+    public void setHitAcceptanceWindow(int window) {
+        hitAcceptance = window;
+    }
+    
+    public void setEnergyAcceptanceWindow(double window) {
+        energyAcceptance = window;
+    }
+    
+    public void setEnforceStrictTimeCompliance(boolean state) {
+        enforceTimeCompliance = state;
+    }
+    
+    public void setReadDAQConfig(boolean state) {
+        readDAQConfig = state;
+    }
+    
+    public void setLocalWindowThresholdMilliseconds(int localWindowThreshold) {
+        this.localWindowThreshold = localWindowThreshold;
+    }
+    
+    /**
+     * Attempts to match all reconstructed clusters that are safely
+     * within the integration window with clusters reported by the SSP.
+     * Method also tracks the ratio of valid reconstructed clusters to
+     * matches found.<br/>
+     * <br/>
+     * Note that unmatched SSP clusters are ignored. Since these may
+     * or may not correspond to reconstructed clusters that occur in
+     * the forbidden time region, it is impossible to say whether or
+     * not these legitimately failed to match or not.
+     */
+    private void clusterVerification() {
+        // ==========================================================
+        // ==== Initialize Cluster Verification =====================
+        // ==========================================================
+        
+        // Print the cluster verification header.
+        OutputLogger.printNewLine(2);
+        OutputLogger.println("======================================================================");
+        OutputLogger.println("=== Cluster Verification =============================================");
+        OutputLogger.println("======================================================================");
+        
+        
+        
+        // ==========================================================
+        // ==== Perform Cluster Matching ============================
+        // ==========================================================
+        
+        // Track the number of cluster pairs that were matched and that
+        // failed by failure type.
+        DetailedClusterEvent event;
+        
+        if(enforceTimeCompliance) {
+            event = matchClustersTimeCompliant(reconClusters, sspClusters, energyAcceptance, hitAcceptance);
+        } else {
+            event = matchClusters(reconClusters, sspClusters, energyAcceptance, hitAcceptance);
+        }
+        
+        // Add the event results to the global results.
+        localStats.getClusterStats().addEvent(event);
+        globalStats.getClusterStats().addEvent(event);
+        localStats.getClusterStats().sawSSPClusters(sspClusters.size());
+        globalStats.getClusterStats().sawSSPClusters(sspClusters.size());
+        localStats.getClusterStats().sawReconClusters(reconClusters.size());
+        globalStats.getClusterStats().sawReconClusters(reconClusters.size());
+        
+        
+        
+        // ==========================================================
+        // ==== Output Event Summary ================================
+        // ==========================================================
+        
+        // Print the valid reconstructed clusters and populate their
+        // distribution graphs.
+        OutputLogger.println();
+        OutputLogger.println("Verified Reconstructed Clusters:");
+        if(!reconClusters.isEmpty()) {
+            for(Cluster reconCluster : reconClusters) {
+                OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(reconCluster));
+            }
+        } else { OutputLogger.println("\tNone"); }
+        
+        // Print the SSP clusters and populate their distribution graphs.
+        OutputLogger.println("SSP Clusters:");
+        if(!sspClusters.isEmpty()) {
+            for(SSPCluster sspCluster : sspClusters) {
+                OutputLogger.printf("\t%s%n", TriggerDiagnosticUtil.clusterToString(sspCluster));
+            }
+        } else { OutputLogger.println("\tNone"); }
+        
+        // Print the matched clusters.
+        OutputLogger.println("Matched Clusters:");
+        if(event.getMatches() != 0) {
+            // Iterate over the matched pairs.
+            for(ClusterMatchedPair pair : event.getClusterPairs()) {
+                // If the pair is a match, print it out.
+                if(pair.isMatch()) {
+                    OutputLogger.printf("\t%s --> %s%n",
+                            TriggerDiagnosticUtil.clusterToString(pair.getReconstructedCluster()),
+                            TriggerDiagnosticUtil.clusterToString(pair.getSSPCluster()));
+                }
+            }
+        }
+         else { OutputLogger.println("\tNone"); }
+        
+        // Print event statistics.
+        OutputLogger.println();
+        OutputLogger.println("Event Statistics:");
+        OutputLogger.printf("\tRecon Clusters     :: %d%n", reconClusters.size());
+        OutputLogger.printf("\tClusters Matched   :: %d%n", event.getMatches());
+        OutputLogger.printf("\tFailed (Position)  :: %d%n", event.getPositionFailures());
+        OutputLogger.printf("\tFailed (Time)      :: %d%n", event.getTimeFailures());
+        OutputLogger.printf("\tFailed (Energy)    :: %d%n", event.getEnergyFailures());
+        OutputLogger.printf("\tFailed (Hit Count) :: %d%n", event.getHitCountFailures());
+        OutputLogger.printf("\tCluster Efficiency :: %3.0f%%%n", 100.0 * event.getMatches() / reconClusters.size());
+        
+        // Note whether there was a cluster match failure.
+        if(event.isFailState() || event.getMatches() - reconClusters.size() != 0) {
+            clusterFail = true;
+        }
+        
+        
+        
+        // TEMP :: Populate the cluster diagnostic plots.
+        
+        // Populate the ALL cluster plots.
+        for(Cluster cluster : reconClusters) {
+            clusterHitPlot[RECON][ALL].fill(cluster.getCalorimeterHits().size());
+            clusterEnergyPlot[RECON][ALL].fill(cluster.getEnergy());
+            clusterTimePlot[RECON][ALL].fill(cluster.getCalorimeterHits().get(0).getTime());
+            Point position = TriggerDiagnosticUtil.getClusterPosition(cluster);
+            clusterPositionPlot[RECON][ALL].fill(position.x, position.y);
+        }
+        for(SSPCluster cluster : sspClusters) {
+            clusterHitPlot[SSP][ALL].fill(cluster.getHitCount());
+            clusterEnergyPlot[SSP][ALL].fill(cluster.getEnergy());
+            clusterTimePlot[SSP][ALL].fill(cluster.getTime());
+            clusterPositionPlot[SSP][ALL].fill(cluster.getXIndex(), cluster.getYIndex());
+        }
+        
+        // Populate the matched and failed plots.
+        for(ClusterMatchedPair pair : event.getClusterPairs()) {
+             if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
+                double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
+                int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
+                energyhitDiffPlot[ALL].fill(energyDiff, hitDiff);
+             }
+            
+            if(pair.isMatch()) {
+                if(pair.getFirstElement() != null) {
+                    clusterHitPlot[RECON][MATCHED].fill(pair.getFirstElement().getCalorimeterHits().size());
+                    clusterEnergyPlot[RECON][MATCHED].fill(pair.getFirstElement().getEnergy());
+                    clusterTimePlot[RECON][MATCHED].fill(pair.getFirstElement().getCalorimeterHits().get(0).getTime());
+                    Point position = TriggerDiagnosticUtil.getClusterPosition(pair.getFirstElement());
+                    clusterPositionPlot[RECON][MATCHED].fill(position.x, position.y);
+                } if(pair.getSecondElement() != null) {
+                    clusterHitPlot[SSP][MATCHED].fill(pair.getSecondElement().getHitCount());
+                    clusterEnergyPlot[SSP][MATCHED].fill(pair.getSecondElement().getEnergy());
+                    clusterTimePlot[SSP][MATCHED].fill(pair.getSecondElement().getTime());
+                    clusterPositionPlot[SSP][MATCHED].fill(pair.getSecondElement().getXIndex(), pair.getSecondElement().getYIndex());
+                } if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
+                    double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
+                    int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
+                    energyhitDiffPlot[MATCHED].fill(energyDiff, hitDiff);
+                }
+            } else {
+                if(pair.getFirstElement() != null) {
+                    clusterHitPlot[RECON][FAILED].fill(pair.getFirstElement().getCalorimeterHits().size());
+                    clusterEnergyPlot[RECON][FAILED].fill(pair.getFirstElement().getEnergy());
+                    clusterTimePlot[RECON][FAILED].fill(pair.getFirstElement().getCalorimeterHits().get(0).getTime());
+                    Point position = TriggerDiagnosticUtil.getClusterPosition(pair.getFirstElement());
+                    clusterPositionPlot[RECON][FAILED].fill(position.x, position.y);
+                } if(pair.getSecondElement() != null) {
+                    clusterHitPlot[SSP][FAILED].fill(pair.getSecondElement().getHitCount());
+                    clusterEnergyPlot[SSP][FAILED].fill(pair.getSecondElement().getEnergy());
+                    clusterTimePlot[SSP][FAILED].fill(pair.getSecondElement().getTime());
+                    clusterPositionPlot[SSP][FAILED].fill(pair.getSecondElement().getXIndex(), pair.getSecondElement().getYIndex());
+                } if(pair.getFirstElement() != null && pair.getSecondElement() != null) {
+                    double energyDiff = pair.getSecondElement().getEnergy() - pair.getFirstElement().getEnergy();
+                    int hitDiff = pair.getSecondElement().getHitCount() - pair.getFirstElement().getCalorimeterHits().size();
+                    energyhitDiffPlot[FAILED].fill(energyDiff, hitDiff);
+                }
+            }
+        }
+    }
+    
+    /**
      * Performs cluster matching between a collection of reconstructed
-	 * clusters and a collection of SSP clusters with an algorithm that
-	 * ignores the times reported for each cluster.
-	 * @param reconClusters - A collection of reconstructed clusters.
-	 * @param sspClusters - A collection of SSP clusters.
-	 * @param energyWindow - The window of allowed deviation between
-	 * the reconstructed cluster and SSP cluster energies.
-	 * @param hitWindow - The window of allowed deviation between
-	 * the reconstructed cluster and SSP cluster hit counts.
-	 * @return Returns the cluster matching results stored inside a
-	 * <code>clusterMatchEvent</code> object.
-	 */
-	private static final DetailedClusterEvent matchClusters(Collection<Cluster> reconClusters,
-			Collection<SSPCluster> sspClusters, double energyWindow, int hitWindow) {
-		// Track the number of cluster pairs that were matched and that
-		// failed by failure type.
-		DetailedClusterEvent event = new DetailedClusterEvent();
-		
-		// Create maps to link cluster position to the list of clusters
-		// that were found at that location.
-		Map<Point, List<Cluster>> reconClusterMap = new HashMap<Point, List<Cluster>>(reconClusters.size());
-		Map<Point, List<SSPCluster>> sspClusterMap = new HashMap<Point, List<SSPCluster>>(reconClusters.size());
-		
-		// Populate the reconstructed cluster map.
-		for(Cluster reconCluster : reconClusters) {
-			// Get the cluster position.
-			Point position = new Point(TriggerDiagnosticUtil.getXIndex(reconCluster),
-					TriggerDiagnosticUtil.getYIndex(reconCluster));
-			
-			// Get the list for this cluster position.
-			List<Cluster> reconList = reconClusterMap.get(position);
-			if(reconList == null) {
-				reconList = new ArrayList<Cluster>();
-				reconClusterMap.put(position, reconList);
-			}
-			
-			// Add the cluster to the list.
-			reconList.add(reconCluster);
-		}
-		
-		// Populate the SSP cluster map.
-		for(SSPCluster sspCluster : sspClusters) {
-			// Get the cluster position.
-			Point position = new Point(sspCluster.getXIndex(), sspCluster.getYIndex());
-			
-			// Get the list for this cluster position.
-			List<SSPCluster> sspList = sspClusterMap.get(position);
-			if(sspList == null) {
-				sspList = new ArrayList<SSPCluster>();
-				sspClusterMap.put(position, sspList);
-			}
-			
-			// Add the cluster to the list.
-			sspList.add(sspCluster);
-		}
-		
-		// For each reconstructed cluster, attempt to match the clusters
-		// with SSP clusters at the same position.
-		positionLoop:
-		for(Entry<Point, List<Cluster>> clusterSet : reconClusterMap.entrySet()) {
-			// Get the reconstructed and SSP clusters at this position.
-			List<Cluster> reconList = clusterSet.getValue();
-			List<SSPCluster> sspList = sspClusterMap.get(clusterSet.getKey());
-			
-			// Print the crystal position header.
-			OutputLogger.println();
-			OutputLogger.printf("Considering clusters at (%3d, %3d)%n", clusterSet.getKey().x, clusterSet.getKey().y);
-			
-			// If there are no SSP clusters, then matching fails by
-			// reason of position. The remainder of the loop may be
-			// skipped, since there is nothing to check.
-			if(sspList == null || sspList.isEmpty()) {
-				event.pairFailPosition(reconList.size());
-				continue positionLoop;
-			}
-			
-			// Get all possible permutations of SSP clusters.
-			List<List<Pair<Cluster, SSPCluster>>> permutations = getPermutations(reconList, sspList);
-			
-			// Print the information for this crystal position.
-			OutputLogger.printf("\tRecon Clusters :: %d%n", reconList.size());
-			OutputLogger.printf("\tSSP Clusters   :: %d%n", sspList.size());
-			OutputLogger.printf("\tPermutations   :: %d%n", permutations.size());
-			
-			// Track the plotted values for the current best permutation.
-			DetailedClusterEvent bestPerm = null;
-			
-			// Iterate over the permutations and find the permutation
-			// that produces the best possible result when compared to
-			// the reconstructed clusters.
-			int permIndex = 0;
-			for(List<Pair<Cluster, SSPCluster>> pairs : permutations) {
-				// Update the current permutation number.
-				permIndex++;
-				
-				// Track the plot values for this permutation.
-				DetailedClusterEvent perm = new DetailedClusterEvent();
-				
-				// Try to match each pair.
-				pairLoop:
-				for(Pair<Cluster, SSPCluster> pair : pairs) {
-					// Print the current reconstructed/SSP cluster pair.
-					OutputLogger.printf("\tP%d :: %s --> %s", permIndex,
-							pair.getFirstElement() == null ? "None" : TriggerDiagnosticUtil.clusterToString(pair.getFirstElement()),
-							pair.getSecondElement() == null ? "None" : TriggerDiagnosticUtil.clusterToString(pair.getSecondElement()));
-					
-					// If either cluster in the pair is null, there
-					// are not enough clusters to perform this match.
-					if(pair.getFirstElement() == null || pair.getSecondElement() == null) {
-						// Log the result.
-						OutputLogger.printf(" [ %18s ]%n", "failure: unpaired");
-						
-						// An unpaired SSP cluster does not necessarily
-						// represent a problem. Often, this just means
-						// that the SSP cluster's matching reconstructed
-						// cluster is outside the verification window.
-						if(pair.getSecondElement() == null) {
-							perm.pairFailPosition(pair.getFirstElement(), pair.getSecondElement());
-						}
-						
-						// Skip the rest of the checks.
-						continue pairLoop;
-					}
-					
-					// Check if the reconstructed cluster has an energy
-					// within the allotted threshold of the SSP cluster.
-					if(pair.getSecondElement().getEnergy() >= pair.getFirstElement().getEnergy() - energyWindow &&
-							pair.getSecondElement().getEnergy() <= pair.getFirstElement().getEnergy() + energyWindow) {
-						
-						// Check that the hit count of the reconstructed
-						// is within the allotted threshold of the SSP
-						// cluster.
-						if(pair.getSecondElement().getHitCount() >= pair.getFirstElement().getCalorimeterHits().size() - hitWindow &&
-								pair.getSecondElement().getHitCount() <= pair.getFirstElement().getCalorimeterHits().size() + hitWindow) {
-							// Designate the pair as a match.
-							perm.pairMatch(pair.getFirstElement(), pair.getSecondElement());
-							OutputLogger.printf(" [ %18s ]%n", "success: matched");
-						} else {
-							perm.pairFailHitCount(pair.getFirstElement(), pair.getSecondElement());
-							OutputLogger.printf(" [ %18s ]%n", "failure: hit count");
-						} // End hit count check.
-					} else {
-						perm.pairFailEnergy(pair.getFirstElement(), pair.getSecondElement());
-						OutputLogger.printf(" [ %18s ]%n", "failure: energy");
-					} // End energy check.
-				} // End Pair Loop
-				
-				// Print the results of the permutation.
-				OutputLogger.printf("\t\tPermutation Matched   :: %d%n", perm.getMatches());
-				OutputLogger.printf("\t\tPermutation Energy    :: %d%n", perm.getEnergyFailures());
-				OutputLogger.printf("\t\tPermutation Hit Count :: %d%n", perm.getHitCountFailures());
-				
-				// Check whether the results from this permutation
-				// exceed the quality of the last best results. A
-				// greater number of matches is always better. If the
-				// matches are the same, select the one with fewer
-				// failures due to energy.
-				bestPerm = getBestPermutation(bestPerm, perm);
-			} // End Permutation Loop
-			
-			// Print the final results for the position.
-			OutputLogger.printf("\tPosition Matched   :: %d%n", bestPerm.getMatches());
-			OutputLogger.printf("\tPosition Energy    :: %d%n", bestPerm.getEnergyFailures());
-			OutputLogger.printf("\tPosition Hit Count :: %d%n", bestPerm.getHitCountFailures());
-			
-			// Add the results from the best-matched permutation
-			// to the event efficiency results.
-			event.addEvent(bestPerm);
-		} // End Crystal Position Loop
-		
-		// Return the cluster match summary.
-		return event;
-	}
-	
-	/**
-	 * Performs cluster matching between a collection of reconstructed
-	 * clusters and a collection of SSP clusters using the strictly
-	 * time-compliant algorithm.
-	 * @param reconClusters - A collection of reconstructed clusters.
-	 * @param sspClusters - A collection of SSP clusters.
-	 * @param energyWindow - The window of allowed deviation between
-	 * the reconstructed cluster and SSP cluster energies.
-	 * @param hitWindow - The window of allowed deviation between
-	 * the reconstructed cluster and SSP cluster hit counts.
-	 * @return Returns the cluster matching results stored inside a
-	 * <code>clusterMatchEvent</code> object.
-	 */
-	private static final DetailedClusterEvent matchClustersTimeCompliant(Collection<Cluster> reconClusters,
-			Collection<SSPCluster> sspClusters, double energyWindow, int hitWindow) {
-		// Track the number of cluster pairs that were matched and that
-		// failed by failure type.
-		DetailedClusterEvent event = new DetailedClusterEvent();
-		
-		// Store the clusters which have been successfully paired.
-		Set<SSPCluster> sspMatched = new HashSet<SSPCluster>(sspClusters.size());
-		
-		// Find reconstructed/SSP cluster matched pairs.
-		reconLoop:
-		for(Cluster reconCluster : reconClusters) {
-			// Track whether a position-matched cluster was found.
-			boolean matchedPosition = false;
-			
-			// VERBOSE :: Output the cluster being matched.
-			OutputLogger.printf("Considering %s%n", TriggerDiagnosticUtil.clusterToString(reconCluster));
-			
-			// Search through the SSP clusters for a matching cluster.
-			sspLoop:
-			for(SSPCluster sspCluster : sspClusters) {
-				// VERBOSE :: Output the SSP cluster being considered.
-				OutputLogger.printf("\t%s ", TriggerDiagnosticUtil.clusterToString(sspCluster));
-				
-				// If this cluster has been paired, skip it.
-				if(sspMatched.contains(sspCluster)) {
-					OutputLogger.printf("[ %7s; %9s ]%n", "fail", "matched");
-					continue sspLoop;
-				}
-				
-				// Matched clusters must have the same position.
-				if(TriggerDiagnosticUtil.getXIndex(reconCluster) != sspCluster.getXIndex()
-						|| TriggerDiagnosticUtil.getYIndex(reconCluster) != sspCluster.getYIndex()) {
-					OutputLogger.printf("[ %7s; %9s ]%n", "fail", "position");
-					continue sspLoop;
-				}
-				
-				// Note that a cluster was found at this position.
-				matchedPosition = true;
-				
-				// Matched clusters must have the same time-stamp.
-				if(reconCluster.getCalorimeterHits().get(0).getTime() != sspCluster.getTime()) {
-					OutputLogger.printf("[ %7s; %9s ]%n", "fail", "time");
-					continue sspLoop;
-				}
-				
-				// Clusters that pass all of the above checks are the
-				// same cluster.
-				sspMatched.add(sspCluster);
-				
-				// Check that the clusters are sufficiently close in
-				// energy to one another.
-				if(sspCluster.getEnergy() >= reconCluster.getEnergy() - energyWindow
-						&& sspCluster.getEnergy() <= reconCluster.getEnergy() + energyWindow) {
-					// If a cluster matches in energy, check that it
-					// is also sufficiently close in hit count.
-					if(sspCluster.getHitCount() >= reconCluster.getCalorimeterHits().size() - hitWindow &&
-							sspCluster.getHitCount() <= reconCluster.getCalorimeterHits().size() + hitWindow) {
-						// The cluster is a match.
-						event.pairMatch(reconCluster, sspCluster);
-						OutputLogger.printf("[ %7s; %9s ]%n", "success", "matched");
-						continue reconLoop;
-					} else {
-						event.pairFailHitCount(reconCluster, sspCluster);
-						OutputLogger.printf("[ %7s; %9s ]%n", "fail", "hit count");
-						continue reconLoop;
-					} // End hit count check.
-				} else {
-					event.pairFailEnergy(reconCluster, sspCluster);
-					OutputLogger.printf("[ %7s; %9s ]%n", "fail", "energy");
-					continue reconLoop;
-				} // End energy check.
-			}// End SSP loop.
-			
-			// If the reconstructed cluster has not been matched, check
-			// if a cluster was found at the same position. If not, then
-			// the cluster fails by reason of position.
-			if(!matchedPosition) {
-				event.pairFailPosition(reconCluster, null);
-			}
-			
-			// Otherwise, the cluster had a potential matched, but the
-			// time-stamps were off. The cluster fails by reason of time.
-			else {
-				event.pairFailTime(reconCluster, null);
-			}
-		} // End recon loop.
-		
-		// Return the populated match event.
-		return event;
-	}
-	
-	/**
-	 * Checks triggers simulated on SSP clusters against the SSP bank's
-	 * reported triggers to verify that the trigger is correctly applying
-	 * cuts to the clusters it sees. Additionally compares triggers
-	 * simulated on reconstructed clusters to measure trigger efficiency.
-	 */
-	private void singlesTriggerVerification() {
-		// Create lists of generic triggers.
-		List<List<? extends Trigger<?>>> sspTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
-		List<List<? extends Trigger<?>>> reconTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
-		
-		// Convert the simulated triggers to generic versions and add
-		// them to the generic list.
-		sspTriggerList.add(triggerData.getSimSSPTriggers().getSingles0Triggers());
-		sspTriggerList.add(triggerData.getSimSSPTriggers().getSingles1Triggers());
-		reconTriggerList.add(triggerData.getSimReconTriggers().getSingles0Triggers());
-		reconTriggerList.add(triggerData.getSimReconTriggers().getSingles1Triggers());
-		
-		// Run generic trigger verification.
-		triggerVerification(sspTriggerList, reconTriggerList, true);
-	}
-	
-	/**
-	 * Checks triggers simulated on SSP clusters against the SSP bank's
-	 * reported triggers to verify that the trigger is correctly applying
-	 * cuts to the clusters it sees. Additionally compares triggers
-	 * simulated on reconstructed clusters to measure trigger efficiency.
-	 */
-	private void pairTriggerVerification() {
-		// Create lists of generic triggers.
-		List<List<? extends Trigger<?>>> sspTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
-		List<List<? extends Trigger<?>>> reconTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
-		
-		// Convert the simulated triggers to generic versions and add
-		// them to the generic list.
-		sspTriggerList.add(triggerData.getSimSSPTriggers().getPair0Triggers());
-		sspTriggerList.add(triggerData.getSimSSPTriggers().getPair1Triggers());
-		reconTriggerList.add(triggerData.getSimReconTriggers().getPair0Triggers());
-		reconTriggerList.add(triggerData.getSimReconTriggers().getPair1Triggers());
-		
-		// Run generic trigger verification.
-		triggerVerification(sspTriggerList, reconTriggerList, false);
-	}
-	
-	/**
-	 * Performs trigger verification for both trigger types.
-	 * @param sspTriggerList - The list of SSP triggers.
-	 * @param reconTriggerList - The list of reconstructed triggers.
-	 * @param isSingles - Whether or not this is a singles trigger
-	 * verification.
-	 */
-	private void triggerVerification(List<List<? extends Trigger<?>>> sspTriggerList, 
-			List<List<? extends Trigger<?>>> reconTriggerList, boolean isSingles) {
-		
-		// ==========================================================
-		// ==== Initialize Trigger Verification =====================
-		// ==========================================================
-		
-		// Print the cluster verification header.
-		OutputLogger.println();
-		OutputLogger.println();
-		OutputLogger.println("======================================================================");
-		if(isSingles) { OutputLogger.println("=== Singles Trigger Verification ====================================="); }
-		else { OutputLogger.println("=== Pair Trigger Verification ========================================"); }
-		OutputLogger.println("======================================================================");
-		
-		// Track the number of triggers seen and the number found.
-		TriggerEvent[] triggerEvent = { new TriggerEvent(), new TriggerEvent() };
-		
-		// ==========================================================
-		// ==== Output Event Summary ================================
-		// ==========================================================
-		
-		// Get the list of triggers reported by the SSP.
-		List<? extends SSPNumberedTrigger> sspTriggers;
-		if(isSingles) { sspTriggers = sspBank.getSinglesTriggers(); }
-		else { sspTriggers = sspBank.getPairTriggers(); }
-		
-		// Output the SSP cluster triggers.
-		OutputLogger.println();
-		OutputLogger.println("SSP Cluster " + (isSingles ? "Singles" : "Pair") + " Triggers");
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
-				OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
-						(triggerNum + 1), triggerPositionString(simTrigger),
-						getTriggerTime(simTrigger), simTrigger.toString());
-			}
-		}
-		if(sspTriggerList.get(0).size() + sspTriggerList.get(1).size() == 0) {
-			OutputLogger.println("\tNone");
-		}
-		
-		// Output the reconstructed cluster singles triggers.
-		OutputLogger.println("Reconstructed Cluster " + (isSingles ? "Singles" : "Pair") + " Triggers");
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			for(Trigger<?> simTrigger : reconTriggerList.get(triggerNum)) {
-				OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
-						(triggerNum + 1), triggerPositionString(simTrigger),
-						getTriggerTime(simTrigger), simTrigger.toString());
-			}
-		}
-		if(reconTriggerList.get(0).size() + reconTriggerList.get(1).size() == 0) {
-			OutputLogger.println("\tNone");
-		}
-		
-		// Output the SSP reported triggers.
-		OutputLogger.println("SSP Reported " + (isSingles ? "Singles" : "Pair") + " Triggers");
-		for(SSPTrigger sspTrigger : sspTriggers) {
-			OutputLogger.printf("\t%s%n", sspTrigger.toString());
-		}
-		if(sspTriggers.size() == 0) { OutputLogger.println("\tNone"); }
-		
-		// Update the trigger event with the counts for each type of
-		// simulated trigger. Reported triggers are counted later when
-		// already iterating over them.
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			triggerEvent[triggerNum].sawSSPSimulatedTriggers(tiFlags, sspTriggerList.get(triggerNum).size());
-			triggerEvent[triggerNum].sawReconSimulatedTriggers(tiFlags, reconTriggerList.get(triggerNum).size());
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== SSP Internal Logic Verification =====================
-		// ==========================================================
-		
-		// Track which SSP triggers have been matched to avoid matching
-		// multiple reconstructed SSP cluster triggers to the same SSP
-		// trigger.
-		Set<SSPNumberedTrigger> sspTriggerSet = new HashSet<SSPNumberedTrigger>();
-		Set<Trigger<?>> simTriggerSet = new HashSet<Trigger<?>>();
-		
-		// Track the number of SSP reported triggers that are found in
-		// excess of the SSP simulated triggers.
-		int sspReportedExtras = sspTriggers.size() - (sspTriggerList.get(0).size() + sspTriggerList.get(1).size());
-		if(sspReportedExtras > 0) {
-			if(isSingles) { singlesInternalFail = true; }
-			else { pairInternalFail = true; }
-		} else { sspReportedExtras = 0; }
-		
-		// Iterate over the triggers.
-		OutputLogger.println();
-		OutputLogger.println("Matching SSP Reported Triggers to SSP Simulated Triggers:");
-		for(SSPNumberedTrigger sspTrigger : sspTriggers) {
-			// Get the trigger information.
-			int triggerNum = sspTrigger.isFirstTrigger() ? 0 : 1;
-			OutputLogger.printf("\t%s%n", sspTrigger.toString());
-			
-			// Note that a bank trigger was seen.
-			triggerEvent[triggerNum].sawReportedTrigger();
-			
-			// Iterate over the SSP cluster simulated triggers and
-			// look for a trigger that matches.
-			matchLoop:
-			for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
-				// VERBOSE :: Output the trigger being considered for
-				//            matching.
-				OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s ",
-						(triggerNum + 1), triggerPositionString(simTrigger),
-						getTriggerTime(simTrigger), simTrigger.toString());
-				
-				// If the current SSP trigger has already been matched,
-				// skip it.
-				if(simTriggerSet.contains(simTrigger)) {
-					OutputLogger.printf("[ %-15s ]%n", "failed; matched");
-					continue matchLoop;
-				}
-				
-				// Check that the triggers have the same time. Triggers
-				// generated from SSP bank clusters should always align
-				// in time.
-				if(sspTrigger.getTime() != getTriggerTime(simTrigger)) {
-					OutputLogger.printf("[ %-15s ]%n", "failed; time");
-					continue matchLoop;
-				}
-				
-				// Check whether the trigger cuts match.
-				boolean[] matchedCuts = triggerCutMatch(simTrigger, sspTrigger);
-				for(int i = 0; i < matchedCuts.length; i++) {
-					if(!matchedCuts[i]) {
-						int typeIndex = isSingles ? 0 : 1;
-						OutputLogger.printf("[ %-15s ]%n", String.format("failed; %s", cutNames[typeIndex][i]));
-						continue matchLoop;
-					}
-				}
-				
-				// If all the cuts match, along with the time and the
-				// trigger number, than these triggers are a match.
-				sspTriggerSet.add(sspTrigger);
-				simTriggerSet.add(simTrigger);
-				triggerEvent[triggerNum].matchedSSPTrigger(tiFlags);
-				OutputLogger.printf("[ %-15s ]%n", "success");
-				break matchLoop;
-			}
-		}
-		
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
-				globalTriggerPlots.sawTrigger(simTrigger);
-				if(simTriggerSet.contains(simTrigger)) {
-					globalTriggerPlots.matchedTrigger(simTrigger);
-				} else {
-					globalTriggerPlots.failedTrigger(simTrigger);
-				}
-			}
-		}
-		
-		// Iterate over the unmatched simulated triggers again and the
-		// unmatched SSP reported trigger that most closely matches it.
-		OutputLogger.println();
-		OutputLogger.println("Matching Failed SSP Reported Triggers to Remaining SSP Simulated Triggers:");
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			simLoop:
-			for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
-				OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
-						(triggerNum + 1), triggerPositionString(simTrigger),
-						getTriggerTime(simTrigger), simTrigger.toString());
-				
-				// Check whether this trigger has already been matched
-				// or not. If it has been matched, skip it.
-				if(simTriggerSet.contains(simTrigger)) {
-					OutputLogger.println("\t\tSkipping; already matched successfully");
-					continue simLoop;
-				}
-				
-				// Get the trigger time for the simulated trigger.
-				double simTime = getTriggerTime(simTrigger);
-				
-				// Track the match statistics for each reported trigger
-				// so that the closest match may be found.
-				int numMatched = -1;
-				boolean[] matchedCut = null;
-				SSPNumberedTrigger bestMatch = null;
-				
-				// Store the readout for the best match.
-				String bestMatchText = null;
-				
-				// Iterate over the reported triggers to find a match.
-				reportedLoop:
-				for(SSPNumberedTrigger sspTrigger : sspTriggers) {
-					OutputLogger.printf("\t\t%s ", sspTrigger.toString());
-					
-					// If the two triggers have different times, this
-					// trigger should be skipped.
-					if(sspTrigger.getTime() != simTime) {
-						OutputLogger.printf("[ %-15s ]%n", "failed; time");
-						continue reportedLoop;
-					}
-					
-					// If this reported trigger has been matched then
-					// it should be skipped.
-					if(sspTriggerSet.contains(sspTrigger)) {
-						OutputLogger.printf("[ %-15s ]%n", "failed; matched");
-						continue reportedLoop;
-					}
-					
-					// Check each of the cuts.
-					boolean[] tempMatchedCut = triggerCutMatch(simTrigger, sspTrigger);
-					
-					// Check each cut and see if this is a closer match
-					// than the previous best match.
-					int tempNumMatched = 0;
-					for(boolean passed : tempMatchedCut) { if(passed) { tempNumMatched++; } }
-					OutputLogger.printf("[ %-15s ]%n", String.format("maybe; %d failed", tempNumMatched));
-					
-					// If the number of matched cuts exceeds the old
-					// best result, this becomes the new best result.
-					if(tempNumMatched > numMatched) {
-						numMatched = tempNumMatched;
-						matchedCut = tempMatchedCut;
-						bestMatch = sspTrigger;
-						bestMatchText = String.format("%s%n", sspTrigger.toString());
-					}
-				}
-				
-				// If there was no match found, it means that there were
-				// no triggers that were both unmatched and at the same
-				// time as this simulated trigger.
-				if(bestMatch == null) {
-					if(isSingles) { singlesInternalFail = true; }
-					else { pairInternalFail = true; }
-					triggerEvent[triggerNum].failedSSPTrigger();
-					OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s",
-							(triggerNum + 1), triggerPositionString(simTrigger),
-							getTriggerTime(simTrigger), simTrigger.toString());
-					OutputLogger.println(" --> No Valid Match Found");
-				} else {
-					triggerEvent[triggerNum].matchedSSPTrigger(tiFlags, matchedCut);
-					OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s",
-							(triggerNum + 1), triggerPositionString(simTrigger),
-							getTriggerTime(simTrigger), simTrigger.toString());
-					OutputLogger.println(" --> " + bestMatchText);
-				}
-			}
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Trigger Efficiency ==================================
-		// ==========================================================
-		
-		// Reset the SSP matched trigger set.
-		sspTriggerSet.clear();
-		
-		// Iterate over the reconstructed cluster singles triggers.
-		OutputLogger.println();
-		OutputLogger.println("Recon Cluster Trigger --> SSP Reported Trigger Match Status");
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			for(Trigger<?> simTrigger : reconTriggerList.get(triggerNum)) {
-				OutputLogger.printf("\tTrigger %d :: %s :: %s%n", (triggerNum + 1),
-						triggerPositionString(simTrigger), simTrigger.toString());
-				
-				// TEMP :: Populate the recon ALL pairs plots.
-				globalTriggerPlots.sawTrigger(simTrigger);
-				
-				// Iterate over the SSP reported triggers and compare
-				// them to the reconstructed cluster simulated trigger.
-				boolean matched = false;
-				matchLoop:
-				for(SSPNumberedTrigger sspTrigger : sspTriggers) {
-					OutputLogger.printf("\t\t\t%s", sspTrigger.toString());
-					
-					// Only compare triggers if they are from the
-					// same trigger source.
-					if((triggerNum == 0 && sspTrigger.isSecondTrigger())
-							|| (triggerNum == 1 && sspTrigger.isFirstTrigger())) {
-						OutputLogger.print(" [ fail; source    ]%n");
-						continue matchLoop;
-					}
-					
-					// Only compare the singles trigger if it was
-					// not already matched to another trigger.
-					if(sspTriggerSet.contains(sspTrigger)) {
-						OutputLogger.print(" [ fail; matched   ]%n");
-						continue matchLoop;
-					}
-					
-					// Test each cut.
-					int typeIndex = isSingles ? 0 : 1;
-					boolean[] matchedCuts = triggerCutMatch(simTrigger, sspTrigger);
-					for(int cutIndex = 0; cutIndex < matchedCuts.length; cutIndex++) {
-						if(!matchedCuts[cutIndex]) {
-							OutputLogger.printf(" [ fail; %-9s ]%n", cutNames[typeIndex][cutIndex]);
-							continue matchLoop;
-						}
-					}
-					
-					// If all the trigger flags match, then the
-					// triggers are a match.
-					sspTriggerSet.add(sspTrigger);
-					triggerEvent[triggerNum].matchedReconTrigger(tiFlags);
-					OutputLogger.print(" [ success         ]%n");
-					globalTriggerPlots.matchedTrigger(simTrigger);
-					matched = true;
-					break matchLoop;
-				}
-				
-				if(!matched) { globalTriggerPlots.failedTrigger(simTrigger); }
-			}
-		}
-		
-		
-		
-		// ==========================================================
-		// ==== Output Event Results ================================
-		// ==========================================================
-		
-		// Get the number of SSP and reconstructed cluster simulated
-		// triggers.
-		int sspSimTriggers = sspTriggerList.get(0).size() + sspTriggerList.get(1).size();
-		int reconSimTriggers = reconTriggerList.get(0).size() + reconTriggerList.get(1).size();
-		int[] sspTriggerCount = { sspTriggerList.get(0).size(), sspTriggerList.get(1).size() };
-		
-		// Print event statistics.
-		OutputLogger.println();
-		OutputLogger.println("Event Statistics:");
-		OutputLogger.printf("\tSSP Cluster Sim Triggers   :: %d%n", sspSimTriggers);
-		OutputLogger.printf("\tRecon Cluster Sim Triggers :: %d%n", reconSimTriggers);
-		OutputLogger.printf("\tSSP Reported Triggers      :: %d%n", sspTriggers.size());
-		
-		int matchedSSPTriggers = triggerEvent[0].getMatchedSSPSimulatedTriggers() + triggerEvent[1].getMatchedSSPSimulatedTriggers();
-		OutputLogger.printf("\tInternal Efficiency        :: %d / %d ", matchedSSPTriggers, sspSimTriggers);
-		if(sspSimTriggers == 0) { OutputLogger.printf("(N/A)%n"); }
-		else { OutputLogger.printf("(%3.0f%%)%n", (100.0 * matchedSSPTriggers / sspSimTriggers)); }
-		
-		int matchedReconTriggers = triggerEvent[0].getMatchedReconSimulatedTriggers() + triggerEvent[1].getMatchedReconSimulatedTriggers();
-		OutputLogger.printf("\tTrigger Efficiency         :: %d / %d", matchedReconTriggers, reconSimTriggers);
-		if(reconSimTriggers == 0) { OutputLogger.printf("(N/A)%n"); }
-		else { OutputLogger.printf("(%3.0f%%)%n", (100.0 * matchedReconTriggers / reconSimTriggers)); }
-		
-		// Print the individual cut performances.
-		if(isSingles) {
-			OutputLogger.println();
-			for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-				OutputLogger.printf("Trigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
-				if(sspSimTriggers == 0) {
-					OutputLogger.printf("\tCluster Energy Lower Bound :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN), sspTriggerCount[triggerNum]);
-					OutputLogger.printf("\tCluster Energy Upper Bound :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX), sspTriggerCount[triggerNum]);
-					OutputLogger.printf("\tCluster Hit Count          :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT), sspTriggerCount[triggerNum]);
-				} else {
-					OutputLogger.printf("\tCluster Energy Lower Bound :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN) / sspTriggerCount[triggerNum]));
-					OutputLogger.printf("\tCluster Energy Upper Bound :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX) / sspTriggerCount[triggerNum]));
-					OutputLogger.printf("\tCluster Hit Count          :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT) / sspTriggerCount[triggerNum]));
-				}
-			}
-			
-			// Update the global trigger tracking variables.
-			localStats.getTriggerStats().getSingles0Stats().addEvent(triggerEvent[0]);
-			localStats.getTriggerStats().getSingles1Stats().addEvent(triggerEvent[1]);
-			globalStats.getTriggerStats().getSingles0Stats().addEvent(triggerEvent[0]);
-			globalStats.getTriggerStats().getSingles1Stats().addEvent(triggerEvent[1]);
-		} else {
-			for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-				OutputLogger.println();
-				OutputLogger.printf("Trigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
-				if(sspTriggerCount[triggerNum] == 0) {
-					OutputLogger.printf("\tPair Energy Sum            :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM), sspTriggerCount[triggerNum]);
-					OutputLogger.printf("\tPair Energy Difference     :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF), sspTriggerCount[triggerNum]);
-					OutputLogger.printf("\tPair Energy Slope          :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount[triggerNum]);
-					OutputLogger.printf("\tPair Coplanarity           :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY), sspTriggerCount[triggerNum]);
-				} else {
-					OutputLogger.printf("\tPair Energy Sum            :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM) / sspTriggerCount[triggerNum]));
-					OutputLogger.printf("\tPair Energy Difference     :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF) / sspTriggerCount[triggerNum]));
-					OutputLogger.printf("\tPair Energy Slope          :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE) / sspTriggerCount[triggerNum]));
-					OutputLogger.printf("\tPair Coplanarity           :: %d / %d (%3.0f%%)%n",
-							triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY), sspTriggerCount[triggerNum],
-							(100.0 * triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY) / sspTriggerCount[triggerNum]));
-				}
-			}
-			
-			// Update the global trigger tracking variables.
-			localStats.getTriggerStats().getPair0Stats().addEvent(triggerEvent[0]);
-			localStats.getTriggerStats().getPair1Stats().addEvent(triggerEvent[1]);
-			globalStats.getTriggerStats().getPair0Stats().addEvent(triggerEvent[0]);
-			globalStats.getTriggerStats().getPair1Stats().addEvent(triggerEvent[1]);
-		}
-		
-		// Note whether the was a trigger match failure.
-		if(triggerEvent[0].getFailedReconSimulatedTriggers() != 0 && triggerEvent[1].getFailedReconSimulatedTriggers() != 0) {
-			if(isSingles) { singlesEfficiencyFail = true; }
-			else { pairEfficiencyFail = true; }
-		} if(triggerEvent[0].getFailedSSPSimulatedTriggers() != 0 && triggerEvent[1].getFailedSSPSimulatedTriggers() != 0) {
-			if(isSingles) { singlesInternalFail = true; }
-			else { pairInternalFail = true; }
-		}
-	}
-	
-	/**
-	 * Outputs all of the verification parameters currently in use by
-	 * the software. A warning will be issued if the values for NSA and
-	 * NSB, along with the FADC window, preclude clusters from being
-	 * verified.
-	 */
-	private void logSettings() {
-		// Output general settings.
-		System.out.println("Cluster Verification Settings");
-		System.out.printf("\tHit Threshold          :: %1d hit(s)%n", hitAcceptance);
-		System.out.printf("\tEnergy Threshold       :: %5.3f GeV%n",  energyAcceptance);
-		System.out.println();
-		
-		// Output window settings.
-		System.out.println("FADC Timing Window Settings");
-		System.out.printf("\tNSB                    :: %3d ns%n", nsb);
-		System.out.printf("\tNSA                    :: %3d ns%n", nsa);
-		System.out.printf("\tFADC Window            :: %3d ns%n", windowWidth);
-		
-		// Calculate the valid clustering window.
-		int start = nsb;
-		int end = windowWidth - nsa;
-		if(start < end) {
-			System.out.printf("\tValid Cluster Window   :: [ %3d ns, %3d ns ]%n", start, end);
-			performClusterVerification = true;
-		} else {
-			System.out.println("\tNSB, NSA, and FADC window preclude a valid cluster verification window.");
-			System.out.println("\tCluster verification will not be performed!");
-			performClusterVerification = false;
-		}
-		System.out.println();
-		
-		// Output the singles trigger settings.
-		for(int i = 0; i < 2; i++) {
-			// Print the settings.
-			System.out.printf("Singles Trigger %d Settings%23s[%5b]%n", (i + 1), "", singlesTriggerEnabled[i]);
-			System.out.printf("\tCluster Energy Low     :: %.3f GeV      [%5b]%n",
-					singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), singlesCutsEnabled[i][0]);
-			System.out.printf("\tCluster Energy High    :: %.3f GeV      [%5b]%n",
-					singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH), singlesCutsEnabled[i][1]);
-			System.out.printf("\tCluster Hit Count      :: %.0f hit(s)       [%5b]%n",
-					singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW), singlesCutsEnabled[i][2]);
-			System.out.println();
-		}
-		
-		// Output the pair trigger settings.
-		for(int i = 0; i < 2; i++) {
-			System.out.printf("Pairs Trigger %d Settings%25s[%5b]%n", (i + 1), "", pairTriggerEnabled[i]);
-			System.out.printf("\tCluster Energy Low     :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), pairCutsEnabled[i][0]);
-			System.out.printf("\tCluster Energy High    :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH), pairCutsEnabled[i][1]);
-			System.out.printf("\tCluster Hit Count      :: %.0f hit(s)       [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW), pairCutsEnabled[i][2]);
-			System.out.printf("\tPair Energy Sum Low    :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW), pairCutsEnabled[i][3]);
-			System.out.printf("\tPair Energy Sum High   :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH), pairCutsEnabled[i][3]);
-			System.out.printf("\tPair Energy Difference :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH), pairCutsEnabled[i][4]);
-			System.out.printf("\tPair Energy Slope      :: %.3f GeV      [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW), pairCutsEnabled[i][5]);
-			System.out.printf("\tPair Energy Slope F    :: %.4f GeV / mm%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F));
-			System.out.printf("\tPair Coplanarity       :: %3.0f Degrees    [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_COPLANARITY_HIGH), pairCutsEnabled[i][6]);
-			System.out.printf("\tPair Time Coincidence  :: %2.0f ns          [%5b]%n",
-					pairsTrigger[i].getCutValue(TriggerModule.PAIR_TIME_COINCIDENCE), true);
-			System.out.println();
-		}
-	}
-	
-	/**
-	 * Summarizes the global run statistics in a log to the terminal.
-	 */
-	private void logStatistics() {
-		// Print the cluster/trigger verification header.
-		System.out.println();
-		System.out.println();
-		System.out.println("======================================================================");
-		System.out.println("=== Cluster/Trigger Verification Results =============================");
-		System.out.println("======================================================================");
-		
-		// Print the general event failure rate.
-		int headSpaces = getPrintSpaces(globalStats.getEventCount());
-		System.out.println("General Event Statistics:");
-		System.out.printf("\tEvent Start Time      :: %.3f s%n", (startTime / Math.pow(10, 9)));
-		System.out.printf("\tEvent End Time        :: %.3f%n", (endTime / Math.pow(10, 9)));
-		System.out.printf("\tEvent Run Time        :: %.3f%n", ((endTime - startTime) / Math.pow(10, 9)));
-		System.out.printf("\tNoise Events          :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
-				globalStats.getNoiseEvents(), globalStats.getEventCount(), (100.0 * globalStats.getNoiseEvents() / globalStats.getEventCount()));
-		System.out.printf("\tCluster Events Failed :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
-				globalStats.getFailedClusterEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedClusterEventCount() / globalStats.getEventCount()));
-		System.out.printf("\tSingles Events Failed :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
-				globalStats.getFailedSinglesEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedSinglesEventCount() / globalStats.getEventCount()));
-		System.out.printf("\tPair Events Failed    :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
-				globalStats.getFailedPairEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedPairEventCount() / globalStats.getEventCount()));
-		
-		// Print out how many events reported a given TI type, both in
-		// total and hierarchically.
-		System.out.println();
-		System.out.println("Event Triggering Type Verification:");
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Trigger", "Total", "Hierarchical");
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Pulser", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PULSER, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PULSER, true));
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Cosmic", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.COSMIC, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.COSMIC, true));
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Singles 1", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES0, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES0, true));
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Singles 2", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES1, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES1, true));
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Pair 1", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR0, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR0, true));
-		System.out.printf("\t%15s\t%15s\t%15s%n", "Pair 2", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR1, false),
-				globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR1, true));
-		
-		// Print the cluster verification data.
-		System.out.println();
-		System.out.println("Cluster Verification:");
-		System.out.printf("\tRecon Clusters        :: %d%n", globalStats.getClusterStats().getReconClusterCount());
-		System.out.printf("\tSSP Clusters          :: %d%n", globalStats.getClusterStats().getSSPClusterCount());
-		System.out.printf("\tClusters Matched      :: %d%n", globalStats.getClusterStats().getMatches());
-		System.out.printf("\tFailed (Position)     :: %d%n", globalStats.getClusterStats().getPositionFailures());
-		System.out.printf("\tFailed (Energy)       :: %d%n", globalStats.getClusterStats().getEnergyFailures());
-		System.out.printf("\tFailed (Hit Count)    :: %d%n", globalStats.getClusterStats().getHitCountFailures());
-		if(globalStats.getClusterStats().getReconClusterCount() == 0) {
-			System.out.printf("\tCluster Efficiency    :: N/A%n");
-		} else {
-			System.out.printf("\tCluster Efficiency    :: %7.3f%%%n",
-					100.0 * globalStats.getClusterStats().getMatches() / globalStats.getClusterStats().getReconClusterCount());
-		}
-		
-		// Print the trigger verification data.
-		for(int triggerType = 0; triggerType < 2; triggerType++) {
-			// Get the trigger data. Type 0 represents singles triggers.
-			TriggerEvent[] triggerData = new TriggerEvent[2];
-			if(triggerType == 0) {
-				triggerData[0] = globalStats.getTriggerStats().getSingles0Stats();
-				triggerData[1] = globalStats.getTriggerStats().getSingles1Stats();
-			} else {
-				triggerData[0] = globalStats.getTriggerStats().getPair0Stats();
-				triggerData[1] = globalStats.getTriggerStats().getPair1Stats();
-			}
-			
-			// Get the basic trigger data.
-			int sspSimTriggers = triggerData[0].getSSPSimulatedTriggers() + triggerData[1].getSSPSimulatedTriggers();
-			int reconSimTriggers = triggerData[0].getReconSimulatedTriggers() + triggerData[1].getReconSimulatedTriggers();
-			int sspReportedTriggers = triggerData[0].getReportedTriggers() + triggerData[1].getReportedTriggers();
-			int sspMatchedTriggers = triggerData[0].getMatchedSSPSimulatedTriggers() + triggerData[1].getMatchedSSPSimulatedTriggers();
-			int reconMatchedTriggers = triggerData[0].getMatchedReconSimulatedTriggers() + triggerData[1].getMatchedReconSimulatedTriggers();
-			
-			// Print the basic trigger statistics.
-			int spaces = getPrintSpaces(sspSimTriggers, reconSimTriggers, sspReportedTriggers);
-			System.out.println();
-			if(triggerType == 0) { System.out.println("Singles Trigger Verification:"); }
-			else { System.out.println("Pair Trigger Verification:"); }
-			System.out.printf("\tSSP Cluster Sim Triggers   :: %" + spaces + "d%n", sspSimTriggers);
-			System.out.printf("\tRecon Cluster Sim Triggers :: %" + spaces + "d%n", reconSimTriggers);
-			System.out.printf("\tSSP Reported Triggers      :: %" + spaces + "d%n", sspReportedTriggers);
-			
-			System.out.printf("\tInternal Efficiency        :: %" + spaces + "d / %" + spaces + "d ", sspMatchedTriggers, sspSimTriggers);
-			if(sspSimTriggers == 0) { System.out.printf("(N/A)%n"); }
-			else { System.out.printf("(%7.3f%%)%n", (100.0 * sspMatchedTriggers / sspSimTriggers)); }
-			
-			System.out.printf("\tTrigger Efficiency         :: %" + spaces + "d / %" + spaces + "d ", reconMatchedTriggers, reconSimTriggers);
-			if(reconSimTriggers == 0) { System.out.printf("(N/A)%n"); }
-			else { System.out.printf("(%7.3f%%)%n" , (100.0 * reconMatchedTriggers / reconSimTriggers)); }
-			
-			// Print the individual cut performances.
-			if(triggerType == 0) {
-				for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-					// Get the appropriate trigger statistics module.
-					TriggerEvent triggerStats;
-					if(triggerNum == 0) { triggerStats = globalStats.getTriggerStats().getSingles0Stats(); }
-					else { triggerStats = globalStats.getTriggerStats().getSingles1Stats(); }
-					
-					// Get the number of SSP triggers for this trigger number.
-					int sspTriggerCount = triggerStats.getSSPSimulatedTriggers();
-					//int sspTriggerCount = triggerRunStats[0].getTotalSSPTriggers(triggerNum);
-				
-					System.out.println();
-					System.out.printf("\tTrigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
-					System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerStats.getUnmatchedSSPSimulatedTriggers());
-					//System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerRunStats[0].getUnmatchedTriggers(triggerNum));
-					if(sspTriggerCount == 0) {
-						System.out.printf("\t\tCluster Energy Lower Bound :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(ENERGY_MIN), sspTriggerCount);
-						System.out.printf("\t\tCluster Energy Upper Bound :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(ENERGY_MAX), sspTriggerCount);
-						System.out.printf("\t\tCluster Hit Count          :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(HIT_COUNT), sspTriggerCount);
-					} else {
-						System.out.printf("\t\tCluster Energy Lower Bound :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(ENERGY_MIN), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(ENERGY_MIN) / sspTriggerCount));
-						System.out.printf("\t\tCluster Energy Upper Bound :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(ENERGY_MAX), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(ENERGY_MAX) / sspTriggerCount));
-						System.out.printf("\t\tCluster Hit Count          :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(HIT_COUNT), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(HIT_COUNT) / sspTriggerCount));
-					}
-				}
-			} else {
-				for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-					// Get the appropriate trigger statistics module.
-					TriggerEvent triggerStats;
-					if(triggerNum == 0) { triggerStats = globalStats.getTriggerStats().getPair0Stats(); }
-					else { triggerStats = globalStats.getTriggerStats().getPair1Stats(); }
-					
-					// Get the number of SSP triggers for this trigger number.
-					int sspTriggerCount = triggerStats.getSSPSimulatedTriggers();
-					
-					System.out.println();
-					System.out.printf("\tTrigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
-					System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerStats.getUnmatchedSSPSimulatedTriggers());
-					if(sspTriggerCount == 0) {
-						System.out.printf("\t\tPair Energy Sum            :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(ENERGY_SUM), sspTriggerCount);
-						System.out.printf("\t\tPair Energy Difference     :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(ENERGY_DIFF), sspTriggerCount);
-						System.out.printf("\t\tPair Energy Slope          :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount);
-						System.out.printf("\t\tPair Coplanarity           :: %" + spaces + "d / %" + spaces + "d%n",
-								triggerStats.getSSPCutFailures(COPLANARITY), sspTriggerCount);
-					} else {
-						System.out.printf("\t\tPair Energy Sum            :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(ENERGY_SUM), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(ENERGY_SUM) / sspTriggerCount));
-						System.out.printf("\t\tPair Energy Difference     :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(ENERGY_DIFF), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(ENERGY_DIFF) / sspTriggerCount));
-						System.out.printf("\t\tPair Energy Slope          :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(ENERGY_SLOPE) / sspTriggerCount));
-						System.out.printf("\t\tPair Coplanarity           :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
-								triggerStats.getSSPCutFailures(COPLANARITY), sspTriggerCount,
-								(100.0 * triggerStats.getSSPCutFailures(COPLANARITY) / sspTriggerCount));
-					}
-				}
-			}
-		}
-		
-		// Print out the trigger efficiency table.
-		System.out.println();
-		globalStats.getTriggerStats().printEfficiencyTable();
-	}
-	
-	/**
-	 * Checks whether all of the hits in a cluster are within the safe
-	 * region of the FADC output window.
-	 * @param reconCluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is safe and
-	 * returns <code>false</code> otherwise.
-	 */
-	private final boolean isVerifiable(Cluster reconCluster) {
-		return TriggerDiagnosticUtil.isVerifiable(reconCluster, nsa, nsb, windowWidth);
-	}
-	
-	/**
-	 * Generates a <code>List</code> collection that contains a set
-	 * of <code>ArrayList</code> collections representing a unique
-	 * permutation of the entries in the argument.
-	 * @param values - A collection of the entries to be permuted.
-	 * @return Returns a list of lists representing the permutations.
-	 */
-	private static final List<List<Pair<Cluster, SSPCluster>>> getPermutations(List<Cluster> reconClusters, List<SSPCluster> sspClusters) {
-		// Store the SSP cluster permutations.
-		List<List<SSPCluster>> permList = new ArrayList<List<SSPCluster>>();
-		
-		// Make sure that the two lists are the same size.
-		int reconSize = reconClusters.size();
-		int sspSize = sspClusters.size();
-		while(sspClusters.size() < reconClusters.size()) {
-			sspClusters.add(null);
-		}
-		while(reconClusters.size() < sspClusters.size()) {
-			reconClusters.add(null);
-		}
-		
-		// Get the SSP cluster permutations.
-		permute(new ArrayList<SSPCluster>(0), sspClusters, permList);
-		
-		// Create pairs from the permutations.
-		List<List<Pair<Cluster, SSPCluster>>> pairList = new ArrayList<List<Pair<Cluster, SSPCluster>>>();
-		for(List<SSPCluster> permutation : permList) {
-			List<Pair<Cluster, SSPCluster>> pairs = new ArrayList<Pair<Cluster, SSPCluster>>(reconClusters.size());
-			
-			for(int clusterIndex = 0; (clusterIndex < reconClusters.size() && clusterIndex < permutation.size()); clusterIndex++) {
-				pairs.add(new Pair<Cluster, SSPCluster>(reconClusters.get(clusterIndex), permutation.get(clusterIndex)));
-			}
-			
-			pairList.add(pairs);
-		}
-		
-		// Remove the extra values.
-		for(int i = sspClusters.size() - 1; i >= sspSize; i--) { sspClusters.remove(i); }
-		for(int i = reconClusters.size() - 1; i >= reconSize; i--) { reconClusters.remove(i); }
-		
-		// Return the pairs.
-		return pairList;
-	}
-	
-	/**
-	 * Recursive method for permuting all entries in the argument
-	 * collection <code>remainingValues</code> into the argument
-	 * <code>permutedValues</code> values. Completed permutations are
-	 * placed in the argument <code>permList</code>.
-	 * @param permutedValues - List to store entries that have already
-	 * been permuted.
-	 * @param remainingValues - List to store  entries that need to be
-	 * permuted.
-	 * @param permList - List to store completed permutations.
-	 */
-	private static final void permute(List<SSPCluster> permutedValues, List<SSPCluster> remainingValues, List<List<SSPCluster>> permList) {
-		// If the list of entries that still need to be sorted is empty,
-		// then there is nothing to sort. Just return and empty list.
-		if(remainingValues.isEmpty()) { return; }
-		
-		// If there is only one value left in the list of entries that
-		// still need to be sorted, then just add it to the permutation
-		// list and return it.
-		else if(remainingValues.size() <= 1) {
-			// Add the last entry.
-			permutedValues.add(remainingValues.get(0));
-			
-			// Add the permutation to the list of completed permutations.
-			permList.add(permutedValues);
-		}
-		
-		// Otherwise, continue to get all possible permutations.
-		else {
-			// Iterate over the entries that have not been permuted.
-			for(int i = 0; i < remainingValues.size(); i++) {
-				// Make new lists to contain the permutations.
-				List<SSPCluster> newPermList = new ArrayList<SSPCluster>(permutedValues.size() + 1);
-				List<SSPCluster> newRemainList = new ArrayList<SSPCluster>(remainingValues.size());
-				
-				// Copy the current permuted entries to the new list
-				// and one value from the list of entries that have
-				// not been permuted yet.
-				newPermList.addAll(permutedValues);
-				newPermList.add(remainingValues.get(i));
-				
-				// The new list of entries that have not been permuted
-				// should be identical, except it should now be missing
-				// the entry that was moved.
-				for(int index = 0; index < remainingValues.size(); index++) {
-					if(index != i) { newRemainList.add(remainingValues.get(index)); }
-				}
-				
-				// Repeat the process with the new lists.
-				permute(newPermList, newRemainList, permList);
-			}
-		}
-	}
-	
-	/**
-	 * Compares two cluster matching events and finds the one that has
-	 * the better results. Note that this will only return results that
-	 * make sense if both of the events represent different permutations
-	 * of the same set of clusters. Comparing events with different sets
-	 * of clusters will produce meaningless results.
-	 * @param firstEvent - The first cluster matching event,
-	 * @param secondEvent - The second cluster matching event.
-	 * @return Returns the cluster matching event that is better.
-	 */
-	private static final DetailedClusterEvent getBestPermutation(DetailedClusterEvent firstEvent, DetailedClusterEvent secondEvent) {
-		// If both permutations are null, return that.
-		if(firstEvent == null && secondEvent == null) {
-			return null;
-		}
-		
-		// If one permutation is null, it is not the best.
-		if(firstEvent == null) { return secondEvent; }
-		else if(secondEvent == null) { return firstEvent; }
-		
-		// A permutation is better if it has more matches.
-		if(firstEvent.getMatches() > secondEvent.getMatches()) { return firstEvent; }
-		else if(secondEvent.getMatches() > firstEvent.getMatches()) { return secondEvent; }
-		
-		// Otherwise, the permutation with the least energy failures is
-		// the better permutation.
-		if(firstEvent.getEnergyFailures() < secondEvent.getEnergyFailures()) { return firstEvent; }
-		else if(secondEvent.getEnergyFailures() < firstEvent.getEnergyFailures()) { return secondEvent; }
-		
-		// If both these values are the same, then the events are identical.
-		return firstEvent;
-	}
-	
-	/**
-	 * Determines the number of spaces needed to render the longest of
-	 * a series of integers as a string.
-	 * @param vals - The series of integers.
-	 * @return Returns the number of spaces needed to render the longest
-	 * integer as a base-10 string.
-	 */
-	private static final int getPrintSpaces(int... vals) {
-		// Track the largest value.
-		int largest = 0;
-		
-		// Iterate over the arguments and find the largest.
-		for(int val : vals) {
-			// Get the length of the string.
-			int length = TriggerDiagnosticUtil.getDigits(val);
-			
-			// If it is larger, track it.
-			if(length > largest) { largest = length; }
-		}
-		
-		// Return the longer one.
-		return largest;
-	}
-	
-	/**
-	 * Gets the position of the source of a <code>Trigger</code> object
-	 * as text. This method only supports trigger sources of the types
-	 * <code>SSPCluster</code>, <code>Cluster</code>, and arrays of size
-	 * two of either type.
-	 * @param trigger - The trigger from which to obtain the source.
-	 * @return Returns the source of the trigger as a <code>String</code>
-	 * object.
-	 * @throws IllegalArgumentException Occurs if the source of the
-	 * trigger is not any of the supported types.
-	 */
-	private static final String triggerPositionString(Trigger<?> trigger) throws IllegalArgumentException {
-		// Get the trigger source.
-		Object source = trigger.getTriggerSource();
-		
-		// Handle valid trigger sources.
-		if(source instanceof SSPCluster) {
-			return TriggerDiagnosticUtil.clusterPositionString((SSPCluster) source);
-		} else if(source instanceof Cluster) {
-			return TriggerDiagnosticUtil.clusterPositionString((Cluster) source);
-		} else if(source instanceof SSPCluster[]) {
-			SSPCluster[] sourcePair = (SSPCluster[]) source;
-			if(sourcePair.length == 2) {
-				return String.format("%s, %s", TriggerDiagnosticUtil.clusterPositionString(sourcePair[0]),
-						TriggerDiagnosticUtil.clusterPositionString(sourcePair[1]));
-			}
-		} else if(source instanceof Cluster[]) {
-			Cluster[] sourcePair = (Cluster[]) source;
-			if(sourcePair.length == 2) {
-				return String.format("%s, %s", TriggerDiagnosticUtil.clusterPositionString(sourcePair[0]),
-						TriggerDiagnosticUtil.clusterPositionString(sourcePair[1]));
-			}
-		}
-		
-		// Otherwise, the source type is unrecognized. Throw an error.
-		throw new IllegalArgumentException(String.format("Trigger source type \"%s\" is not supported.",
-				trigger.getTriggerSource().getClass().getSimpleName()));
-	}
-	
-	/**
-	 * Gets the time of a simulated trigger object. Method supports
-	 * triggers with source objects of type <code>SSPCluster</code>,
-	 * <code>Cluster</code>, and arrays of size two composed of either
-	 * object type.
-	 * @param trigger - The trigger.
-	 * @return Returns the time at which the trigger occurred.
-	 * @throws IllegalArgumentException Occurs if the trigger source
-	 * is not a supported type.
-	 */
-	private static final double getTriggerTime(Trigger<?> trigger) throws IllegalArgumentException {
-		// Get the trigger source.
-		Object source = trigger.getTriggerSource();
-		
-		// Get the trigger time for supported trigger types.
-		if(source instanceof SSPCluster) {
-			return ((SSPCluster) source).getTime();
-		} else if(source instanceof Cluster) {
-			return TriggerDiagnosticUtil.getClusterTime((Cluster) source);
-		} else if(source instanceof SSPCluster[]) {
-			// Get the pair.
-			SSPCluster[] sourcePair = (SSPCluster[]) source;
-			
-			// Get the time of the bottom cluster.
-			if(sourcePair.length == 2) {
-				if(sourcePair[0].getYIndex() < 0) { return sourcePair[0].getTime(); }
-				else if(sourcePair[1].getYIndex() < 0) { return sourcePair[1].getTime(); }
-				else { throw new IllegalArgumentException("Cluster pairs must be formed of a top/bottom pair."); }
-			}
-			else { throw new IllegalArgumentException("Cluster pairs must be of size 2."); }
-		} else if(source instanceof Cluster[]) {
-			// Get the pair.
-			Cluster[] sourcePair = (Cluster[]) source;
-			int[] iy = {
-				TriggerDiagnosticUtil.getYIndex(sourcePair[0]),
-				TriggerDiagnosticUtil.getYIndex(sourcePair[1])
-			};
-			
-			// Get the time of the bottom cluster.
-			if(sourcePair.length == 2) {
-				if(iy[0] < 0) { return TriggerDiagnosticUtil.getClusterTime(sourcePair[0]); }
-				else if(iy[1] < 0) { return TriggerDiagnosticUtil.getClusterTime(sourcePair[1]); }
-				else { throw new IllegalArgumentException("Cluster pairs must be formed of a top/bottom pair."); }
-			}
-			else { throw new IllegalArgumentException("Cluster pairs must be of size 2."); }
-		}
-		
-		// If the source type is unrecognized, throw an exception.
-		throw new IllegalArgumentException(String.format("Trigger source type \"%\" is not supported.",
-				source.getClass().getSimpleName()));
-	}
-	
-	/**
-	 * Checks if a simulated trigger and an SSP trigger match. Note
-	 * that only certain types can be compared. These are:
-	 * <ul><li><code>SinglesTrigger<?> --> SSPSinglesTrigger</code></li>
-	 * <li><code>PairTrigger<?> --> SSPPairTrigger</code></li></ul>
-	 * @param simTrigger - The simulated trigger.
-	 * @param sspTrigger - The SSP bank trigger.
-	 * @return Returns an array of <code>boolean</code> primitives that
-	 * indicate which cuts passed and which failed.
-	 */
-	private static final boolean[] triggerCutMatch(Trigger<?> simTrigger, SSPTrigger sspTrigger) {
-		// Check that the cuts match for supported trigger types.
-		if(simTrigger instanceof SinglesTrigger && sspTrigger instanceof SSPSinglesTrigger) {
-			// Create an array to store the cut checks.
-			boolean[] cutMatch = new boolean[3];
-			
-			// Cast the triggers.
-			SinglesTrigger<?> simSingles = (SinglesTrigger<?>) simTrigger;
-			SSPSinglesTrigger sspSingles = (SSPSinglesTrigger) sspTrigger;
-			
-			// Perform the check.
-			cutMatch[ENERGY_MIN] = (simSingles.getStateClusterEnergyLow()  == sspSingles.passCutEnergyMin());
-			cutMatch[ENERGY_MAX] = (simSingles.getStateClusterEnergyHigh() == sspSingles.passCutEnergyMax());
-			cutMatch[HIT_COUNT] = (simSingles.getStateHitCount()          == sspSingles.passCutHitCount());
-			
-			// Return the match array.
-			return cutMatch;
-		} else if(simTrigger instanceof PairTrigger && sspTrigger instanceof SSPPairTrigger) {
-			// Create an array to store the cut checks.
-			boolean[] cutMatch = new boolean[4];
-			
-			// Cast the triggers.
-			PairTrigger<?> simPair = (PairTrigger<?>) simTrigger;
-			SSPPairTrigger sspPair = (SSPPairTrigger) sspTrigger;
-			
-			// Perform the check.
-			cutMatch[ENERGY_SUM] = (simPair.getStateEnergySum()        == sspPair.passCutEnergySum());
-			cutMatch[ENERGY_DIFF] = (simPair.getStateEnergyDifference() == sspPair.passCutEnergyDifference());
-			cutMatch[ENERGY_SLOPE] = (simPair.getStateEnergySlope()      == sspPair.passCutEnergySlope());
-			cutMatch[COPLANARITY] = (simPair.getStateCoplanarity()      == sspPair.passCutCoplanarity());
-			
-			// Return the match array.
-			return cutMatch;
-		}
-		
-		// If this point is reached, the triggers are not of a supported
-		// type for cut comparison. Produce an exception.
-		throw new IllegalArgumentException(String.format("Triggers of type \"%s\" can not be cut-matched with triggers of type \"%s\".",
-				simTrigger.getClass().getSimpleName(), sspTrigger.getClass().getSimpleName()));
-	}
+     * clusters and a collection of SSP clusters with an algorithm that
+     * ignores the times reported for each cluster.
+     * @param reconClusters - A collection of reconstructed clusters.
+     * @param sspClusters - A collection of SSP clusters.
+     * @param energyWindow - The window of allowed deviation between
+     * the reconstructed cluster and SSP cluster energies.
+     * @param hitWindow - The window of allowed deviation between
+     * the reconstructed cluster and SSP cluster hit counts.
+     * @return Returns the cluster matching results stored inside a
+     * <code>clusterMatchEvent</code> object.
+     */
+    private static final DetailedClusterEvent matchClusters(Collection<Cluster> reconClusters,
+            Collection<SSPCluster> sspClusters, double energyWindow, int hitWindow) {
+        // Track the number of cluster pairs that were matched and that
+        // failed by failure type.
+        DetailedClusterEvent event = new DetailedClusterEvent();
+        
+        // Create maps to link cluster position to the list of clusters
+        // that were found at that location.
+        Map<Point, List<Cluster>> reconClusterMap = new HashMap<Point, List<Cluster>>(reconClusters.size());
+        Map<Point, List<SSPCluster>> sspClusterMap = new HashMap<Point, List<SSPCluster>>(reconClusters.size());
+        
+        // Populate the reconstructed cluster map.
+        for(Cluster reconCluster : reconClusters) {
+            // Get the cluster position.
+            Point position = new Point(TriggerDiagnosticUtil.getXIndex(reconCluster),
+                    TriggerDiagnosticUtil.getYIndex(reconCluster));
+            
+            // Get the list for this cluster position.
+            List<Cluster> reconList = reconClusterMap.get(position);
+            if(reconList == null) {
+                reconList = new ArrayList<Cluster>();
+                reconClusterMap.put(position, reconList);
+            }
+            
+            // Add the cluster to the list.
+            reconList.add(reconCluster);
+        }
+        
+        // Populate the SSP cluster map.
+        for(SSPCluster sspCluster : sspClusters) {
+            // Get the cluster position.
+            Point position = new Point(sspCluster.getXIndex(), sspCluster.getYIndex());
+            
+            // Get the list for this cluster position.
+            List<SSPCluster> sspList = sspClusterMap.get(position);
+            if(sspList == null) {
+                sspList = new ArrayList<SSPCluster>();
+                sspClusterMap.put(position, sspList);
+            }
+            
+            // Add the cluster to the list.
+            sspList.add(sspCluster);
+        }
+        
+        // For each reconstructed cluster, attempt to match the clusters
+        // with SSP clusters at the same position.
+        positionLoop:
+        for(Entry<Point, List<Cluster>> clusterSet : reconClusterMap.entrySet()) {
+            // Get the reconstructed and SSP clusters at this position.
+            List<Cluster> reconList = clusterSet.getValue();
+            List<SSPCluster> sspList = sspClusterMap.get(clusterSet.getKey());
+            
+            // Print the crystal position header.
+            OutputLogger.println();
+            OutputLogger.printf("Considering clusters at (%3d, %3d)%n", clusterSet.getKey().x, clusterSet.getKey().y);
+            
+            // If there are no SSP clusters, then matching fails by
+            // reason of position. The remainder of the loop may be
+            // skipped, since there is nothing to check.
+            if(sspList == null || sspList.isEmpty()) {
+                event.pairFailPosition(reconList.size());
+                continue positionLoop;
+            }
+            
+            // Get all possible permutations of SSP clusters.
+            List<List<Pair<Cluster, SSPCluster>>> permutations = getPermutations(reconList, sspList);
+            
+            // Print the information for this crystal position.
+            OutputLogger.printf("\tRecon Clusters :: %d%n", reconList.size());
+            OutputLogger.printf("\tSSP Clusters   :: %d%n", sspList.size());
+            OutputLogger.printf("\tPermutations   :: %d%n", permutations.size());
+            
+            // Track the plotted values for the current best permutation.
+            DetailedClusterEvent bestPerm = null;
+            
+            // Iterate over the permutations and find the permutation
+            // that produces the best possible result when compared to
+            // the reconstructed clusters.
+            int permIndex = 0;
+            for(List<Pair<Cluster, SSPCluster>> pairs : permutations) {
+                // Update the current permutation number.
+                permIndex++;
+                
+                // Track the plot values for this permutation.
+                DetailedClusterEvent perm = new DetailedClusterEvent();
+                
+                // Try to match each pair.
+                pairLoop:
+                for(Pair<Cluster, SSPCluster> pair : pairs) {
+                    // Print the current reconstructed/SSP cluster pair.
+                    OutputLogger.printf("\tP%d :: %s --> %s", permIndex,
+                            pair.getFirstElement() == null ? "None" : TriggerDiagnosticUtil.clusterToString(pair.getFirstElement()),
+                            pair.getSecondElement() == null ? "None" : TriggerDiagnosticUtil.clusterToString(pair.getSecondElement()));
+                    
+                    // If either cluster in the pair is null, there
+                    // are not enough clusters to perform this match.
+                    if(pair.getFirstElement() == null || pair.getSecondElement() == null) {
+                        // Log the result.
+                        OutputLogger.printf(" [ %18s ]%n", "failure: unpaired");
+                        
+                        // An unpaired SSP cluster does not necessarily
+                        // represent a problem. Often, this just means
+                        // that the SSP cluster's matching reconstructed
+                        // cluster is outside the verification window.
+                        if(pair.getSecondElement() == null) {
+                            perm.pairFailPosition(pair.getFirstElement(), pair.getSecondElement());
+                        }
+                        
+                        // Skip the rest of the checks.
+                        continue pairLoop;
+                    }
+                    
+                    // Check if the reconstructed cluster has an energy
+                    // within the allotted threshold of the SSP cluster.
+                    if(pair.getSecondElement().getEnergy() >= pair.getFirstElement().getEnergy() - energyWindow &&
+                            pair.getSecondElement().getEnergy() <= pair.getFirstElement().getEnergy() + energyWindow) {
+                        
+                        // Check that the hit count of the reconstructed
+                        // is within the allotted threshold of the SSP
+                        // cluster.
+                        if(pair.getSecondElement().getHitCount() >= pair.getFirstElement().getCalorimeterHits().size() - hitWindow &&
+                                pair.getSecondElement().getHitCount() <= pair.getFirstElement().getCalorimeterHits().size() + hitWindow) {
+                            // Designate the pair as a match.
+                            perm.pairMatch(pair.getFirstElement(), pair.getSecondElement());
+                            OutputLogger.printf(" [ %18s ]%n", "success: matched");
+                        } else {
+                            perm.pairFailHitCount(pair.getFirstElement(), pair.getSecondElement());
+                            OutputLogger.printf(" [ %18s ]%n", "failure: hit count");
+                        } // End hit count check.
+                    } else {
+                        perm.pairFailEnergy(pair.getFirstElement(), pair.getSecondElement());
+                        OutputLogger.printf(" [ %18s ]%n", "failure: energy");
+                    } // End energy check.
+                } // End Pair Loop
+                
+                // Print the results of the permutation.
+                OutputLogger.printf("\t\tPermutation Matched   :: %d%n", perm.getMatches());
+                OutputLogger.printf("\t\tPermutation Energy    :: %d%n", perm.getEnergyFailures());
+                OutputLogger.printf("\t\tPermutation Hit Count :: %d%n", perm.getHitCountFailures());
+                
+                // Check whether the results from this permutation
+                // exceed the quality of the last best results. A
+                // greater number of matches is always better. If the
+                // matches are the same, select the one with fewer
+                // failures due to energy.
+                bestPerm = getBestPermutation(bestPerm, perm);
+            } // End Permutation Loop
+            
+            // Print the final results for the position.
+            OutputLogger.printf("\tPosition Matched   :: %d%n", bestPerm.getMatches());
+            OutputLogger.printf("\tPosition Energy    :: %d%n", bestPerm.getEnergyFailures());
+            OutputLogger.printf("\tPosition Hit Count :: %d%n", bestPerm.getHitCountFailures());
+            
+            // Add the results from the best-matched permutation
+            // to the event efficiency results.
+            event.addEvent(bestPerm);
+        } // End Crystal Position Loop
+        
+        // Return the cluster match summary.
+        return event;
+    }
+    
+    /**
+     * Performs cluster matching between a collection of reconstructed
+     * clusters and a collection of SSP clusters using the strictly
+     * time-compliant algorithm.
+     * @param reconClusters - A collection of reconstructed clusters.
+     * @param sspClusters - A collection of SSP clusters.
+     * @param energyWindow - The window of allowed deviation between
+     * the reconstructed cluster and SSP cluster energies.
+     * @param hitWindow - The window of allowed deviation between
+     * the reconstructed cluster and SSP cluster hit counts.
+     * @return Returns the cluster matching results stored inside a
+     * <code>clusterMatchEvent</code> object.
+     */
+    private static final DetailedClusterEvent matchClustersTimeCompliant(Collection<Cluster> reconClusters,
+            Collection<SSPCluster> sspClusters, double energyWindow, int hitWindow) {
+        // Track the number of cluster pairs that were matched and that
+        // failed by failure type.
+        DetailedClusterEvent event = new DetailedClusterEvent();
+        
+        // Store the clusters which have been successfully paired.
+        Set<SSPCluster> sspMatched = new HashSet<SSPCluster>(sspClusters.size());
+        
+        // Find reconstructed/SSP cluster matched pairs.
+        reconLoop:
+        for(Cluster reconCluster : reconClusters) {
+            // Track whether a position-matched cluster was found.
+            boolean matchedPosition = false;
+            
+            // VERBOSE :: Output the cluster being matched.
+            OutputLogger.printf("Considering %s%n", TriggerDiagnosticUtil.clusterToString(reconCluster));
+            
+            // Search through the SSP clusters for a matching cluster.
+            sspLoop:
+            for(SSPCluster sspCluster : sspClusters) {
+                // VERBOSE :: Output the SSP cluster being considered.
+                OutputLogger.printf("\t%s ", TriggerDiagnosticUtil.clusterToString(sspCluster));
+                
+                // If this cluster has been paired, skip it.
+                if(sspMatched.contains(sspCluster)) {
+                    OutputLogger.printf("[ %7s; %9s ]%n", "fail", "matched");
+                    continue sspLoop;
+                }
+                
+                // Matched clusters must have the same position.
+                if(TriggerDiagnosticUtil.getXIndex(reconCluster) != sspCluster.getXIndex()
+                        || TriggerDiagnosticUtil.getYIndex(reconCluster) != sspCluster.getYIndex()) {
+                    OutputLogger.printf("[ %7s; %9s ]%n", "fail", "position");
+                    continue sspLoop;
+                }
+                
+                // Note that a cluster was found at this position.
+                matchedPosition = true;
+                
+                // Matched clusters must have the same time-stamp.
+                if(reconCluster.getCalorimeterHits().get(0).getTime() != sspCluster.getTime()) {
+                    OutputLogger.printf("[ %7s; %9s ]%n", "fail", "time");
+                    continue sspLoop;
+                }
+                
+                // Clusters that pass all of the above checks are the
+                // same cluster.
+                sspMatched.add(sspCluster);
+                
+                // Check that the clusters are sufficiently close in
+                // energy to one another.
+                if(sspCluster.getEnergy() >= reconCluster.getEnergy() - energyWindow
+                        && sspCluster.getEnergy() <= reconCluster.getEnergy() + energyWindow) {
+                    // If a cluster matches in energy, check that it
+                    // is also sufficiently close in hit count.
+                    if(sspCluster.getHitCount() >= reconCluster.getCalorimeterHits().size() - hitWindow &&
+                            sspCluster.getHitCount() <= reconCluster.getCalorimeterHits().size() + hitWindow) {
+                        // The cluster is a match.
+                        event.pairMatch(reconCluster, sspCluster);
+                        OutputLogger.printf("[ %7s; %9s ]%n", "success", "matched");
+                        continue reconLoop;
+                    } else {
+                        event.pairFailHitCount(reconCluster, sspCluster);
+                        OutputLogger.printf("[ %7s; %9s ]%n", "fail", "hit count");
+                        continue reconLoop;
+                    } // End hit count check.
+                } else {
+                    event.pairFailEnergy(reconCluster, sspCluster);
+                    OutputLogger.printf("[ %7s; %9s ]%n", "fail", "energy");
+                    continue reconLoop;
+                } // End energy check.
+            }// End SSP loop.
+            
+            // If the reconstructed cluster has not been matched, check
+            // if a cluster was found at the same position. If not, then
+            // the cluster fails by reason of position.
+            if(!matchedPosition) {
+                event.pairFailPosition(reconCluster, null);
+            }
+            
+            // Otherwise, the cluster had a potential matched, but the
+            // time-stamps were off. The cluster fails by reason of time.
+            else {
+                event.pairFailTime(reconCluster, null);
+            }
+        } // End recon loop.
+        
+        // Return the populated match event.
+        return event;
+    }
+    
+    /**
+     * Checks triggers simulated on SSP clusters against the SSP bank's
+     * reported triggers to verify that the trigger is correctly applying
+     * cuts to the clusters it sees. Additionally compares triggers
+     * simulated on reconstructed clusters to measure trigger efficiency.
+     */
+    private void singlesTriggerVerification() {
+        // Create lists of generic triggers.
+        List<List<? extends Trigger<?>>> sspTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
+        List<List<? extends Trigger<?>>> reconTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
+        
+        // Convert the simulated triggers to generic versions and add
+        // them to the generic list.
+        sspTriggerList.add(triggerData.getSimSSPTriggers().getSingles0Triggers());
+        sspTriggerList.add(triggerData.getSimSSPTriggers().getSingles1Triggers());
+        reconTriggerList.add(triggerData.getSimReconTriggers().getSingles0Triggers());
+        reconTriggerList.add(triggerData.getSimReconTriggers().getSingles1Triggers());
+        
+        // Run generic trigger verification.
+        triggerVerification(sspTriggerList, reconTriggerList, true);
+    }
+    
+    /**
+     * Checks triggers simulated on SSP clusters against the SSP bank's
+     * reported triggers to verify that the trigger is correctly applying
+     * cuts to the clusters it sees. Additionally compares triggers
+     * simulated on reconstructed clusters to measure trigger efficiency.
+     */
+    private void pairTriggerVerification() {
+        // Create lists of generic triggers.
+        List<List<? extends Trigger<?>>> sspTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
+        List<List<? extends Trigger<?>>> reconTriggerList = new ArrayList<List<? extends Trigger<?>>>(2);
+        
+        // Convert the simulated triggers to generic versions and add
+        // them to the generic list.
+        sspTriggerList.add(triggerData.getSimSSPTriggers().getPair0Triggers());
+        sspTriggerList.add(triggerData.getSimSSPTriggers().getPair1Triggers());
+        reconTriggerList.add(triggerData.getSimReconTriggers().getPair0Triggers());
+        reconTriggerList.add(triggerData.getSimReconTriggers().getPair1Triggers());
+        
+        // Run generic trigger verification.
+        triggerVerification(sspTriggerList, reconTriggerList, false);
+    }
+    
+    /**
+     * Performs trigger verification for both trigger types.
+     * @param sspTriggerList - The list of SSP triggers.
+     * @param reconTriggerList - The list of reconstructed triggers.
+     * @param isSingles - Whether or not this is a singles trigger
+     * verification.
+     */
+    private void triggerVerification(List<List<? extends Trigger<?>>> sspTriggerList, 
+            List<List<? extends Trigger<?>>> reconTriggerList, boolean isSingles) {
+        
+        // ==========================================================
+        // ==== Initialize Trigger Verification =====================
+        // ==========================================================
+        
+        // Print the cluster verification header.
+        OutputLogger.println();
+        OutputLogger.println();
+        OutputLogger.println("======================================================================");
+        if(isSingles) { OutputLogger.println("=== Singles Trigger Verification ====================================="); }
+        else { OutputLogger.println("=== Pair Trigger Verification ========================================"); }
+        OutputLogger.println("======================================================================");
+        
+        // Track the number of triggers seen and the number found.
+        TriggerEvent[] triggerEvent = { new TriggerEvent(), new TriggerEvent() };
+        
+        // ==========================================================
+        // ==== Output Event Summary ================================
+        // ==========================================================
+        
+        // Get the list of triggers reported by the SSP.
+        List<? extends SSPNumberedTrigger> sspTriggers;
+        if(isSingles) { sspTriggers = sspBank.getSinglesTriggers(); }
+        else { sspTriggers = sspBank.getPairTriggers(); }
+        
+        // Output the SSP cluster triggers.
+        OutputLogger.println();
+        OutputLogger.println("SSP Cluster " + (isSingles ? "Singles" : "Pair") + " Triggers");
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
+                OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
+                        (triggerNum + 1), triggerPositionString(simTrigger),
+                        getTriggerTime(simTrigger), simTrigger.toString());
+            }
+        }
+        if(sspTriggerList.get(0).size() + sspTriggerList.get(1).size() == 0) {
+            OutputLogger.println("\tNone");
+        }
+        
+        // Output the reconstructed cluster singles triggers.
+        OutputLogger.println("Reconstructed Cluster " + (isSingles ? "Singles" : "Pair") + " Triggers");
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            for(Trigger<?> simTrigger : reconTriggerList.get(triggerNum)) {
+                OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
+                        (triggerNum + 1), triggerPositionString(simTrigger),
+                        getTriggerTime(simTrigger), simTrigger.toString());
+            }
+        }
+        if(reconTriggerList.get(0).size() + reconTriggerList.get(1).size() == 0) {
+            OutputLogger.println("\tNone");
+        }
+        
+        // Output the SSP reported triggers.
+        OutputLogger.println("SSP Reported " + (isSingles ? "Singles" : "Pair") + " Triggers");
+        for(SSPTrigger sspTrigger : sspTriggers) {
+            OutputLogger.printf("\t%s%n", sspTrigger.toString());
+        }
+        if(sspTriggers.size() == 0) { OutputLogger.println("\tNone"); }
+        
+        // Update the trigger event with the counts for each type of
+        // simulated trigger. Reported triggers are counted later when
+        // already iterating over them.
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            triggerEvent[triggerNum].sawSSPSimulatedTriggers(tiFlags, sspTriggerList.get(triggerNum).size());
+            triggerEvent[triggerNum].sawReconSimulatedTriggers(tiFlags, reconTriggerList.get(triggerNum).size());
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== SSP Internal Logic Verification =====================
+        // ==========================================================
+        
+        // Track which SSP triggers have been matched to avoid matching
+        // multiple reconstructed SSP cluster triggers to the same SSP
+        // trigger.
+        Set<SSPNumberedTrigger> sspTriggerSet = new HashSet<SSPNumberedTrigger>();
+        Set<Trigger<?>> simTriggerSet = new HashSet<Trigger<?>>();
+        
+        // Track the number of SSP reported triggers that are found in
+        // excess of the SSP simulated triggers.
+        int sspReportedExtras = sspTriggers.size() - (sspTriggerList.get(0).size() + sspTriggerList.get(1).size());
+        if(sspReportedExtras > 0) {
+            if(isSingles) { singlesInternalFail = true; }
+            else { pairInternalFail = true; }
+        } else { sspReportedExtras = 0; }
+        
+        // Iterate over the triggers.
+        OutputLogger.println();
+        OutputLogger.println("Matching SSP Reported Triggers to SSP Simulated Triggers:");
+        for(SSPNumberedTrigger sspTrigger : sspTriggers) {
+            // Get the trigger information.
+            int triggerNum = sspTrigger.isFirstTrigger() ? 0 : 1;
+            OutputLogger.printf("\t%s%n", sspTrigger.toString());
+            
+            // Note that a bank trigger was seen.
+            triggerEvent[triggerNum].sawReportedTrigger();
+            
+            // Iterate over the SSP cluster simulated triggers and
+            // look for a trigger that matches.
+            matchLoop:
+            for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
+                // VERBOSE :: Output the trigger being considered for
+                //            matching.
+                OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s ",
+                        (triggerNum + 1), triggerPositionString(simTrigger),
+                        getTriggerTime(simTrigger), simTrigger.toString());
+                
+                // If the current SSP trigger has already been matched,
+                // skip it.
+                if(simTriggerSet.contains(simTrigger)) {
+                    OutputLogger.printf("[ %-15s ]%n", "failed; matched");
+                    continue matchLoop;
+                }
+                
+                // Check that the triggers have the same time. Triggers
+                // generated from SSP bank clusters should always align
+                // in time.
+                if(sspTrigger.getTime() != getTriggerTime(simTrigger)) {
+                    OutputLogger.printf("[ %-15s ]%n", "failed; time");
+                    continue matchLoop;
+                }
+                
+                // Check whether the trigger cuts match.
+                boolean[] matchedCuts = triggerCutMatch(simTrigger, sspTrigger);
+                for(int i = 0; i < matchedCuts.length; i++) {
+                    if(!matchedCuts[i]) {
+                        int typeIndex = isSingles ? 0 : 1;
+                        OutputLogger.printf("[ %-15s ]%n", String.format("failed; %s", cutNames[typeIndex][i]));
+                        continue matchLoop;
+                    }
+                }
+                
+                // If all the cuts match, along with the time and the
+                // trigger number, than these triggers are a match.
+                sspTriggerSet.add(sspTrigger);
+                simTriggerSet.add(simTrigger);
+                triggerEvent[triggerNum].matchedSSPTrigger(tiFlags);
+                OutputLogger.printf("[ %-15s ]%n", "success");
+                break matchLoop;
+            }
+        }
+        
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
+                globalTriggerPlots.sawTrigger(simTrigger);
+                if(simTriggerSet.contains(simTrigger)) {
+                    globalTriggerPlots.matchedTrigger(simTrigger);
+                } else {
+                    globalTriggerPlots.failedTrigger(simTrigger);
+                }
+            }
+        }
+        
+        // Iterate over the unmatched simulated triggers again and the
+        // unmatched SSP reported trigger that most closely matches it.
+        OutputLogger.println();
+        OutputLogger.println("Matching Failed SSP Reported Triggers to Remaining SSP Simulated Triggers:");
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            simLoop:
+            for(Trigger<?> simTrigger : sspTriggerList.get(triggerNum)) {
+                OutputLogger.printf("\tTrigger %d :: %s :: %3.0f :: %s%n",
+                        (triggerNum + 1), triggerPositionString(simTrigger),
+                        getTriggerTime(simTrigger), simTrigger.toString());
+                
+                // Check whether this trigger has already been matched
+                // or not. If it has been matched, skip it.
+                if(simTriggerSet.contains(simTrigger)) {
+                    OutputLogger.println("\t\tSkipping; already matched successfully");
+                    continue simLoop;
+                }
+                
+                // Get the trigger time for the simulated trigger.
+                double simTime = getTriggerTime(simTrigger);
+                
+                // Track the match statistics for each reported trigger
+                // so that the closest match may be found.
+                int numMatched = -1;
+                boolean[] matchedCut = null;
+                SSPNumberedTrigger bestMatch = null;
+                
+                // Store the readout for the best match.
+                String bestMatchText = null;
+                
+                // Iterate over the reported triggers to find a match.
+                reportedLoop:
+                for(SSPNumberedTrigger sspTrigger : sspTriggers) {
+                    OutputLogger.printf("\t\t%s ", sspTrigger.toString());
+                    
+                    // If the two triggers have different times, this
+                    // trigger should be skipped.
+                    if(sspTrigger.getTime() != simTime) {
+                        OutputLogger.printf("[ %-15s ]%n", "failed; time");
+                        continue reportedLoop;
+                    }
+                    
+                    // If this reported trigger has been matched then
+                    // it should be skipped.
+                    if(sspTriggerSet.contains(sspTrigger)) {
+                        OutputLogger.printf("[ %-15s ]%n", "failed; matched");
+                        continue reportedLoop;
+                    }
+                    
+                    // Check each of the cuts.
+                    boolean[] tempMatchedCut = triggerCutMatch(simTrigger, sspTrigger);
+                    
+                    // Check each cut and see if this is a closer match
+                    // than the previous best match.
+                    int tempNumMatched = 0;
+                    for(boolean passed : tempMatchedCut) { if(passed) { tempNumMatched++; } }
+                    OutputLogger.printf("[ %-15s ]%n", String.format("maybe; %d failed", tempNumMatched));
+                    
+                    // If the number of matched cuts exceeds the old
+                    // best result, this becomes the new best result.
+                    if(tempNumMatched > numMatched) {
+                        numMatched = tempNumMatched;
+                        matchedCut = tempMatchedCut;
+                        bestMatch = sspTrigger;
+                        bestMatchText = String.format("%s%n", sspTrigger.toString());
+                    }
+                }
+                
+                // If there was no match found, it means that there were
+                // no triggers that were both unmatched and at the same
+                // time as this simulated trigger.
+                if(bestMatch == null) {
+                    if(isSingles) { singlesInternalFail = true; }
+                    else { pairInternalFail = true; }
+                    triggerEvent[triggerNum].failedSSPTrigger();
+                    OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s",
+                            (triggerNum + 1), triggerPositionString(simTrigger),
+                            getTriggerTime(simTrigger), simTrigger.toString());
+                    OutputLogger.println(" --> No Valid Match Found");
+                } else {
+                    triggerEvent[triggerNum].matchedSSPTrigger(tiFlags, matchedCut);
+                    OutputLogger.printf("\t\tTrigger %d :: %s :: %3.0f :: %s",
+                            (triggerNum + 1), triggerPositionString(simTrigger),
+                            getTriggerTime(simTrigger), simTrigger.toString());
+                    OutputLogger.println(" --> " + bestMatchText);
+                }
+            }
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Trigger Efficiency ==================================
+        // ==========================================================
+        
+        // Reset the SSP matched trigger set.
+        sspTriggerSet.clear();
+        
+        // Iterate over the reconstructed cluster singles triggers.
+        OutputLogger.println();
+        OutputLogger.println("Recon Cluster Trigger --> SSP Reported Trigger Match Status");
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            for(Trigger<?> simTrigger : reconTriggerList.get(triggerNum)) {
+                OutputLogger.printf("\tTrigger %d :: %s :: %s%n", (triggerNum + 1),
+                        triggerPositionString(simTrigger), simTrigger.toString());
+                
+                // TEMP :: Populate the recon ALL pairs plots.
+                globalTriggerPlots.sawTrigger(simTrigger);
+                
+                // Iterate over the SSP reported triggers and compare
+                // them to the reconstructed cluster simulated trigger.
+                boolean matched = false;
+                matchLoop:
+                for(SSPNumberedTrigger sspTrigger : sspTriggers) {
+                    OutputLogger.printf("\t\t\t%s", sspTrigger.toString());
+                    
+                    // Only compare triggers if they are from the
+                    // same trigger source.
+                    if((triggerNum == 0 && sspTrigger.isSecondTrigger())
+                            || (triggerNum == 1 && sspTrigger.isFirstTrigger())) {
+                        OutputLogger.print(" [ fail; source    ]%n");
+                        continue matchLoop;
+                    }
+                    
+                    // Only compare the singles trigger if it was
+                    // not already matched to another trigger.
+                    if(sspTriggerSet.contains(sspTrigger)) {
+                        OutputLogger.print(" [ fail; matched   ]%n");
+                        continue matchLoop;
+                    }
+                    
+                    // Test each cut.
+                    int typeIndex = isSingles ? 0 : 1;
+                    boolean[] matchedCuts = triggerCutMatch(simTrigger, sspTrigger);
+                    for(int cutIndex = 0; cutIndex < matchedCuts.length; cutIndex++) {
+                        if(!matchedCuts[cutIndex]) {
+                            OutputLogger.printf(" [ fail; %-9s ]%n", cutNames[typeIndex][cutIndex]);
+                            continue matchLoop;
+                        }
+                    }
+                    
+                    // If all the trigger flags match, then the
+                    // triggers are a match.
+                    sspTriggerSet.add(sspTrigger);
+                    triggerEvent[triggerNum].matchedReconTrigger(tiFlags);
+                    OutputLogger.print(" [ success         ]%n");
+                    globalTriggerPlots.matchedTrigger(simTrigger);
+                    matched = true;
+                    break matchLoop;
+                }
+                
+                if(!matched) { globalTriggerPlots.failedTrigger(simTrigger); }
+            }
+        }
+        
+        
+        
+        // ==========================================================
+        // ==== Output Event Results ================================
+        // ==========================================================
+        
+        // Get the number of SSP and reconstructed cluster simulated
+        // triggers.
+        int sspSimTriggers = sspTriggerList.get(0).size() + sspTriggerList.get(1).size();
+        int reconSimTriggers = reconTriggerList.get(0).size() + reconTriggerList.get(1).size();
+        int[] sspTriggerCount = { sspTriggerList.get(0).size(), sspTriggerList.get(1).size() };
+        
+        // Print event statistics.
+        OutputLogger.println();
+        OutputLogger.println("Event Statistics:");
+        OutputLogger.printf("\tSSP Cluster Sim Triggers   :: %d%n", sspSimTriggers);
+        OutputLogger.printf("\tRecon Cluster Sim Triggers :: %d%n", reconSimTriggers);
+        OutputLogger.printf("\tSSP Reported Triggers      :: %d%n", sspTriggers.size());
+        
+        int matchedSSPTriggers = triggerEvent[0].getMatchedSSPSimulatedTriggers() + triggerEvent[1].getMatchedSSPSimulatedTriggers();
+        OutputLogger.printf("\tInternal Efficiency        :: %d / %d ", matchedSSPTriggers, sspSimTriggers);
+        if(sspSimTriggers == 0) { OutputLogger.printf("(N/A)%n"); }
+        else { OutputLogger.printf("(%3.0f%%)%n", (100.0 * matchedSSPTriggers / sspSimTriggers)); }
+        
+        int matchedReconTriggers = triggerEvent[0].getMatchedReconSimulatedTriggers() + triggerEvent[1].getMatchedReconSimulatedTriggers();
+        OutputLogger.printf("\tTrigger Efficiency         :: %d / %d", matchedReconTriggers, reconSimTriggers);
+        if(reconSimTriggers == 0) { OutputLogger.printf("(N/A)%n"); }
+        else { OutputLogger.printf("(%3.0f%%)%n", (100.0 * matchedReconTriggers / reconSimTriggers)); }
+        
+        // Print the individual cut performances.
+        if(isSingles) {
+            OutputLogger.println();
+            for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+                OutputLogger.printf("Trigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
+                if(sspSimTriggers == 0) {
+                    OutputLogger.printf("\tCluster Energy Lower Bound :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN), sspTriggerCount[triggerNum]);
+                    OutputLogger.printf("\tCluster Energy Upper Bound :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX), sspTriggerCount[triggerNum]);
+                    OutputLogger.printf("\tCluster Hit Count          :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT), sspTriggerCount[triggerNum]);
+                } else {
+                    OutputLogger.printf("\tCluster Energy Lower Bound :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MIN) / sspTriggerCount[triggerNum]));
+                    OutputLogger.printf("\tCluster Energy Upper Bound :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_MAX) / sspTriggerCount[triggerNum]));
+                    OutputLogger.printf("\tCluster Hit Count          :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(HIT_COUNT) / sspTriggerCount[triggerNum]));
+                }
+            }
+            
+            // Update the global trigger tracking variables.
+            localStats.getTriggerStats().getSingles0Stats().addEvent(triggerEvent[0]);
+            localStats.getTriggerStats().getSingles1Stats().addEvent(triggerEvent[1]);
+            globalStats.getTriggerStats().getSingles0Stats().addEvent(triggerEvent[0]);
+            globalStats.getTriggerStats().getSingles1Stats().addEvent(triggerEvent[1]);
+        } else {
+            for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+                OutputLogger.println();
+                OutputLogger.printf("Trigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
+                if(sspTriggerCount[triggerNum] == 0) {
+                    OutputLogger.printf("\tPair Energy Sum            :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM), sspTriggerCount[triggerNum]);
+                    OutputLogger.printf("\tPair Energy Difference     :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF), sspTriggerCount[triggerNum]);
+                    OutputLogger.printf("\tPair Energy Slope          :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount[triggerNum]);
+                    OutputLogger.printf("\tPair Coplanarity           :: %d / %d%n", triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY), sspTriggerCount[triggerNum]);
+                } else {
+                    OutputLogger.printf("\tPair Energy Sum            :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SUM) / sspTriggerCount[triggerNum]));
+                    OutputLogger.printf("\tPair Energy Difference     :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_DIFF) / sspTriggerCount[triggerNum]));
+                    OutputLogger.printf("\tPair Energy Slope          :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(ENERGY_SLOPE) / sspTriggerCount[triggerNum]));
+                    OutputLogger.printf("\tPair Coplanarity           :: %d / %d (%3.0f%%)%n",
+                            triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY), sspTriggerCount[triggerNum],
+                            (100.0 * triggerEvent[triggerNum].getSSPCutFailures(COPLANARITY) / sspTriggerCount[triggerNum]));
+                }
+            }
+            
+            // Update the global trigger tracking variables.
+            localStats.getTriggerStats().getPair0Stats().addEvent(triggerEvent[0]);
+            localStats.getTriggerStats().getPair1Stats().addEvent(triggerEvent[1]);
+            globalStats.getTriggerStats().getPair0Stats().addEvent(triggerEvent[0]);
+            globalStats.getTriggerStats().getPair1Stats().addEvent(triggerEvent[1]);
+        }
+        
+        // Note whether the was a trigger match failure.
+        if(triggerEvent[0].getFailedReconSimulatedTriggers() != 0 && triggerEvent[1].getFailedReconSimulatedTriggers() != 0) {
+            if(isSingles) { singlesEfficiencyFail = true; }
+            else { pairEfficiencyFail = true; }
+        } if(triggerEvent[0].getFailedSSPSimulatedTriggers() != 0 && triggerEvent[1].getFailedSSPSimulatedTriggers() != 0) {
+            if(isSingles) { singlesInternalFail = true; }
+            else { pairInternalFail = true; }
+        }
+    }
+    
+    /**
+     * Outputs all of the verification parameters currently in use by
+     * the software. A warning will be issued if the values for NSA and
+     * NSB, along with the FADC window, preclude clusters from being
+     * verified.
+     */
+    private void logSettings() {
+        // Output general settings.
+        System.out.println("Cluster Verification Settings");
+        System.out.printf("\tHit Threshold          :: %1d hit(s)%n", hitAcceptance);
+        System.out.printf("\tEnergy Threshold       :: %5.3f GeV%n",  energyAcceptance);
+        System.out.println();
+        
+        // Output window settings.
+        System.out.println("FADC Timing Window Settings");
+        System.out.printf("\tNSB                    :: %3d ns%n", nsb);
+        System.out.printf("\tNSA                    :: %3d ns%n", nsa);
+        System.out.printf("\tFADC Window            :: %3d ns%n", windowWidth);
+        
+        // Calculate the valid clustering window.
+        int start = nsb;
+        int end = windowWidth - nsa;
+        if(start < end) {
+            System.out.printf("\tValid Cluster Window   :: [ %3d ns, %3d ns ]%n", start, end);
+            performClusterVerification = true;
+        } else {
+            System.out.println("\tNSB, NSA, and FADC window preclude a valid cluster verification window.");
+            System.out.println("\tCluster verification will not be performed!");
+            performClusterVerification = false;
+        }
+        System.out.println();
+        
+        // Output the singles trigger settings.
+        for(int i = 0; i < 2; i++) {
+            // Print the settings.
+            System.out.printf("Singles Trigger %d Settings%23s[%5b]%n", (i + 1), "", singlesTriggerEnabled[i]);
+            System.out.printf("\tCluster Energy Low     :: %.3f GeV      [%5b]%n",
+                    singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), singlesCutsEnabled[i][0]);
+            System.out.printf("\tCluster Energy High    :: %.3f GeV      [%5b]%n",
+                    singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH), singlesCutsEnabled[i][1]);
+            System.out.printf("\tCluster Hit Count      :: %.0f hit(s)       [%5b]%n",
+                    singlesTrigger[i].getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW), singlesCutsEnabled[i][2]);
+            System.out.println();
+        }
+        
+        // Output the pair trigger settings.
+        for(int i = 0; i < 2; i++) {
+            System.out.printf("Pairs Trigger %d Settings%25s[%5b]%n", (i + 1), "", pairTriggerEnabled[i]);
+            System.out.printf("\tCluster Energy Low     :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), pairCutsEnabled[i][0]);
+            System.out.printf("\tCluster Energy High    :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH), pairCutsEnabled[i][1]);
+            System.out.printf("\tCluster Hit Count      :: %.0f hit(s)       [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW), pairCutsEnabled[i][2]);
+            System.out.printf("\tPair Energy Sum Low    :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW), pairCutsEnabled[i][3]);
+            System.out.printf("\tPair Energy Sum High   :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH), pairCutsEnabled[i][3]);
+            System.out.printf("\tPair Energy Difference :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH), pairCutsEnabled[i][4]);
+            System.out.printf("\tPair Energy Slope      :: %.3f GeV      [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW), pairCutsEnabled[i][5]);
+            System.out.printf("\tPair Energy Slope F    :: %.4f GeV / mm%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F));
+            System.out.printf("\tPair Coplanarity       :: %3.0f Degrees    [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_COPLANARITY_HIGH), pairCutsEnabled[i][6]);
+            System.out.printf("\tPair Time Coincidence  :: %2.0f ns          [%5b]%n",
+                    pairsTrigger[i].getCutValue(TriggerModule.PAIR_TIME_COINCIDENCE), true);
+            System.out.println();
+        }
+    }
+    
+    /**
+     * Summarizes the global run statistics in a log to the terminal.
+     */
+    private void logStatistics() {
+        // Print the cluster/trigger verification header.
+        System.out.println();
+        System.out.println();
+        System.out.println("======================================================================");
+        System.out.println("=== Cluster/Trigger Verification Results =============================");
+        System.out.println("======================================================================");
+        
+        // Print the general event failure rate.
+        int headSpaces = getPrintSpaces(globalStats.getEventCount());
+        System.out.println("General Event Statistics:");
+        System.out.printf("\tEvent Start Time      :: %.3f s%n", (startTime / Math.pow(10, 9)));
+        System.out.printf("\tEvent End Time        :: %.3f%n", (endTime / Math.pow(10, 9)));
+        System.out.printf("\tEvent Run Time        :: %.3f%n", ((endTime - startTime) / Math.pow(10, 9)));
+        System.out.printf("\tNoise Events          :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
+                globalStats.getNoiseEvents(), globalStats.getEventCount(), (100.0 * globalStats.getNoiseEvents() / globalStats.getEventCount()));
+        System.out.printf("\tCluster Events Failed :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
+                globalStats.getFailedClusterEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedClusterEventCount() / globalStats.getEventCount()));
+        System.out.printf("\tSingles Events Failed :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
+                globalStats.getFailedSinglesEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedSinglesEventCount() / globalStats.getEventCount()));
+        System.out.printf("\tPair Events Failed    :: %" + headSpaces + "d / %" + headSpaces + "d (%7.3f%%)%n",
+                globalStats.getFailedPairEventCount(), globalStats.getEventCount(), (100.0 * globalStats.getFailedPairEventCount() / globalStats.getEventCount()));
+        
+        // Print out how many events reported a given TI type, both in
+        // total and hierarchically.
+        System.out.println();
+        System.out.println("Event Triggering Type Verification:");
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Trigger", "Total", "Hierarchical");
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Pulser", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PULSER, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PULSER, true));
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Cosmic", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.COSMIC, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.COSMIC, true));
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Singles 1", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES0, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES0, true));
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Singles 2", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES1, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.SINGLES1, true));
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Pair 1", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR0, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR0, true));
+        System.out.printf("\t%15s\t%15s\t%15s%n", "Pair 2", globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR1, false),
+                globalStats.getTriggerStats().getTITriggers(TriggerDiagStats.PAIR1, true));
+        
+        // Print the cluster verification data.
+        System.out.println();
+        System.out.println("Cluster Verification:");
+        System.out.printf("\tRecon Clusters        :: %d%n", globalStats.getClusterStats().getReconClusterCount());
+        System.out.printf("\tSSP Clusters          :: %d%n", globalStats.getClusterStats().getSSPClusterCount());
+        System.out.printf("\tClusters Matched      :: %d%n", globalStats.getClusterStats().getMatches());
+        System.out.printf("\tFailed (Position)     :: %d%n", globalStats.getClusterStats().getPositionFailures());
+        System.out.printf("\tFailed (Energy)       :: %d%n", globalStats.getClusterStats().getEnergyFailures());
+        System.out.printf("\tFailed (Hit Count)    :: %d%n", globalStats.getClusterStats().getHitCountFailures());
+        if(globalStats.getClusterStats().getReconClusterCount() == 0) {
+            System.out.printf("\tCluster Efficiency    :: N/A%n");
+        } else {
+            System.out.printf("\tCluster Efficiency    :: %7.3f%%%n",
+                    100.0 * globalStats.getClusterStats().getMatches() / globalStats.getClusterStats().getReconClusterCount());
+        }
+        
+        // Print the trigger verification data.
+        for(int triggerType = 0; triggerType < 2; triggerType++) {
+            // Get the trigger data. Type 0 represents singles triggers.
+            TriggerEvent[] triggerData = new TriggerEvent[2];
+            if(triggerType == 0) {
+                triggerData[0] = globalStats.getTriggerStats().getSingles0Stats();
+                triggerData[1] = globalStats.getTriggerStats().getSingles1Stats();
+            } else {
+                triggerData[0] = globalStats.getTriggerStats().getPair0Stats();
+                triggerData[1] = globalStats.getTriggerStats().getPair1Stats();
+            }
+            
+            // Get the basic trigger data.
+            int sspSimTriggers = triggerData[0].getSSPSimulatedTriggers() + triggerData[1].getSSPSimulatedTriggers();
+            int reconSimTriggers = triggerData[0].getReconSimulatedTriggers() + triggerData[1].getReconSimulatedTriggers();
+            int sspReportedTriggers = triggerData[0].getReportedTriggers() + triggerData[1].getReportedTriggers();
+            int sspMatchedTriggers = triggerData[0].getMatchedSSPSimulatedTriggers() + triggerData[1].getMatchedSSPSimulatedTriggers();
+            int reconMatchedTriggers = triggerData[0].getMatchedReconSimulatedTriggers() + triggerData[1].getMatchedReconSimulatedTriggers();
+            
+            // Print the basic trigger statistics.
+            int spaces = getPrintSpaces(sspSimTriggers, reconSimTriggers, sspReportedTriggers);
+            System.out.println();
+            if(triggerType == 0) { System.out.println("Singles Trigger Verification:"); }
+            else { System.out.println("Pair Trigger Verification:"); }
+            System.out.printf("\tSSP Cluster Sim Triggers   :: %" + spaces + "d%n", sspSimTriggers);
+            System.out.printf("\tRecon Cluster Sim Triggers :: %" + spaces + "d%n", reconSimTriggers);
+            System.out.printf("\tSSP Reported Triggers      :: %" + spaces + "d%n", sspReportedTriggers);
+            
+            System.out.printf("\tInternal Efficiency        :: %" + spaces + "d / %" + spaces + "d ", sspMatchedTriggers, sspSimTriggers);
+            if(sspSimTriggers == 0) { System.out.printf("(N/A)%n"); }
+            else { System.out.printf("(%7.3f%%)%n", (100.0 * sspMatchedTriggers / sspSimTriggers)); }
+            
+            System.out.printf("\tTrigger Efficiency         :: %" + spaces + "d / %" + spaces + "d ", reconMatchedTriggers, reconSimTriggers);
+            if(reconSimTriggers == 0) { System.out.printf("(N/A)%n"); }
+            else { System.out.printf("(%7.3f%%)%n" , (100.0 * reconMatchedTriggers / reconSimTriggers)); }
+            
+            // Print the individual cut performances.
+            if(triggerType == 0) {
+                for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+                    // Get the appropriate trigger statistics module.
+                    TriggerEvent triggerStats;
+                    if(triggerNum == 0) { triggerStats = globalStats.getTriggerStats().getSingles0Stats(); }
+                    else { triggerStats = globalStats.getTriggerStats().getSingles1Stats(); }
+                    
+                    // Get the number of SSP triggers for this trigger number.
+                    int sspTriggerCount = triggerStats.getSSPSimulatedTriggers();
+                    //int sspTriggerCount = triggerRunStats[0].getTotalSSPTriggers(triggerNum);
+                
+                    System.out.println();
+                    System.out.printf("\tTrigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
+                    System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerStats.getUnmatchedSSPSimulatedTriggers());
+                    //System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerRunStats[0].getUnmatchedTriggers(triggerNum));
+                    if(sspTriggerCount == 0) {
+                        System.out.printf("\t\tCluster Energy Lower Bound :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(ENERGY_MIN), sspTriggerCount);
+                        System.out.printf("\t\tCluster Energy Upper Bound :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(ENERGY_MAX), sspTriggerCount);
+                        System.out.printf("\t\tCluster Hit Count          :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(HIT_COUNT), sspTriggerCount);
+                    } else {
+                        System.out.printf("\t\tCluster Energy Lower Bound :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(ENERGY_MIN), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(ENERGY_MIN) / sspTriggerCount));
+                        System.out.printf("\t\tCluster Energy Upper Bound :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(ENERGY_MAX), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(ENERGY_MAX) / sspTriggerCount));
+                        System.out.printf("\t\tCluster Hit Count          :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(HIT_COUNT), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(HIT_COUNT) / sspTriggerCount));
+                    }
+                }
+            } else {
+                for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+                    // Get the appropriate trigger statistics module.
+                    TriggerEvent triggerStats;
+                    if(triggerNum == 0) { triggerStats = globalStats.getTriggerStats().getPair0Stats(); }
+                    else { triggerStats = globalStats.getTriggerStats().getPair1Stats(); }
+                    
+                    // Get the number of SSP triggers for this trigger number.
+                    int sspTriggerCount = triggerStats.getSSPSimulatedTriggers();
+                    
+                    System.out.println();
+                    System.out.printf("\tTrigger %d Individual Cut Failure Rate:%n", (triggerNum + 1));
+                    System.out.printf("\t\tUmatched Triggers          :: %" + spaces + "d%n", triggerStats.getUnmatchedSSPSimulatedTriggers());
+                    if(sspTriggerCount == 0) {
+                        System.out.printf("\t\tPair Energy Sum            :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(ENERGY_SUM), sspTriggerCount);
+                        System.out.printf("\t\tPair Energy Difference     :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(ENERGY_DIFF), sspTriggerCount);
+                        System.out.printf("\t\tPair Energy Slope          :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount);
+                        System.out.printf("\t\tPair Coplanarity           :: %" + spaces + "d / %" + spaces + "d%n",
+                                triggerStats.getSSPCutFailures(COPLANARITY), sspTriggerCount);
+                    } else {
+                        System.out.printf("\t\tPair Energy Sum            :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(ENERGY_SUM), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(ENERGY_SUM) / sspTriggerCount));
+                        System.out.printf("\t\tPair Energy Difference     :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(ENERGY_DIFF), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(ENERGY_DIFF) / sspTriggerCount));
+                        System.out.printf("\t\tPair Energy Slope          :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(ENERGY_SLOPE), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(ENERGY_SLOPE) / sspTriggerCount));
+                        System.out.printf("\t\tPair Coplanarity           :: %" + spaces + "d / %" + spaces + "d (%7.3f%%)%n",
+                                triggerStats.getSSPCutFailures(COPLANARITY), sspTriggerCount,
+                                (100.0 * triggerStats.getSSPCutFailures(COPLANARITY) / sspTriggerCount));
+                    }
+                }
+            }
+        }
+        
+        // Print out the trigger efficiency table.
+        System.out.println();
+        globalStats.getTriggerStats().printEfficiencyTable();
+    }
+    
+    /**
+     * Checks whether all of the hits in a cluster are within the safe
+     * region of the FADC output window.
+     * @param reconCluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is safe and
+     * returns <code>false</code> otherwise.
+     */
+    private final boolean isVerifiable(Cluster reconCluster) {
+        return TriggerDiagnosticUtil.isVerifiable(reconCluster, nsa, nsb, windowWidth);
+    }
+    
+    /**
+     * Generates a <code>List</code> collection that contains a set
+     * of <code>ArrayList</code> collections representing a unique
+     * permutation of the entries in the argument.
+     * @param values - A collection of the entries to be permuted.
+     * @return Returns a list of lists representing the permutations.
+     */
+    private static final List<List<Pair<Cluster, SSPCluster>>> getPermutations(List<Cluster> reconClusters, List<SSPCluster> sspClusters) {
+        // Store the SSP cluster permutations.
+        List<List<SSPCluster>> permList = new ArrayList<List<SSPCluster>>();
+        
+        // Make sure that the two lists are the same size.
+        int reconSize = reconClusters.size();
+        int sspSize = sspClusters.size();
+        while(sspClusters.size() < reconClusters.size()) {
+            sspClusters.add(null);
+        }
+        while(reconClusters.size() < sspClusters.size()) {
+            reconClusters.add(null);
+        }
+        
+        // Get the SSP cluster permutations.
+        permute(new ArrayList<SSPCluster>(0), sspClusters, permList);
+        
+        // Create pairs from the permutations.
+        List<List<Pair<Cluster, SSPCluster>>> pairList = new ArrayList<List<Pair<Cluster, SSPCluster>>>();
+        for(List<SSPCluster> permutation : permList) {
+            List<Pair<Cluster, SSPCluster>> pairs = new ArrayList<Pair<Cluster, SSPCluster>>(reconClusters.size());
+            
+            for(int clusterIndex = 0; (clusterIndex < reconClusters.size() && clusterIndex < permutation.size()); clusterIndex++) {
+                pairs.add(new Pair<Cluster, SSPCluster>(reconClusters.get(clusterIndex), permutation.get(clusterIndex)));
+            }
+            
+            pairList.add(pairs);
+        }
+        
+        // Remove the extra values.
+        for(int i = sspClusters.size() - 1; i >= sspSize; i--) { sspClusters.remove(i); }
+        for(int i = reconClusters.size() - 1; i >= reconSize; i--) { reconClusters.remove(i); }
+        
+        // Return the pairs.
+        return pairList;
+    }
+    
+    /**
+     * Recursive method for permuting all entries in the argument
+     * collection <code>remainingValues</code> into the argument
+     * <code>permutedValues</code> values. Completed permutations are
+     * placed in the argument <code>permList</code>.
+     * @param permutedValues - List to store entries that have already
+     * been permuted.
+     * @param remainingValues - List to store  entries that need to be
+     * permuted.
+     * @param permList - List to store completed permutations.
+     */
+    private static final void permute(List<SSPCluster> permutedValues, List<SSPCluster> remainingValues, List<List<SSPCluster>> permList) {
+        // If the list of entries that still need to be sorted is empty,
+        // then there is nothing to sort. Just return and empty list.
+        if(remainingValues.isEmpty()) { return; }
+        
+        // If there is only one value left in the list of entries that
+        // still need to be sorted, then just add it to the permutation
+        // list and return it.
+        else if(remainingValues.size() <= 1) {
+            // Add the last entry.
+            permutedValues.add(remainingValues.get(0));
+            
+            // Add the permutation to the list of completed permutations.
+            permList.add(permutedValues);
+        }
+        
+        // Otherwise, continue to get all possible permutations.
+        else {
+            // Iterate over the entries that have not been permuted.
+            for(int i = 0; i < remainingValues.size(); i++) {
+                // Make new lists to contain the permutations.
+                List<SSPCluster> newPermList = new ArrayList<SSPCluster>(permutedValues.size() + 1);
+                List<SSPCluster> newRemainList = new ArrayList<SSPCluster>(remainingValues.size());
+                
+                // Copy the current permuted entries to the new list
+                // and one value from the list of entries that have
+                // not been permuted yet.
+                newPermList.addAll(permutedValues);
+                newPermList.add(remainingValues.get(i));
+                
+                // The new list of entries that have not been permuted
+                // should be identical, except it should now be missing
+                // the entry that was moved.
+                for(int index = 0; index < remainingValues.size(); index++) {
+                    if(index != i) { newRemainList.add(remainingValues.get(index)); }
+                }
+                
+                // Repeat the process with the new lists.
+                permute(newPermList, newRemainList, permList);
+            }
+        }
+    }
+    
+    /**
+     * Compares two cluster matching events and finds the one that has
+     * the better results. Note that this will only return results that
+     * make sense if both of the events represent different permutations
+     * of the same set of clusters. Comparing events with different sets
+     * of clusters will produce meaningless results.
+     * @param firstEvent - The first cluster matching event,
+     * @param secondEvent - The second cluster matching event.
+     * @return Returns the cluster matching event that is better.
+     */
+    private static final DetailedClusterEvent getBestPermutation(DetailedClusterEvent firstEvent, DetailedClusterEvent secondEvent) {
+        // If both permutations are null, return that.
+        if(firstEvent == null && secondEvent == null) {
+            return null;
+        }
+        
+        // If one permutation is null, it is not the best.
+        if(firstEvent == null) { return secondEvent; }
+        else if(secondEvent == null) { return firstEvent; }
+        
+        // A permutation is better if it has more matches.
+        if(firstEvent.getMatches() > secondEvent.getMatches()) { return firstEvent; }
+        else if(secondEvent.getMatches() > firstEvent.getMatches()) { return secondEvent; }
+        
+        // Otherwise, the permutation with the least energy failures is
+        // the better permutation.
+        if(firstEvent.getEnergyFailures() < secondEvent.getEnergyFailures()) { return firstEvent; }
+        else if(secondEvent.getEnergyFailures() < firstEvent.getEnergyFailures()) { return secondEvent; }
+        
+        // If both these values are the same, then the events are identical.
+        return firstEvent;
+    }
+    
+    /**
+     * Determines the number of spaces needed to render the longest of
+     * a series of integers as a string.
+     * @param vals - The series of integers.
+     * @return Returns the number of spaces needed to render the longest
+     * integer as a base-10 string.
+     */
+    private static final int getPrintSpaces(int... vals) {
+        // Track the largest value.
+        int largest = 0;
+        
+        // Iterate over the arguments and find the largest.
+        for(int val : vals) {
+            // Get the length of the string.
+            int length = TriggerDiagnosticUtil.getDigits(val);
+            
+            // If it is larger, track it.
+            if(length > largest) { largest = length; }
+        }
+        
+        // Return the longer one.
+        return largest;
+    }
+    
+    /**
+     * Gets the position of the source of a <code>Trigger</code> object
+     * as text. This method only supports trigger sources of the types
+     * <code>SSPCluster</code>, <code>Cluster</code>, and arrays of size
+     * two of either type.
+     * @param trigger - The trigger from which to obtain the source.
+     * @return Returns the source of the trigger as a <code>String</code>
+     * object.
+     * @throws IllegalArgumentException Occurs if the source of the
+     * trigger is not any of the supported types.
+     */
+    private static final String triggerPositionString(Trigger<?> trigger) throws IllegalArgumentException {
+        // Get the trigger source.
+        Object source = trigger.getTriggerSource();
+        
+        // Handle valid trigger sources.
+        if(source instanceof SSPCluster) {
+            return TriggerDiagnosticUtil.clusterPositionString((SSPCluster) source);
+        } else if(source instanceof Cluster) {
+            return TriggerDiagnosticUtil.clusterPositionString((Cluster) source);
+        } else if(source instanceof SSPCluster[]) {
+            SSPCluster[] sourcePair = (SSPCluster[]) source;
+            if(sourcePair.length == 2) {
+                return String.format("%s, %s", TriggerDiagnosticUtil.clusterPositionString(sourcePair[0]),
+                        TriggerDiagnosticUtil.clusterPositionString(sourcePair[1]));
+            }
+        } else if(source instanceof Cluster[]) {
+            Cluster[] sourcePair = (Cluster[]) source;
+            if(sourcePair.length == 2) {
+                return String.format("%s, %s", TriggerDiagnosticUtil.clusterPositionString(sourcePair[0]),
+                        TriggerDiagnosticUtil.clusterPositionString(sourcePair[1]));
+            }
+        }
+        
+        // Otherwise, the source type is unrecognized. Throw an error.
+        throw new IllegalArgumentException(String.format("Trigger source type \"%s\" is not supported.",
+                trigger.getTriggerSource().getClass().getSimpleName()));
+    }
+    
+    /**
+     * Gets the time of a simulated trigger object. Method supports
+     * triggers with source objects of type <code>SSPCluster</code>,
+     * <code>Cluster</code>, and arrays of size two composed of either
+     * object type.
+     * @param trigger - The trigger.
+     * @return Returns the time at which the trigger occurred.
+     * @throws IllegalArgumentException Occurs if the trigger source
+     * is not a supported type.
+     */
+    private static final double getTriggerTime(Trigger<?> trigger) throws IllegalArgumentException {
+        // Get the trigger source.
+        Object source = trigger.getTriggerSource();
+        
+        // Get the trigger time for supported trigger types.
+        if(source instanceof SSPCluster) {
+            return ((SSPCluster) source).getTime();
+        } else if(source instanceof Cluster) {
+            return TriggerDiagnosticUtil.getClusterTime((Cluster) source);
+        } else if(source instanceof SSPCluster[]) {
+            // Get the pair.
+            SSPCluster[] sourcePair = (SSPCluster[]) source;
+            
+            // Get the time of the bottom cluster.
+            if(sourcePair.length == 2) {
+                if(sourcePair[0].getYIndex() < 0) { return sourcePair[0].getTime(); }
+                else if(sourcePair[1].getYIndex() < 0) { return sourcePair[1].getTime(); }
+                else { throw new IllegalArgumentException("Cluster pairs must be formed of a top/bottom pair."); }
+            }
+            else { throw new IllegalArgumentException("Cluster pairs must be of size 2."); }
+        } else if(source instanceof Cluster[]) {
+            // Get the pair.
+            Cluster[] sourcePair = (Cluster[]) source;
+            int[] iy = {
+                TriggerDiagnosticUtil.getYIndex(sourcePair[0]),
+                TriggerDiagnosticUtil.getYIndex(sourcePair[1])
+            };
+            
+            // Get the time of the bottom cluster.
+            if(sourcePair.length == 2) {
+                if(iy[0] < 0) { return TriggerDiagnosticUtil.getClusterTime(sourcePair[0]); }
+                else if(iy[1] < 0) { return TriggerDiagnosticUtil.getClusterTime(sourcePair[1]); }
+                else { throw new IllegalArgumentException("Cluster pairs must be formed of a top/bottom pair."); }
+            }
+            else { throw new IllegalArgumentException("Cluster pairs must be of size 2."); }
+        }
+        
+        // If the source type is unrecognized, throw an exception.
+        throw new IllegalArgumentException(String.format("Trigger source type \"%\" is not supported.",
+                source.getClass().getSimpleName()));
+    }
+    
+    /**
+     * Checks if a simulated trigger and an SSP trigger match. Note
+     * that only certain types can be compared. These are:
+     * <ul><li><code>SinglesTrigger<?> --> SSPSinglesTrigger</code></li>
+     * <li><code>PairTrigger<?> --> SSPPairTrigger</code></li></ul>
+     * @param simTrigger - The simulated trigger.
+     * @param sspTrigger - The SSP bank trigger.
+     * @return Returns an array of <code>boolean</code> primitives that
+     * indicate which cuts passed and which failed.
+     */
+    private static final boolean[] triggerCutMatch(Trigger<?> simTrigger, SSPTrigger sspTrigger) {
+        // Check that the cuts match for supported trigger types.
+        if(simTrigger instanceof SinglesTrigger && sspTrigger instanceof SSPSinglesTrigger) {
+            // Create an array to store the cut checks.
+            boolean[] cutMatch = new boolean[3];
+            
+            // Cast the triggers.
+            SinglesTrigger<?> simSingles = (SinglesTrigger<?>) simTrigger;
+            SSPSinglesTrigger sspSingles = (SSPSinglesTrigger) sspTrigger;
+            
+            // Perform the check.
+            cutMatch[ENERGY_MIN] = (simSingles.getStateClusterEnergyLow()  == sspSingles.passCutEnergyMin());
+            cutMatch[ENERGY_MAX] = (simSingles.getStateClusterEnergyHigh() == sspSingles.passCutEnergyMax());
+            cutMatch[HIT_COUNT] = (simSingles.getStateHitCount()          == sspSingles.passCutHitCount());
+            
+            // Return the match array.
+            return cutMatch;
+        } else if(simTrigger instanceof PairTrigger && sspTrigger instanceof SSPPairTrigger) {
+            // Create an array to store the cut checks.
+            boolean[] cutMatch = new boolean[4];
+            
+            // Cast the triggers.
+            PairTrigger<?> simPair = (PairTrigger<?>) simTrigger;
+            SSPPairTrigger sspPair = (SSPPairTrigger) sspTrigger;
+            
+            // Perform the check.
+            cutMatch[ENERGY_SUM] = (simPair.getStateEnergySum()        == sspPair.passCutEnergySum());
+            cutMatch[ENERGY_DIFF] = (simPair.getStateEnergyDifference() == sspPair.passCutEnergyDifference());
+            cutMatch[ENERGY_SLOPE] = (simPair.getStateEnergySlope()      == sspPair.passCutEnergySlope());
+            cutMatch[COPLANARITY] = (simPair.getStateCoplanarity()      == sspPair.passCutCoplanarity());
+            
+            // Return the match array.
+            return cutMatch;
+        }
+        
+        // If this point is reached, the triggers are not of a supported
+        // type for cut comparison. Produce an exception.
+        throw new IllegalArgumentException(String.format("Triggers of type \"%s\" can not be cut-matched with triggers of type \"%s\".",
+                simTrigger.getClass().getSimpleName(), sspTrigger.getClass().getSimpleName()));
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerTurnOnDriver.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerTurnOnDriver.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/TriggerTurnOnDriver.java	Wed Mar  9 11:43:24 2016
@@ -70,9 +70,9 @@
     public TriggerTurnOnDriver() {
     }
     
-	public void setShowPlots(boolean showPlots) {
-		this.showPlots = showPlots;
-	}
+    public void setShowPlots(boolean showPlots) {
+        this.showPlots = showPlots;
+    }
 
     @Override
     protected void detectorChanged(Detector detector) {

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterEvent.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterEvent.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterEvent.java	Wed Mar  9 11:43:24 2016
@@ -9,104 +9,104 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ClusterEvent extends ClusterStatModule {
-	/**
-	 * Fuses another <code>ClusterEvent</code> with this object. The
-	 * other event's cluster pairs and states will be added to those
-	 * already in this event.
-	 * @param event - The event to fuse.
-	 */
-	public void addEvent(ClusterEvent event) {
-		// If the event is null, do nothing.
-		if(event == null) { return; }
-		
-		// Add the values stored in the argument event to the counters
-		// in this event.
-		sspClusters   += event.sspClusters;
-		reconClusters += event.reconClusters;
-		matches       += event.matches;
-		failEnergy    += event.failEnergy;
-		failPosition  += event.failPosition;
-		failHitCount  += event.failHitCount;
-	}
-	
-	/**
-	 * Indicates whether at least one cluster pair in the event created
-	 * a fail state.
-	 * @return Returns <code>true</code> if not all clusters matched and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean isFailState() {
-		return (failEnergy > 0) || (failHitCount > 0) || (failTime > 0) || (failPosition > 0);
-	}
-	
-	/**
-	 * Notes that a reconstructed cluster and SSP cluster pair failed
-	 * due to energy.
-	 */
-	public void pairFailEnergy() {
-		failEnergy++;
-	}
-	
-	/**
-	 * Notes that a reconstructed cluster and SSP cluster pair failed
-	 * due to hit count.
-	 */
-	public void pairFailHitCount() {
-		failHitCount++;
-	}
-	
-	/**
-	 * Notes that a reconstructed cluster and SSP cluster pair failed
-	 * due to position.
-	 */
-	public void pairFailPosition() {
-		failPosition++;
-	}
-	
-	/**
-	 * Notes that one or more reconstructed cluster and SSP cluster pair
-	 * failed due to position.
-	 * @param count - The number of events that failed in this manner.
-	 */
-	public void pairFailPosition(int count) {
-		// negative values are non-physical.
-		if(count < 0) {
-			throw new IllegalArgumentException("Cluster failure counts must be non-negative.");
-		}
-		
-		// Increment the count.
-		failPosition += count;
-	}
-	
-	/**
-	 * Notes that a reconstructed cluster and SSP cluster pair failed
-	 * due to time.
-	 */
-	public void pairFailTime() {
-		failTime++;
-	}
-	
-	/**
-	 * Notes that a reconstructed cluster and SSP cluster pair was
-	 * successfully matched.
-	 */
-	public void pairMatch() {
-		matches++;
-	}
-	
-	/**
-	 * Increments the number of reconstructed FADC clusters seen.
-	 * @param count - The number of clusters seen.
-	 */
-	public void sawReconClusters(int count) {
-		reconClusters += count;
-	}
-	
-	/**
-	 * Increments the number of SSP bank clusters seen.
-	 * @param count - The number of clusters seen.
-	 */
-	public void sawSSPClusters(int count) {
-		sspClusters += count;
-	}
+    /**
+     * Fuses another <code>ClusterEvent</code> with this object. The
+     * other event's cluster pairs and states will be added to those
+     * already in this event.
+     * @param event - The event to fuse.
+     */
+    public void addEvent(ClusterEvent event) {
+        // If the event is null, do nothing.
+        if(event == null) { return; }
+        
+        // Add the values stored in the argument event to the counters
+        // in this event.
+        sspClusters   += event.sspClusters;
+        reconClusters += event.reconClusters;
+        matches       += event.matches;
+        failEnergy    += event.failEnergy;
+        failPosition  += event.failPosition;
+        failHitCount  += event.failHitCount;
+    }
+    
+    /**
+     * Indicates whether at least one cluster pair in the event created
+     * a fail state.
+     * @return Returns <code>true</code> if not all clusters matched and
+     * <code>false</code> otherwise.
+     */
+    public boolean isFailState() {
+        return (failEnergy > 0) || (failHitCount > 0) || (failTime > 0) || (failPosition > 0);
+    }
+    
+    /**
+     * Notes that a reconstructed cluster and SSP cluster pair failed
+     * due to energy.
+     */
+    public void pairFailEnergy() {
+        failEnergy++;
+    }
+    
+    /**
+     * Notes that a reconstructed cluster and SSP cluster pair failed
+     * due to hit count.
+     */
+    public void pairFailHitCount() {
+        failHitCount++;
+    }
+    
+    /**
+     * Notes that a reconstructed cluster and SSP cluster pair failed
+     * due to position.
+     */
+    public void pairFailPosition() {
+        failPosition++;
+    }
+    
+    /**
+     * Notes that one or more reconstructed cluster and SSP cluster pair
+     * failed due to position.
+     * @param count - The number of events that failed in this manner.
+     */
+    public void pairFailPosition(int count) {
+        // negative values are non-physical.
+        if(count < 0) {
+            throw new IllegalArgumentException("Cluster failure counts must be non-negative.");
+        }
+        
+        // Increment the count.
+        failPosition += count;
+    }
+    
+    /**
+     * Notes that a reconstructed cluster and SSP cluster pair failed
+     * due to time.
+     */
+    public void pairFailTime() {
+        failTime++;
+    }
+    
+    /**
+     * Notes that a reconstructed cluster and SSP cluster pair was
+     * successfully matched.
+     */
+    public void pairMatch() {
+        matches++;
+    }
+    
+    /**
+     * Increments the number of reconstructed FADC clusters seen.
+     * @param count - The number of clusters seen.
+     */
+    public void sawReconClusters(int count) {
+        reconClusters += count;
+    }
+    
+    /**
+     * Increments the number of SSP bank clusters seen.
+     * @param count - The number of clusters seen.
+     */
+    public void sawSSPClusters(int count) {
+        sspClusters += count;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterMatchedPair.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterMatchedPair.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterMatchedPair.java	Wed Mar  9 11:43:24 2016
@@ -14,114 +14,114 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ClusterMatchedPair extends Pair<Cluster, SSPCluster> {
-	// CLass variables.
-	private final byte state;
-	
-	/**
-	 * Instantiates a new <code>ClusterMatchedPair</code> object from
-	 * the two indicated clusters and marks their match state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 * @param state - The pair match state.
-	 */
-	public ClusterMatchedPair(Cluster reconCluster, SSPCluster sspCluster, byte state) {
-		// Set the cluster pairs.
-		super(reconCluster, sspCluster);
-		
-		// If the state is defined, set it. Otherwise, it is unknown.
-		if(state == TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED
-				|| state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION
-				|| state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY
-				|| state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT) {
-			this.state = state;
-		} else {
-			this.state = TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_UNKNOWN;
-		}
-	}
-	
-	/**
-	 * Gets the reconstructed cluster of the pair.
-	 * @return Returns the reconstructed cluster a <code>Cluster</cod>
-	 * object.
-	 */
-	public Cluster getReconstructedCluster() {
-		return getFirstElement();
-	}
-	
-	/**
-	 * Gets the SSP cluster of the pair.
-	 * @return Returns the SSP cluster as an <code>SSPCluster</code>
-	 * object.
-	 */
-	public SSPCluster getSSPCluster() {
-		return getSecondElement();
-	}
-	
-	/**
-	 * Gets the raw state identifier.
-	 * @return Returns the state identifier as a <code>byte</code>
-	 * primitive. Valid identifiers are defined in the class
-	 * <code>TriggerDiagnosticUtil</code>.
-	 */
-	public byte getState() {
-		return state;
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair failed to not being close
-	 * enough in energy.
-	 * @return Returns <code>true</code> if the pair match state is an
-	 * energy fail state and <code>false</code> otherwise.
-	 */
-	public boolean isEnergyFailState() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY);
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair failed to match due to not
-	 * being close enough in hit count.
-	 * @return Returns <code>true</code> if the pair match state is a
-	 * hit count fail state and <code>false</code> otherwise.
-	 */
-	public boolean isHitCountFailState() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT);
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair matched.
-	 * @return Returns <code>true</code> if the pair match state is a
-	 * match state and <code>false</code> otherwise.
-	 */
-	public boolean isMatch() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED);
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair failed to match due to the
-	 * cluster positions not aligning.
-	 * @return Returns <code>true</code> if the pair match state is a
-	 * position fail state and <code>false</code> otherwise.
-	 */
-	public boolean isPositionFailState() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION);
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair failed to match due to the
-	 * cluster time-stamps not aligning.
-	 * @return Returns <code>true</code> if the pair match state is a
-	 * time fail state and <code>false</code> otherwise.
-	 */
-	public boolean isTimeFailState() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_TIME);
-	}
-	
-	/**
-	 * Indicates whether the recon/SSP pair has no known match state.
-	 * @return Returns <code>true</code> if the pair match state is
-	 * unknown and <code>false</code> otherwise.
-	 */
-	public boolean isUnknownState() {
-		return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_UNKNOWN);
-	}
+    // CLass variables.
+    private final byte state;
+    
+    /**
+     * Instantiates a new <code>ClusterMatchedPair</code> object from
+     * the two indicated clusters and marks their match state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     * @param state - The pair match state.
+     */
+    public ClusterMatchedPair(Cluster reconCluster, SSPCluster sspCluster, byte state) {
+        // Set the cluster pairs.
+        super(reconCluster, sspCluster);
+        
+        // If the state is defined, set it. Otherwise, it is unknown.
+        if(state == TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED
+                || state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION
+                || state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY
+                || state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT) {
+            this.state = state;
+        } else {
+            this.state = TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_UNKNOWN;
+        }
+    }
+    
+    /**
+     * Gets the reconstructed cluster of the pair.
+     * @return Returns the reconstructed cluster a <code>Cluster</cod>
+     * object.
+     */
+    public Cluster getReconstructedCluster() {
+        return getFirstElement();
+    }
+    
+    /**
+     * Gets the SSP cluster of the pair.
+     * @return Returns the SSP cluster as an <code>SSPCluster</code>
+     * object.
+     */
+    public SSPCluster getSSPCluster() {
+        return getSecondElement();
+    }
+    
+    /**
+     * Gets the raw state identifier.
+     * @return Returns the state identifier as a <code>byte</code>
+     * primitive. Valid identifiers are defined in the class
+     * <code>TriggerDiagnosticUtil</code>.
+     */
+    public byte getState() {
+        return state;
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair failed to not being close
+     * enough in energy.
+     * @return Returns <code>true</code> if the pair match state is an
+     * energy fail state and <code>false</code> otherwise.
+     */
+    public boolean isEnergyFailState() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY);
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair failed to match due to not
+     * being close enough in hit count.
+     * @return Returns <code>true</code> if the pair match state is a
+     * hit count fail state and <code>false</code> otherwise.
+     */
+    public boolean isHitCountFailState() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT);
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair matched.
+     * @return Returns <code>true</code> if the pair match state is a
+     * match state and <code>false</code> otherwise.
+     */
+    public boolean isMatch() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED);
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair failed to match due to the
+     * cluster positions not aligning.
+     * @return Returns <code>true</code> if the pair match state is a
+     * position fail state and <code>false</code> otherwise.
+     */
+    public boolean isPositionFailState() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION);
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair failed to match due to the
+     * cluster time-stamps not aligning.
+     * @return Returns <code>true</code> if the pair match state is a
+     * time fail state and <code>false</code> otherwise.
+     */
+    public boolean isTimeFailState() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_TIME);
+    }
+    
+    /**
+     * Indicates whether the recon/SSP pair has no known match state.
+     * @return Returns <code>true</code> if the pair match state is
+     * unknown and <code>false</code> otherwise.
+     */
+    public boolean isUnknownState() {
+        return (state == TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_UNKNOWN);
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterStatModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterStatModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/ClusterStatModule.java	Wed Mar  9 11:43:24 2016
@@ -7,100 +7,100 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ClusterStatModule {
-	// Track cluster statistics.
-	protected int sspClusters   = 0;
-	protected int reconClusters = 0;
-	protected int matches       = 0;
-	protected int failEnergy    = 0;
-	protected int failPosition  = 0;
-	protected int failHitCount  = 0;
-	protected int failTime      = 0;
-	
-	/**
-	 * Instantiates a <code>ClusterStatModule</code> with no statistics
-	 * stored.
-	 */
-	ClusterStatModule() {  }
-	
-	/**
-	 * Clears all statistical information and resets the object of its
-	 * default, empty state.
-	 */
-	void clear() {
-		sspClusters   = 0;
-		reconClusters = 0;
-		matches       = 0;
-		failEnergy    = 0;
-		failPosition  = 0;
-		failHitCount  = 0;
-		failTime      = 0;
-	}
-	
-	@Override
-	public ClusterStatModule clone() {
-		// Create a clone.
-		ClusterStatModule clone = new ClusterStatModule();
-		
-		// Copy the statistical values to the clone.
-		clone.sspClusters   = sspClusters;
-		clone.reconClusters = reconClusters;
-		clone.matches       = matches;
-		clone.failEnergy    = failEnergy;
-		clone.failPosition  = failPosition;
-		clone.failHitCount  = failHitCount;
-		clone.failTime      = failTime;
-		
-		// Return the clone.
-		return clone;
-	}
-	
-	/**
-	 * Gets the number of cluster pairs stored in this event that are
-	 * marked with energy fail states.
-	 * @return Returns the number of instances of this state as an
-	 * <code>int</code> primitive.
-	 */
-	public int getEnergyFailures() {
-		return failEnergy;
-	}
-	
-	/**
-	 * Gets the number of cluster pairs stored in this event that are
-	 * marked with hit count fail states.
-	 * @return Returns the number of instances of this state as an
-	 * <code>int</code> primitive.
-	 */
-	public int getHitCountFailures() {
-		return failHitCount;
-	}
-	
-	/**
-	 * Gets the number of cluster pairs stored in this event that are
-	 * marked with position fail states.
-	 * @return Returns the number of instances of this state as an
-	 * <code>int</code> primitive.
-	 */
-	public int getMatches() {
-		return matches;
-	}
-	
-	/**
-	 * Gets the number of cluster pairs stored in this event that are
-	 * marked with position fail states.
-	 * @return Returns the number of instances of this state as an
-	 * <code>int</code> primitive.
-	 */
-	public int getPositionFailures() {
-		return failPosition;
-	}
-	
-	/**
-	 * Gets the total number of verifiable reconstructed clusters seen.
+    // Track cluster statistics.
+    protected int sspClusters   = 0;
+    protected int reconClusters = 0;
+    protected int matches       = 0;
+    protected int failEnergy    = 0;
+    protected int failPosition  = 0;
+    protected int failHitCount  = 0;
+    protected int failTime      = 0;
+    
+    /**
+     * Instantiates a <code>ClusterStatModule</code> with no statistics
+     * stored.
+     */
+    ClusterStatModule() {  }
+    
+    /**
+     * Clears all statistical information and resets the object of its
+     * default, empty state.
+     */
+    void clear() {
+        sspClusters   = 0;
+        reconClusters = 0;
+        matches       = 0;
+        failEnergy    = 0;
+        failPosition  = 0;
+        failHitCount  = 0;
+        failTime      = 0;
+    }
+    
+    @Override
+    public ClusterStatModule clone() {
+        // Create a clone.
+        ClusterStatModule clone = new ClusterStatModule();
+        
+        // Copy the statistical values to the clone.
+        clone.sspClusters   = sspClusters;
+        clone.reconClusters = reconClusters;
+        clone.matches       = matches;
+        clone.failEnergy    = failEnergy;
+        clone.failPosition  = failPosition;
+        clone.failHitCount  = failHitCount;
+        clone.failTime      = failTime;
+        
+        // Return the clone.
+        return clone;
+    }
+    
+    /**
+     * Gets the number of cluster pairs stored in this event that are
+     * marked with energy fail states.
+     * @return Returns the number of instances of this state as an
+     * <code>int</code> primitive.
+     */
+    public int getEnergyFailures() {
+        return failEnergy;
+    }
+    
+    /**
+     * Gets the number of cluster pairs stored in this event that are
+     * marked with hit count fail states.
+     * @return Returns the number of instances of this state as an
+     * <code>int</code> primitive.
+     */
+    public int getHitCountFailures() {
+        return failHitCount;
+    }
+    
+    /**
+     * Gets the number of cluster pairs stored in this event that are
+     * marked with position fail states.
+     * @return Returns the number of instances of this state as an
+     * <code>int</code> primitive.
+     */
+    public int getMatches() {
+        return matches;
+    }
+    
+    /**
+     * Gets the number of cluster pairs stored in this event that are
+     * marked with position fail states.
+     * @return Returns the number of instances of this state as an
+     * <code>int</code> primitive.
+     */
+    public int getPositionFailures() {
+        return failPosition;
+    }
+    
+    /**
+     * Gets the total number of verifiable reconstructed clusters seen.
      * @return Returns the cluster count as an <code>int</code>
      * primitive.
-	 */
+     */
     public int getReconClusterCount() {
-    	return reconClusters;
+        return reconClusters;
     }
     
     /**
@@ -109,16 +109,16 @@
      * primitive.
      */
     public int getSSPClusterCount() {
-    	return sspClusters;
+        return sspClusters;
     }
-	
-	/**
-	 * Gets the number of cluster pairs stored in this event that are
-	 * marked with time fail states.
-	 * @return Returns the number of instances of this state as an
-	 * <code>int</code> primitive.
-	 */
-	public int getTimeFailures() {
-		return failTime;
-	}
+    
+    /**
+     * Gets the number of cluster pairs stored in this event that are
+     * marked with time fail states.
+     * @return Returns the number of instances of this state as an
+     * <code>int</code> primitive.
+     */
+    public int getTimeFailures() {
+        return failTime;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DetailedClusterEvent.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DetailedClusterEvent.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DetailedClusterEvent.java	Wed Mar  9 11:43:24 2016
@@ -8,89 +8,89 @@
 import org.lcsim.event.Cluster;
 
 public class DetailedClusterEvent extends ClusterEvent {
-	// Store all of the pairs.
-	private List<ClusterMatchedPair> pairList = new ArrayList<ClusterMatchedPair>();
-	
-	/**
-	 * Fuses another <code>ClusterEvent</code> with this object. The
-	 * other event's cluster pairs and states will be added to those
-	 * already in this event.
-	 * @param event - The event to fuse.
-	 */
-	public void addEvent(ClusterEvent event) {
-		// Run the superclass method.
-		super.addEvent(event);
-		
-		// If the event is null, do nothing.
-		if(event == null) { return; }
-		
-		// Merge the list of cluster pairs, if applicable.
-		if(event instanceof DetailedClusterEvent) {
-			pairList.addAll(((DetailedClusterEvent) event).pairList);
-		}
-	}
-	
-	/**
-	 * Adds a reconstructed/SSP cluster pair and marks it as having an
-	 * energy fail state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 */
-	public void pairFailEnergy(Cluster reconCluster, SSPCluster sspCluster) {
-		pairFailEnergy();
-		pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY));
-	}
-	
-	/**
-	 * Adds a reconstructed/SSP cluster pair and marks it as having a
-	 * hit count fail state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 */
-	public void pairFailHitCount(Cluster reconCluster, SSPCluster sspCluster) {
-		pairFailHitCount();
-		pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT));
-	}
-	
-	/**
-	 * Adds a reconstructed/SSP cluster pair and marks it as having a
-	 * position fail state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 */
-	public void pairFailPosition(Cluster reconCluster, SSPCluster sspCluster) {
-		pairFailPosition();
-		pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION));
-	}
-	
-	/**
-	 * Adds a reconstructed/SSP cluster pair and marks it as having a
-	 * time fail state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 */
-	public void pairFailTime(Cluster reconCluster, SSPCluster sspCluster) {
-		pairFailTime();
-		pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_TIME));
-	}
-	
-	/**
-	 * Adds a reconstructed/SSP cluster pair and marks it as having a
-	 * match state.
-	 * @param reconCluster - The reconstructed cluster.
-	 * @param sspCluster - The SSP cluster.
-	 */
-	public void pairMatch(Cluster reconCluster, SSPCluster sspCluster) {
-		pairMatch();
-		pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED));
-	}
-	
-	/**
-	 * Gets a list of all matched cluster pairs and their match states.
-	 * @return Returns the matched cluster pairs as a <code>List</code>
-	 * of <code>ClusterMatchedPair</code> objects.
-	 */
-	public List<ClusterMatchedPair> getClusterPairs() {
-		return pairList;
-	}
+    // Store all of the pairs.
+    private List<ClusterMatchedPair> pairList = new ArrayList<ClusterMatchedPair>();
+    
+    /**
+     * Fuses another <code>ClusterEvent</code> with this object. The
+     * other event's cluster pairs and states will be added to those
+     * already in this event.
+     * @param event - The event to fuse.
+     */
+    public void addEvent(ClusterEvent event) {
+        // Run the superclass method.
+        super.addEvent(event);
+        
+        // If the event is null, do nothing.
+        if(event == null) { return; }
+        
+        // Merge the list of cluster pairs, if applicable.
+        if(event instanceof DetailedClusterEvent) {
+            pairList.addAll(((DetailedClusterEvent) event).pairList);
+        }
+    }
+    
+    /**
+     * Adds a reconstructed/SSP cluster pair and marks it as having an
+     * energy fail state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     */
+    public void pairFailEnergy(Cluster reconCluster, SSPCluster sspCluster) {
+        pairFailEnergy();
+        pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_ENERGY));
+    }
+    
+    /**
+     * Adds a reconstructed/SSP cluster pair and marks it as having a
+     * hit count fail state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     */
+    public void pairFailHitCount(Cluster reconCluster, SSPCluster sspCluster) {
+        pairFailHitCount();
+        pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_HIT_COUNT));
+    }
+    
+    /**
+     * Adds a reconstructed/SSP cluster pair and marks it as having a
+     * position fail state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     */
+    public void pairFailPosition(Cluster reconCluster, SSPCluster sspCluster) {
+        pairFailPosition();
+        pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_POSITION));
+    }
+    
+    /**
+     * Adds a reconstructed/SSP cluster pair and marks it as having a
+     * time fail state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     */
+    public void pairFailTime(Cluster reconCluster, SSPCluster sspCluster) {
+        pairFailTime();
+        pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_FAIL_TIME));
+    }
+    
+    /**
+     * Adds a reconstructed/SSP cluster pair and marks it as having a
+     * match state.
+     * @param reconCluster - The reconstructed cluster.
+     * @param sspCluster - The SSP cluster.
+     */
+    public void pairMatch(Cluster reconCluster, SSPCluster sspCluster) {
+        pairMatch();
+        pairList.add(new ClusterMatchedPair(reconCluster, sspCluster, TriggerDiagnosticUtil.CLUSTER_STATE_MATCHED));
+    }
+    
+    /**
+     * Gets a list of all matched cluster pairs and their match states.
+     * @return Returns the matched cluster pairs as a <code>List</code>
+     * of <code>ClusterMatchedPair</code> objects.
+     */
+    public List<ClusterMatchedPair> getClusterPairs() {
+        return pairList;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DiagnosticSnapshot.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DiagnosticSnapshot.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/DiagnosticSnapshot.java	Wed Mar  9 11:43:24 2016
@@ -8,117 +8,117 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class DiagnosticSnapshot {
-	// Store the TI trigger information.
-	private int[] tiSeenAll = new int[6];
-	private int[] tiSeenHierarchical = new int[6];
-	
-	// Store the statistical modules.
-	private final GeneralStatModule generalStats;
-	private final ClusterStatModule clusterStats;
-	private final TriggerStatModule[] triggerStats = new TriggerStatModule[4];
-	
-	/**
-	 * Creates a snapshot of the trigger diagnostic results.
-	 * @param stats - The run statistical object.
-	 */
-	DiagnosticSnapshot(RunDiagStats stats) {
-		// Store the statistical modules.
-		generalStats = stats.clone();
-		clusterStats = stats.getClusterStats().clone();
-		triggerStats[0] = stats.getTriggerStats().getSingles0Stats().clone();
-		triggerStats[1] = stats.getTriggerStats().getSingles1Stats().clone();
-		triggerStats[2] = stats.getTriggerStats().getPair0Stats().clone();
-		triggerStats[3] = stats.getTriggerStats().getPair1Stats().clone();
-		
-		// Copy the TI trigger data.
-		for(int triggerType = 0; triggerType < 6; triggerType++) {
-			tiSeenAll[triggerType] = stats.getTriggerStats().getTITriggers(triggerType, false);
-			tiSeenHierarchical[triggerType] = stats.getTriggerStats().getTITriggers(triggerType, true);
-		}
-	}
-	
-	/**
-	 * Gets the general run statistics.
-	 * @return Returns a <code>GeneralStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public GeneralStatModule getGeneralStats() {
-		return generalStats;
-	}
-	
-	/**
-	 * Gets the cluster statistics.
-	 * @return Returns a <code>ClusterStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public ClusterStatModule getClusterStats() {
-		return clusterStats;
-	}
-	
-	/**
-	 * Gets the singles 0 trigger statistics.
-	 * @return Returns a <code>TriggerStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public TriggerStatModule getSingles0Stats() {
-		return triggerStats[0];
-	}
-	
-	/**
-	 * Gets the singles 1 trigger statistics.
-	 * @return Returns a <code>TriggerStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public TriggerStatModule getSingles1Stats() {
-		return triggerStats[1];
-	}
-	
-	/**
-	 * Gets the pair 0 trigger statistics.
-	 * @return Returns a <code>TriggerStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public TriggerStatModule getPair0Stats() {
-		return triggerStats[2];
-	}
-	
-	/**
-	 * Gets the pair 1 trigger statistics.
-	 * @return Returns a <code>TriggerStatModule</code> object that
-	 * contains the statistics.
-	 */
-	public TriggerStatModule getPair1Stats() {
-		return triggerStats[3];
-	}
-	
-	/**
-	 * Gets the total number of events where the TI reported a trigger
-	 * of the specified type.
-	 * @param triggerID - The identifier for the type of trigger.
-	 * @param unique - <code>true</code> returns only the number of
-	 * events where this trigger type was the <i>only</i> type seen by
-	 * the TI while <code>false</code> returns the number of events
-	 * that saw this trigger type without regards for other trigger
-	 * flags.
-	 * @return Returns the count as an <code>int</code>.
-	 */
-	public int getTITriggers(int triggerID, boolean hierarchical) {
-		// Verify the trigger type.
-		validateTriggerType(triggerID);
-		
-		// Increment the counters.
-		if(hierarchical) { return tiSeenHierarchical[triggerID]; }
-		else { return tiSeenAll[triggerID]; }
-	}
-	
-	/**
-	 * Produces an exception if the argument trigger type is not of a
-	 * supported type.
-	 * @param triggerType - The trigger type to verify.
-	 */
-	private static final void validateTriggerType(int triggerType) {
-		if(triggerType < 0 || triggerType > 5) {
-			throw new IndexOutOfBoundsException(String.format("Trigger type \"%d\" is not supported.", triggerType));
-		}
-	}
+    // Store the TI trigger information.
+    private int[] tiSeenAll = new int[6];
+    private int[] tiSeenHierarchical = new int[6];
+    
+    // Store the statistical modules.
+    private final GeneralStatModule generalStats;
+    private final ClusterStatModule clusterStats;
+    private final TriggerStatModule[] triggerStats = new TriggerStatModule[4];
+    
+    /**
+     * Creates a snapshot of the trigger diagnostic results.
+     * @param stats - The run statistical object.
+     */
+    DiagnosticSnapshot(RunDiagStats stats) {
+        // Store the statistical modules.
+        generalStats = stats.clone();
+        clusterStats = stats.getClusterStats().clone();
+        triggerStats[0] = stats.getTriggerStats().getSingles0Stats().clone();
+        triggerStats[1] = stats.getTriggerStats().getSingles1Stats().clone();
+        triggerStats[2] = stats.getTriggerStats().getPair0Stats().clone();
+        triggerStats[3] = stats.getTriggerStats().getPair1Stats().clone();
+        
+        // Copy the TI trigger data.
+        for(int triggerType = 0; triggerType < 6; triggerType++) {
+            tiSeenAll[triggerType] = stats.getTriggerStats().getTITriggers(triggerType, false);
+            tiSeenHierarchical[triggerType] = stats.getTriggerStats().getTITriggers(triggerType, true);
+        }
+    }
+    
+    /**
+     * Gets the general run statistics.
+     * @return Returns a <code>GeneralStatModule</code> object that
+     * contains the statistics.
+     */
+    public GeneralStatModule getGeneralStats() {
+        return generalStats;
+    }
+    
+    /**
+     * Gets the cluster statistics.
+     * @return Returns a <code>ClusterStatModule</code> object that
+     * contains the statistics.
+     */
+    public ClusterStatModule getClusterStats() {
+        return clusterStats;
+    }
+    
+    /**
+     * Gets the singles 0 trigger statistics.
+     * @return Returns a <code>TriggerStatModule</code> object that
+     * contains the statistics.
+     */
+    public TriggerStatModule getSingles0Stats() {
+        return triggerStats[0];
+    }
+    
+    /**
+     * Gets the singles 1 trigger statistics.
+     * @return Returns a <code>TriggerStatModule</code> object that
+     * contains the statistics.
+     */
+    public TriggerStatModule getSingles1Stats() {
+        return triggerStats[1];
+    }
+    
+    /**
+     * Gets the pair 0 trigger statistics.
+     * @return Returns a <code>TriggerStatModule</code> object that
+     * contains the statistics.
+     */
+    public TriggerStatModule getPair0Stats() {
+        return triggerStats[2];
+    }
+    
+    /**
+     * Gets the pair 1 trigger statistics.
+     * @return Returns a <code>TriggerStatModule</code> object that
+     * contains the statistics.
+     */
+    public TriggerStatModule getPair1Stats() {
+        return triggerStats[3];
+    }
+    
+    /**
+     * Gets the total number of events where the TI reported a trigger
+     * of the specified type.
+     * @param triggerID - The identifier for the type of trigger.
+     * @param unique - <code>true</code> returns only the number of
+     * events where this trigger type was the <i>only</i> type seen by
+     * the TI while <code>false</code> returns the number of events
+     * that saw this trigger type without regards for other trigger
+     * flags.
+     * @return Returns the count as an <code>int</code>.
+     */
+    public int getTITriggers(int triggerID, boolean hierarchical) {
+        // Verify the trigger type.
+        validateTriggerType(triggerID);
+        
+        // Increment the counters.
+        if(hierarchical) { return tiSeenHierarchical[triggerID]; }
+        else { return tiSeenAll[triggerID]; }
+    }
+    
+    /**
+     * Produces an exception if the argument trigger type is not of a
+     * supported type.
+     * @param triggerType - The trigger type to verify.
+     */
+    private static final void validateTriggerType(int triggerType) {
+        if(triggerType < 0 || triggerType > 5) {
+            throw new IndexOutOfBoundsException(String.format("Trigger type \"%d\" is not supported.", triggerType));
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/GeneralStatModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/GeneralStatModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/GeneralStatModule.java	Wed Mar  9 11:43:24 2016
@@ -7,97 +7,97 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class GeneralStatModule {
-	// Store general run statistics.
-	protected long endTime = -1;
-	protected long startTime = -1;
-	protected int totalEvents = 0;
-	protected int noiseEvents = 0;
-	protected int failedPairEvents = 0;
-	protected int failedClusterEvents = 0;
-	protected int failedSinglesEvents = 0;
-	
-	/**
-	 * Clears all of the statistical counters in the object.
-	 */
-	void clear() {
-		endTime = -1;
-		startTime = -1;
-		totalEvents = 0;
-		noiseEvents = 0;
-		failedPairEvents = 0;
-		failedClusterEvents = 0;
-		failedSinglesEvents = 0;
-	}
-	
-	@Override
-	public GeneralStatModule clone() {
-		// Create the a cloned object.
-		GeneralStatModule clone = new GeneralStatModule();
-		
-		// Copy the tracked statistical data to the clone.
-		clone.endTime             = endTime;
-		clone.startTime           = startTime;
-		clone.totalEvents         = totalEvents;
-		clone.noiseEvents         = noiseEvents;
-		clone.failedPairEvents    = failedPairEvents;
-		clone.failedClusterEvents = failedClusterEvents;
-		clone.failedSinglesEvents = failedSinglesEvents;
-		
-		// Return the clone.
-		return clone;
-	}
-	
-	/**
-	 * Gets the length of time, in nanoseconds, over which the events
-	 * represented by this object occurred.
-	 * @return Returns the length of time as a <code>long</code>.
-	 */
-	public long getDuration() {
-		return endTime - startTime;
-	}
-	
-	/**
-	 * Gets the number of events seen.
-	 * @return Returns the number of events as an <code>int</code>.
-	 */
-	public int getEventCount() {
-		return totalEvents;
-	}
-	
-	/**
-	 * Gets the number of events in which at least one cluster was
-	 * not matched.
-	 * @return Returns the number of events as an <code>int</code>.
-	 */
-	public int getFailedClusterEventCount() {
-		return failedClusterEvents;
-	}
-	
-	/**
-	 * Gets the number of events in which at least one pair trigger
-	 * was not matched.
-	 * @return Returns the number of events as an <code>int</code>.
-	 */
-	public int getFailedPairEventCount() {
-		return failedPairEvents;
-	}
+    // Store general run statistics.
+    protected long endTime = -1;
+    protected long startTime = -1;
+    protected int totalEvents = 0;
+    protected int noiseEvents = 0;
+    protected int failedPairEvents = 0;
+    protected int failedClusterEvents = 0;
+    protected int failedSinglesEvents = 0;
+    
+    /**
+     * Clears all of the statistical counters in the object.
+     */
+    void clear() {
+        endTime = -1;
+        startTime = -1;
+        totalEvents = 0;
+        noiseEvents = 0;
+        failedPairEvents = 0;
+        failedClusterEvents = 0;
+        failedSinglesEvents = 0;
+    }
+    
+    @Override
+    public GeneralStatModule clone() {
+        // Create the a cloned object.
+        GeneralStatModule clone = new GeneralStatModule();
+        
+        // Copy the tracked statistical data to the clone.
+        clone.endTime             = endTime;
+        clone.startTime           = startTime;
+        clone.totalEvents         = totalEvents;
+        clone.noiseEvents         = noiseEvents;
+        clone.failedPairEvents    = failedPairEvents;
+        clone.failedClusterEvents = failedClusterEvents;
+        clone.failedSinglesEvents = failedSinglesEvents;
+        
+        // Return the clone.
+        return clone;
+    }
+    
+    /**
+     * Gets the length of time, in nanoseconds, over which the events
+     * represented by this object occurred.
+     * @return Returns the length of time as a <code>long</code>.
+     */
+    public long getDuration() {
+        return endTime - startTime;
+    }
+    
+    /**
+     * Gets the number of events seen.
+     * @return Returns the number of events as an <code>int</code>.
+     */
+    public int getEventCount() {
+        return totalEvents;
+    }
+    
+    /**
+     * Gets the number of events in which at least one cluster was
+     * not matched.
+     * @return Returns the number of events as an <code>int</code>.
+     */
+    public int getFailedClusterEventCount() {
+        return failedClusterEvents;
+    }
+    
+    /**
+     * Gets the number of events in which at least one pair trigger
+     * was not matched.
+     * @return Returns the number of events as an <code>int</code>.
+     */
+    public int getFailedPairEventCount() {
+        return failedPairEvents;
+    }
 
-	/**
-	 * Gets the number of events in which at least one singles trigger
-	 * was not matched.
-	 * @return Returns the number of events as an <code>int</code>.
-	 */
-	public int getFailedSinglesEventCount() {
-		return failedSinglesEvents;
-	}
-	
-	/**
-	 * Gets the number of events which were ignored due to having too
-	 * many hits in them.
-	 * @return Returns the number of events as an <code>int</code>.
-	 */
-	public int getNoiseEvents() {
-		return noiseEvents;
-	}
+    /**
+     * Gets the number of events in which at least one singles trigger
+     * was not matched.
+     * @return Returns the number of events as an <code>int</code>.
+     */
+    public int getFailedSinglesEventCount() {
+        return failedSinglesEvents;
+    }
+    
+    /**
+     * Gets the number of events which were ignored due to having too
+     * many hits in them.
+     * @return Returns the number of events as an <code>int</code>.
+     */
+    public int getNoiseEvents() {
+        return noiseEvents;
+    }
 
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/RunDiagStats.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/RunDiagStats.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/RunDiagStats.java	Wed Mar  9 11:43:24 2016
@@ -9,89 +9,89 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class RunDiagStats extends GeneralStatModule {
-	// Store the statistics for trigger matching.
-	private TriggerDiagStats triggerStats = new TriggerDiagStats();
-	
-	// Store the statistics for cluster matching.
-	private ClusterEvent clusterStats = new ClusterEvent();
-	
-	/**
-	 * Clears all of the statistical counters in the object.
-	 */
-	public void clear() {
-		super.clear();
-		clusterStats.clear();
-		triggerStats.clear();
-	}
-	
-	/**
-	 * Notes that an event failed to match all clusters.
-	 */
-	public void failedClusterEvent() {
-		failedClusterEvents++;
-	}
-	
-	/**
-	 * Notes that an event failed to match all pair triggers.
-	 */
-	public void failedPairEvent() {
-		failedPairEvents++;
-	}
+    // Store the statistics for trigger matching.
+    private TriggerDiagStats triggerStats = new TriggerDiagStats();
+    
+    // Store the statistics for cluster matching.
+    private ClusterEvent clusterStats = new ClusterEvent();
+    
+    /**
+     * Clears all of the statistical counters in the object.
+     */
+    public void clear() {
+        super.clear();
+        clusterStats.clear();
+        triggerStats.clear();
+    }
+    
+    /**
+     * Notes that an event failed to match all clusters.
+     */
+    public void failedClusterEvent() {
+        failedClusterEvents++;
+    }
+    
+    /**
+     * Notes that an event failed to match all pair triggers.
+     */
+    public void failedPairEvent() {
+        failedPairEvents++;
+    }
 
-	/**
-	 * Notes that an event failed to match all singles triggers.
-	 */
-	public void failedSinglesEvent() {
-		failedSinglesEvents++;
-	}
-	
-	/**
-	 * Gets the cluster data.
-	 * @return Returns the <code>ClusterEvent</code> object that holds
-	 * the cluster data.
-	 */
-	public ClusterEvent getClusterStats() {
-		return clusterStats;
-	}
-	
-	/**
-	 * Gets a snapshot of the statistical data at the present time. The
-	 * snapshot will remain static and unchanged even if the generating
-	 * object itself is updated.
-	 * @return Returns a snapshot as a <code>DiagnosticSnapshot</code>
-	 * object.
-	 */
-	public DiagnosticSnapshot getSnapshot() {
-		return new DiagnosticSnapshot(this);
-	}
-	
-	/**
-	 * Gets the trigger data.
-	 * @return Returns the <code>TriggerDiagStats</code> object that holds
-	 * the cluster data.
-	 */
-	public TriggerDiagStats getTriggerStats() {
-		return triggerStats;
-	}
-	
-	/**
-	 * Notes that an event occurred.
-	 */
-	public void sawEvent(long eventTime) {
-		// Increment the event count.
-		totalEvents++;
-		
-		// If the start time is not defined, use this as the start time.
-		if(startTime == -1) { startTime = eventTime; }
-		
-		// The end time should always match the most recent event.
-		endTime = eventTime;
-	}
+    /**
+     * Notes that an event failed to match all singles triggers.
+     */
+    public void failedSinglesEvent() {
+        failedSinglesEvents++;
+    }
+    
+    /**
+     * Gets the cluster data.
+     * @return Returns the <code>ClusterEvent</code> object that holds
+     * the cluster data.
+     */
+    public ClusterEvent getClusterStats() {
+        return clusterStats;
+    }
+    
+    /**
+     * Gets a snapshot of the statistical data at the present time. The
+     * snapshot will remain static and unchanged even if the generating
+     * object itself is updated.
+     * @return Returns a snapshot as a <code>DiagnosticSnapshot</code>
+     * object.
+     */
+    public DiagnosticSnapshot getSnapshot() {
+        return new DiagnosticSnapshot(this);
+    }
+    
+    /**
+     * Gets the trigger data.
+     * @return Returns the <code>TriggerDiagStats</code> object that holds
+     * the cluster data.
+     */
+    public TriggerDiagStats getTriggerStats() {
+        return triggerStats;
+    }
+    
+    /**
+     * Notes that an event occurred.
+     */
+    public void sawEvent(long eventTime) {
+        // Increment the event count.
+        totalEvents++;
+        
+        // If the start time is not defined, use this as the start time.
+        if(startTime == -1) { startTime = eventTime; }
+        
+        // The end time should always match the most recent event.
+        endTime = eventTime;
+    }
 
-	/**
-	 * Notes that an event was labeled as noise.
-	 */
-	public void sawNoiseEvent() {
-		noiseEvents++;
-	}
+    /**
+     * Notes that an event was labeled as noise.
+     */
+    public void sawNoiseEvent() {
+        noiseEvents++;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerDiagStats.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerDiagStats.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerDiagStats.java	Wed Mar  9 11:43:24 2016
@@ -4,304 +4,304 @@
 import org.hps.analysis.trigger.util.TriggerDiagnosticUtil;
 
 public class TriggerDiagStats {
-	// Define TI trigger type identifiers.
-	public static final int SINGLES0 = TriggerStatModule.SINGLES_0;
-	public static final int SINGLES1 = TriggerStatModule.SINGLES_1;
-	public static final int PAIR0    = TriggerStatModule.PAIR_0;
-	public static final int PAIR1    = TriggerStatModule.PAIR_1;
-	public static final int PULSER   = TriggerStatModule.PULSER;
-	public static final int COSMIC   = TriggerStatModule.COSMIC;
-	
-	// Tracks the number of TI triggers seen across all events for only
-	// the TI trigger with the highest priority in the event.
-	private int[] tiSeenHierarchical = new int[6];
-	
-	// Tracks the number of TI triggers across all events.
-	private int[] tiSeenAll = new int[6];
-	
-	// Store the statistics modules for each of the regular triggers.
-	private TriggerEvent[] triggerStats = new TriggerEvent[4];
-	
-	/**
-	 * Instantiates a new <code>TriggerDiagStats</code> object.
-	 */
-	public TriggerDiagStats() {
-		// Instantiate a trigger statistics module for each of the
-		// triggers for which statistics are supported.
-		for(int triggerType = 0; triggerType < 4; triggerType++) {
-			triggerStats[triggerType] = new TriggerEvent();
-		}
-	}
-	
-	/**
-	 * Clears all of the statistical counters in the object.
-	 */
-	void clear() {
-		// Clear the tracked TI trigger data.
-		for(int tiType = 0; tiType < 6; tiType++) {
-			tiSeenAll[tiType] = 0;
-			tiSeenHierarchical[tiType] = 0;
-		}
-		
-		// Clear the trigger statistical modules.
-		for(int triggerType = 0; triggerType < 4; triggerType++) {
-			triggerStats[triggerType].clear();
-		}
-	}
-	
-	/**
-	 * Gets the trigger data for the pair 0 trigger.
-	 * @return Returns the <code>TriggerEvent</code> object that holds
-	 * the trigger data for the pair 0 trigger.
-	 */
-	public TriggerEvent getPair0Stats() {
-		return triggerStats[PAIR0];
-	}
-	
-	/**
-	 * Gets the trigger data for the pair 1 trigger.
-	 * @return Returns the <code>TriggerEvent</code> object that holds
-	 * the trigger data for the pair 1 trigger.
-	 */
-	public TriggerEvent getPair1Stats() {
-		return triggerStats[PAIR1];
-	}
-	
-	/**
-	 * Gets the trigger data for the singles 0 trigger.
-	 * @return Returns the <code>TriggerEvent</code> object that holds
-	 * the trigger data for the singles 0 trigger.
-	 */
-	public TriggerEvent getSingles0Stats() {
-		return triggerStats[SINGLES0];
-	}
-	
-	/**
-	 * Gets the trigger data for the singles 1 trigger.
-	 * @return Returns the <code>TriggerEvent</code> object that holds
-	 * the trigger data for the singles 1 trigger.
-	 */
-	public TriggerEvent getSingles1Stats() {
-		return triggerStats[SINGLES1];
-	}
-	
-	/**
-	 * Gets the total number of events where the TI reported a trigger
-	 * of the specified type.
-	 * @param triggerID - The identifier for the type of trigger.
-	 * @param unique - <code>true</code> returns only the number of
-	 * events where this trigger type was the <i>only</i> type seen by
-	 * the TI while <code>false</code> returns the number of events
-	 * that saw this trigger type without regards for other trigger
-	 * flags.
-	 * @return Returns the count as an <code>int</code>.
-	 */
-	public int getTITriggers(int triggerID, boolean hierarchical) {
-		// Verify the trigger type.
-		validateTriggerType(triggerID);
-		
-		// Increment the counters.
-		if(hierarchical) { return tiSeenHierarchical[triggerID]; }
-		else { return tiSeenAll[triggerID]; }
-	}
-	
-	/**
-	 * Increments the counts tracking the number of TI flags seen.
-	 * @param flags - An array of <code>boolean</code> values of size
-	 * six. This represents one flag for each possible TI trigger type.
-	 */
-	public void sawTITriggers(boolean[] flags) {
-		// There must be six trigger flags and the array must not be
-		// null.
-		if(flags == null) {
-			throw new NullPointerException("TI trigger flags can not be null.");
-		} if(flags.length != 6) {
-			throw new IllegalArgumentException("TI trigger flags must be of size six.");
-		}
-		
-		// Check each TI flag in the order of the flag hierarchy. The
-		// first flag in the hierarchy that is true is recorded in the
-		// hierarchical count. All flags are recorded in the all count.
-		boolean foundHierarchical = false;
-		if(flags[PAIR1]) {
-			tiSeenAll[PAIR1]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[PAIR1]++;
-				foundHierarchical = true;
-			}
-		} if(flags[PAIR0]) {
-			tiSeenAll[PAIR0]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[PAIR0]++;
-				foundHierarchical = true;
-			}
-		} if(flags[SINGLES1]) {
-			tiSeenAll[SINGLES1]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[SINGLES1]++;
-				foundHierarchical = true;
-			}
-		} if(flags[SINGLES0]) {
-			tiSeenAll[SINGLES0]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[SINGLES0]++;
-				foundHierarchical = true;
-			}
-		} if(flags[PULSER]) {
-			tiSeenAll[PULSER]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[PULSER]++;
-				foundHierarchical = true;
-			}
-		} if(flags[COSMIC]) {
-			tiSeenAll[COSMIC]++;
-			if(!foundHierarchical) {
-				tiSeenHierarchical[COSMIC]++;
-				foundHierarchical = true;
-			}
-		}
-	}
-	
-	/**
-	 * Prints the trigger statistics to the terminal as a table.
-	 */
-	public void printEfficiencyTable() {
-		// Get the trigger statistics tables.
-		int[][] seenStats = new int[6][4];
-		int[][] matchedStats = new int[6][4];
-		TriggerEvent[] triggerEvents = { getSingles0Stats(), getSingles1Stats(), getPair0Stats(), getPair1Stats() };
-		for(int i = 0; i < 4; i++) {
-			for(int j = 0; j < 6; j++) {
-				seenStats[j][i] = triggerEvents[i].getReconSimulatedTriggers(j);
-				matchedStats[j][i] = triggerEvents[i].getMatchedReconSimulatedTriggers(j);
-			}
-		}
-		
-		// Define constant spacing variables.
-		int columnSpacing = 3;
-		
-		// Define table headers.
-		String sourceName = "Source";
-		String seenName = "Trigger Efficiency";
-		
-		// Get the longest column header name.
-		int longestHeader = -1;
-		String[] headerNames = {
-				TriggerDiagnosticUtil.TRIGGER_NAME[0],
-				TriggerDiagnosticUtil.TRIGGER_NAME[1],
-				TriggerDiagnosticUtil.TRIGGER_NAME[2],
-				TriggerDiagnosticUtil.TRIGGER_NAME[3],
-				"TI Highest Type"
-		};
-		for(String triggerName : headerNames) {
-			longestHeader = ComponentUtils.max(longestHeader, triggerName.length());
-		}
-		longestHeader = ComponentUtils.max(longestHeader, sourceName.length());
-		
-		// Determine the spacing needed to display the largest numerical
-		// cell value.
-		int numWidth = -1;
-		int longestCell = -1;
-		for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
-			for(int seenTriggerID = 0; seenTriggerID < 4; seenTriggerID++) {
-				int valueSize = ComponentUtils.getDigits(seenStats[eventTriggerID][seenTriggerID]);
-				int cellSize = valueSize * 2 + 13;
-				if(cellSize > longestCell) {
-					longestCell = cellSize;
-					numWidth = valueSize;
-				}
-			}
-		}
-		
-		// The total column width can then be calculated from the
-		// longer of the header and cell values.
-		int columnWidth = ComponentUtils.max(longestCell, longestHeader);
-		int sourceWidth = ComponentUtils.max(
-				TriggerDiagnosticUtil.TRIGGER_NAME[0].length(), TriggerDiagnosticUtil.TRIGGER_NAME[1].length(),
-				TriggerDiagnosticUtil.TRIGGER_NAME[2].length(), TriggerDiagnosticUtil.TRIGGER_NAME[3].length(),
-				TriggerDiagnosticUtil.TRIGGER_NAME[4].length(), TriggerDiagnosticUtil.TRIGGER_NAME[5].length(),
-				sourceName.length() );
-		
-		// Calculate the total width of the table value header columns.
-		int headerTotalWidth = (headerNames.length * columnWidth)
-				+ ((headerNames.length - 1) * columnSpacing);
-		
-		// Write the table header.
-		String spacingText = ComponentUtils.getChars(' ', columnSpacing);
-		System.out.println(ComponentUtils.getChars(' ', sourceWidth) + spacingText
-				+ getCenteredString(seenName, headerTotalWidth));
-		
-		// Create the format strings for the cell values.
-		String headerFormat = "%-" + sourceWidth + "s" + spacingText;
-		String cellFormat = "%" + numWidth + "d / %" + numWidth + "d (%7.3f)";
-		String nullText = getCenteredString(ComponentUtils.getChars('-', numWidth) + " / "
-				+ ComponentUtils.getChars('-', numWidth) + " (  N/A  )", columnWidth) + spacingText;
-		
-		// Print the column headers.
-		System.out.printf(headerFormat, sourceName);
-		for(String header : headerNames) {
-			System.out.print(getCenteredString(header, columnWidth) + spacingText);
-		}
-		System.out.println();
-		
-		// Write out the value columns.
-		for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
-			// Print out the row header.
-			System.out.printf(headerFormat, TriggerDiagnosticUtil.TRIGGER_NAME[eventTriggerID]);
-			
-			// Print the cell values.
-			for(int seenTriggerID = 0; seenTriggerID < 4; seenTriggerID++) {
-				if(seenTriggerID == eventTriggerID) { System.out.print(nullText); }
-				else {
-					String cellText = String.format(cellFormat, matchedStats[eventTriggerID][seenTriggerID],
-							seenStats[eventTriggerID][seenTriggerID],
-							(100.0 * matchedStats[eventTriggerID][seenTriggerID] / seenStats[eventTriggerID][seenTriggerID]));
-					System.out.print(getCenteredString(cellText, columnWidth) + spacingText);
-				}
-			}
-			
-			// Output the number of events that had only the trigger
-			// type ID for the current trigger type flagged by the TI.
-			System.out.print(getCenteredString("" + getTITriggers(eventTriggerID, true), columnWidth) + spacingText);
-			
-			// Start a new line.
-			System.out.println();
-		}
-	}
-	
-	/**
-	 * Produces a <code>String</code> of the indicated length with the
-	 * text <code>value</code> centered in the middle. Extra length is
-	 * filled through spaces before and after the text.
-	 * @param value - The text to display.
-	 * @param width - The number of spaces to include.
-	 * @return Returns a <code>String</code> of the specified length,
-	 * or the argument text if it is longer.
-	 */
-	private static final String getCenteredString(String value, int width) {
-		// The method can not perform as intended if the argument text
-		// exceeds the requested string length. Just return the text.
-		if(width <= value.length()) {
-			return value;
-		}
-		
-		// Otherwise, get the amount of buffering needed to center the
-		// text and add it around the text to produce the string.
-		else {
-			int buffer = (width - value.length()) / 2;
-			return ComponentUtils.getChars(' ', buffer) + value
-					+ ComponentUtils.getChars(' ', width - buffer - value.length());
-		}
-	}
-	
-	/**
-	 * Produces an exception if the argument trigger type is not of a
-	 * supported type.
-	 * @param triggerType - The trigger type to verify.
-	 */
-	private static final void validateTriggerType(int triggerType) {
-		if(triggerType < 0 || triggerType > 5) {
-			throw new IndexOutOfBoundsException(String.format("Trigger type \"%d\" is not supported.", triggerType));
-		}
-	}
+    // Define TI trigger type identifiers.
+    public static final int SINGLES0 = TriggerStatModule.SINGLES_0;
+    public static final int SINGLES1 = TriggerStatModule.SINGLES_1;
+    public static final int PAIR0    = TriggerStatModule.PAIR_0;
+    public static final int PAIR1    = TriggerStatModule.PAIR_1;
+    public static final int PULSER   = TriggerStatModule.PULSER;
+    public static final int COSMIC   = TriggerStatModule.COSMIC;
+    
+    // Tracks the number of TI triggers seen across all events for only
+    // the TI trigger with the highest priority in the event.
+    private int[] tiSeenHierarchical = new int[6];
+    
+    // Tracks the number of TI triggers across all events.
+    private int[] tiSeenAll = new int[6];
+    
+    // Store the statistics modules for each of the regular triggers.
+    private TriggerEvent[] triggerStats = new TriggerEvent[4];
+    
+    /**
+     * Instantiates a new <code>TriggerDiagStats</code> object.
+     */
+    public TriggerDiagStats() {
+        // Instantiate a trigger statistics module for each of the
+        // triggers for which statistics are supported.
+        for(int triggerType = 0; triggerType < 4; triggerType++) {
+            triggerStats[triggerType] = new TriggerEvent();
+        }
+    }
+    
+    /**
+     * Clears all of the statistical counters in the object.
+     */
+    void clear() {
+        // Clear the tracked TI trigger data.
+        for(int tiType = 0; tiType < 6; tiType++) {
+            tiSeenAll[tiType] = 0;
+            tiSeenHierarchical[tiType] = 0;
+        }
+        
+        // Clear the trigger statistical modules.
+        for(int triggerType = 0; triggerType < 4; triggerType++) {
+            triggerStats[triggerType].clear();
+        }
+    }
+    
+    /**
+     * Gets the trigger data for the pair 0 trigger.
+     * @return Returns the <code>TriggerEvent</code> object that holds
+     * the trigger data for the pair 0 trigger.
+     */
+    public TriggerEvent getPair0Stats() {
+        return triggerStats[PAIR0];
+    }
+    
+    /**
+     * Gets the trigger data for the pair 1 trigger.
+     * @return Returns the <code>TriggerEvent</code> object that holds
+     * the trigger data for the pair 1 trigger.
+     */
+    public TriggerEvent getPair1Stats() {
+        return triggerStats[PAIR1];
+    }
+    
+    /**
+     * Gets the trigger data for the singles 0 trigger.
+     * @return Returns the <code>TriggerEvent</code> object that holds
+     * the trigger data for the singles 0 trigger.
+     */
+    public TriggerEvent getSingles0Stats() {
+        return triggerStats[SINGLES0];
+    }
+    
+    /**
+     * Gets the trigger data for the singles 1 trigger.
+     * @return Returns the <code>TriggerEvent</code> object that holds
+     * the trigger data for the singles 1 trigger.
+     */
+    public TriggerEvent getSingles1Stats() {
+        return triggerStats[SINGLES1];
+    }
+    
+    /**
+     * Gets the total number of events where the TI reported a trigger
+     * of the specified type.
+     * @param triggerID - The identifier for the type of trigger.
+     * @param unique - <code>true</code> returns only the number of
+     * events where this trigger type was the <i>only</i> type seen by
+     * the TI while <code>false</code> returns the number of events
+     * that saw this trigger type without regards for other trigger
+     * flags.
+     * @return Returns the count as an <code>int</code>.
+     */
+    public int getTITriggers(int triggerID, boolean hierarchical) {
+        // Verify the trigger type.
+        validateTriggerType(triggerID);
+        
+        // Increment the counters.
+        if(hierarchical) { return tiSeenHierarchical[triggerID]; }
+        else { return tiSeenAll[triggerID]; }
+    }
+    
+    /**
+     * Increments the counts tracking the number of TI flags seen.
+     * @param flags - An array of <code>boolean</code> values of size
+     * six. This represents one flag for each possible TI trigger type.
+     */
+    public void sawTITriggers(boolean[] flags) {
+        // There must be six trigger flags and the array must not be
+        // null.
+        if(flags == null) {
+            throw new NullPointerException("TI trigger flags can not be null.");
+        } if(flags.length != 6) {
+            throw new IllegalArgumentException("TI trigger flags must be of size six.");
+        }
+        
+        // Check each TI flag in the order of the flag hierarchy. The
+        // first flag in the hierarchy that is true is recorded in the
+        // hierarchical count. All flags are recorded in the all count.
+        boolean foundHierarchical = false;
+        if(flags[PAIR1]) {
+            tiSeenAll[PAIR1]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[PAIR1]++;
+                foundHierarchical = true;
+            }
+        } if(flags[PAIR0]) {
+            tiSeenAll[PAIR0]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[PAIR0]++;
+                foundHierarchical = true;
+            }
+        } if(flags[SINGLES1]) {
+            tiSeenAll[SINGLES1]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[SINGLES1]++;
+                foundHierarchical = true;
+            }
+        } if(flags[SINGLES0]) {
+            tiSeenAll[SINGLES0]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[SINGLES0]++;
+                foundHierarchical = true;
+            }
+        } if(flags[PULSER]) {
+            tiSeenAll[PULSER]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[PULSER]++;
+                foundHierarchical = true;
+            }
+        } if(flags[COSMIC]) {
+            tiSeenAll[COSMIC]++;
+            if(!foundHierarchical) {
+                tiSeenHierarchical[COSMIC]++;
+                foundHierarchical = true;
+            }
+        }
+    }
+    
+    /**
+     * Prints the trigger statistics to the terminal as a table.
+     */
+    public void printEfficiencyTable() {
+        // Get the trigger statistics tables.
+        int[][] seenStats = new int[6][4];
+        int[][] matchedStats = new int[6][4];
+        TriggerEvent[] triggerEvents = { getSingles0Stats(), getSingles1Stats(), getPair0Stats(), getPair1Stats() };
+        for(int i = 0; i < 4; i++) {
+            for(int j = 0; j < 6; j++) {
+                seenStats[j][i] = triggerEvents[i].getReconSimulatedTriggers(j);
+                matchedStats[j][i] = triggerEvents[i].getMatchedReconSimulatedTriggers(j);
+            }
+        }
+        
+        // Define constant spacing variables.
+        int columnSpacing = 3;
+        
+        // Define table headers.
+        String sourceName = "Source";
+        String seenName = "Trigger Efficiency";
+        
+        // Get the longest column header name.
+        int longestHeader = -1;
+        String[] headerNames = {
+                TriggerDiagnosticUtil.TRIGGER_NAME[0],
+                TriggerDiagnosticUtil.TRIGGER_NAME[1],
+                TriggerDiagnosticUtil.TRIGGER_NAME[2],
+                TriggerDiagnosticUtil.TRIGGER_NAME[3],
+                "TI Highest Type"
+        };
+        for(String triggerName : headerNames) {
+            longestHeader = ComponentUtils.max(longestHeader, triggerName.length());
+        }
+        longestHeader = ComponentUtils.max(longestHeader, sourceName.length());
+        
+        // Determine the spacing needed to display the largest numerical
+        // cell value.
+        int numWidth = -1;
+        int longestCell = -1;
+        for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
+            for(int seenTriggerID = 0; seenTriggerID < 4; seenTriggerID++) {
+                int valueSize = ComponentUtils.getDigits(seenStats[eventTriggerID][seenTriggerID]);
+                int cellSize = valueSize * 2 + 13;
+                if(cellSize > longestCell) {
+                    longestCell = cellSize;
+                    numWidth = valueSize;
+                }
+            }
+        }
+        
+        // The total column width can then be calculated from the
+        // longer of the header and cell values.
+        int columnWidth = ComponentUtils.max(longestCell, longestHeader);
+        int sourceWidth = ComponentUtils.max(
+                TriggerDiagnosticUtil.TRIGGER_NAME[0].length(), TriggerDiagnosticUtil.TRIGGER_NAME[1].length(),
+                TriggerDiagnosticUtil.TRIGGER_NAME[2].length(), TriggerDiagnosticUtil.TRIGGER_NAME[3].length(),
+                TriggerDiagnosticUtil.TRIGGER_NAME[4].length(), TriggerDiagnosticUtil.TRIGGER_NAME[5].length(),
+                sourceName.length() );
+        
+        // Calculate the total width of the table value header columns.
+        int headerTotalWidth = (headerNames.length * columnWidth)
+                + ((headerNames.length - 1) * columnSpacing);
+        
+        // Write the table header.
+        String spacingText = ComponentUtils.getChars(' ', columnSpacing);
+        System.out.println(ComponentUtils.getChars(' ', sourceWidth) + spacingText
+                + getCenteredString(seenName, headerTotalWidth));
+        
+        // Create the format strings for the cell values.
+        String headerFormat = "%-" + sourceWidth + "s" + spacingText;
+        String cellFormat = "%" + numWidth + "d / %" + numWidth + "d (%7.3f)";
+        String nullText = getCenteredString(ComponentUtils.getChars('-', numWidth) + " / "
+                + ComponentUtils.getChars('-', numWidth) + " (  N/A  )", columnWidth) + spacingText;
+        
+        // Print the column headers.
+        System.out.printf(headerFormat, sourceName);
+        for(String header : headerNames) {
+            System.out.print(getCenteredString(header, columnWidth) + spacingText);
+        }
+        System.out.println();
+        
+        // Write out the value columns.
+        for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
+            // Print out the row header.
+            System.out.printf(headerFormat, TriggerDiagnosticUtil.TRIGGER_NAME[eventTriggerID]);
+            
+            // Print the cell values.
+            for(int seenTriggerID = 0; seenTriggerID < 4; seenTriggerID++) {
+                if(seenTriggerID == eventTriggerID) { System.out.print(nullText); }
+                else {
+                    String cellText = String.format(cellFormat, matchedStats[eventTriggerID][seenTriggerID],
+                            seenStats[eventTriggerID][seenTriggerID],
+                            (100.0 * matchedStats[eventTriggerID][seenTriggerID] / seenStats[eventTriggerID][seenTriggerID]));
+                    System.out.print(getCenteredString(cellText, columnWidth) + spacingText);
+                }
+            }
+            
+            // Output the number of events that had only the trigger
+            // type ID for the current trigger type flagged by the TI.
+            System.out.print(getCenteredString("" + getTITriggers(eventTriggerID, true), columnWidth) + spacingText);
+            
+            // Start a new line.
+            System.out.println();
+        }
+    }
+    
+    /**
+     * Produces a <code>String</code> of the indicated length with the
+     * text <code>value</code> centered in the middle. Extra length is
+     * filled through spaces before and after the text.
+     * @param value - The text to display.
+     * @param width - The number of spaces to include.
+     * @return Returns a <code>String</code> of the specified length,
+     * or the argument text if it is longer.
+     */
+    private static final String getCenteredString(String value, int width) {
+        // The method can not perform as intended if the argument text
+        // exceeds the requested string length. Just return the text.
+        if(width <= value.length()) {
+            return value;
+        }
+        
+        // Otherwise, get the amount of buffering needed to center the
+        // text and add it around the text to produce the string.
+        else {
+            int buffer = (width - value.length()) / 2;
+            return ComponentUtils.getChars(' ', buffer) + value
+                    + ComponentUtils.getChars(' ', width - buffer - value.length());
+        }
+    }
+    
+    /**
+     * Produces an exception if the argument trigger type is not of a
+     * supported type.
+     * @param triggerType - The trigger type to verify.
+     */
+    private static final void validateTriggerType(int triggerType) {
+        if(triggerType < 0 || triggerType > 5) {
+            throw new IndexOutOfBoundsException(String.format("Trigger type \"%d\" is not supported.", triggerType));
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerEvent.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerEvent.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerEvent.java	Wed Mar  9 11:43:24 2016
@@ -9,263 +9,263 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class TriggerEvent extends TriggerStatModule {
-	/**
-	 * Adds the statistics from one event object into this one.
-	 * @param event - The event data to add.
-	 */
-	public void addEvent(TriggerStatModule event) {
-		// Merge the values that do not depend on trigger source type.
-		reportedTriggers += event.reportedTriggers;
-		
-		// Merge each value that depends on the trigger source type.
-		for(int sourceType = 0; sourceType < 2; sourceType++) {
-			simTriggers[sourceType] += event.simTriggers[sourceType];
-			matchedTriggers[sourceType] += event.matchedTriggers[sourceType];
-			unmatchedTriggers[sourceType] += event.unmatchedTriggers[sourceType];
-			
-			// Merge the number of times each cut failed.
-			for(int cutID = 0; cutID < 4; cutID++) {
-				failedCuts[sourceType][cutID] += event.failedCuts[sourceType][cutID];
-			}
-			
-			// Copy the values for the TI flag trigger counters.
-			for(int tiType = 0; tiType < 6; tiType++) {
-				tiTriggersSeen[sourceType][tiType] += event.tiTriggersSeen[sourceType][tiType];
-				tiTriggersMatched[sourceType][tiType] += event.tiTriggersMatched[sourceType][tiType];
-			}
-		}
-	}
-	
-	/**
-	 * Indicates that a reconstructed trigger could not be matched, even
-	 * partially, to an SSP bank trigger.
-	 */
-	public void failedReconTrigger() {
-		unmatchedTriggers[RECON]++;
-	}
-	
-	/**
-	 * Indicates that an SSP simulated trigger could not be matched, even
-	 * partially, to an SSP bank trigger.
-	 */
-	public void failedSSPTrigger() {
-		unmatchedTriggers[SSP]++;
-	}
+    /**
+     * Adds the statistics from one event object into this one.
+     * @param event - The event data to add.
+     */
+    public void addEvent(TriggerStatModule event) {
+        // Merge the values that do not depend on trigger source type.
+        reportedTriggers += event.reportedTriggers;
+        
+        // Merge each value that depends on the trigger source type.
+        for(int sourceType = 0; sourceType < 2; sourceType++) {
+            simTriggers[sourceType] += event.simTriggers[sourceType];
+            matchedTriggers[sourceType] += event.matchedTriggers[sourceType];
+            unmatchedTriggers[sourceType] += event.unmatchedTriggers[sourceType];
+            
+            // Merge the number of times each cut failed.
+            for(int cutID = 0; cutID < 4; cutID++) {
+                failedCuts[sourceType][cutID] += event.failedCuts[sourceType][cutID];
+            }
+            
+            // Copy the values for the TI flag trigger counters.
+            for(int tiType = 0; tiType < 6; tiType++) {
+                tiTriggersSeen[sourceType][tiType] += event.tiTriggersSeen[sourceType][tiType];
+                tiTriggersMatched[sourceType][tiType] += event.tiTriggersMatched[sourceType][tiType];
+            }
+        }
+    }
+    
+    /**
+     * Indicates that a reconstructed trigger could not be matched, even
+     * partially, to an SSP bank trigger.
+     */
+    public void failedReconTrigger() {
+        unmatchedTriggers[RECON]++;
+    }
+    
+    /**
+     * Indicates that an SSP simulated trigger could not be matched, even
+     * partially, to an SSP bank trigger.
+     */
+    public void failedSSPTrigger() {
+        unmatchedTriggers[SSP]++;
+    }
 
-	/**
-	 * Indicates that a trigger simulated from a reconstructed cluster
-	 * was successfully matched to a trigger in the SSP bank.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param triggerTypeID - An identifier indicating the type of
-	 * trigger that was matched.
-	 */
-	public void matchedReconTrigger(boolean[] tiFlags) {
-		matchedTriggers(tiFlags, RECON);
-	}
-	
-	/**
-	 * Indicates that a trigger simulated from a reconstructed cluster
-	 * was partially matched to a trigger in the SSP bank, and notes
-	 * which cuts did and did not match.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param triggerTypeID - An identifier indicating the type of
-	 * trigger that was matched.
-	 * @param matchedCuts - An array of size 3 or 4 indicating which
-	 * cuts did and did not align between the triggers.
-	 */
-	public void matchedReconTrigger(boolean[] tiFlags, boolean[] matchedCuts) {
-		matchedTriggers(tiFlags, matchedCuts, RECON);
-	}
-	
-	/**
-	 * Indicates that a trigger simulated from an SSP bank cluster was
-	 * successfully matched to a trigger in the SSP bank.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param triggerTypeID - An identifier indicating the type of
-	 * trigger that was matched.
-	 */
-	public void matchedSSPTrigger(boolean[] tiFlags) {
-		matchedTriggers(tiFlags, SSP);
-	}
-	
-	/**
-	 * Indicates that a trigger simulated from an SSP bank cluster was
-	 * partially matched to a trigger in the SSP bank, and notes which
-	 * cuts did and did not match.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param triggerTypeID - An identifier indicating the type of
-	 * trigger that was matched.
-	 * @param matchedCuts - An array of size 3 or 4 indicating which
-	 * cuts did and did not align between the triggers.
-	 */
-	public void matchedSSPTrigger(boolean[] tiFlags, boolean[] matchedCuts) {
-		matchedTriggers(tiFlags, matchedCuts, SSP);
-	}
-	
-	/**
-	 * Indicates that a trigger simulated from a reconstructed cluster
-	 * was seen and increments the count for this type of trigger by one.
-	 * @param tiFlags - Whether or not each of the TI bank flags is
-	 * active or not.
-	 */
-	public void sawReconSimulatedTrigger(boolean[] tiFlags) {
-		sawReconSimulatedTriggers(tiFlags, 1);
-	}
-	
-	/**
-	 * Indicates that a number triggers simulated from reconstructed
-	 * clusters were seen and increments the count for this type of
-	 * trigger by the indicated number.
-	 * @param tiFlags - Whether or not each of the TI bank flags is
-	 * active or not.
-	 * @param count - The number of simulated triggers seen.
-	 */
-	public void sawReconSimulatedTriggers(boolean[] tiFlags, int count) {
-		// Increment the total count.
-		simTriggers[RECON] += count;
-		
-		// Increment the TI flag counters.
-		for(int tiType = 0; tiType < 6; tiType++) {
-			if(tiFlags[tiType]) {
-				tiTriggersSeen[RECON][tiType] += count;
-			}
-		}
-	}
-	
-	/**
-	 * Indicates that a trigger from the SSP trigger bank was seen and
-	 * increments the count for this type of trigger by one.
-	 */
-	public void sawReportedTrigger() {
-		sawReportedTriggers(1);
-	}
-	
-	/**
-	 * Indicates that a number triggers from the SSP trigger bank were
-	 * seen and increments the count for this type of trigger by the
-	 * indicated number.
-	 * @param count - The number of simulated triggers seen.
-	 */
-	public void sawReportedTriggers(int count) {
-		reportedTriggers += count;
-	}
-	
-	/**
-	 * Indicates that a trigger simulated from an SSP bank cluster was
-	 * seen and increments the count for this type of trigger by one.
-	 * @param tiFlags - Whether or not each of the TI bank flags is
-	 * active or not.
-	 */
-	public void sawSSPSimulatedTrigger(boolean[] tiFlags) {
-		sawSSPSimulatedTriggers(tiFlags, 1);
-	}
-	
-	/**
-	 * Indicates that a number triggers simulated from SSP bank clusters
-	 * were seen and increments the count for this type of trigger by
-	 * the indicated number.
-	 * @param tiFlags - Whether or not each of the TI bank flags is
-	 * active or not.
-	 * @param count - The number of simulated triggers seen.
-	 */
-	public void sawSSPSimulatedTriggers(boolean[] tiFlags, int count) {
-		// Increment the total count.
-		simTriggers[SSP] += count;
-		
-		// Increment the TI flag counters.
-		for(int tiType = 0; tiType < 6; tiType++) {
-			if(tiFlags[tiType]) {
-				tiTriggersSeen[SSP][tiType] += count;
-			}
-		}
-	}
-	
-	/**
-	 * Indicates that a simulated trigger was successfully matched to
-	 * an SSP bank trigger.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param sourceType - Uses <code>SSP</code> for triggers simulated
-	 * from an SSP bank cluster and <code>RECON</code> for triggers that
-	 * were simulated from a reconstructed cluster.
-	 */
-	private final void matchedTriggers(boolean[] tiFlags, int sourceType) {
-		// Increment the total triggers matched.
-		matchedTriggers[sourceType]++;
-		
-		// Increment the triggers matched for this type for each if
-		// the active TI bank flags.
-		for(int tiType = 0; tiType < 6; tiType++) {
-			if(tiFlags[tiType]) {
-				tiTriggersMatched[sourceType][tiType]++;
-			}
-		}
-	}
-	
-	/**
-	 * Indicates that a simulated trigger was partially matched to a
-	 * trigger in the SSP bank, and notes which cuts did and did not
-	 * match.
-	 * @param tiFlags - An array of size 6 indicating which TI bank
-	 * flags are active and which are not.
-	 * @param sourceType - Uses <code>SSP</code> for triggers simulated
-	 * from an SSP bank cluster and <code>RECON</code> for triggers that
-	 * were simulated from a reconstructed cluster.
-	 */
-	private void matchedTriggers(boolean[] tiFlags, boolean[] matchedCuts, int sourceType) {
-		// The matched cuts must be defined.
-		if(matchedCuts == null) {
-			throw new NullPointerException("The matched cuts array must be defined.");
-		}
-		
-		// The matched cuts array must be of either size 3 or 4.
-		if(matchedCuts.length != 3 && matchedCuts.length != 4) {
-			throw new IllegalArgumentException("All triggers must use either three or four cuts.");
-		}
-		
-		// Increment the counters for each cut that was no matched. Also
-		// track whether or not a cut actually failed.
-		boolean cutFailed = false;
-		for(int cutIndex = 0; cutIndex < matchedCuts.length; cutIndex++) {
-			if(!matchedCuts[cutIndex]) {
-				failedCuts[sourceType][cutIndex]++;
-				cutFailed = true;
-			}
-		}
-		
-		// If no cut failed, this is actually a match. Increment the
-		// appropriate counters.
-		if(!cutFailed) {
-			matchedTriggers(tiFlags, sourceType);
-		}
-	}
-	
-	@Deprecated
-	public String getPrintData() {
-		StringBuffer out = new StringBuffer();
+    /**
+     * Indicates that a trigger simulated from a reconstructed cluster
+     * was successfully matched to a trigger in the SSP bank.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param triggerTypeID - An identifier indicating the type of
+     * trigger that was matched.
+     */
+    public void matchedReconTrigger(boolean[] tiFlags) {
+        matchedTriggers(tiFlags, RECON);
+    }
+    
+    /**
+     * Indicates that a trigger simulated from a reconstructed cluster
+     * was partially matched to a trigger in the SSP bank, and notes
+     * which cuts did and did not match.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param triggerTypeID - An identifier indicating the type of
+     * trigger that was matched.
+     * @param matchedCuts - An array of size 3 or 4 indicating which
+     * cuts did and did not align between the triggers.
+     */
+    public void matchedReconTrigger(boolean[] tiFlags, boolean[] matchedCuts) {
+        matchedTriggers(tiFlags, matchedCuts, RECON);
+    }
+    
+    /**
+     * Indicates that a trigger simulated from an SSP bank cluster was
+     * successfully matched to a trigger in the SSP bank.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param triggerTypeID - An identifier indicating the type of
+     * trigger that was matched.
+     */
+    public void matchedSSPTrigger(boolean[] tiFlags) {
+        matchedTriggers(tiFlags, SSP);
+    }
+    
+    /**
+     * Indicates that a trigger simulated from an SSP bank cluster was
+     * partially matched to a trigger in the SSP bank, and notes which
+     * cuts did and did not match.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param triggerTypeID - An identifier indicating the type of
+     * trigger that was matched.
+     * @param matchedCuts - An array of size 3 or 4 indicating which
+     * cuts did and did not align between the triggers.
+     */
+    public void matchedSSPTrigger(boolean[] tiFlags, boolean[] matchedCuts) {
+        matchedTriggers(tiFlags, matchedCuts, SSP);
+    }
+    
+    /**
+     * Indicates that a trigger simulated from a reconstructed cluster
+     * was seen and increments the count for this type of trigger by one.
+     * @param tiFlags - Whether or not each of the TI bank flags is
+     * active or not.
+     */
+    public void sawReconSimulatedTrigger(boolean[] tiFlags) {
+        sawReconSimulatedTriggers(tiFlags, 1);
+    }
+    
+    /**
+     * Indicates that a number triggers simulated from reconstructed
+     * clusters were seen and increments the count for this type of
+     * trigger by the indicated number.
+     * @param tiFlags - Whether or not each of the TI bank flags is
+     * active or not.
+     * @param count - The number of simulated triggers seen.
+     */
+    public void sawReconSimulatedTriggers(boolean[] tiFlags, int count) {
+        // Increment the total count.
+        simTriggers[RECON] += count;
+        
+        // Increment the TI flag counters.
+        for(int tiType = 0; tiType < 6; tiType++) {
+            if(tiFlags[tiType]) {
+                tiTriggersSeen[RECON][tiType] += count;
+            }
+        }
+    }
+    
+    /**
+     * Indicates that a trigger from the SSP trigger bank was seen and
+     * increments the count for this type of trigger by one.
+     */
+    public void sawReportedTrigger() {
+        sawReportedTriggers(1);
+    }
+    
+    /**
+     * Indicates that a number triggers from the SSP trigger bank were
+     * seen and increments the count for this type of trigger by the
+     * indicated number.
+     * @param count - The number of simulated triggers seen.
+     */
+    public void sawReportedTriggers(int count) {
+        reportedTriggers += count;
+    }
+    
+    /**
+     * Indicates that a trigger simulated from an SSP bank cluster was
+     * seen and increments the count for this type of trigger by one.
+     * @param tiFlags - Whether or not each of the TI bank flags is
+     * active or not.
+     */
+    public void sawSSPSimulatedTrigger(boolean[] tiFlags) {
+        sawSSPSimulatedTriggers(tiFlags, 1);
+    }
+    
+    /**
+     * Indicates that a number triggers simulated from SSP bank clusters
+     * were seen and increments the count for this type of trigger by
+     * the indicated number.
+     * @param tiFlags - Whether or not each of the TI bank flags is
+     * active or not.
+     * @param count - The number of simulated triggers seen.
+     */
+    public void sawSSPSimulatedTriggers(boolean[] tiFlags, int count) {
+        // Increment the total count.
+        simTriggers[SSP] += count;
+        
+        // Increment the TI flag counters.
+        for(int tiType = 0; tiType < 6; tiType++) {
+            if(tiFlags[tiType]) {
+                tiTriggersSeen[SSP][tiType] += count;
+            }
+        }
+    }
+    
+    /**
+     * Indicates that a simulated trigger was successfully matched to
+     * an SSP bank trigger.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param sourceType - Uses <code>SSP</code> for triggers simulated
+     * from an SSP bank cluster and <code>RECON</code> for triggers that
+     * were simulated from a reconstructed cluster.
+     */
+    private final void matchedTriggers(boolean[] tiFlags, int sourceType) {
+        // Increment the total triggers matched.
+        matchedTriggers[sourceType]++;
+        
+        // Increment the triggers matched for this type for each if
+        // the active TI bank flags.
+        for(int tiType = 0; tiType < 6; tiType++) {
+            if(tiFlags[tiType]) {
+                tiTriggersMatched[sourceType][tiType]++;
+            }
+        }
+    }
+    
+    /**
+     * Indicates that a simulated trigger was partially matched to a
+     * trigger in the SSP bank, and notes which cuts did and did not
+     * match.
+     * @param tiFlags - An array of size 6 indicating which TI bank
+     * flags are active and which are not.
+     * @param sourceType - Uses <code>SSP</code> for triggers simulated
+     * from an SSP bank cluster and <code>RECON</code> for triggers that
+     * were simulated from a reconstructed cluster.
+     */
+    private void matchedTriggers(boolean[] tiFlags, boolean[] matchedCuts, int sourceType) {
+        // The matched cuts must be defined.
+        if(matchedCuts == null) {
+            throw new NullPointerException("The matched cuts array must be defined.");
+        }
+        
+        // The matched cuts array must be of either size 3 or 4.
+        if(matchedCuts.length != 3 && matchedCuts.length != 4) {
+            throw new IllegalArgumentException("All triggers must use either three or four cuts.");
+        }
+        
+        // Increment the counters for each cut that was no matched. Also
+        // track whether or not a cut actually failed.
+        boolean cutFailed = false;
+        for(int cutIndex = 0; cutIndex < matchedCuts.length; cutIndex++) {
+            if(!matchedCuts[cutIndex]) {
+                failedCuts[sourceType][cutIndex]++;
+                cutFailed = true;
+            }
+        }
+        
+        // If no cut failed, this is actually a match. Increment the
+        // appropriate counters.
+        if(!cutFailed) {
+            matchedTriggers(tiFlags, sourceType);
+        }
+    }
+    
+    @Deprecated
+    public String getPrintData() {
+        StringBuffer out = new StringBuffer();
 
-		out.append("\n");
-		out.append("Trigger Result\n");
-		out.append("SSP Sim Triggers    :: " + simTriggers[SSP] + "\n");
-		out.append("Recon Sim Triggers  :: " + simTriggers[RECON] + "\n");
-		out.append("Reported Triggers   :: " + reportedTriggers + "\n");
-		out.append(String.format("Internal Efficiency :: %d / %d (%7.3f)%n", matchedTriggers[SSP], simTriggers[SSP],
-				(100.0 * matchedTriggers[SSP] / simTriggers[SSP])));
-		out.append(String.format("Trigger Efficiency  :: %d / %d (%7.3f)%n", matchedTriggers[RECON], simTriggers[RECON],
-				(100.0 * matchedTriggers[RECON] / simTriggers[RECON])));
-		
-		out.append("\n");
-		out.append("Individual Cut Failure Rates\n");
-		out.append("Unmatched Triggers   :: " + unmatchedTriggers[SSP] + "\n");
-		for(int i = 0; i < 4; i++) {
-			out.append(String.format("\tCut %d :: %d / %d (%7.3f)%n", i, failedCuts[SSP][i], simTriggers[SSP],
-					(100.0 * failedCuts[SSP][i] / simTriggers[SSP])));
-		}
-		
-		return out.toString();
-	}
+        out.append("\n");
+        out.append("Trigger Result\n");
+        out.append("SSP Sim Triggers    :: " + simTriggers[SSP] + "\n");
+        out.append("Recon Sim Triggers  :: " + simTriggers[RECON] + "\n");
+        out.append("Reported Triggers   :: " + reportedTriggers + "\n");
+        out.append(String.format("Internal Efficiency :: %d / %d (%7.3f)%n", matchedTriggers[SSP], simTriggers[SSP],
+                (100.0 * matchedTriggers[SSP] / simTriggers[SSP])));
+        out.append(String.format("Trigger Efficiency  :: %d / %d (%7.3f)%n", matchedTriggers[RECON], simTriggers[RECON],
+                (100.0 * matchedTriggers[RECON] / simTriggers[RECON])));
+        
+        out.append("\n");
+        out.append("Individual Cut Failure Rates\n");
+        out.append("Unmatched Triggers   :: " + unmatchedTriggers[SSP] + "\n");
+        for(int i = 0; i < 4; i++) {
+            out.append(String.format("\tCut %d :: %d / %d (%7.3f)%n", i, failedCuts[SSP][i], simTriggers[SSP],
+                    (100.0 * failedCuts[SSP][i] / simTriggers[SSP])));
+        }
+        
+        return out.toString();
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerStatModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerStatModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/data/TriggerStatModule.java	Wed Mar  9 11:43:24 2016
@@ -10,285 +10,285 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class TriggerStatModule {
-	// Store the reference index for SSP simulated triggers and recon
-	// simulated triggers.
-	protected static final int SSP = 0;
-	protected static final int RECON = 1;
-	
-	// Define TI trigger type identifiers.
-	public static final int SINGLES_0 = 0;
-	public static final int SINGLES_1 = 1;
-	public static final int PAIR_0    = 2;
-	public static final int PAIR_1    = 3;
-	public static final int PULSER    = 4;
-	public static final int COSMIC    = 5;
-	
-	// Track the number of simulated triggers seen for each source type.
-	// SSP simulated triggers from the SSP bank clusters. Reconstructed
-	// simulated triggers come from clusters built from FADC data.
-	protected int[] simTriggers = new int[2];
-	
-	// Also track the number of triggers reported by the SSP bank.
-	protected int reportedTriggers = 0;
-	
-	// Track the number of simulated triggers of each type that were
-	// successfully matched.
-	protected int[] matchedTriggers = new int[2];
-	
-	// Track the number of simulated triggers that could not be matched
-	// at all.
-	protected int[] unmatchedTriggers = new int[2];
-	
-	// Track which cuts succeeded and which cuts failed for each type.
-	// Note that this is currently only tracked for SSP cluster triggers.
-	protected int[][] failedCuts = new int[2][4];
-	
-	// Store the number of trigger matches seen over all events that
-	// contain a given TI flag.
-	protected int[][] tiTriggersSeen = new int[2][6];
-	protected int[][] tiTriggersMatched = new int[2][6];
-	
-	/**
-	 * Clears all of the statistical counters in the object.
-	 */
-	void clear() {
-		// Clear all values.
-		for(int sourceType = 0; sourceType < 2; sourceType++) {
-			// Clear the general statistics.
-			simTriggers[sourceType]       = 0;
-			matchedTriggers[sourceType]   = 0;
-			unmatchedTriggers[sourceType] = 0;
-			
-			// Clear the cut failure statistics.
-			for(int cutID = 0; cutID < 4; cutID++) {
-				failedCuts[sourceType][cutID] = 0;
-			}
-			
-			// Clear the TI flag statistics.
-			for(int tiType = 0; tiType < 6; tiType++) {
-				tiTriggersSeen[sourceType][tiType]    = 0;
-				tiTriggersMatched[sourceType][tiType] = 0;
-			}
-		}
-	}
-	
-	@Override
-	public TriggerStatModule clone() {
-		// Make a new statistics module.
-		TriggerStatModule clone = new TriggerStatModule();
-		
-		// Copy the values that do not depend on trigger source type.
-		clone.reportedTriggers = reportedTriggers;
-		
-		// Set each value that depends on the trigger source type.
-		for(int sourceType = 0; sourceType < 2; sourceType++) {
-			clone.simTriggers[sourceType] = simTriggers[sourceType];
-			clone.matchedTriggers[sourceType] = matchedTriggers[sourceType];
-			clone.unmatchedTriggers[sourceType] = unmatchedTriggers[sourceType];
-			
-			// Set the number of times each cut failed.
-			for(int cutID = 0; cutID < 4; cutID++) {
-				clone.failedCuts[sourceType][cutID] = failedCuts[sourceType][cutID];
-			}
-			
-			// Copy the values for the TI flag trigger counters.
-			for(int tiType = 0; tiType < 6; tiType++) {
-				clone.tiTriggersSeen[sourceType][tiType] = tiTriggersSeen[sourceType][tiType];
-				clone.tiTriggersMatched[sourceType][tiType] = tiTriggersMatched[sourceType][tiType];
-			}
-		}
-		
-		// Return the copied clone.
-		return clone;
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were not matched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getFailedReconSimulatedTriggers() {
-		return simTriggers[RECON] - matchedTriggers[RECON];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were not matched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getFailedSSPSimulatedTriggers() {
-		return simTriggers[SSP] - matchedTriggers[SSP];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were matched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getMatchedReconSimulatedTriggers() {
-		return matchedTriggers[RECON];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were matched for a given type of trigger when a given TI
-	 * bank flag was active.
-	 * @param tiTypeID - The identifier for the type of TI bank trigger
-	 * that should be active.
-	 * @param triggerTypeID - The identifier for the type of trigger.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getMatchedReconSimulatedTriggers(int tiTypeID) {
-		return tiTriggersMatched[RECON][tiTypeID];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were matched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getMatchedSSPSimulatedTriggers() {
-		return matchedTriggers[SSP];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were matched for a given type of trigger when a given TI
-	 * bank flag was active.
-	 * @param tiTypeID - The identifier for the type of TI bank trigger
-	 * that should be active.
-	 * @param triggerTypeID - The identifier for the type of trigger.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getMatchedSSPSimulatedTriggers(int tiTypeID) {
-		return tiTriggersMatched[SSP][tiTypeID];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were matched, but did not see full cut alignment.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getPartiallyMatchedReconSimulatedTriggers() {
-		return simTriggers[RECON] - (matchedTriggers[RECON] + unmatchedTriggers[RECON]);
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were matched, but did not see full cut alignment.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getPartiallyMatchedSSPSimulatedTriggers() {
-		return simTriggers[SSP] - (matchedTriggers[SSP] + unmatchedTriggers[SSP]);
-	}
-	
-	/**
-	 * Gets the number of times the specified cut failed for triggers
-	 * that were partially matched for triggers simulated from FADC
-	 * reconstructed clusters.
-	 * @param cutIndex - The numerical cut identifier.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getReconCutFailures(int cutIndex) {
-		return getCutFailures(RECON, cutIndex);
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were seen.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getReconSimulatedTriggers() {
-		return simTriggers[RECON];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were seen for a given trigger type when a given TI bank
-	 * flag was active.
-	 * @param tiTypeID - The identifier for the type of TI bank trigger
-	 * that should be active.
-	 * @param triggerTypeID - The identifier for the type of trigger.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getReconSimulatedTriggers(int tiTypeID) {
-		return tiTriggersSeen[RECON][tiTypeID];
-	}
-	
-	/**
-	 * Gets the number of triggers reported by the SSP bank.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getReportedTriggers() {
-		return reportedTriggers;
-	}
-	
-	/**
-	 * Gets the number of times the specified cut failed for triggers
-	 * that were partially matched for triggers simulated from SSP
-	 * bank clusters.
-	 * @param cutIndex - The numerical cut identifier.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getSSPCutFailures(int cutIndex) {
-		return getCutFailures(SSP, cutIndex);
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were seen.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getSSPSimulatedTriggers() {
-		return simTriggers[SSP];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were seen for a given trigger type when a given TI bank
-	 * flag was active.
-	 * @param tiTypeID - The identifier for the type of TI bank trigger
-	 * that should be active.
-	 * @param triggerTypeID - The identifier for the type of trigger.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getSSPSimulatedTriggers(int tiTypeID) {
-		return tiTriggersSeen[SSP][tiTypeID];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from reconstructed clusters
-	 * that were completely unmatched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getUnmatchedReconSimulatedTriggers() {
-		return unmatchedTriggers[RECON];
-	}
-	
-	/**
-	 * Gets the number of simulated triggers from SSP bank clusters
-	 * that were completely unmatched.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	public int getUnmatchedSSPSimulatedTriggers() {
-		return unmatchedTriggers[SSP];
-	}
-	
-	/**
-	 * Gets the number of times the specified cut failed for triggers
-	 * that were partially matched for triggers simulated from the type
-	 * of cluster indicated.
-	 * @param type - Either <code>SSP</code> or <code>RECON</code>.
-	 * @param cutIndex - The numerical cut identifier.
-	 * @return Returns the number of triggers as an <code>int</code>.
-	 */
-	private int getCutFailures(int type, int cutIndex) {
-		// Ensure that the cut index is valid.
-		if(cutIndex < 0 || cutIndex >= 4) {
-			throw new IndexOutOfBoundsException(String.format("Cut index \"%d\" is not recognized.", cutIndex));
-		}
-		
-		// Return the cut failures.
-		return failedCuts[type][cutIndex];
-	}
+    // Store the reference index for SSP simulated triggers and recon
+    // simulated triggers.
+    protected static final int SSP = 0;
+    protected static final int RECON = 1;
+    
+    // Define TI trigger type identifiers.
+    public static final int SINGLES_0 = 0;
+    public static final int SINGLES_1 = 1;
+    public static final int PAIR_0    = 2;
+    public static final int PAIR_1    = 3;
+    public static final int PULSER    = 4;
+    public static final int COSMIC    = 5;
+    
+    // Track the number of simulated triggers seen for each source type.
+    // SSP simulated triggers from the SSP bank clusters. Reconstructed
+    // simulated triggers come from clusters built from FADC data.
+    protected int[] simTriggers = new int[2];
+    
+    // Also track the number of triggers reported by the SSP bank.
+    protected int reportedTriggers = 0;
+    
+    // Track the number of simulated triggers of each type that were
+    // successfully matched.
+    protected int[] matchedTriggers = new int[2];
+    
+    // Track the number of simulated triggers that could not be matched
+    // at all.
+    protected int[] unmatchedTriggers = new int[2];
+    
+    // Track which cuts succeeded and which cuts failed for each type.
+    // Note that this is currently only tracked for SSP cluster triggers.
+    protected int[][] failedCuts = new int[2][4];
+    
+    // Store the number of trigger matches seen over all events that
+    // contain a given TI flag.
+    protected int[][] tiTriggersSeen = new int[2][6];
+    protected int[][] tiTriggersMatched = new int[2][6];
+    
+    /**
+     * Clears all of the statistical counters in the object.
+     */
+    void clear() {
+        // Clear all values.
+        for(int sourceType = 0; sourceType < 2; sourceType++) {
+            // Clear the general statistics.
+            simTriggers[sourceType]       = 0;
+            matchedTriggers[sourceType]   = 0;
+            unmatchedTriggers[sourceType] = 0;
+            
+            // Clear the cut failure statistics.
+            for(int cutID = 0; cutID < 4; cutID++) {
+                failedCuts[sourceType][cutID] = 0;
+            }
+            
+            // Clear the TI flag statistics.
+            for(int tiType = 0; tiType < 6; tiType++) {
+                tiTriggersSeen[sourceType][tiType]    = 0;
+                tiTriggersMatched[sourceType][tiType] = 0;
+            }
+        }
+    }
+    
+    @Override
+    public TriggerStatModule clone() {
+        // Make a new statistics module.
+        TriggerStatModule clone = new TriggerStatModule();
+        
+        // Copy the values that do not depend on trigger source type.
+        clone.reportedTriggers = reportedTriggers;
+        
+        // Set each value that depends on the trigger source type.
+        for(int sourceType = 0; sourceType < 2; sourceType++) {
+            clone.simTriggers[sourceType] = simTriggers[sourceType];
+            clone.matchedTriggers[sourceType] = matchedTriggers[sourceType];
+            clone.unmatchedTriggers[sourceType] = unmatchedTriggers[sourceType];
+            
+            // Set the number of times each cut failed.
+            for(int cutID = 0; cutID < 4; cutID++) {
+                clone.failedCuts[sourceType][cutID] = failedCuts[sourceType][cutID];
+            }
+            
+            // Copy the values for the TI flag trigger counters.
+            for(int tiType = 0; tiType < 6; tiType++) {
+                clone.tiTriggersSeen[sourceType][tiType] = tiTriggersSeen[sourceType][tiType];
+                clone.tiTriggersMatched[sourceType][tiType] = tiTriggersMatched[sourceType][tiType];
+            }
+        }
+        
+        // Return the copied clone.
+        return clone;
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were not matched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getFailedReconSimulatedTriggers() {
+        return simTriggers[RECON] - matchedTriggers[RECON];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were not matched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getFailedSSPSimulatedTriggers() {
+        return simTriggers[SSP] - matchedTriggers[SSP];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were matched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getMatchedReconSimulatedTriggers() {
+        return matchedTriggers[RECON];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were matched for a given type of trigger when a given TI
+     * bank flag was active.
+     * @param tiTypeID - The identifier for the type of TI bank trigger
+     * that should be active.
+     * @param triggerTypeID - The identifier for the type of trigger.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getMatchedReconSimulatedTriggers(int tiTypeID) {
+        return tiTriggersMatched[RECON][tiTypeID];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were matched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getMatchedSSPSimulatedTriggers() {
+        return matchedTriggers[SSP];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were matched for a given type of trigger when a given TI
+     * bank flag was active.
+     * @param tiTypeID - The identifier for the type of TI bank trigger
+     * that should be active.
+     * @param triggerTypeID - The identifier for the type of trigger.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getMatchedSSPSimulatedTriggers(int tiTypeID) {
+        return tiTriggersMatched[SSP][tiTypeID];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were matched, but did not see full cut alignment.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getPartiallyMatchedReconSimulatedTriggers() {
+        return simTriggers[RECON] - (matchedTriggers[RECON] + unmatchedTriggers[RECON]);
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were matched, but did not see full cut alignment.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getPartiallyMatchedSSPSimulatedTriggers() {
+        return simTriggers[SSP] - (matchedTriggers[SSP] + unmatchedTriggers[SSP]);
+    }
+    
+    /**
+     * Gets the number of times the specified cut failed for triggers
+     * that were partially matched for triggers simulated from FADC
+     * reconstructed clusters.
+     * @param cutIndex - The numerical cut identifier.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getReconCutFailures(int cutIndex) {
+        return getCutFailures(RECON, cutIndex);
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were seen.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getReconSimulatedTriggers() {
+        return simTriggers[RECON];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were seen for a given trigger type when a given TI bank
+     * flag was active.
+     * @param tiTypeID - The identifier for the type of TI bank trigger
+     * that should be active.
+     * @param triggerTypeID - The identifier for the type of trigger.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getReconSimulatedTriggers(int tiTypeID) {
+        return tiTriggersSeen[RECON][tiTypeID];
+    }
+    
+    /**
+     * Gets the number of triggers reported by the SSP bank.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getReportedTriggers() {
+        return reportedTriggers;
+    }
+    
+    /**
+     * Gets the number of times the specified cut failed for triggers
+     * that were partially matched for triggers simulated from SSP
+     * bank clusters.
+     * @param cutIndex - The numerical cut identifier.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getSSPCutFailures(int cutIndex) {
+        return getCutFailures(SSP, cutIndex);
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were seen.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getSSPSimulatedTriggers() {
+        return simTriggers[SSP];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were seen for a given trigger type when a given TI bank
+     * flag was active.
+     * @param tiTypeID - The identifier for the type of TI bank trigger
+     * that should be active.
+     * @param triggerTypeID - The identifier for the type of trigger.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getSSPSimulatedTriggers(int tiTypeID) {
+        return tiTriggersSeen[SSP][tiTypeID];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from reconstructed clusters
+     * that were completely unmatched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getUnmatchedReconSimulatedTriggers() {
+        return unmatchedTriggers[RECON];
+    }
+    
+    /**
+     * Gets the number of simulated triggers from SSP bank clusters
+     * that were completely unmatched.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    public int getUnmatchedSSPSimulatedTriggers() {
+        return unmatchedTriggers[SSP];
+    }
+    
+    /**
+     * Gets the number of times the specified cut failed for triggers
+     * that were partially matched for triggers simulated from the type
+     * of cluster indicated.
+     * @param type - Either <code>SSP</code> or <code>RECON</code>.
+     * @param cutIndex - The numerical cut identifier.
+     * @return Returns the number of triggers as an <code>int</code>.
+     */
+    private int getCutFailures(int type, int cutIndex) {
+        // Ensure that the cut index is valid.
+        if(cutIndex < 0 || cutIndex >= 4) {
+            throw new IndexOutOfBoundsException(String.format("Cut index \"%d\" is not recognized.", cutIndex));
+        }
+        
+        // Return the cut failures.
+        return failedCuts[type][cutIndex];
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/event/TriggerPlotsModule.java	Wed Mar  9 11:43:24 2016
@@ -16,383 +16,383 @@
  * @author Kyle McCarty
  */
 public class TriggerPlotsModule {
-	// Reference variables.
-	private static final int RECON     = 0;
-	private static final int SSP       = 1;
-	private static final int ALL       = 0;
-	private static final int MATCHED   = 1;
-	private static final int FAILED    = 2;
-	private static final int TRIGGERED = 3;
-	private static final int NO_CUTS   = 4;
-	
-	// Class variables.
-	private final double[] energySlopeParamF;
-	private static final double MØLLER_SUM_THRESHOLD = 0.750;
-	
-	// Plots.
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[][][] singlesClusterEnergyPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] singlesHitCountPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] singlesTriggerTimePlot = new IHistogram1D[2][2][5];
-	
-	private IHistogram1D[][][] pairClusterEnergyPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairHitCountPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairTimePlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairSumPlot = new IHistogram1D[2][2][5];
+    // Reference variables.
+    private static final int RECON     = 0;
+    private static final int SSP       = 1;
+    private static final int ALL       = 0;
+    private static final int MATCHED   = 1;
+    private static final int FAILED    = 2;
+    private static final int TRIGGERED = 3;
+    private static final int NO_CUTS   = 4;
+    
+    // Class variables.
+    private final double[] energySlopeParamF;
+    private static final double MØLLER_SUM_THRESHOLD = 0.750;
+    
+    // Plots.
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D[][][] singlesClusterEnergyPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] singlesHitCountPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] singlesTriggerTimePlot = new IHistogram1D[2][2][5];
+    
+    private IHistogram1D[][][] pairClusterEnergyPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairHitCountPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairTimePlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairSumPlot = new IHistogram1D[2][2][5];
     private IHistogram2D[][][] pairSumEnergiesPlot = new IHistogram2D[2][2][5];
-	private IHistogram1D[][][] pairDiffPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairSlopePlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairCoplanarityPlot = new IHistogram1D[2][2][5];
-	private IHistogram1D[][][] pairTriggerTimePlot = new IHistogram1D[2][2][5];
-	
-	private IHistogram1D[] møllerClusterEnergyPlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerHitCountPlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerTimePlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerSumPlot = new IHistogram1D[2];
+    private IHistogram1D[][][] pairDiffPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairSlopePlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairCoplanarityPlot = new IHistogram1D[2][2][5];
+    private IHistogram1D[][][] pairTriggerTimePlot = new IHistogram1D[2][2][5];
+    
+    private IHistogram1D[] møllerClusterEnergyPlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerHitCountPlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerTimePlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerSumPlot = new IHistogram1D[2];
     private IHistogram2D[] møllerSumEnergiesPlot = new IHistogram2D[2];
-	private IHistogram1D[] møllerDiffPlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerSlopePlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerCoplanarityPlot = new IHistogram1D[2];
-	private IHistogram1D[] møllerTriggerTimePlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerDiffPlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerSlopePlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerCoplanarityPlot = new IHistogram1D[2];
+    private IHistogram1D[] møllerTriggerTimePlot = new IHistogram1D[2];
     private IHistogram2D[] møllerPositionPlot = new IHistogram2D[2];
-	
-	private IHistogram1D[] tridentClusterEnergyPlot = new IHistogram1D[2];
-	private IHistogram1D[] tridentHitCountPlot = new IHistogram1D[2];
+    
+    private IHistogram1D[] tridentClusterEnergyPlot = new IHistogram1D[2];
+    private IHistogram1D[] tridentHitCountPlot = new IHistogram1D[2];
     private IHistogram2D[] tridentPositionPlot = new IHistogram2D[2];
-	
-	/**
-	 * Instantiates a new <code>TriggerPlotsModule</code> that will use
-	 * the indicated values for the energy slope conversion factor when
-	 * plotting energy slope values. Plots will be attached to the
-	 * default AIDA instance.
-	 * @param trigger0F - The energy slope conversion factor for the
-	 * first trigger.
-	 * @param trigger1F - The energy slope conversion factor for the
-	 * second trigger.
-	 */
-	public TriggerPlotsModule(double trigger0F, double trigger1F) {
-		// Store the energy slope parameter.
-		energySlopeParamF = new double[2];
-		energySlopeParamF[0] = trigger0F;
-		energySlopeParamF[1] = trigger1F;
-		
-		// Define type string values.
-		String[] sourceType = { "Recon", "SSP" };
-		String[] resultType = { "All", "Matched", "Failed", "Triggered", "No Cuts" };
-		
-		// Instantiate the trigger result plots for each trigger.
-		for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
-			// Get the directory for the current triggers.
-			String pairDir = "Pair Trigger " + triggerNum;
-			String singlesDir = "Singles Trigger " + triggerNum;
-			
-			// Instantiate the trigger result plots for each type of
-			// trigger source object.
-			for(int source = 0; source < 2; source++) {
-				// Instantiate the trigger result plots for each type
-				// of trigger match result.
-				for(int result = 0; result < 5; result++) {
-					// Instantiate the singles trigger plots.
-					singlesClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Cluster Energy (%s)",
-							singlesDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
-					singlesHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Hit Count (%s)",
-							singlesDir, sourceType[source], resultType[result]), 9, 0.5, 9.5);
-					singlesTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Trigger Time (%s)",
-							singlesDir, sourceType[source], resultType[result]), 100, 0, 400);
-					
-					// Instantiate the pair trigger plots.
-					pairHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Hit Count (%s)",
-							pairDir, sourceType[source], resultType[result]), 9, 0.5, 9.5);
-					pairClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Cluster Energy (%s)",
-							pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
-					pairTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Time Coincidence (%s)",
-							pairDir, sourceType[source], resultType[result]), 8, 0, 32);
-					pairSumPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Sum (%s)",
-							pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+    
+    /**
+     * Instantiates a new <code>TriggerPlotsModule</code> that will use
+     * the indicated values for the energy slope conversion factor when
+     * plotting energy slope values. Plots will be attached to the
+     * default AIDA instance.
+     * @param trigger0F - The energy slope conversion factor for the
+     * first trigger.
+     * @param trigger1F - The energy slope conversion factor for the
+     * second trigger.
+     */
+    public TriggerPlotsModule(double trigger0F, double trigger1F) {
+        // Store the energy slope parameter.
+        energySlopeParamF = new double[2];
+        energySlopeParamF[0] = trigger0F;
+        energySlopeParamF[1] = trigger1F;
+        
+        // Define type string values.
+        String[] sourceType = { "Recon", "SSP" };
+        String[] resultType = { "All", "Matched", "Failed", "Triggered", "No Cuts" };
+        
+        // Instantiate the trigger result plots for each trigger.
+        for(int triggerNum = 0; triggerNum < 2; triggerNum++) {
+            // Get the directory for the current triggers.
+            String pairDir = "Pair Trigger " + triggerNum;
+            String singlesDir = "Singles Trigger " + triggerNum;
+            
+            // Instantiate the trigger result plots for each type of
+            // trigger source object.
+            for(int source = 0; source < 2; source++) {
+                // Instantiate the trigger result plots for each type
+                // of trigger match result.
+                for(int result = 0; result < 5; result++) {
+                    // Instantiate the singles trigger plots.
+                    singlesClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Cluster Energy (%s)",
+                            singlesDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+                    singlesHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Hit Count (%s)",
+                            singlesDir, sourceType[source], resultType[result]), 9, 0.5, 9.5);
+                    singlesTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Singles Trigger Time (%s)",
+                            singlesDir, sourceType[source], resultType[result]), 100, 0, 400);
+                    
+                    // Instantiate the pair trigger plots.
+                    pairHitCountPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Hit Count (%s)",
+                            pairDir, sourceType[source], resultType[result]), 9, 0.5, 9.5);
+                    pairClusterEnergyPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Cluster Energy (%s)",
+                            pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+                    pairTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Time Coincidence (%s)",
+                            pairDir, sourceType[source], resultType[result]), 8, 0, 32);
+                    pairSumPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Sum (%s)",
+                            pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
                                         pairSumEnergiesPlot[triggerNum][source][result] = aida.histogram2D(String.format("%s/%s/Pair 2D Energy Sum (%s)",
                                                         pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0, 300, 0.0, 3.0);
-					pairDiffPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Difference (%s)",
-							pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
-					pairSlopePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Slope (%s)",
-							pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
-					pairCoplanarityPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Coplanarity (%s)",
-							pairDir, sourceType[source], resultType[result]), 180, 0, 180);
-					pairTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Trigger Time (%s)",
-							pairDir, sourceType[source], resultType[result]), 100, 0, 400);
-				}
-			}
-			
-			// Instantiate the Møller plots.
-			møllerHitCountPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Hit Count",
-					pairDir), 9, 0.5, 9.5);
-			møllerClusterEnergyPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Cluster Energy",
-					pairDir), 300, 0.0, 3.0);
-			møllerTimePlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Time Coincidence",
-					pairDir), 8, 0, 32);
-			møllerSumPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Energy Sum",
-					pairDir), 300, 0.0, 3.0);
-			møllerSumEnergiesPlot[triggerNum] = aida.histogram2D(String.format("%s/Møller/Møller-like Pair 2D Energy Sum",
+                    pairDiffPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Difference (%s)",
+                            pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+                    pairSlopePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Energy Slope (%s)",
+                            pairDir, sourceType[source], resultType[result]), 300, 0.0, 3.0);
+                    pairCoplanarityPlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Coplanarity (%s)",
+                            pairDir, sourceType[source], resultType[result]), 180, 0, 180);
+                    pairTriggerTimePlot[triggerNum][source][result] = aida.histogram1D(String.format("%s/%s/Pair Trigger Time (%s)",
+                            pairDir, sourceType[source], resultType[result]), 100, 0, 400);
+                }
+            }
+            
+            // Instantiate the Møller plots.
+            møllerHitCountPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Hit Count",
+                    pairDir), 9, 0.5, 9.5);
+            møllerClusterEnergyPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Cluster Energy",
+                    pairDir), 300, 0.0, 3.0);
+            møllerTimePlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Time Coincidence",
+                    pairDir), 8, 0, 32);
+            møllerSumPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Energy Sum",
+                    pairDir), 300, 0.0, 3.0);
+            møllerSumEnergiesPlot[triggerNum] = aida.histogram2D(String.format("%s/Møller/Møller-like Pair 2D Energy Sum",
                     pairDir), 300, 0.0, 3.0, 300, 0.0, 3.0);
             møllerDiffPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Energy Difference",
-					pairDir), 300, 0.0, 3.0);
+                    pairDir), 300, 0.0, 3.0);
             møllerSlopePlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Energy Slope",
-					pairDir), 300, 0.0, 3.0);
+                    pairDir), 300, 0.0, 3.0);
             møllerCoplanarityPlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Coplanarity",
-					pairDir), 180, 0, 180);
+                    pairDir), 180, 0, 180);
             møllerTriggerTimePlot[triggerNum] = aida.histogram1D(String.format("%s/Møller/Møller-like Pair Trigger Time",
-					pairDir), 100, 0, 400);
+                    pairDir), 100, 0, 400);
             møllerPositionPlot[triggerNum] = aida.histogram2D(String.format("%s/Møller/Møller-like Pair Position",
-					pairDir), 46, -23, 23, 11, -5.5, 5.5);
+                    pairDir), 46, -23, 23, 11, -5.5, 5.5);
             
             // Instantiate the trident plots.
             tridentHitCountPlot[triggerNum] = aida.histogram1D(String.format("%s/Trident/Trident-like Pair Hit Count",
-            		singlesDir), 9, 0.5, 9.5);
-			tridentClusterEnergyPlot[triggerNum] = aida.histogram1D(String.format("%s/Trident/Trident-like Pair Cluster Energy",
-					singlesDir), 300, 0.0, 3.0);
+                    singlesDir), 9, 0.5, 9.5);
+            tridentClusterEnergyPlot[triggerNum] = aida.histogram1D(String.format("%s/Trident/Trident-like Pair Cluster Energy",
+                    singlesDir), 300, 0.0, 3.0);
             tridentPositionPlot[triggerNum] = aida.histogram2D(String.format("%s/Trident/Trident-like Pair Position",
-            		singlesDir), 46, -23, 23, 11, -5.5, 5.5);
-		}
-	}
-	
-	/**
-	 * Populates the "failed" plots of the appropriate type with the
-	 * cut results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void failedTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, FAILED);
-	}
-	
-	/**
-	 * Populates the "matched" plots of the appropriate type with the
-	 * cut results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void matchedTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, MATCHED);
-	}
-	
-	/**
-	 * Populates the "triggered" plots of the appropriate type with the
-	 * cut results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void passedTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, TRIGGERED);
-	}
-	
-	/**
-	 * Indicates that a cluster was seen by a trigger and adds it to
-	 * the "no cuts" plots.
-	 * @param triggerNum - The number of the trigger.
-	 * @param cluster - The cluster that was seen.
-	 */
-	public void sawCluster(int triggerNum, Cluster cluster) {
-		processSingles(triggerNum, NO_CUTS, cluster);
-	}
-	
-	/**
-	 * Indicates that a cluster was seen by a trigger and adds it to
-	 * the "no cuts" plots.
-	 * @param triggerNum - The number of the trigger.
-	 * @param cluster - The cluster that was seen.
-	 */
-	public void sawCluster(int triggerNum, SSPCluster cluster) {
-		processSingles(triggerNum, NO_CUTS, cluster);
-	}
-	
-	/**
-	 * Indicates that a cluster pair was seen by a trigger and adds it
-	 * to the "no cuts" plots.
-	 * @param triggerNum - The number of the trigger.
-	 * @param pair - The cluster pair that was seen.
-	 */
-	public void sawPair(int triggerNum, Cluster[] pair) {
-		processPair(triggerNum, NO_CUTS, pair);
-	}
-	
-	/**
-	 * Indicates that a cluster pair was seen by a trigger and adds it
-	 * to the "no cuts" plots.
-	 * @param triggerNum - The number of the trigger.
-	 * @param pair - The cluster pair that was seen.
-	 */
-	public void sawPair(int triggerNum, SSPCluster[] pair) {
-		processPair(triggerNum, NO_CUTS, pair);
-	}
-	
-	/**
-	 * Populates the "all" plots of the appropriate type with the cut
-	 * results from the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 */
-	public void sawTrigger(Trigger<?> trigger) {
-		processTrigger(trigger, ALL);
-	}
-	
-	/**
-	 * Sets the energy slope conversion factor to be used to calculate
-	 * the energy slope value for plots.
-	 * @param triggerNum - The trigger for which the conversion factor
-	 * should be used.
-	 * @param value - The conversion factor in units of GeV/mm.
-	 */
-	public void setEnergySlopeParamF(int triggerNum, double value) {
-		// Make sure that the trigger number is valid.
-		if(triggerNum < 0 || triggerNum > 1) {
-			throw new IllegalArgumentException(String.format("Trigger number %d is not valid.", triggerNum));
-		}
-		
-		// Set the parameter.
-		energySlopeParamF[triggerNum] = value;
-	}
-	
-	/**
-	 * Populates the indicated type of plots of the appropriate type
-	 * for the argument trigger.
-	 * @param trigger - The trigger from which to populate the plots.
-	 * @param plotType - The type of plot to populate. This must be one
-	 * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
-	 */
-	private void processTrigger(Trigger<?> trigger, int plotType) {
-		// Get the trigger number and source.
-		Object source = trigger.getTriggerSource();
-		int triggerNum = trigger.getTriggerNumber();
-		
-		// Populate the plots using the appropriate method.
-		if(source instanceof Cluster) {
-			processSingles(triggerNum, plotType, (Cluster) source);
-		}
-		else if(source instanceof SSPCluster) {
-			processSingles(triggerNum, plotType, (SSPCluster) source);
-		}
-		else if(source instanceof Cluster[]) {
-			processPair(triggerNum, plotType, (Cluster[]) source);
-		}
-		else if(source instanceof SSPCluster[]) {
-			processPair(triggerNum, plotType, (SSPCluster[]) source);
-		}
-		
-		// If the trigger source is unsupported, produce an error.
-		else {
-			throw new IllegalArgumentException(String.format("Trigger source \"%s\" is not supported.", source.getClass().getSimpleName()));
-		}
-	}
-	
-	/**
-	 * Populates the trigger singles plots for the indicated type for
-	 * reconstructed clusters.
-	 * @param triggerNum - The trigger number of the source trigger.
-	 * @param plotType - The type of plot to populate. This must be one
-	 * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
-	 * @param pair - The triggering cluster.
-	 */
-	private void processSingles(int triggerNum, int plotType, Cluster cluster) {
-		// Fill the cluster singles plots.
-		singlesHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
-		singlesClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
-		singlesTriggerTimePlot[triggerNum][RECON][plotType].fill(cluster.getCalorimeterHits().get(0).getTime());
-	}
-	
-	/**
-	 * Populates the trigger singles plots for the indicated type for SSP
-	 * clusters.
-	 * @param triggerNum - The trigger number of the source trigger.
-	 * @param plotType - The type of plot to populate. This must be one
-	 * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
-	 * @param pair - The triggering cluster.
-	 */
-	private void processSingles(int triggerNum, int plotType, SSPCluster cluster) {
-		// Fill the cluster singles plots.
-		singlesHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
-		singlesClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
-		singlesTriggerTimePlot[triggerNum][SSP][plotType].fill(cluster.getTime());
-		
-		// Check if this cluster is "trident-like."
-		// TODO: Define "trident-like."
-		boolean processTrident = false;
-		
-		// If this is a trident-like event, add it to the trident plots.
-		if(processTrident) {
-			tridentHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(cluster));
-			tridentClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
-			tridentPositionPlot[triggerNum].fill(cluster.getXIndex() > 0 ? cluster.getXIndex() - 1 : cluster.getXIndex(), cluster.getYIndex());
-		}
-	}
-	
-	/**
-	 * Populates the trigger pair plots for the indicated type for
-	 * reconstructed cluster pairs.
-	 * @param triggerNum - The trigger number of the source trigger.
-	 * @param plotType - The type of plot to populate. This must be one
-	 * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
-	 * @param pair - The triggering pair.
-	 */
-	private void processPair(int triggerNum, int plotType, Cluster[] pair) {
-		// Fill the cluster singles plots.
-		pairHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(pair[0]));
-		pairHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
-		pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
-		pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
-		pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[0].getCalorimeterHits().get(0).getTime());
-		pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[1].getCalorimeterHits().get(0).getTime());
-		
-		// Fill the cluster pair plots.
-		pairTimePlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));
-		pairSumPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergySum(pair));
+                    singlesDir), 46, -23, 23, 11, -5.5, 5.5);
+        }
+    }
+    
+    /**
+     * Populates the "failed" plots of the appropriate type with the
+     * cut results from the argument trigger.
+     * @param trigger - The trigger from which to populate the plots.
+     */
+    public void failedTrigger(Trigger<?> trigger) {
+        processTrigger(trigger, FAILED);
+    }
+    
+    /**
+     * Populates the "matched" plots of the appropriate type with the
+     * cut results from the argument trigger.
+     * @param trigger - The trigger from which to populate the plots.
+     */
+    public void matchedTrigger(Trigger<?> trigger) {
+        processTrigger(trigger, MATCHED);
+    }
+    
+    /**
+     * Populates the "triggered" plots of the appropriate type with the
+     * cut results from the argument trigger.
+     * @param trigger - The trigger from which to populate the plots.
+     */
+    public void passedTrigger(Trigger<?> trigger) {
+        processTrigger(trigger, TRIGGERED);
+    }
+    
+    /**
+     * Indicates that a cluster was seen by a trigger and adds it to
+     * the "no cuts" plots.
+     * @param triggerNum - The number of the trigger.
+     * @param cluster - The cluster that was seen.
+     */
+    public void sawCluster(int triggerNum, Cluster cluster) {
+        processSingles(triggerNum, NO_CUTS, cluster);
+    }
+    
+    /**
+     * Indicates that a cluster was seen by a trigger and adds it to
+     * the "no cuts" plots.
+     * @param triggerNum - The number of the trigger.
+     * @param cluster - The cluster that was seen.
+     */
+    public void sawCluster(int triggerNum, SSPCluster cluster) {
+        processSingles(triggerNum, NO_CUTS, cluster);
+    }
+    
+    /**
+     * Indicates that a cluster pair was seen by a trigger and adds it
+     * to the "no cuts" plots.
+     * @param triggerNum - The number of the trigger.
+     * @param pair - The cluster pair that was seen.
+     */
+    public void sawPair(int triggerNum, Cluster[] pair) {
+        processPair(triggerNum, NO_CUTS, pair);
+    }
+    
+    /**
+     * Indicates that a cluster pair was seen by a trigger and adds it
+     * to the "no cuts" plots.
+     * @param triggerNum - The number of the trigger.
+     * @param pair - The cluster pair that was seen.
+     */
+    public void sawPair(int triggerNum, SSPCluster[] pair) {
+        processPair(triggerNum, NO_CUTS, pair);
+    }
+    
+    /**
+     * Populates the "all" plots of the appropriate type with the cut
+     * results from the argument trigger.
+     * @param trigger - The trigger from which to populate the plots.
+     */
+    public void sawTrigger(Trigger<?> trigger) {
+        processTrigger(trigger, ALL);
+    }
+    
+    /**
+     * Sets the energy slope conversion factor to be used to calculate
+     * the energy slope value for plots.
+     * @param triggerNum - The trigger for which the conversion factor
+     * should be used.
+     * @param value - The conversion factor in units of GeV/mm.
+     */
+    public void setEnergySlopeParamF(int triggerNum, double value) {
+        // Make sure that the trigger number is valid.
+        if(triggerNum < 0 || triggerNum > 1) {
+            throw new IllegalArgumentException(String.format("Trigger number %d is not valid.", triggerNum));
+        }
+        
+        // Set the parameter.
+        energySlopeParamF[triggerNum] = value;
+    }
+    
+    /**
+     * Populates the indicated type of plots of the appropriate type
+     * for the argument trigger.
+     * @param trigger - The trigger from which to populate the plots.
+     * @param plotType - The type of plot to populate. This must be one
+     * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
+     */
+    private void processTrigger(Trigger<?> trigger, int plotType) {
+        // Get the trigger number and source.
+        Object source = trigger.getTriggerSource();
+        int triggerNum = trigger.getTriggerNumber();
+        
+        // Populate the plots using the appropriate method.
+        if(source instanceof Cluster) {
+            processSingles(triggerNum, plotType, (Cluster) source);
+        }
+        else if(source instanceof SSPCluster) {
+            processSingles(triggerNum, plotType, (SSPCluster) source);
+        }
+        else if(source instanceof Cluster[]) {
+            processPair(triggerNum, plotType, (Cluster[]) source);
+        }
+        else if(source instanceof SSPCluster[]) {
+            processPair(triggerNum, plotType, (SSPCluster[]) source);
+        }
+        
+        // If the trigger source is unsupported, produce an error.
+        else {
+            throw new IllegalArgumentException(String.format("Trigger source \"%s\" is not supported.", source.getClass().getSimpleName()));
+        }
+    }
+    
+    /**
+     * Populates the trigger singles plots for the indicated type for
+     * reconstructed clusters.
+     * @param triggerNum - The trigger number of the source trigger.
+     * @param plotType - The type of plot to populate. This must be one
+     * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
+     * @param pair - The triggering cluster.
+     */
+    private void processSingles(int triggerNum, int plotType, Cluster cluster) {
+        // Fill the cluster singles plots.
+        singlesHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
+        singlesClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+        singlesTriggerTimePlot[triggerNum][RECON][plotType].fill(cluster.getCalorimeterHits().get(0).getTime());
+    }
+    
+    /**
+     * Populates the trigger singles plots for the indicated type for SSP
+     * clusters.
+     * @param triggerNum - The trigger number of the source trigger.
+     * @param plotType - The type of plot to populate. This must be one
+     * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
+     * @param pair - The triggering cluster.
+     */
+    private void processSingles(int triggerNum, int plotType, SSPCluster cluster) {
+        // Fill the cluster singles plots.
+        singlesHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(cluster));
+        singlesClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+        singlesTriggerTimePlot[triggerNum][SSP][plotType].fill(cluster.getTime());
+        
+        // Check if this cluster is "trident-like."
+        // TODO: Define "trident-like."
+        boolean processTrident = false;
+        
+        // If this is a trident-like event, add it to the trident plots.
+        if(processTrident) {
+            tridentHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(cluster));
+            tridentClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+            tridentPositionPlot[triggerNum].fill(cluster.getXIndex() > 0 ? cluster.getXIndex() - 1 : cluster.getXIndex(), cluster.getYIndex());
+        }
+    }
+    
+    /**
+     * Populates the trigger pair plots for the indicated type for
+     * reconstructed cluster pairs.
+     * @param triggerNum - The trigger number of the source trigger.
+     * @param plotType - The type of plot to populate. This must be one
+     * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
+     * @param pair - The triggering pair.
+     */
+    private void processPair(int triggerNum, int plotType, Cluster[] pair) {
+        // Fill the cluster singles plots.
+        pairHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(pair[0]));
+        pairHitCountPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
+        pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
+        pairClusterEnergyPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
+        pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[0].getCalorimeterHits().get(0).getTime());
+        pairTriggerTimePlot[triggerNum][RECON][plotType].fill(pair[1].getCalorimeterHits().get(0).getTime());
+        
+        // Fill the cluster pair plots.
+        pairTimePlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));
+        pairSumPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergySum(pair));
                 pairSumEnergiesPlot[triggerNum][RECON][plotType].fill(pair[0].getEnergy(), pair[1].getEnergy());
-		pairDiffPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergyDifference(pair));
-		pairSlopePlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
-		pairCoplanarityPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueCoplanarity(pair));
-	}
-	
-	/**
-	 * Populates the trigger pair plots for the indicated type for SSP
-	 * cluster pairs.
-	 * @param triggerNum - The trigger number of the source trigger.
-	 * @param plotType - The type of plot to populate. This must be one
-	 * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
-	 * @param pair - The triggering pair.
-	 */
-	private void processPair(int triggerNum, int plotType, SSPCluster[] pair) {
-		// Fill the cluster singles plots.
-		pairHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(pair[0]));
-		pairHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
-		pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
-		pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
-		pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[0].getTime());
-		pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[1].getTime());
-		
-		// Fill the cluster pair plots.
-		pairTimePlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));
-		pairSumPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergySum(pair));
+        pairDiffPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergyDifference(pair));
+        pairSlopePlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
+        pairCoplanarityPlot[triggerNum][RECON][plotType].fill(TriggerModule.getValueCoplanarity(pair));
+    }
+    
+    /**
+     * Populates the trigger pair plots for the indicated type for SSP
+     * cluster pairs.
+     * @param triggerNum - The trigger number of the source trigger.
+     * @param plotType - The type of plot to populate. This must be one
+     * of <code>ALL</code>, <code>MATCHED</code>, or <code>FAILED</code>.
+     * @param pair - The triggering pair.
+     */
+    private void processPair(int triggerNum, int plotType, SSPCluster[] pair) {
+        // Fill the cluster singles plots.
+        pairHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(pair[0]));
+        pairHitCountPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterHitCount(pair[1]));
+        pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
+        pairClusterEnergyPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
+        pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[0].getTime());
+        pairTriggerTimePlot[triggerNum][SSP][plotType].fill(pair[1].getTime());
+        
+        // Fill the cluster pair plots.
+        pairTimePlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueTimeCoincidence(pair));
+        pairSumPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergySum(pair));
         pairSumEnergiesPlot[triggerNum][SSP][plotType].fill(pair[0].getEnergy(), pair[1].getEnergy());
-		pairDiffPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergyDifference(pair));
-		pairSlopePlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
-		pairCoplanarityPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueCoplanarity(pair));
-		
-		// Check if this pair is "Møller-like."
-		boolean processMøller = TriggerModule.getValueEnergySum(pair) >= MØLLER_SUM_THRESHOLD;
-		
-		// If the pair is Møller-like, populate the Møller plots.
-		if(processMøller) {
-			// Fill the cluster singles plots.
-			møllerHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(pair[0]));
-			møllerHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(pair[1]));
-			møllerClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
-			møllerClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
-			møllerTriggerTimePlot[triggerNum].fill(pair[0].getTime());
-			møllerTriggerTimePlot[triggerNum].fill(pair[1].getTime());
-			møllerPositionPlot[triggerNum].fill(pair[0].getXIndex() > 0 ? pair[0].getXIndex() - 1 : pair[0].getXIndex(), pair[0].getYIndex());
-			møllerPositionPlot[triggerNum].fill(pair[1].getXIndex() > 0 ? pair[1].getXIndex() - 1 : pair[1].getXIndex(), pair[1].getYIndex());
-			
-			// Fill the cluster pair plots.
-			møllerTimePlot[triggerNum].fill(TriggerModule.getValueTimeCoincidence(pair));
-			møllerSumPlot[triggerNum].fill(TriggerModule.getValueEnergySum(pair));
-			møllerSumEnergiesPlot[triggerNum].fill(pair[0].getEnergy(), pair[1].getEnergy());
-	        møllerDiffPlot[triggerNum].fill(TriggerModule.getValueEnergyDifference(pair));
-	        møllerSlopePlot[triggerNum].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
-	        møllerCoplanarityPlot[triggerNum].fill(TriggerModule.getValueCoplanarity(pair));
-		}
-	}
+        pairDiffPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergyDifference(pair));
+        pairSlopePlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
+        pairCoplanarityPlot[triggerNum][SSP][plotType].fill(TriggerModule.getValueCoplanarity(pair));
+        
+        // Check if this pair is "Møller-like."
+        boolean processMøller = TriggerModule.getValueEnergySum(pair) >= MØLLER_SUM_THRESHOLD;
+        
+        // If the pair is Møller-like, populate the Møller plots.
+        if(processMøller) {
+            // Fill the cluster singles plots.
+            møllerHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(pair[0]));
+            møllerHitCountPlot[triggerNum].fill(TriggerModule.getValueClusterHitCount(pair[1]));
+            møllerClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(pair[0]));
+            møllerClusterEnergyPlot[triggerNum].fill(TriggerModule.getValueClusterTotalEnergy(pair[1]));
+            møllerTriggerTimePlot[triggerNum].fill(pair[0].getTime());
+            møllerTriggerTimePlot[triggerNum].fill(pair[1].getTime());
+            møllerPositionPlot[triggerNum].fill(pair[0].getXIndex() > 0 ? pair[0].getXIndex() - 1 : pair[0].getXIndex(), pair[0].getYIndex());
+            møllerPositionPlot[triggerNum].fill(pair[1].getXIndex() > 0 ? pair[1].getXIndex() - 1 : pair[1].getXIndex(), pair[1].getYIndex());
+            
+            // Fill the cluster pair plots.
+            møllerTimePlot[triggerNum].fill(TriggerModule.getValueTimeCoincidence(pair));
+            møllerSumPlot[triggerNum].fill(TriggerModule.getValueEnergySum(pair));
+            møllerSumEnergiesPlot[triggerNum].fill(pair[0].getEnergy(), pair[1].getEnergy());
+            møllerDiffPlot[triggerNum].fill(TriggerModule.getValueEnergyDifference(pair));
+            møllerSlopePlot[triggerNum].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF[triggerNum]));
+            møllerCoplanarityPlot[triggerNum].fill(TriggerModule.getValueCoplanarity(pair));
+        }
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/ComponentUtils.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/ComponentUtils.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/ComponentUtils.java	Wed Mar  9 11:43:24 2016
@@ -11,116 +11,116 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ComponentUtils {
-	/** The default spacing used between a horizontal edge of one
-	 * component and the horizontal edge of another. */
-	public static final int hinternal = 10;
-	/** The default spacing used between a vertical edge of one
-	 * component and the vertical edge of another. */
-	public static final int vinternal = 10;
-	/** The default spacing used between a horizontal edge of one
-	 * component and the edge of its parent component. */
-	public static final int hexternal = 0;
-	/** The default spacing used between a vertical edge of one
-	 * component and the edge of its parent component. */
-	public static final int vexternal = 0;
-	
-	/**
-	 * Gets a <code>String</code> composed of a number of instances of
-	 * character <code>c</code> equal to <code>number</code>.
-	 * @param c - The character to repeat.
-	 * @param number - The number of repetitions.
-	 * @return Returns the repeated character as a <code>String</code>.
-	 */
-	public static final String getChars(char c, int number) {
-		// Create a buffer to store the characters in.
-		StringBuffer s = new StringBuffer();
-		
-		// Add the indicated number of instances.
-		for(int i = 0; i < number; i++) {
-			s.append(c);
-		}
-		
-		// Return the string.
-		return s.toString();
-	}
-	
-	/**
-	 * Gets the number of digits in the base-10 String representation
-	 * of an integer primitive. Negative signs are not included in the
-	 * digit count.
-	 * @param value - The value of which to obtain the length.
-	 * @return Returns the number of digits in the String representation
-	 * of the argument value.
-	 */
-	public static final int getDigits(int value) {
-		return TriggerDiagnosticUtil.getDigits(value);
-	}
-	
-	/**
-	 * Gets the maximum value from a list of values.
-	 * @param values - The values to compare.
-	 * @return Returns the largest of the argument values.
-	 * @throws IllegalArgumentException Occurs if no values are given.
-	 */
-	public static final int max(int... values) throws IllegalArgumentException {
-		// Throw an error if no arguments are provided.
-		if(values == null || values.length == 0) {
-			throw new IllegalArgumentException("Can not determine maximum value from a list of 0 values.");
-		}
-		
-		// If there is only one value, return it.
-		if(values.length == 1) { return values[0]; }
-		
-		// Otherwise, get the largest value.
-		int largest = Integer.MIN_VALUE;
-		for(int value : values) {
-			if(value > largest) { largest = value; }
-		}
-		
-		// Return the result.
-		return largest;
-	}
-	
-	/**
-	 * Gets the x-coordinate immediately to the right of the given
-	 * component.
-	 * @param c - The component of which to find the edge.
-	 * @return Returns the x-coordinate as an <code>int</code> value.
-	 */
-	public static final int getNextX(Component c) {
-		return getNextX(c, 0);
-	}
-	
-	/**
-	 * Gets the x-coordinate a given distance to the right edge of the
-	 * argument component.
-	 * @param c - The component of which to find the edge.
-	 * @param spacing - The additional spacing past the edge of the
-	 * component to add.
-	 * @return Returns the x-coordinate as an <code>int</code> value.
-	 */
-	public static final int getNextX(Component c, int spacing) {
-		return c.getX() + c.getWidth() + spacing;
-	}
-	
-	/**
-	 * Gets the y-coordinate immediately below the given component.
-	 * @param c - The component of which to find the edge.
-	 * @return Returns the y-coordinate as an <code>int</code> value.
-	 */
-	public static final int getNextY(Component c) {
-		return getNextY(c, 0);
-	}
-	
-	/**
-	 * Gets the y-coordinate a given distance below the bottom edge
-	 * of the argument component.
-	 * @param c - The component of which to find the edge.
-	 * @param spacing - The additional spacing past the edge of the
-	 * component to add.
-	 * @return Returns the y-coordinate as an <code>int</code> value.
-	 */
-	public static final int getNextY(Component c, int spacing) {
-		return c.getY() + c.getHeight() + spacing;
-	}
+    /** The default spacing used between a horizontal edge of one
+     * component and the horizontal edge of another. */
+    public static final int hinternal = 10;
+    /** The default spacing used between a vertical edge of one
+     * component and the vertical edge of another. */
+    public static final int vinternal = 10;
+    /** The default spacing used between a horizontal edge of one
+     * component and the edge of its parent component. */
+    public static final int hexternal = 0;
+    /** The default spacing used between a vertical edge of one
+     * component and the edge of its parent component. */
+    public static final int vexternal = 0;
+    
+    /**
+     * Gets a <code>String</code> composed of a number of instances of
+     * character <code>c</code> equal to <code>number</code>.
+     * @param c - The character to repeat.
+     * @param number - The number of repetitions.
+     * @return Returns the repeated character as a <code>String</code>.
+     */
+    public static final String getChars(char c, int number) {
+        // Create a buffer to store the characters in.
+        StringBuffer s = new StringBuffer();
+        
+        // Add the indicated number of instances.
+        for(int i = 0; i < number; i++) {
+            s.append(c);
+        }
+        
+        // Return the string.
+        return s.toString();
+    }
+    
+    /**
+     * Gets the number of digits in the base-10 String representation
+     * of an integer primitive. Negative signs are not included in the
+     * digit count.
+     * @param value - The value of which to obtain the length.
+     * @return Returns the number of digits in the String representation
+     * of the argument value.
+     */
+    public static final int getDigits(int value) {
+        return TriggerDiagnosticUtil.getDigits(value);
+    }
+    
+    /**
+     * Gets the maximum value from a list of values.
+     * @param values - The values to compare.
+     * @return Returns the largest of the argument values.
+     * @throws IllegalArgumentException Occurs if no values are given.
+     */
+    public static final int max(int... values) throws IllegalArgumentException {
+        // Throw an error if no arguments are provided.
+        if(values == null || values.length == 0) {
+            throw new IllegalArgumentException("Can not determine maximum value from a list of 0 values.");
+        }
+        
+        // If there is only one value, return it.
+        if(values.length == 1) { return values[0]; }
+        
+        // Otherwise, get the largest value.
+        int largest = Integer.MIN_VALUE;
+        for(int value : values) {
+            if(value > largest) { largest = value; }
+        }
+        
+        // Return the result.
+        return largest;
+    }
+    
+    /**
+     * Gets the x-coordinate immediately to the right of the given
+     * component.
+     * @param c - The component of which to find the edge.
+     * @return Returns the x-coordinate as an <code>int</code> value.
+     */
+    public static final int getNextX(Component c) {
+        return getNextX(c, 0);
+    }
+    
+    /**
+     * Gets the x-coordinate a given distance to the right edge of the
+     * argument component.
+     * @param c - The component of which to find the edge.
+     * @param spacing - The additional spacing past the edge of the
+     * component to add.
+     * @return Returns the x-coordinate as an <code>int</code> value.
+     */
+    public static final int getNextX(Component c, int spacing) {
+        return c.getX() + c.getWidth() + spacing;
+    }
+    
+    /**
+     * Gets the y-coordinate immediately below the given component.
+     * @param c - The component of which to find the edge.
+     * @return Returns the y-coordinate as an <code>int</code> value.
+     */
+    public static final int getNextY(Component c) {
+        return getNextY(c, 0);
+    }
+    
+    /**
+     * Gets the y-coordinate a given distance below the bottom edge
+     * of the argument component.
+     * @param c - The component of which to find the edge.
+     * @param spacing - The additional spacing past the edge of the
+     * component to add.
+     * @return Returns the y-coordinate as an <code>int</code> value.
+     */
+    public static final int getNextY(Component c, int spacing) {
+        return c.getY() + c.getHeight() + spacing;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/OutputLogger.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/OutputLogger.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/OutputLogger.java	Wed Mar  9 11:43:24 2016
@@ -3,28 +3,28 @@
 public class OutputLogger {
     private static StringBuffer outputBuffer = new StringBuffer();
     
-	public static final void printf(String text, Object... args) {
-		outputBuffer.append(String.format(text, args));
-	}
-	
-	public static final void println() { printf(String.format("%n")); }
-	
-	public static final void println(String text) { printf(String.format("%s%n", text)); }
-	
-	public static final void print(String text) { printf(text); }
-	
-	public static final void printLog() {
-		System.out.println(outputBuffer.toString());
-		clearLog();
-	}
-	
-	public static final void printNewLine() { println(); }
-	
-	public static final void printNewLine(int quantity) {
-		for(int i = 0; i < quantity; i++) { println(); }
-	}
-	
-	public static final void clearLog() {
-		outputBuffer = new StringBuffer();
-	}
+    public static final void printf(String text, Object... args) {
+        outputBuffer.append(String.format(text, args));
+    }
+    
+    public static final void println() { printf(String.format("%n")); }
+    
+    public static final void println(String text) { printf(String.format("%s%n", text)); }
+    
+    public static final void print(String text) { printf(text); }
+    
+    public static final void printLog() {
+        System.out.println(outputBuffer.toString());
+        clearLog();
+    }
+    
+    public static final void printNewLine() { println(); }
+    
+    public static final void printNewLine(int quantity) {
+        for(int i = 0; i < quantity; i++) { println(); }
+    }
+    
+    public static final void clearLog() {
+        outputBuffer = new StringBuffer();
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Pair.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Pair.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Pair.java	Wed Mar  9 11:43:24 2016
@@ -8,32 +8,32 @@
  * @param <F> - The object type of the second element in the pair.
  */
 public class Pair<E, F> {
-	private final E firstObject;
-	private final F secondObject;
-	
-	/**
-	 * Creates a pair of the two indicated objects.
-	 * @param firstObject - The first object.
-	 * @param secondObject - The second object.
-	 */
-	public Pair(E firstElement, F secondElement) {
-		this.firstObject = firstElement;
-		this.secondObject = secondElement;
-	}
-	
-	/**
-	 * Gets the first element of the pair.
-	 * @return Returns the first element.
-	 */
-	public E getFirstElement() {
-		return firstObject;
-	}
-	
-	/**
-	 * Gets the second element of the pair.
-	 * @return Returns the second element.
-	 */
-	public F getSecondElement() {
-		return secondObject;
-	}
+    private final E firstObject;
+    private final F secondObject;
+    
+    /**
+     * Creates a pair of the two indicated objects.
+     * @param firstObject - The first object.
+     * @param secondObject - The second object.
+     */
+    public Pair(E firstElement, F secondElement) {
+        this.firstObject = firstElement;
+        this.secondObject = secondElement;
+    }
+    
+    /**
+     * Gets the first element of the pair.
+     * @return Returns the first element.
+     */
+    public E getFirstElement() {
+        return firstObject;
+    }
+    
+    /**
+     * Gets the second element of the pair.
+     * @return Returns the second element.
+     */
+    public F getSecondElement() {
+        return secondObject;
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/PairTrigger.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/PairTrigger.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/PairTrigger.java	Wed Mar  9 11:43:24 2016
@@ -3,164 +3,164 @@
 import org.hps.record.triggerbank.TriggerModule;
 
 public class PairTrigger<E> extends SinglesTrigger<E> {
-	// Define the supported trigger cuts.
-	private static final String PAIR_ENERGY_SUM_LOW = TriggerModule.PAIR_ENERGY_SUM_LOW;
-	private static final String PAIR_ENERGY_SUM_HIGH = TriggerModule.PAIR_ENERGY_SUM_HIGH;
-	private static final String PAIR_ENERGY_DIFFERENCE_HIGH = TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH;
-	private static final String PAIR_ENERGY_SLOPE_LOW = TriggerModule.PAIR_ENERGY_SLOPE_LOW;
-	private static final String PAIR_COPLANARITY_HIGH = TriggerModule.PAIR_COPLANARITY_HIGH;
+    // Define the supported trigger cuts.
+    private static final String PAIR_ENERGY_SUM_LOW = TriggerModule.PAIR_ENERGY_SUM_LOW;
+    private static final String PAIR_ENERGY_SUM_HIGH = TriggerModule.PAIR_ENERGY_SUM_HIGH;
+    private static final String PAIR_ENERGY_DIFFERENCE_HIGH = TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH;
+    private static final String PAIR_ENERGY_SLOPE_LOW = TriggerModule.PAIR_ENERGY_SLOPE_LOW;
+    private static final String PAIR_COPLANARITY_HIGH = TriggerModule.PAIR_COPLANARITY_HIGH;
     private static final String PAIR_TIME_COINCIDENCE = "pairTimeCoincidence";
-	
-	/**
-	 * Instantiates a new <code>PairTrigger</code> with all cut
-	 * states set to <code>false</code> and with the trigger source
-	 * defined according to the specified object.
-	 * @param source - The object from which the trigger cut states
-	 * are derived.
-	 */
-	public PairTrigger(E source, int triggerNum) {
-		// Instantiate the superclass.
-		super(source, triggerNum);
-		
-		// Add the supported cuts types.
-		addValidCut(PAIR_ENERGY_SUM_LOW);
-		addValidCut(PAIR_ENERGY_SUM_HIGH);
-		addValidCut(PAIR_ENERGY_DIFFERENCE_HIGH);
-		addValidCut(PAIR_ENERGY_SLOPE_LOW);
-		addValidCut(PAIR_COPLANARITY_HIGH);
-		addValidCut(PAIR_TIME_COINCIDENCE);
-	}
-	
-	/**
-	 * Gets whether the pair energy sum lower bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateEnergySumLow() {
-		return getCutState(PAIR_ENERGY_SUM_LOW);
-	}
-	
-	/**
-	 * Gets whether the pair energy sum upper bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateEnergySumHigh() {
-		return getCutState(PAIR_ENERGY_SUM_HIGH);
-	}
-	
-	/**
-	 * Gets whether both the pair energy sum upper and lower bound cuts
-	 * were met.
-	 * @return Returns <code>true</code> if the cuts were met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateEnergySum() {
-		return getCutState(PAIR_ENERGY_SUM_HIGH);
-	}
-	
-	/**
-	 * Gets whether the pair energy difference cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateEnergyDifference() {
-		return getCutState(PAIR_ENERGY_DIFFERENCE_HIGH);
-	}
-	
-	/**
-	 * Gets whether the pair energy slope cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateEnergySlope() {
-		return getCutState(PAIR_ENERGY_SLOPE_LOW);
-	}
-	
-	/**
-	 * Gets whether the pair coplanarity cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateCoplanarity() {
-		return getCutState(PAIR_COPLANARITY_HIGH);
-	}
-	
-	/**
-	 * Gets whether the time coincidence cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateTimeCoincidence() {
-		return getCutState(PAIR_TIME_COINCIDENCE);
-	}
-	
-	/**
-	 * Sets whether the conditions for the pair energy sum lower bound
-	 * cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateEnergySumLow(boolean state) {
-		setCutState(PAIR_ENERGY_SUM_LOW, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the pair energy sum upper bound
-	 * cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateEnergySumHigh(boolean state) {
-		setCutState(PAIR_ENERGY_SUM_HIGH, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the pair energy difference cut
-	 * were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateEnergyDifference(boolean state) {
-		setCutState(PAIR_ENERGY_DIFFERENCE_HIGH, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the pair energy slope cut were
-	 * met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateEnergySlope(boolean state) {
-		setCutState(PAIR_ENERGY_SLOPE_LOW, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the pair coplanarity cut were
-	 * met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateCoplanarity(boolean state) {
-		setCutState(PAIR_COPLANARITY_HIGH, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the time coincidence cut were
-	 * met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateTimeCoincidence(boolean state) {
-		setCutState(PAIR_TIME_COINCIDENCE, state);
-	}
-	
-	@Override
-	public String toString() {
-		return String.format("EClusterLow: %d; EClusterHigh %d; HitCount: %d; ESumLow: %d, ESumHigh: %d, EDiff: %d, ESlope: %d, Coplanarity: %d",
-				getStateClusterEnergyLow() ? 1 : 0, getStateClusterEnergyHigh() ? 1 : 0,
-				getStateHitCount() ? 1 : 0, getStateEnergySumLow() ? 1 : 0,
-				getStateEnergySumHigh() ? 1 : 0, getStateEnergyDifference() ? 1 : 0,
-				getStateEnergySlope() ? 1 : 0, getStateCoplanarity() ? 1 : 0);
-	}
+    
+    /**
+     * Instantiates a new <code>PairTrigger</code> with all cut
+     * states set to <code>false</code> and with the trigger source
+     * defined according to the specified object.
+     * @param source - The object from which the trigger cut states
+     * are derived.
+     */
+    public PairTrigger(E source, int triggerNum) {
+        // Instantiate the superclass.
+        super(source, triggerNum);
+        
+        // Add the supported cuts types.
+        addValidCut(PAIR_ENERGY_SUM_LOW);
+        addValidCut(PAIR_ENERGY_SUM_HIGH);
+        addValidCut(PAIR_ENERGY_DIFFERENCE_HIGH);
+        addValidCut(PAIR_ENERGY_SLOPE_LOW);
+        addValidCut(PAIR_COPLANARITY_HIGH);
+        addValidCut(PAIR_TIME_COINCIDENCE);
+    }
+    
+    /**
+     * Gets whether the pair energy sum lower bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateEnergySumLow() {
+        return getCutState(PAIR_ENERGY_SUM_LOW);
+    }
+    
+    /**
+     * Gets whether the pair energy sum upper bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateEnergySumHigh() {
+        return getCutState(PAIR_ENERGY_SUM_HIGH);
+    }
+    
+    /**
+     * Gets whether both the pair energy sum upper and lower bound cuts
+     * were met.
+     * @return Returns <code>true</code> if the cuts were met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateEnergySum() {
+        return getCutState(PAIR_ENERGY_SUM_HIGH);
+    }
+    
+    /**
+     * Gets whether the pair energy difference cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateEnergyDifference() {
+        return getCutState(PAIR_ENERGY_DIFFERENCE_HIGH);
+    }
+    
+    /**
+     * Gets whether the pair energy slope cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateEnergySlope() {
+        return getCutState(PAIR_ENERGY_SLOPE_LOW);
+    }
+    
+    /**
+     * Gets whether the pair coplanarity cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateCoplanarity() {
+        return getCutState(PAIR_COPLANARITY_HIGH);
+    }
+    
+    /**
+     * Gets whether the time coincidence cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateTimeCoincidence() {
+        return getCutState(PAIR_TIME_COINCIDENCE);
+    }
+    
+    /**
+     * Sets whether the conditions for the pair energy sum lower bound
+     * cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateEnergySumLow(boolean state) {
+        setCutState(PAIR_ENERGY_SUM_LOW, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the pair energy sum upper bound
+     * cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateEnergySumHigh(boolean state) {
+        setCutState(PAIR_ENERGY_SUM_HIGH, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the pair energy difference cut
+     * were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateEnergyDifference(boolean state) {
+        setCutState(PAIR_ENERGY_DIFFERENCE_HIGH, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the pair energy slope cut were
+     * met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateEnergySlope(boolean state) {
+        setCutState(PAIR_ENERGY_SLOPE_LOW, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the pair coplanarity cut were
+     * met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateCoplanarity(boolean state) {
+        setCutState(PAIR_COPLANARITY_HIGH, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the time coincidence cut were
+     * met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateTimeCoincidence(boolean state) {
+        setCutState(PAIR_TIME_COINCIDENCE, state);
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("EClusterLow: %d; EClusterHigh %d; HitCount: %d; ESumLow: %d, ESumHigh: %d, EDiff: %d, ESlope: %d, Coplanarity: %d",
+                getStateClusterEnergyLow() ? 1 : 0, getStateClusterEnergyHigh() ? 1 : 0,
+                getStateHitCount() ? 1 : 0, getStateEnergySumLow() ? 1 : 0,
+                getStateEnergySumHigh() ? 1 : 0, getStateEnergyDifference() ? 1 : 0,
+                getStateEnergySlope() ? 1 : 0, getStateCoplanarity() ? 1 : 0);
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/SinglesTrigger.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/SinglesTrigger.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/SinglesTrigger.java	Wed Mar  9 11:43:24 2016
@@ -3,151 +3,151 @@
 import org.hps.record.triggerbank.TriggerModule;
 
 public class SinglesTrigger<E> extends Trigger<E> {
-	// Define the supported trigger cuts.
-	private static final String CLUSTER_HIT_COUNT_LOW = TriggerModule.CLUSTER_HIT_COUNT_LOW;
-	private static final String CLUSTER_SEED_ENERGY_LOW = TriggerModule.CLUSTER_SEED_ENERGY_LOW;
-	private static final String CLUSTER_SEED_ENERGY_HIGH = TriggerModule.CLUSTER_SEED_ENERGY_HIGH;
-	private static final String CLUSTER_TOTAL_ENERGY_LOW = TriggerModule.CLUSTER_TOTAL_ENERGY_LOW;
-	private static final String CLUSTER_TOTAL_ENERGY_HIGH = TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH;
-	
-	/**
-	 * Instantiates a new <code>SinglesTrigger</code> with all cut
-	 * states set to <code>false</code> and with the trigger source
-	 * defined according to the specified object.
-	 * @param source - The object from which the trigger cut states
-	 * are derived.
-	 */
-	public SinglesTrigger(E source, int triggerNum) {
-		// Instantiate the superclass.
-		super(source, triggerNum);
-		
-		// Add the supported cuts types.
-		addValidCut(CLUSTER_HIT_COUNT_LOW);
-		addValidCut(CLUSTER_SEED_ENERGY_LOW);
-		addValidCut(CLUSTER_SEED_ENERGY_HIGH);
-		addValidCut(CLUSTER_TOTAL_ENERGY_LOW);
-		addValidCut(CLUSTER_TOTAL_ENERGY_HIGH);
-	}
-	
-	/**
-	 * Gets whether the cluster hit count cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateHitCount() {
-		return getCutState(CLUSTER_HIT_COUNT_LOW);
-	}
-	
-	/**
-	 * Gets whether the cluster seed energy lower bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateSeedEnergyLow() {
-		return getCutState(CLUSTER_SEED_ENERGY_LOW);
-	}
-	
-	/**
-	 * Gets whether the cluster seed energy upper bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateSeedEnergyHigh() {
-		return getCutState(CLUSTER_SEED_ENERGY_HIGH);
-	}
-	
-	/**
-	 * Gets whether both the cluster seed energy upper and lower bound
-	 * cuts were met.
-	 * @return Returns <code>true</code> if the cuts were met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateSeedEnergy() {
-		return getCutState(CLUSTER_SEED_ENERGY_LOW) && getCutState(CLUSTER_SEED_ENERGY_HIGH);
-	}
-	
-	/**
-	 * Gets whether the cluster total energy lower bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateClusterEnergyLow() {
-		return getCutState(CLUSTER_TOTAL_ENERGY_LOW);
-	}
-	
-	/**
-	 * Gets whether the cluster total energy upper bound cut was met.
-	 * @return Returns <code>true</code> if the cut was met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateClusterEnergyHigh() {
-		return getCutState(CLUSTER_TOTAL_ENERGY_HIGH);
-	}
-	
-	/**
-	 * Gets whether both the cluster total energy upper and lower bound
-	 * cuts were met.
-	 * @return Returns <code>true</code> if the cuts were met and
-	 * <code>false</code> otherwise.
-	 */
-	public boolean getStateClusterEnergy() {
-		return getCutState(CLUSTER_TOTAL_ENERGY_LOW) && getCutState(CLUSTER_TOTAL_ENERGY_HIGH);
-	}
-	
-	/**
-	 * Sets whether the conditions for the cluster hit count cut were
-	 * met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateHitCount(boolean state) {
-		setCutState(CLUSTER_HIT_COUNT_LOW, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the cluster seed energy lower
-	 * bound cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateSeedEnergyLow(boolean state) {
-		setCutState(CLUSTER_SEED_ENERGY_LOW, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the cluster seed energy upper
-	 * bound cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateSeedEnergyHigh(boolean state) {
-		setCutState(CLUSTER_SEED_ENERGY_HIGH, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the cluster total energy lower
-	 * bound cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateClusterEnergyLow(boolean state) {
-		setCutState(CLUSTER_TOTAL_ENERGY_LOW, state);
-	}
-	
-	/**
-	 * Sets whether the conditions for the cluster total energy upper
-	 * bound cut were met.
-	 * @param state - <code>true</code> indicates that the cut conditions
-	 * were met and <code>false</code> that they were not.
-	 */
-	public void setStateClusterEnergyHigh(boolean state) {
-		setCutState(CLUSTER_TOTAL_ENERGY_HIGH, state);
-	}
-	
-	@Override
-	public String toString() {
-		return String.format("EClusterLow: %d; EClusterHigh %d; HitCount: %d",
-				getStateClusterEnergyLow() ? 1 : 0, getStateClusterEnergyHigh() ? 1 : 0,
-				getStateHitCount() ? 1 : 0);
-	}
+    // Define the supported trigger cuts.
+    private static final String CLUSTER_HIT_COUNT_LOW = TriggerModule.CLUSTER_HIT_COUNT_LOW;
+    private static final String CLUSTER_SEED_ENERGY_LOW = TriggerModule.CLUSTER_SEED_ENERGY_LOW;
+    private static final String CLUSTER_SEED_ENERGY_HIGH = TriggerModule.CLUSTER_SEED_ENERGY_HIGH;
+    private static final String CLUSTER_TOTAL_ENERGY_LOW = TriggerModule.CLUSTER_TOTAL_ENERGY_LOW;
+    private static final String CLUSTER_TOTAL_ENERGY_HIGH = TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH;
+    
+    /**
+     * Instantiates a new <code>SinglesTrigger</code> with all cut
+     * states set to <code>false</code> and with the trigger source
+     * defined according to the specified object.
+     * @param source - The object from which the trigger cut states
+     * are derived.
+     */
+    public SinglesTrigger(E source, int triggerNum) {
+        // Instantiate the superclass.
+        super(source, triggerNum);
+        
+        // Add the supported cuts types.
+        addValidCut(CLUSTER_HIT_COUNT_LOW);
+        addValidCut(CLUSTER_SEED_ENERGY_LOW);
+        addValidCut(CLUSTER_SEED_ENERGY_HIGH);
+        addValidCut(CLUSTER_TOTAL_ENERGY_LOW);
+        addValidCut(CLUSTER_TOTAL_ENERGY_HIGH);
+    }
+    
+    /**
+     * Gets whether the cluster hit count cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateHitCount() {
+        return getCutState(CLUSTER_HIT_COUNT_LOW);
+    }
+    
+    /**
+     * Gets whether the cluster seed energy lower bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateSeedEnergyLow() {
+        return getCutState(CLUSTER_SEED_ENERGY_LOW);
+    }
+    
+    /**
+     * Gets whether the cluster seed energy upper bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateSeedEnergyHigh() {
+        return getCutState(CLUSTER_SEED_ENERGY_HIGH);
+    }
+    
+    /**
+     * Gets whether both the cluster seed energy upper and lower bound
+     * cuts were met.
+     * @return Returns <code>true</code> if the cuts were met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateSeedEnergy() {
+        return getCutState(CLUSTER_SEED_ENERGY_LOW) && getCutState(CLUSTER_SEED_ENERGY_HIGH);
+    }
+    
+    /**
+     * Gets whether the cluster total energy lower bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateClusterEnergyLow() {
+        return getCutState(CLUSTER_TOTAL_ENERGY_LOW);
+    }
+    
+    /**
+     * Gets whether the cluster total energy upper bound cut was met.
+     * @return Returns <code>true</code> if the cut was met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateClusterEnergyHigh() {
+        return getCutState(CLUSTER_TOTAL_ENERGY_HIGH);
+    }
+    
+    /**
+     * Gets whether both the cluster total energy upper and lower bound
+     * cuts were met.
+     * @return Returns <code>true</code> if the cuts were met and
+     * <code>false</code> otherwise.
+     */
+    public boolean getStateClusterEnergy() {
+        return getCutState(CLUSTER_TOTAL_ENERGY_LOW) && getCutState(CLUSTER_TOTAL_ENERGY_HIGH);
+    }
+    
+    /**
+     * Sets whether the conditions for the cluster hit count cut were
+     * met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateHitCount(boolean state) {
+        setCutState(CLUSTER_HIT_COUNT_LOW, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the cluster seed energy lower
+     * bound cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateSeedEnergyLow(boolean state) {
+        setCutState(CLUSTER_SEED_ENERGY_LOW, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the cluster seed energy upper
+     * bound cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateSeedEnergyHigh(boolean state) {
+        setCutState(CLUSTER_SEED_ENERGY_HIGH, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the cluster total energy lower
+     * bound cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateClusterEnergyLow(boolean state) {
+        setCutState(CLUSTER_TOTAL_ENERGY_LOW, state);
+    }
+    
+    /**
+     * Sets whether the conditions for the cluster total energy upper
+     * bound cut were met.
+     * @param state - <code>true</code> indicates that the cut conditions
+     * were met and <code>false</code> that they were not.
+     */
+    public void setStateClusterEnergyHigh(boolean state) {
+        setCutState(CLUSTER_TOTAL_ENERGY_HIGH, state);
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("EClusterLow: %d; EClusterHigh %d; HitCount: %d",
+                getStateClusterEnergyLow() ? 1 : 0, getStateClusterEnergyHigh() ? 1 : 0,
+                getStateHitCount() ? 1 : 0);
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Trigger.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Trigger.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/Trigger.java	Wed Mar  9 11:43:24 2016
@@ -14,139 +14,139 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public abstract class Trigger<E> {
-	// Track whether the trigger conditions were met.
-	private boolean passTrigger = false;
-	// Store the cut condition states.
-	private Map<String, Boolean> passMap = new HashMap<String, Boolean>();
-	// Store the cluster associated with the trigger.
-	private final E source;
-	// Store the trigger number.
-	private final int triggerNum;
-	
-	/**
-	 * Creates a new <code>Trigger</code> object with the argument
-	 * specifying the object from whence the trigger state is derived.
-	 * @param source - The trigger source object.
-	 */
-	protected Trigger(E source) {
-		this(source, -1);
-	}
-	
-	/**
-	 * Creates a new <code>Trigger</code> object with the argument
-	 * specifying the object from whence the trigger state is derived.
-	 * @param source - The trigger source object.
-	 * @param triggerNum - The number of the trigger.
-	 */
-	protected Trigger(E source, int triggerNum) {
-		this.source = source;
-		this.triggerNum = triggerNum;
-	}
-	
-	/**
-	 * Adds a cut to the set of cuts tracked by this trigger.
-	 * @param cut - The identifier for the cut.
-	 */
-	protected void addValidCut(String cut) {
-		passMap.put(cut, new Boolean(false));
-	}
-	
-	/**
-	 * Gets the state of the specified cut.
-	 * @param cut - The identifier for the cut.
-	 * @return Returns <code>true</code> if the conditions for the
-	 * specified cut were met and <code>false</code> otherwise.
-	 * @throws IllegalArgumentException Occurs if the specified cut
-	 * is not supported by the object.
-	 */
-	protected boolean getCutState(String cut) throws IllegalArgumentException {
-		if(passMap.containsKey(cut)) {
-			return passMap.get(cut);
-		} else {
-			throw new IllegalArgumentException(String.format("Trigger cut \"%s\" is not a supported trigger cut.", cut));
-		}
-	}
-	
-	/**
-	 * Gets the number of the trigger. If the trigger has no number,
-	 * it will return <code>-1</code>.
-	 * @return Returns the trigger number as an <code>int</code>.
-	 */
-	public int getTriggerNumber() {
-		return triggerNum;
-	}
-	
-	/**
-	 * Gets the object to which the trigger cuts are applied.
-	 * @return Returns the trigger source object.
-	 */
-	public E getTriggerSource() { return source; }
-	
-	/**
-	 * Gets whether the conditions for the trigger were met.
-	 * @return Returns <code>true</code> if the conditions for the
-	 * trigger were met and <code>false</code> if they were not.
-	 */
-	public boolean getTriggerState() {
-		return passTrigger;
-	}
-	
-	/**
-	 * Removes a cut from the set of cuts tracked by the trigger.
-	 * @param cut - The identifier for the cut.
-	 */
-	protected void removeValidCut(String cut) {
-		passMap.remove(cut);
-	}
-	
-	/**
-	 * Checks whether the all of the trigger cut conditions were met.
-	 * @return Returns <code>true</code> if all of the cut conditions
-	 * were met and <code>false</code> otherwise.
-	 */
-	private boolean isValidTrigger() {
-		// Iterate over all of the cuts and look for any that have not
-		// been met.
-		for(Entry<String, Boolean> cut : passMap.entrySet()) {
-			if(!cut.getValue()) { return false; }
-		}
-		
-		// If there are no cut conditions that have not been met, then
-		// the trigger is valid.
-		return true;
-	}
-	
-	/**
-	 * Sets whether the conditions for the specified cut were met.
-	 * @param cut - The identifier for the cut.
-	 * @param state - <code>true</code> indicates that the conditions
-	 * for the cut were met and <code>false</code> that they were not.
-	 * @throws IllegalArgumentException Occurs if the specified cut
-	 * is not supported by the object.
-	 */
-	protected void setCutState(String cut, boolean state) throws IllegalArgumentException {
-		if(passMap.containsKey(cut)) {
-			// Set the cut state.
-			passMap.put(cut, state);
-			
-			// If the cut state is true, then all cut conditions may have
-			// been met. Check whether this is true and, if so, set the
-			// trigger state accordingly.
-			if(state && isValidTrigger()) { passTrigger = true; }
-			else { passTrigger = false; }
-		} else {
-			throw new IllegalArgumentException(String.format("Trigger cut \"%s\" is not a supported trigger cut.", cut));
-		}
-	}
-	
-	/**
-	 * Indicates whether the specified cut state is tracked by this
-	 * object or not.
-	 * @param cut - The identifier for the cut.
-	 * @return Returns <code>true</code> if the cut state is tracked
-	 * by this object and <code>false</code> otherwise.
-	 */
-	protected boolean supportsCut(String cut) {
-		return passMap.containsKey(cut);
-	}
+    // Track whether the trigger conditions were met.
+    private boolean passTrigger = false;
+    // Store the cut condition states.
+    private Map<String, Boolean> passMap = new HashMap<String, Boolean>();
+    // Store the cluster associated with the trigger.
+    private final E source;
+    // Store the trigger number.
+    private final int triggerNum;
+    
+    /**
+     * Creates a new <code>Trigger</code> object with the argument
+     * specifying the object from whence the trigger state is derived.
+     * @param source - The trigger source object.
+     */
+    protected Trigger(E source) {
+        this(source, -1);
+    }
+    
+    /**
+     * Creates a new <code>Trigger</code> object with the argument
+     * specifying the object from whence the trigger state is derived.
+     * @param source - The trigger source object.
+     * @param triggerNum - The number of the trigger.
+     */
+    protected Trigger(E source, int triggerNum) {
+        this.source = source;
+        this.triggerNum = triggerNum;
+    }
+    
+    /**
+     * Adds a cut to the set of cuts tracked by this trigger.
+     * @param cut - The identifier for the cut.
+     */
+    protected void addValidCut(String cut) {
+        passMap.put(cut, new Boolean(false));
+    }
+    
+    /**
+     * Gets the state of the specified cut.
+     * @param cut - The identifier for the cut.
+     * @return Returns <code>true</code> if the conditions for the
+     * specified cut were met and <code>false</code> otherwise.
+     * @throws IllegalArgumentException Occurs if the specified cut
+     * is not supported by the object.
+     */
+    protected boolean getCutState(String cut) throws IllegalArgumentException {
+        if(passMap.containsKey(cut)) {
+            return passMap.get(cut);
+        } else {
+            throw new IllegalArgumentException(String.format("Trigger cut \"%s\" is not a supported trigger cut.", cut));
+        }
+    }
+    
+    /**
+     * Gets the number of the trigger. If the trigger has no number,
+     * it will return <code>-1</code>.
+     * @return Returns the trigger number as an <code>int</code>.
+     */
+    public int getTriggerNumber() {
+        return triggerNum;
+    }
+    
+    /**
+     * Gets the object to which the trigger cuts are applied.
+     * @return Returns the trigger source object.
+     */
+    public E getTriggerSource() { return source; }
+    
+    /**
+     * Gets whether the conditions for the trigger were met.
+     * @return Returns <code>true</code> if the conditions for the
+     * trigger were met and <code>false</code> if they were not.
+     */
+    public boolean getTriggerState() {
+        return passTrigger;
+    }
+    
+    /**
+     * Removes a cut from the set of cuts tracked by the trigger.
+     * @param cut - The identifier for the cut.
+     */
+    protected void removeValidCut(String cut) {
+        passMap.remove(cut);
+    }
+    
+    /**
+     * Checks whether the all of the trigger cut conditions were met.
+     * @return Returns <code>true</code> if all of the cut conditions
+     * were met and <code>false</code> otherwise.
+     */
+    private boolean isValidTrigger() {
+        // Iterate over all of the cuts and look for any that have not
+        // been met.
+        for(Entry<String, Boolean> cut : passMap.entrySet()) {
+            if(!cut.getValue()) { return false; }
+        }
+        
+        // If there are no cut conditions that have not been met, then
+        // the trigger is valid.
+        return true;
+    }
+    
+    /**
+     * Sets whether the conditions for the specified cut were met.
+     * @param cut - The identifier for the cut.
+     * @param state - <code>true</code> indicates that the conditions
+     * for the cut were met and <code>false</code> that they were not.
+     * @throws IllegalArgumentException Occurs if the specified cut
+     * is not supported by the object.
+     */
+    protected void setCutState(String cut, boolean state) throws IllegalArgumentException {
+        if(passMap.containsKey(cut)) {
+            // Set the cut state.
+            passMap.put(cut, state);
+            
+            // If the cut state is true, then all cut conditions may have
+            // been met. Check whether this is true and, if so, set the
+            // trigger state accordingly.
+            if(state && isValidTrigger()) { passTrigger = true; }
+            else { passTrigger = false; }
+        } else {
+            throw new IllegalArgumentException(String.format("Trigger cut \"%s\" is not a supported trigger cut.", cut));
+        }
+    }
+    
+    /**
+     * Indicates whether the specified cut state is tracked by this
+     * object or not.
+     * @param cut - The identifier for the cut.
+     * @return Returns <code>true</code> if the cut state is tracked
+     * by this object and <code>false</code> otherwise.
+     */
+    protected boolean supportsCut(String cut) {
+        return passMap.containsKey(cut);
+    }
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/TriggerDiagnosticUtil.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/TriggerDiagnosticUtil.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/trigger/util/TriggerDiagnosticUtil.java	Wed Mar  9 11:43:24 2016
@@ -15,208 +15,208 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class TriggerDiagnosticUtil {
-	// Cluster match state variables.
-	public static final byte CLUSTER_STATE_MATCHED        = 0;
-	public static final byte CLUSTER_STATE_FAIL_POSITION  = 1;
-	public static final byte CLUSTER_STATE_FAIL_ENERGY    = 2;
-	public static final byte CLUSTER_STATE_FAIL_HIT_COUNT = 3;
-	public static final byte CLUSTER_STATE_FAIL_TIME      = 4;
-	public static final byte CLUSTER_STATE_FAIL_UNKNOWN   = 5;
-	
-	// Trigger match cut IDs.
-	public static final int SINGLES_ENERGY_MIN = 0;
-	public static final int SINGLES_ENERGY_MAX = 1;
-	public static final int SINGLES_HIT_COUNT = 2;
-	public static final int PAIR_ENERGY_SUM = 0;
-	public static final int PAIR_ENERGY_DIFF = 1;
-	public static final int PAIR_ENERGY_SLOPE = 2;
-	public static final int PAIR_COPLANARITY = 3;
-	
-	// Trigger type variables.
-	public static final int TRIGGER_PULSER    = TriggerStatModule.PULSER;
-	public static final int TRIGGER_COSMIC    = TriggerStatModule.COSMIC;
-	public static final int TRIGGER_SINGLES_0 = TriggerStatModule.SINGLES_0;
-	public static final int TRIGGER_SINGLES_1 = TriggerStatModule.SINGLES_1;
-	public static final int TRIGGER_PAIR_0    = TriggerStatModule.PAIR_0;
-	public static final int TRIGGER_PAIR_1    = TriggerStatModule.PAIR_1;
-	public static final String[] TRIGGER_NAME = { "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Pulser", "Cosmic" };
-	
-	/**
-	 * Convenience method that writes the position of a cluster in the
-	 * form (ix, iy).
-	 * @param cluster - The cluster.
-	 * @return Returns the cluster position as a <code>String</code>.
-	 */
-	public static final String clusterPositionString(Cluster cluster) {
-		return String.format("(%3d, %3d)",
-				cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
-				cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
-	}
-	
-	/**
-	 * Convenience method that writes the position of a cluster in the
-	 * form (ix, iy).
-	 * @param cluster - The cluster.
-	 * @return Returns the cluster position as a <code>String</code>.
-	 */
-	public static final String clusterPositionString(SSPCluster cluster) {
-		return String.format("(%3d, %3d)", cluster.getXIndex(), cluster.getYIndex());
-	}
-	
-	/**
-	 * Convenience method that writes the information in a cluster to
-	 * a <code>String</code>.
-	 * @param cluster - The cluster.
-	 * @return Returns the cluster information as a <code>String</code>.
-	 */
-	public static final String clusterToString(Cluster cluster) {
-		return String.format("Cluster at (%3d, %3d) with %.3f GeV and %d hits at %4.0f ns.",
-				cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
-				cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"),
-				cluster.getEnergy(), cluster.getCalorimeterHits().size(),
-				cluster.getCalorimeterHits().get(0).getTime());
-	}
-	
-	/**
-	 * Convenience method that writes the information in a cluster to
-	 * a <code>String</code>.
-	 * @param cluster - The cluster.
-	 * @return Returns the cluster information as a <code>String</code>.
-	 */
-	public static final String clusterToString(SSPCluster cluster) {
-		return String.format("Cluster at (%3d, %3d) with %.3f GeV and %d hits at %4d ns.",
-				cluster.getXIndex(), cluster.getYIndex(), cluster.getEnergy(),
-				cluster.getHitCount(), cluster.getTime());
-	}
-	
-	/**
-	 * Gets the x/y-indices of the cluster.
-	 * @param cluster -  The cluster of which to obtain the indices.
-	 * @return Returns the indices as a <code>Point</code> object.
-	 */
-	public static final Point getClusterPosition(Cluster cluster) {
-		return new Point(getXIndex(cluster), getYIndex(cluster));
-	}
-	
-	/**
-	 * Gets the x/y-indices of the cluster.
-	 * @param cluster -  The cluster of which to obtain the indices.
-	 * @return Returns the indices as a <code>Point</code> object.
-	 */
-	public static final Point getClusterPosition(SSPCluster cluster) {
-		return new Point(cluster.getXIndex(), cluster.getYIndex());
-	}
-	
-	/**
-	 * Gets the time stamp of the cluster in nanoseconds.
-	 * @param cluster - The cluster.
-	 * @return Returns the time-stamp.
-	 */
-	public static final double getClusterTime(Cluster cluster) {
-		return cluster.getCalorimeterHits().get(0).getTime();
-	}
-	
-	/**
-	 * Gets the time stamp of the cluster in nanoseconds.
-	 * @param cluster - The cluster.
-	 * @return Returns the time-stamp.
-	 */
-	public static final int getClusterTime(SSPCluster cluster) {
-		return cluster.getTime();
-	}
-	
-	/**
-	 * Gets the number of digits in the base-10 String representation
-	 * of an integer primitive. Negative signs are not included in the
-	 * digit count.
-	 * @param value - The value of which to obtain the length.
-	 * @return Returns the number of digits in the String representation
-	 * of the argument value.
-	 */
-	public static final int getDigits(int value) {
-		if(value < 0) { return Integer.toString(value).length() - 1; }
-		else { return Integer.toString(value).length(); }
-	}
-	
-	/**
-	 * Gets the number of hits in a cluster.
-	 * @param cluster - The cluster.
-	 * @return Returns the number of hits in the cluster.
-	 */
-	public static final int getHitCount(Cluster cluster) {
-		return cluster.getCalorimeterHits().size();
-	}
-	
-	/**
-	 * Gets the number of hits in a cluster.
-	 * @param cluster - The cluster.
-	 * @return Returns the number of hits in the cluster.
-	 */
-	public static final int getHitCount(SSPCluster cluster) {
-		return cluster.getHitCount();
-	}
-	
-	/**
-	 * Gets the x-index of the cluster's seed hit.
-	 * @param cluster - The cluster.
-	 * @return Returns the x-index.
-	 */
-	public static final int getXIndex(Cluster cluster) {
-		return cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-	}
-	
-	/**
-	 * Gets the x-index of the cluster's seed hit.
-	 * @param cluster - The cluster.
-	 * @return Returns the x-index.
-	 */
-	public static final int getXIndex(SSPCluster cluster) {
-		return cluster.getXIndex();
-	}
-	
-	/**
-	 * Gets the y-index of the cluster's seed hit.
-	 * @param cluster - The cluster.
-	 * @return Returns the y-index.
-	 */
-	public static final int getYIndex(Cluster cluster) {
-		return cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-	}
-	
-	/**
-	 * Gets the y-index of the cluster's seed hit.
-	 * @param cluster - The cluster.
-	 * @return Returns the y-index.
-	 */
-	public static final int getYIndex(SSPCluster cluster) {
-		return cluster.getYIndex();
-	}
-	
-	/**
-	 * Checks whether all of the hits in a cluster are within the safe
-	 * region of the FADC output window.
-	 * @param reconCluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is safe and
-	 * returns <code>false</code> otherwise.
-	 */
-	public static final boolean isVerifiable(Cluster reconCluster, int nsa, int nsb, int windowWidth) {
-		// Iterate over the hits in the cluster.
-		for(CalorimeterHit hit : reconCluster.getCalorimeterHits()) {
-			// Check that none of the hits are within the disallowed
-			// region of the FADC readout window.
-			if(hit.getTime() <= nsb || hit.getTime() >= (windowWidth - nsa)) {
-				return false;
-			}
-			
-			// Also check to make sure that the cluster does not have
-			// any negative energy hits. These are, obviously, wrong.
-			if(hit.getCorrectedEnergy() < 0.0) {
-				return false;
-			}
-		}
-		
-		// If all of the cluster hits pass the time cut, the cluster
-		// is valid.
-		return true;
-	}
+    // Cluster match state variables.
+    public static final byte CLUSTER_STATE_MATCHED        = 0;
+    public static final byte CLUSTER_STATE_FAIL_POSITION  = 1;
+    public static final byte CLUSTER_STATE_FAIL_ENERGY    = 2;
+    public static final byte CLUSTER_STATE_FAIL_HIT_COUNT = 3;
+    public static final byte CLUSTER_STATE_FAIL_TIME      = 4;
+    public static final byte CLUSTER_STATE_FAIL_UNKNOWN   = 5;
+    
+    // Trigger match cut IDs.
+    public static final int SINGLES_ENERGY_MIN = 0;
+    public static final int SINGLES_ENERGY_MAX = 1;
+    public static final int SINGLES_HIT_COUNT = 2;
+    public static final int PAIR_ENERGY_SUM = 0;
+    public static final int PAIR_ENERGY_DIFF = 1;
+    public static final int PAIR_ENERGY_SLOPE = 2;
+    public static final int PAIR_COPLANARITY = 3;
+    
+    // Trigger type variables.
+    public static final int TRIGGER_PULSER    = TriggerStatModule.PULSER;
+    public static final int TRIGGER_COSMIC    = TriggerStatModule.COSMIC;
+    public static final int TRIGGER_SINGLES_0 = TriggerStatModule.SINGLES_0;
+    public static final int TRIGGER_SINGLES_1 = TriggerStatModule.SINGLES_1;
+    public static final int TRIGGER_PAIR_0    = TriggerStatModule.PAIR_0;
+    public static final int TRIGGER_PAIR_1    = TriggerStatModule.PAIR_1;
+    public static final String[] TRIGGER_NAME = { "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Pulser", "Cosmic" };
+    
+    /**
+     * Convenience method that writes the position of a cluster in the
+     * form (ix, iy).
+     * @param cluster - The cluster.
+     * @return Returns the cluster position as a <code>String</code>.
+     */
+    public static final String clusterPositionString(Cluster cluster) {
+        return String.format("(%3d, %3d)",
+                cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
+                cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
+    }
+    
+    /**
+     * Convenience method that writes the position of a cluster in the
+     * form (ix, iy).
+     * @param cluster - The cluster.
+     * @return Returns the cluster position as a <code>String</code>.
+     */
+    public static final String clusterPositionString(SSPCluster cluster) {
+        return String.format("(%3d, %3d)", cluster.getXIndex(), cluster.getYIndex());
+    }
+    
+    /**
+     * Convenience method that writes the information in a cluster to
+     * a <code>String</code>.
+     * @param cluster - The cluster.
+     * @return Returns the cluster information as a <code>String</code>.
+     */
+    public static final String clusterToString(Cluster cluster) {
+        return String.format("Cluster at (%3d, %3d) with %.3f GeV and %d hits at %4.0f ns.",
+                cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
+                cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"),
+                cluster.getEnergy(), cluster.getCalorimeterHits().size(),
+                cluster.getCalorimeterHits().get(0).getTime());
+    }
+    
+    /**
+     * Convenience method that writes the information in a cluster to
+     * a <code>String</code>.
+     * @param cluster - The cluster.
+     * @return Returns the cluster information as a <code>String</code>.
+     */
+    public static final String clusterToString(SSPCluster cluster) {
+        return String.format("Cluster at (%3d, %3d) with %.3f GeV and %d hits at %4d ns.",
+                cluster.getXIndex(), cluster.getYIndex(), cluster.getEnergy(),
+                cluster.getHitCount(), cluster.getTime());
+    }
+    
+    /**
+     * Gets the x/y-indices of the cluster.
+     * @param cluster -  The cluster of which to obtain the indices.
+     * @return Returns the indices as a <code>Point</code> object.
+     */
+    public static final Point getClusterPosition(Cluster cluster) {
+        return new Point(getXIndex(cluster), getYIndex(cluster));
+    }
+    
+    /**
+     * Gets the x/y-indices of the cluster.
+     * @param cluster -  The cluster of which to obtain the indices.
+     * @return Returns the indices as a <code>Point</code> object.
+     */
+    public static final Point getClusterPosition(SSPCluster cluster) {
+        return new Point(cluster.getXIndex(), cluster.getYIndex());
+    }
+    
+    /**
+     * Gets the time stamp of the cluster in nanoseconds.
+     * @param cluster - The cluster.
+     * @return Returns the time-stamp.
+     */
+    public static final double getClusterTime(Cluster cluster) {
+        return cluster.getCalorimeterHits().get(0).getTime();
+    }
+    
+    /**
+     * Gets the time stamp of the cluster in nanoseconds.
+     * @param cluster - The cluster.
+     * @return Returns the time-stamp.
+     */
+    public static final int getClusterTime(SSPCluster cluster) {
+        return cluster.getTime();
+    }
+    
+    /**
+     * Gets the number of digits in the base-10 String representation
+     * of an integer primitive. Negative signs are not included in the
+     * digit count.
+     * @param value - The value of which to obtain the length.
+     * @return Returns the number of digits in the String representation
+     * of the argument value.
+     */
+    public static final int getDigits(int value) {
+        if(value < 0) { return Integer.toString(value).length() - 1; }
+        else { return Integer.toString(value).length(); }
+    }
+    
+    /**
+     * Gets the number of hits in a cluster.
+     * @param cluster - The cluster.
+     * @return Returns the number of hits in the cluster.
+     */
+    public static final int getHitCount(Cluster cluster) {
+        return cluster.getCalorimeterHits().size();
+    }
+    
+    /**
+     * Gets the number of hits in a cluster.
+     * @param cluster - The cluster.
+     * @return Returns the number of hits in the cluster.
+     */
+    public static final int getHitCount(SSPCluster cluster) {
+        return cluster.getHitCount();
+    }
+    
+    /**
+     * Gets the x-index of the cluster's seed hit.
+     * @param cluster - The cluster.
+     * @return Returns the x-index.
+     */
+    public static final int getXIndex(Cluster cluster) {
+        return cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+    }
+    
+    /**
+     * Gets the x-index of the cluster's seed hit.
+     * @param cluster - The cluster.
+     * @return Returns the x-index.
+     */
+    public static final int getXIndex(SSPCluster cluster) {
+        return cluster.getXIndex();
+    }
+    
+    /**
+     * Gets the y-index of the cluster's seed hit.
+     * @param cluster - The cluster.
+     * @return Returns the y-index.
+     */
+    public static final int getYIndex(Cluster cluster) {
+        return cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+    }
+    
+    /**
+     * Gets the y-index of the cluster's seed hit.
+     * @param cluster - The cluster.
+     * @return Returns the y-index.
+     */
+    public static final int getYIndex(SSPCluster cluster) {
+        return cluster.getYIndex();
+    }
+    
+    /**
+     * Checks whether all of the hits in a cluster are within the safe
+     * region of the FADC output window.
+     * @param reconCluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is safe and
+     * returns <code>false</code> otherwise.
+     */
+    public static final boolean isVerifiable(Cluster reconCluster, int nsa, int nsb, int windowWidth) {
+        // Iterate over the hits in the cluster.
+        for(CalorimeterHit hit : reconCluster.getCalorimeterHits()) {
+            // Check that none of the hits are within the disallowed
+            // region of the FADC readout window.
+            if(hit.getTime() <= nsb || hit.getTime() >= (windowWidth - nsa)) {
+                return false;
+            }
+            
+            // Also check to make sure that the cluster does not have
+            // any negative energy hits. These are, obviously, wrong.
+            if(hit.getCorrectedEnergy() < 0.0) {
+                return false;
+            }
+        }
+        
+        // If all of the cluster hits pass the time cut, the cluster
+        // is valid.
+        return true;
+    }
 }

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-3/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-3/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-3/compact.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
         </comment>
     </info>
     

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
            4th: round start with v1-3
            L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw
         </comment>

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
         </comment>
     </info>
     

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
            4th: round start with v1-3
            1) float L2_tu_rw, L3_tu_rw, L4_tu_rw
         </comment>

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L2-3-4_tu_rw.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L2-3-4_tu_rw.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-4/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L2-3-4_tu_rw.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
         </comment>
     </info>
     

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-1/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
         </comment>
     </info>
     

Modified: java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-2/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-HPS-EngRun2015-Nominal-v1-4-1-100k-L456_L123_L234_L345_L123_L456_tu_rwIter0Iter1Iter2Iter3Iter4Iter5.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-2/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-HPS-EngRun2015-Nominal-v1-4-1-100k-L456_L123_L234_L345_L123_L456_tu_rwIter0Iter1Iter2Iter3Iter4Iter5.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-EngRun2015-Nominal-v1-5-2/compact_millepede-milleBinaryISN_hps_005772.evio.0.gbl-HPS-EngRun2015-Nominal-v1-4-1-100k-L456_L123_L234_L345_L123_L456_tu_rwIter0Iter1Iter2Iter3Iter4Iter5.xml	Wed Mar  9 11:43:24 2016
@@ -9,8 +9,8 @@
                1) float L2_tu, 2) float L2_tu, L4_tu, L5_tu
                2nd: round
                1) float L2_tu, L4_tu, L5_tu
-	       3rd: round
-	       1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
+           3rd: round
+           1) float L2_tu_rw, L4_tu_rw, L5_tu_rw
            4th: round start with v1-3
            L3_L4_L5_tu_rw_THEN_L2_tu_rw_THEN_L2_L3_L4_tu_rw_THEN_L2_L3_L5_tu_rw_THEN_L2_L3_L4_L5_excl_L3ST_tu_L4Sb_tu_THEN_L2_L4_L5_tu_rw
         </comment>

Modified: java/trunk/detector-data/detectors/HPS-Proposal2014-v3-2pt2-0zOffset/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-Proposal2014-v3-2pt2-0zOffset/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-Proposal2014-v3-2pt2-0zOffset/compact.xml	Wed Mar  9 11:43:24 2016
@@ -305,7 +305,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="endOfFieldZ" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
             
            
         </detector>     

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v5/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v5/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v5/compact.xml	Wed Mar  9 11:43:24 2016
@@ -488,7 +488,7 @@
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001"/>
             <fraction n="1.0" ref="Vacuum" />
@@ -578,7 +578,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="endOfFieldZ" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v6/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v6/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v6/compact.xml	Wed Mar  9 11:43:24 2016
@@ -488,7 +488,7 @@
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001"/>
             <fraction n="1.0" ref="Vacuum" />
@@ -578,7 +578,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="endOfFieldZ" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v7-2/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v7-2/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v7-2/compact.xml	Wed Mar  9 11:43:24 2016
@@ -86,127 +86,127 @@
         <constant name="y9b_misalign" value="0.0"/>
         <constant name="y10b_misalign" value="0.0"/>
 
-		<!-- alignment corrections -->
-	<constant name="x1t_align" value="0.000000"/>
-	<constant name="x2t_align" value="0.000000"/>
-	<constant name="x3t_align" value="0.000000"/>
-	<constant name="x4t_align" value="0.000000"/>
-	<constant name="x5t_align" value="0.000000"/>
-	<constant name="x6t_align" value="0.000000"/>
-	<constant name="x7t_align" value="0.000000"/>
-	<constant name="x8t_align" value="0.000000"/>
-	<constant name="x9t_align" value="0.000000"/>
-	<constant name="x10t_align" value="0.000000"/>
-	<constant name="y1t_align" value="0.000000"/>
-	<constant name="y2t_align" value="0.000000"/>
-	<constant name="y3t_align" value="0.0"/>
-	<constant name="y4t_align" value="0.0"/>
-	<constant name="y5t_align" value="0.000000"/>
-	<constant name="y6t_align" value="0.000000"/>
-	<constant name="y7t_align" value="0.000000"/>
-	<constant name="y8t_align" value="0.000000"/>
-	<constant name="y9t_align" value="0.000000"/>
-	<constant name="y10t_align" value="0.000000"/>
-	<constant name="z1t_align" value="0.000000"/>
-	<constant name="z2t_align" value="0.000000"/>
-	<constant name="z3t_align" value="0.000000"/>
-	<constant name="z4t_align" value="0.000000"/>
-	<constant name="z5t_align" value="0.000000"/>
-	<constant name="z6t_align" value="0.000000"/>
-	<constant name="z7t_align" value="0.000000"/>
-	<constant name="z8t_align" value="0.000000"/>
-	<constant name="z9t_align" value="0.000000"/>
-	<constant name="z10t_align" value="0.000000"/>
-	<constant name="rx1t_align" value="0.000000"/>
-	<constant name="rx2t_align" value="0.000000"/>
-	<constant name="rx3t_align" value="0.000000"/>
-	<constant name="rx4t_align" value="0.000000"/>
-	<constant name="rx5t_align" value="0.000000"/>
-	<constant name="rx6t_align" value="0.000000"/>
-	<constant name="rx7t_align" value="0.000000"/>
-	<constant name="rx8t_align" value="0.000000"/>
-	<constant name="rx9t_align" value="0.000000"/>
-	<constant name="rx10t_align" value="0.000000"/>
-	<constant name="ry1t_align" value="0.000000"/>
-	<constant name="ry2t_align" value="0.000000"/>
-	<constant name="ry3t_align" value="0.000000"/>
-	<constant name="ry4t_align" value="0.000000"/>
-	<constant name="ry5t_align" value="0.000000"/>
-	<constant name="ry6t_align" value="0.000000"/>
-	<constant name="ry7t_align" value="0.000000"/>
-	<constant name="ry8t_align" value="0.000000"/>
-	<constant name="ry9t_align" value="0.000000"/>
-	<constant name="ry10t_align" value="0.000000"/>
-	<constant name="rz1t_align" value="0.000000"/>
-	<constant name="rz2t_align" value="0.000000"/>
-	<constant name="rz3t_align" value="0.000000"/>
-	<constant name="rz4t_align" value="0.000000"/>
-	<constant name="rz5t_align" value="0.000000"/>
-	<constant name="rz6t_align" value="0.000000"/>
-	<constant name="rz7t_align" value="0.000000"/>
-	<constant name="rz8t_align" value="0.000000"/>
-	<constant name="rz9t_align" value="0.000000"/>
-	<constant name="rz10t_align" value="0.000000"/>
-	<constant name="x1b_align" value="0.000000"/>
-	<constant name="x2b_align" value="0.000000"/>
-	<constant name="x3b_align" value="0.000000"/>
-	<constant name="x4b_align" value="0.000000"/>
-	<constant name="x5b_align" value="0.000000"/>
-	<constant name="x6b_align" value="0.00000"/>
-	<constant name="x7b_align" value="0.000000"/>
-	<constant name="x8b_align" value="0.000000"/>
-	<constant name="x9b_align" value="0.000000"/>
-	<constant name="x10b_align" value="0.000000"/>
-	<constant name="y1b_align" value="0.000000"/>
-	<constant name="y2b_align" value="0.000000"/>
-	<constant name="y3b_align" value="0.000000"/>
-	<constant name="y4b_align" value="0.000000"/>
-	<constant name="y5b_align" value="0.0"/>
-	<constant name="y6b_align" value="0.0"/>
-	<constant name="y7b_align" value="0.000000"/>
-	<constant name="y8b_align" value="0.000000"/>
-	<constant name="y9b_align" value="0.000000"/>
-	<constant name="y10b_align" value="0.000000"/>
-	<constant name="z1b_align" value="0.000000"/>
-	<constant name="z2b_align" value="0.000000"/>
-	<constant name="z3b_align" value="0.000000"/>
-	<constant name="z4b_align" value="0.000000"/>
-	<constant name="z5b_align" value="0.000000"/>
-	<constant name="z6b_align" value="0.000000"/>
-	<constant name="z7b_align" value="0.000000"/>
-	<constant name="z8b_align" value="0.000000"/>
-	<constant name="z9b_align" value="0.000000"/>
-	<constant name="z10b_align" value="0.000000"/>
-	<constant name="rx1b_align" value="0.000000"/>
-	<constant name="rx2b_align" value="0.000000"/>
-	<constant name="rx3b_align" value="0.000000"/>
-	<constant name="rx4b_align" value="0.000000"/>
-	<constant name="rx5b_align" value="0.000000"/>
-	<constant name="rx6b_align" value="0.000000"/>
-	<constant name="rx7b_align" value="0.000000"/>
-	<constant name="rx8b_align" value="0.000000"/>
-	<constant name="rx9b_align" value="0.000000"/>
-	<constant name="rx10b_align" value="0.000000"/>
-	<constant name="ry1b_align" value="0.000000"/>
-	<constant name="ry2b_align" value="0.000000"/>
-	<constant name="ry3b_align" value="0.000000"/>
-	<constant name="ry4b_align" value="0.000000"/>
-	<constant name="ry5b_align" value="0.000000"/>
-	<constant name="ry6b_align" value="0.000000"/>
-	<constant name="ry7b_align" value="0.000000"/>
-	<constant name="ry8b_align" value="0.000000"/>
-	<constant name="ry9b_align" value="0.000000"/>
-	<constant name="ry10b_align" value="0.000000"/>
-	<constant name="rz1b_align" value="0.000000"/>
-	<constant name="rz2b_align" value="0.000000"/>
-	<constant name="rz3b_align" value="0.000000"/>
-	<constant name="rz4b_align" value="0.000000"/>
-	<constant name="rz5b_align" value="0.000000"/>
-	<constant name="rz6b_align" value="0.000000"/>
-	<constant name="rz7b_align" value="0.000000"/>
-	<constant name="rz8b_align" value="0.000000"/>
-	<constant name="rz9b_align" value="0.000000"/>
-	<constant name="rz10b_align" value="0.000000"/>
+        <!-- alignment corrections -->
+    <constant name="x1t_align" value="0.000000"/>
+    <constant name="x2t_align" value="0.000000"/>
+    <constant name="x3t_align" value="0.000000"/>
+    <constant name="x4t_align" value="0.000000"/>
+    <constant name="x5t_align" value="0.000000"/>
+    <constant name="x6t_align" value="0.000000"/>
+    <constant name="x7t_align" value="0.000000"/>
+    <constant name="x8t_align" value="0.000000"/>
+    <constant name="x9t_align" value="0.000000"/>
+    <constant name="x10t_align" value="0.000000"/>
+    <constant name="y1t_align" value="0.000000"/>
+    <constant name="y2t_align" value="0.000000"/>
+    <constant name="y3t_align" value="0.0"/>
+    <constant name="y4t_align" value="0.0"/>
+    <constant name="y5t_align" value="0.000000"/>
+    <constant name="y6t_align" value="0.000000"/>
+    <constant name="y7t_align" value="0.000000"/>
+    <constant name="y8t_align" value="0.000000"/>
+    <constant name="y9t_align" value="0.000000"/>
+    <constant name="y10t_align" value="0.000000"/>
+    <constant name="z1t_align" value="0.000000"/>
+    <constant name="z2t_align" value="0.000000"/>
+    <constant name="z3t_align" value="0.000000"/>
+    <constant name="z4t_align" value="0.000000"/>
+    <constant name="z5t_align" value="0.000000"/>
+    <constant name="z6t_align" value="0.000000"/>
+    <constant name="z7t_align" value="0.000000"/>
+    <constant name="z8t_align" value="0.000000"/>
+    <constant name="z9t_align" value="0.000000"/>
+    <constant name="z10t_align" value="0.000000"/>
+    <constant name="rx1t_align" value="0.000000"/>
+    <constant name="rx2t_align" value="0.000000"/>
+    <constant name="rx3t_align" value="0.000000"/>
+    <constant name="rx4t_align" value="0.000000"/>
+    <constant name="rx5t_align" value="0.000000"/>
+    <constant name="rx6t_align" value="0.000000"/>
+    <constant name="rx7t_align" value="0.000000"/>
+    <constant name="rx8t_align" value="0.000000"/>
+    <constant name="rx9t_align" value="0.000000"/>
+    <constant name="rx10t_align" value="0.000000"/>
+    <constant name="ry1t_align" value="0.000000"/>
+    <constant name="ry2t_align" value="0.000000"/>
+    <constant name="ry3t_align" value="0.000000"/>
+    <constant name="ry4t_align" value="0.000000"/>
+    <constant name="ry5t_align" value="0.000000"/>
+    <constant name="ry6t_align" value="0.000000"/>
+    <constant name="ry7t_align" value="0.000000"/>
+    <constant name="ry8t_align" value="0.000000"/>
+    <constant name="ry9t_align" value="0.000000"/>
+    <constant name="ry10t_align" value="0.000000"/>
+    <constant name="rz1t_align" value="0.000000"/>
+    <constant name="rz2t_align" value="0.000000"/>
+    <constant name="rz3t_align" value="0.000000"/>
+    <constant name="rz4t_align" value="0.000000"/>
+    <constant name="rz5t_align" value="0.000000"/>
+    <constant name="rz6t_align" value="0.000000"/>
+    <constant name="rz7t_align" value="0.000000"/>
+    <constant name="rz8t_align" value="0.000000"/>
+    <constant name="rz9t_align" value="0.000000"/>
+    <constant name="rz10t_align" value="0.000000"/>
+    <constant name="x1b_align" value="0.000000"/>
+    <constant name="x2b_align" value="0.000000"/>
+    <constant name="x3b_align" value="0.000000"/>
+    <constant name="x4b_align" value="0.000000"/>
+    <constant name="x5b_align" value="0.000000"/>
+    <constant name="x6b_align" value="0.00000"/>
+    <constant name="x7b_align" value="0.000000"/>
+    <constant name="x8b_align" value="0.000000"/>
+    <constant name="x9b_align" value="0.000000"/>
+    <constant name="x10b_align" value="0.000000"/>
+    <constant name="y1b_align" value="0.000000"/>
+    <constant name="y2b_align" value="0.000000"/>
+    <constant name="y3b_align" value="0.000000"/>
+    <constant name="y4b_align" value="0.000000"/>
+    <constant name="y5b_align" value="0.0"/>
+    <constant name="y6b_align" value="0.0"/>
+    <constant name="y7b_align" value="0.000000"/>
+    <constant name="y8b_align" value="0.000000"/>
+    <constant name="y9b_align" value="0.000000"/>
+    <constant name="y10b_align" value="0.000000"/>
+    <constant name="z1b_align" value="0.000000"/>
+    <constant name="z2b_align" value="0.000000"/>
+    <constant name="z3b_align" value="0.000000"/>
+    <constant name="z4b_align" value="0.000000"/>
+    <constant name="z5b_align" value="0.000000"/>
+    <constant name="z6b_align" value="0.000000"/>
+    <constant name="z7b_align" value="0.000000"/>
+    <constant name="z8b_align" value="0.000000"/>
+    <constant name="z9b_align" value="0.000000"/>
+    <constant name="z10b_align" value="0.000000"/>
+    <constant name="rx1b_align" value="0.000000"/>
+    <constant name="rx2b_align" value="0.000000"/>
+    <constant name="rx3b_align" value="0.000000"/>
+    <constant name="rx4b_align" value="0.000000"/>
+    <constant name="rx5b_align" value="0.000000"/>
+    <constant name="rx6b_align" value="0.000000"/>
+    <constant name="rx7b_align" value="0.000000"/>
+    <constant name="rx8b_align" value="0.000000"/>
+    <constant name="rx9b_align" value="0.000000"/>
+    <constant name="rx10b_align" value="0.000000"/>
+    <constant name="ry1b_align" value="0.000000"/>
+    <constant name="ry2b_align" value="0.000000"/>
+    <constant name="ry3b_align" value="0.000000"/>
+    <constant name="ry4b_align" value="0.000000"/>
+    <constant name="ry5b_align" value="0.000000"/>
+    <constant name="ry6b_align" value="0.000000"/>
+    <constant name="ry7b_align" value="0.000000"/>
+    <constant name="ry8b_align" value="0.000000"/>
+    <constant name="ry9b_align" value="0.000000"/>
+    <constant name="ry10b_align" value="0.000000"/>
+    <constant name="rz1b_align" value="0.000000"/>
+    <constant name="rz2b_align" value="0.000000"/>
+    <constant name="rz3b_align" value="0.000000"/>
+    <constant name="rz4b_align" value="0.000000"/>
+    <constant name="rz5b_align" value="0.000000"/>
+    <constant name="rz6b_align" value="0.000000"/>
+    <constant name="rz7b_align" value="0.000000"/>
+    <constant name="rz8b_align" value="0.000000"/>
+    <constant name="rz9b_align" value="0.000000"/>
+    <constant name="rz10b_align" value="0.000000"/>
 
         <!-- Positions of sensor centers above/below nominal beam -->
         <constant name="y1t" value="36.894" />
@@ -606,134 +606,134 @@
         <constant name="mod2_rx10b" value="mod_rx10b"/>
         <constant name="mod2_ry10b" value="mod_ry10b+y_rot_bot_pivot"/>
         <constant name="mod2_rz10b" value="mod_rz10b"/>
-    	
-    	<!-- final constants -->
-	<constant name="final_x1t" value="mod2_x1t+x1t_align"/>
-	<constant name="final_x2t" value="mod2_x2t+x2t_align"/>
-	<constant name="final_x3t" value="mod2_x3t+x3t_align"/>
-	<constant name="final_x4t" value="mod2_x4t+x4t_align"/>
-	<constant name="final_x5t" value="mod2_x5t+x5t_align"/>
-	<constant name="final_x6t" value="mod2_x6t+x6t_align"/>
-	<constant name="final_x7t" value="mod2_x7t+x7t_align"/>
-	<constant name="final_x8t" value="mod2_x8t+x8t_align"/>
-	<constant name="final_x9t" value="mod2_x9t+x9t_align"/>
-	<constant name="final_x10t" value="mod2_x10t+x10t_align"/>
-	<constant name="final_y1t" value="mod2_y1t+y1t_align"/>
-	<constant name="final_y2t" value="mod2_y2t+y2t_align"/>
-	<constant name="final_y3t" value="mod2_y3t+y3t_align"/>
-	<constant name="final_y4t" value="mod2_y4t+y4t_align"/>
-	<constant name="final_y5t" value="mod2_y5t+y5t_align"/>
-	<constant name="final_y6t" value="mod2_y6t+y6t_align"/>
-	<constant name="final_y7t" value="mod2_y7t+y7t_align"/>
-	<constant name="final_y8t" value="mod2_y8t+y8t_align"/>
-	<constant name="final_y9t" value="mod2_y9t+y9t_align"/>
-	<constant name="final_y10t" value="mod2_y10t+y10t_align"/>
-	<constant name="final_z1t" value="mod2_z1t+z1t_align"/>
-	<constant name="final_z2t" value="mod2_z2t+z2t_align"/>
-	<constant name="final_z3t" value="mod2_z3t+z3t_align"/>
-	<constant name="final_z4t" value="mod2_z4t+z4t_align"/>
-	<constant name="final_z5t" value="mod2_z5t+z5t_align"/>
-	<constant name="final_z6t" value="mod2_z6t+z6t_align"/>
-	<constant name="final_z7t" value="mod2_z7t+z7t_align"/>
-	<constant name="final_z8t" value="mod2_z8t+z8t_align"/>
-	<constant name="final_z9t" value="mod2_z9t+z9t_align"/>
-	<constant name="final_z10t" value="mod2_z10t+z10t_align"/>
-	<constant name="final_rx1t" value="mod2_rx1t+rx1t_align"/>
-	<constant name="final_rx2t" value="mod2_rx2t+rx2t_align"/>
-	<constant name="final_rx3t" value="mod2_rx3t+rx3t_align"/>
-	<constant name="final_rx4t" value="mod2_rx4t+rx4t_align"/>
-	<constant name="final_rx5t" value="mod2_rx5t+rx5t_align"/>
-	<constant name="final_rx6t" value="mod2_rx6t+rx6t_align"/>
-	<constant name="final_rx7t" value="mod2_rx7t+rx7t_align"/>
-	<constant name="final_rx8t" value="mod2_rx8t+rx8t_align"/>
-	<constant name="final_rx9t" value="mod2_rx9t+rx9t_align"/>
-	<constant name="final_rx10t" value="mod2_rx10t+rx10t_align"/>
-	<constant name="final_ry1t" value="mod2_ry1t+ry1t_align"/>
-	<constant name="final_ry2t" value="mod2_ry2t+ry2t_align"/>
-	<constant name="final_ry3t" value="mod2_ry3t+ry3t_align"/>
-	<constant name="final_ry4t" value="mod2_ry4t+ry4t_align"/>
-	<constant name="final_ry5t" value="mod2_ry5t+ry5t_align"/>
-	<constant name="final_ry6t" value="mod2_ry6t+ry6t_align"/>
-	<constant name="final_ry7t" value="mod2_ry7t+ry7t_align"/>
-	<constant name="final_ry8t" value="mod2_ry8t+ry8t_align"/>
-	<constant name="final_ry9t" value="mod2_ry9t+ry9t_align"/>
-	<constant name="final_ry10t" value="mod2_ry10t+ry10t_align"/>
-	<constant name="final_rz1t" value="mod2_rz1t+rz1t_align"/>
-	<constant name="final_rz2t" value="mod2_rz2t+rz2t_align"/>
-	<constant name="final_rz3t" value="mod2_rz3t+rz3t_align"/>
-	<constant name="final_rz4t" value="mod2_rz4t+rz4t_align"/>
-	<constant name="final_rz5t" value="mod2_rz5t+rz5t_align"/>
-	<constant name="final_rz6t" value="mod2_rz6t+rz6t_align"/>
-	<constant name="final_rz7t" value="mod2_rz7t+rz7t_align"/>
-	<constant name="final_rz8t" value="mod2_rz8t+rz8t_align"/>
-	<constant name="final_rz9t" value="mod2_rz9t+rz9t_align"/>
-	<constant name="final_rz10t" value="mod2_rz10t+rz10t_align"/>
-	<constant name="final_x1b" value="mod2_x1b+x1b_align"/>
-	<constant name="final_x2b" value="mod2_x2b+x2b_align"/>
-	<constant name="final_x3b" value="mod2_x3b+x3b_align"/>
-	<constant name="final_x4b" value="mod2_x4b+x4b_align"/>
-	<constant name="final_x5b" value="mod2_x5b+x5b_align"/>
-	<constant name="final_x6b" value="mod2_x6b+x6b_align"/>
-	<constant name="final_x7b" value="mod2_x7b+x7b_align"/>
-	<constant name="final_x8b" value="mod2_x8b+x8b_align"/>
-	<constant name="final_x9b" value="mod2_x9b+x9b_align"/>
-	<constant name="final_x10b" value="mod2_x10b+x10b_align"/>
-	<constant name="final_y1b" value="mod2_y1b+y1b_align"/>
-	<constant name="final_y2b" value="mod2_y2b+y2b_align"/>
-	<constant name="final_y3b" value="mod2_y3b+y3b_align"/>
-	<constant name="final_y4b" value="mod2_y4b+y4b_align"/>
-	<constant name="final_y5b" value="mod2_y5b+y5b_align"/>
-	<constant name="final_y6b" value="mod2_y6b+y6b_align"/>
-	<constant name="final_y7b" value="mod2_y7b+y7b_align"/>
-	<constant name="final_y8b" value="mod2_y8b+y8b_align"/>
-	<constant name="final_y9b" value="mod2_y9b+y9b_align"/>
-	<constant name="final_y10b" value="mod2_y10b+y10b_align"/>
-	<constant name="final_z1b" value="mod2_z1b+z1b_align"/>
-	<constant name="final_z2b" value="mod2_z2b+z2b_align"/>
-	<constant name="final_z3b" value="mod2_z3b+z3b_align"/>
-	<constant name="final_z4b" value="mod2_z4b+z4b_align"/>
-	<constant name="final_z5b" value="mod2_z5b+z5b_align"/>
-	<constant name="final_z6b" value="mod2_z6b+z6b_align"/>
-	<constant name="final_z7b" value="mod2_z7b+z7b_align"/>
-	<constant name="final_z8b" value="mod2_z8b+z8b_align"/>
-	<constant name="final_z9b" value="mod2_z9b+z9b_align"/>
-	<constant name="final_z10b" value="mod2_z10b+z10b_align"/>
-	<constant name="final_rx1b" value="mod2_rx1b+rx1b_align"/>
-	<constant name="final_rx2b" value="mod2_rx2b+rx2b_align"/>
-	<constant name="final_rx3b" value="mod2_rx3b+rx3b_align"/>
-	<constant name="final_rx4b" value="mod2_rx4b+rx4b_align"/>
-	<constant name="final_rx5b" value="mod2_rx5b+rx5b_align"/>
-	<constant name="final_rx6b" value="mod2_rx6b+rx6b_align"/>
-	<constant name="final_rx7b" value="mod2_rx7b+rx7b_align"/>
-	<constant name="final_rx8b" value="mod2_rx8b+rx8b_align"/>
-	<constant name="final_rx9b" value="mod2_rx9b+rx9b_align"/>
-	<constant name="final_rx10b" value="mod2_rx10b+rx10b_align"/>
-	<constant name="final_ry1b" value="mod2_ry1b+ry1b_align"/>
-	<constant name="final_ry2b" value="mod2_ry2b+ry2b_align"/>
-	<constant name="final_ry3b" value="mod2_ry3b+ry3b_align"/>
-	<constant name="final_ry4b" value="mod2_ry4b+ry4b_align"/>
-	<constant name="final_ry5b" value="mod2_ry5b+ry5b_align"/>
-	<constant name="final_ry6b" value="mod2_ry6b+ry6b_align"/>
-	<constant name="final_ry7b" value="mod2_ry7b+ry7b_align"/>
-	<constant name="final_ry8b" value="mod2_ry8b+ry8b_align"/>
-	<constant name="final_ry9b" value="mod2_ry9b+ry9b_align"/>
-	<constant name="final_ry10b" value="mod2_ry10b+ry10b_align"/>
-	<constant name="final_rz1b" value="mod2_rz1b+rz1b_align"/>
-	<constant name="final_rz2b" value="mod2_rz2b+rz2b_align"/>
-	<constant name="final_rz3b" value="mod2_rz3b+rz3b_align"/>
-	<constant name="final_rz4b" value="mod2_rz4b+rz4b_align"/>
-	<constant name="final_rz5b" value="mod2_rz5b+rz5b_align"/>
-	<constant name="final_rz6b" value="mod2_rz6b+rz6b_align"/>
-	<constant name="final_rz7b" value="mod2_rz7b+rz7b_align"/>
-	<constant name="final_rz8b" value="mod2_rz8b+rz8b_align"/>
-	<constant name="final_rz9b" value="mod2_rz9b+rz9b_align"/>
-	<constant name="final_rz10b" value="mod2_rz10b+rz10b_align"/>
-    	
-    	
+        
+        <!-- final constants -->
+    <constant name="final_x1t" value="mod2_x1t+x1t_align"/>
+    <constant name="final_x2t" value="mod2_x2t+x2t_align"/>
+    <constant name="final_x3t" value="mod2_x3t+x3t_align"/>
+    <constant name="final_x4t" value="mod2_x4t+x4t_align"/>
+    <constant name="final_x5t" value="mod2_x5t+x5t_align"/>
+    <constant name="final_x6t" value="mod2_x6t+x6t_align"/>
+    <constant name="final_x7t" value="mod2_x7t+x7t_align"/>
+    <constant name="final_x8t" value="mod2_x8t+x8t_align"/>
+    <constant name="final_x9t" value="mod2_x9t+x9t_align"/>
+    <constant name="final_x10t" value="mod2_x10t+x10t_align"/>
+    <constant name="final_y1t" value="mod2_y1t+y1t_align"/>
+    <constant name="final_y2t" value="mod2_y2t+y2t_align"/>
+    <constant name="final_y3t" value="mod2_y3t+y3t_align"/>
+    <constant name="final_y4t" value="mod2_y4t+y4t_align"/>
+    <constant name="final_y5t" value="mod2_y5t+y5t_align"/>
+    <constant name="final_y6t" value="mod2_y6t+y6t_align"/>
+    <constant name="final_y7t" value="mod2_y7t+y7t_align"/>
+    <constant name="final_y8t" value="mod2_y8t+y8t_align"/>
+    <constant name="final_y9t" value="mod2_y9t+y9t_align"/>
+    <constant name="final_y10t" value="mod2_y10t+y10t_align"/>
+    <constant name="final_z1t" value="mod2_z1t+z1t_align"/>
+    <constant name="final_z2t" value="mod2_z2t+z2t_align"/>
+    <constant name="final_z3t" value="mod2_z3t+z3t_align"/>
+    <constant name="final_z4t" value="mod2_z4t+z4t_align"/>
+    <constant name="final_z5t" value="mod2_z5t+z5t_align"/>
+    <constant name="final_z6t" value="mod2_z6t+z6t_align"/>
+    <constant name="final_z7t" value="mod2_z7t+z7t_align"/>
+    <constant name="final_z8t" value="mod2_z8t+z8t_align"/>
+    <constant name="final_z9t" value="mod2_z9t+z9t_align"/>
+    <constant name="final_z10t" value="mod2_z10t+z10t_align"/>
+    <constant name="final_rx1t" value="mod2_rx1t+rx1t_align"/>
+    <constant name="final_rx2t" value="mod2_rx2t+rx2t_align"/>
+    <constant name="final_rx3t" value="mod2_rx3t+rx3t_align"/>
+    <constant name="final_rx4t" value="mod2_rx4t+rx4t_align"/>
+    <constant name="final_rx5t" value="mod2_rx5t+rx5t_align"/>
+    <constant name="final_rx6t" value="mod2_rx6t+rx6t_align"/>
+    <constant name="final_rx7t" value="mod2_rx7t+rx7t_align"/>
+    <constant name="final_rx8t" value="mod2_rx8t+rx8t_align"/>
+    <constant name="final_rx9t" value="mod2_rx9t+rx9t_align"/>
+    <constant name="final_rx10t" value="mod2_rx10t+rx10t_align"/>
+    <constant name="final_ry1t" value="mod2_ry1t+ry1t_align"/>
+    <constant name="final_ry2t" value="mod2_ry2t+ry2t_align"/>
+    <constant name="final_ry3t" value="mod2_ry3t+ry3t_align"/>
+    <constant name="final_ry4t" value="mod2_ry4t+ry4t_align"/>
+    <constant name="final_ry5t" value="mod2_ry5t+ry5t_align"/>
+    <constant name="final_ry6t" value="mod2_ry6t+ry6t_align"/>
+    <constant name="final_ry7t" value="mod2_ry7t+ry7t_align"/>
+    <constant name="final_ry8t" value="mod2_ry8t+ry8t_align"/>
+    <constant name="final_ry9t" value="mod2_ry9t+ry9t_align"/>
+    <constant name="final_ry10t" value="mod2_ry10t+ry10t_align"/>
+    <constant name="final_rz1t" value="mod2_rz1t+rz1t_align"/>
+    <constant name="final_rz2t" value="mod2_rz2t+rz2t_align"/>
+    <constant name="final_rz3t" value="mod2_rz3t+rz3t_align"/>
+    <constant name="final_rz4t" value="mod2_rz4t+rz4t_align"/>
+    <constant name="final_rz5t" value="mod2_rz5t+rz5t_align"/>
+    <constant name="final_rz6t" value="mod2_rz6t+rz6t_align"/>
+    <constant name="final_rz7t" value="mod2_rz7t+rz7t_align"/>
+    <constant name="final_rz8t" value="mod2_rz8t+rz8t_align"/>
+    <constant name="final_rz9t" value="mod2_rz9t+rz9t_align"/>
+    <constant name="final_rz10t" value="mod2_rz10t+rz10t_align"/>
+    <constant name="final_x1b" value="mod2_x1b+x1b_align"/>
+    <constant name="final_x2b" value="mod2_x2b+x2b_align"/>
+    <constant name="final_x3b" value="mod2_x3b+x3b_align"/>
+    <constant name="final_x4b" value="mod2_x4b+x4b_align"/>
+    <constant name="final_x5b" value="mod2_x5b+x5b_align"/>
+    <constant name="final_x6b" value="mod2_x6b+x6b_align"/>
+    <constant name="final_x7b" value="mod2_x7b+x7b_align"/>
+    <constant name="final_x8b" value="mod2_x8b+x8b_align"/>
+    <constant name="final_x9b" value="mod2_x9b+x9b_align"/>
+    <constant name="final_x10b" value="mod2_x10b+x10b_align"/>
+    <constant name="final_y1b" value="mod2_y1b+y1b_align"/>
+    <constant name="final_y2b" value="mod2_y2b+y2b_align"/>
+    <constant name="final_y3b" value="mod2_y3b+y3b_align"/>
+    <constant name="final_y4b" value="mod2_y4b+y4b_align"/>
+    <constant name="final_y5b" value="mod2_y5b+y5b_align"/>
+    <constant name="final_y6b" value="mod2_y6b+y6b_align"/>
+    <constant name="final_y7b" value="mod2_y7b+y7b_align"/>
+    <constant name="final_y8b" value="mod2_y8b+y8b_align"/>
+    <constant name="final_y9b" value="mod2_y9b+y9b_align"/>
+    <constant name="final_y10b" value="mod2_y10b+y10b_align"/>
+    <constant name="final_z1b" value="mod2_z1b+z1b_align"/>
+    <constant name="final_z2b" value="mod2_z2b+z2b_align"/>
+    <constant name="final_z3b" value="mod2_z3b+z3b_align"/>
+    <constant name="final_z4b" value="mod2_z4b+z4b_align"/>
+    <constant name="final_z5b" value="mod2_z5b+z5b_align"/>
+    <constant name="final_z6b" value="mod2_z6b+z6b_align"/>
+    <constant name="final_z7b" value="mod2_z7b+z7b_align"/>
+    <constant name="final_z8b" value="mod2_z8b+z8b_align"/>
+    <constant name="final_z9b" value="mod2_z9b+z9b_align"/>
+    <constant name="final_z10b" value="mod2_z10b+z10b_align"/>
+    <constant name="final_rx1b" value="mod2_rx1b+rx1b_align"/>
+    <constant name="final_rx2b" value="mod2_rx2b+rx2b_align"/>
+    <constant name="final_rx3b" value="mod2_rx3b+rx3b_align"/>
+    <constant name="final_rx4b" value="mod2_rx4b+rx4b_align"/>
+    <constant name="final_rx5b" value="mod2_rx5b+rx5b_align"/>
+    <constant name="final_rx6b" value="mod2_rx6b+rx6b_align"/>
+    <constant name="final_rx7b" value="mod2_rx7b+rx7b_align"/>
+    <constant name="final_rx8b" value="mod2_rx8b+rx8b_align"/>
+    <constant name="final_rx9b" value="mod2_rx9b+rx9b_align"/>
+    <constant name="final_rx10b" value="mod2_rx10b+rx10b_align"/>
+    <constant name="final_ry1b" value="mod2_ry1b+ry1b_align"/>
+    <constant name="final_ry2b" value="mod2_ry2b+ry2b_align"/>
+    <constant name="final_ry3b" value="mod2_ry3b+ry3b_align"/>
+    <constant name="final_ry4b" value="mod2_ry4b+ry4b_align"/>
+    <constant name="final_ry5b" value="mod2_ry5b+ry5b_align"/>
+    <constant name="final_ry6b" value="mod2_ry6b+ry6b_align"/>
+    <constant name="final_ry7b" value="mod2_ry7b+ry7b_align"/>
+    <constant name="final_ry8b" value="mod2_ry8b+ry8b_align"/>
+    <constant name="final_ry9b" value="mod2_ry9b+ry9b_align"/>
+    <constant name="final_ry10b" value="mod2_ry10b+ry10b_align"/>
+    <constant name="final_rz1b" value="mod2_rz1b+rz1b_align"/>
+    <constant name="final_rz2b" value="mod2_rz2b+rz2b_align"/>
+    <constant name="final_rz3b" value="mod2_rz3b+rz3b_align"/>
+    <constant name="final_rz4b" value="mod2_rz4b+rz4b_align"/>
+    <constant name="final_rz5b" value="mod2_rz5b+rz5b_align"/>
+    <constant name="final_rz6b" value="mod2_rz6b+rz6b_align"/>
+    <constant name="final_rz7b" value="mod2_rz7b+rz7b_align"/>
+    <constant name="final_rz8b" value="mod2_rz8b+rz8b_align"/>
+    <constant name="final_rz9b" value="mod2_rz9b+rz9b_align"/>
+    <constant name="final_rz10b" value="mod2_rz10b+rz10b_align"/>
+        
+        
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001"/>
             <fraction n="1.0" ref="Vacuum" />
@@ -822,7 +822,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v7-3/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v7-3/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v7-3/compact.xml	Wed Mar  9 11:43:24 2016
@@ -84,127 +84,127 @@
         <constant name="y9b_misalign" value="0.0" />
         <constant name="y10b_misalign" value="0.0" />
 
-		<!-- alignment corrections -->
-	<constant name="x1t_align" value="0.000000" />
-	<constant name="x2t_align" value="-0.000000" />
-	<constant name="x3t_align" value="-0.000012" />
-	<constant name="x4t_align" value="-0.017488" />
-	<constant name="x5t_align" value="-0.000064" />
-	<constant name="x6t_align" value="-0.000141" />
-	<constant name="x7t_align" value="0.000002" />
-	<constant name="x8t_align" value="0.000573" />
-	<constant name="x9t_align" value="0.000000" />
-	<constant name="x10t_align" value="-0.000000" />
-	<constant name="y1t_align" value="0.000000" />
-	<constant name="y2t_align" value="0.000000" />
-	<constant name="y3t_align" value="-0.094679" />
-	<constant name="y4t_align" value="-0.174440" />
-	<constant name="y5t_align" value="0.118670" />
-	<constant name="y6t_align" value="-0.001400" />
-	<constant name="y7t_align" value="0.047526" />
-	<constant name="y8t_align" value="0.011511" />
-	<constant name="y9t_align" value="0.000000" />
-	<constant name="y10t_align" value="0.000000" />
-	<constant name="z1t_align" value="0.000000" />
-	<constant name="z2t_align" value="0.000000" />
-	<constant name="z3t_align" value="-0.002463" />
-	<constant name="z4t_align" value="-0.003986" />
-	<constant name="z5t_align" value="0.003089" />
-	<constant name="z6t_align" value="-0.000032" />
-	<constant name="z7t_align" value="0.001236" />
-	<constant name="z8t_align" value="0.000281" />
-	<constant name="z9t_align" value="0.000000" />
-	<constant name="z10t_align" value="0.000000" />
-	<constant name="rx1t_align" value="0.000000" />
-	<constant name="rx2t_align" value="-0.000000" />
-	<constant name="rx3t_align" value="0.000000" />
-	<constant name="rx4t_align" value="-0.000000" />
-	<constant name="rx5t_align" value="0.000000" />
-	<constant name="rx6t_align" value="-0.000000" />
-	<constant name="rx7t_align" value="0.000000" />
-	<constant name="rx8t_align" value="-0.000000" />
-	<constant name="rx9t_align" value="0.000000" />
-	<constant name="rx10t_align" value="-0.000000" />
-	<constant name="ry1t_align" value="0.000000" />
-	<constant name="ry2t_align" value="0.000000" />
-	<constant name="ry3t_align" value="0.000000" />
-	<constant name="ry4t_align" value="0.000000" />
-	<constant name="ry5t_align" value="0.000000" />
-	<constant name="ry6t_align" value="0.000000" />
-	<constant name="ry7t_align" value="0.000000" />
-	<constant name="ry8t_align" value="0.000000" />
-	<constant name="ry9t_align" value="0.000000" />
-	<constant name="ry10t_align" value="0.000000" />
-	<constant name="rz1t_align" value="0.000000" />
-	<constant name="rz2t_align" value="0.000000" />
-	<constant name="rz3t_align" value="0.000000" />
-	<constant name="rz4t_align" value="0.000000" />
-	<constant name="rz5t_align" value="0.000000" />
-	<constant name="rz6t_align" value="0.000000" />
-	<constant name="rz7t_align" value="0.000000" />
-	<constant name="rz8t_align" value="0.000000" />
-	<constant name="rz9t_align" value="0.000000" />
-	<constant name="rz10t_align" value="0.000000" />
-	<constant name="x1b_align" value="0.000000" />
-	<constant name="x2b_align" value="-0.000000" />
-	<constant name="x3b_align" value="-0.068351" />
-	<constant name="x4b_align" value="0.000012" />
-	<constant name="x5b_align" value="-0.100385" />
-	<constant name="x6b_align" value="0.000012" />
-	<constant name="x7b_align" value="-0.025606" />
-	<constant name="x8b_align" value="0.000007" />
-	<constant name="x9b_align" value="0.000000" />
-	<constant name="x10b_align" value="-0.000000" />
-	<constant name="y1b_align" value="0.000000" />
-	<constant name="y2b_align" value="0.000000" />
-	<constant name="y3b_align" value="0.681109" />
-	<constant name="y4b_align" value="0.061551" />
-	<constant name="y5b_align" value="1.004204" />
-	<constant name="y6b_align" value="0.037831" />
-	<constant name="y7b_align" value="0.506463" />
-	<constant name="y8b_align" value="0.015775" />
-	<constant name="y9b_align" value="0.000000" />
-	<constant name="y10b_align" value="0.000000" />
-	<constant name="z1b_align" value="0.000000" />
-	<constant name="z2b_align" value="0.000000" />
-	<constant name="z3b_align" value="-0.013322" />
-	<constant name="z4b_align" value="-0.001371" />
-	<constant name="z5b_align" value="-0.019651" />
-	<constant name="z6b_align" value="-0.000843" />
-	<constant name="z7b_align" value="-0.010587" />
-	<constant name="z8b_align" value="-0.000352" />
-	<constant name="z9b_align" value="0.000000" />
-	<constant name="z10b_align" value="0.000000" />
-	<constant name="rx1b_align" value="0.000000" />
-	<constant name="rx2b_align" value="-0.000000" />
-	<constant name="rx3b_align" value="0.000000" />
-	<constant name="rx4b_align" value="-0.000000" />
-	<constant name="rx5b_align" value="0.000000" />
-	<constant name="rx6b_align" value="-0.000000" />
-	<constant name="rx7b_align" value="0.000000" />
-	<constant name="rx8b_align" value="-0.000000" />
-	<constant name="rx9b_align" value="0.000000" />
-	<constant name="rx10b_align" value="-0.000000" />
-	<constant name="ry1b_align" value="0.000000" />
-	<constant name="ry2b_align" value="0.000000" />
-	<constant name="ry3b_align" value="0.000000" />
-	<constant name="ry4b_align" value="0.000000" />
-	<constant name="ry5b_align" value="0.000000" />
-	<constant name="ry6b_align" value="0.000000" />
-	<constant name="ry7b_align" value="0.000000" />
-	<constant name="ry8b_align" value="0.000000" />
-	<constant name="ry9b_align" value="0.000000" />
-	<constant name="ry10b_align" value="0.000000" />
-	<constant name="rz1b_align" value="0.000000" />
-	<constant name="rz2b_align" value="0.000000" />
-	<constant name="rz3b_align" value="0.000000" />
-	<constant name="rz4b_align" value="0.000000" />
-	<constant name="rz5b_align" value="0.000000" />
-	<constant name="rz6b_align" value="0.000000" />
-	<constant name="rz7b_align" value="0.000000" />
-	<constant name="rz8b_align" value="0.000000" />
-	<constant name="rz9b_align" value="0.000000" />
-	<constant name="rz10b_align" value="0.000000" />
+        <!-- alignment corrections -->
+    <constant name="x1t_align" value="0.000000" />
+    <constant name="x2t_align" value="-0.000000" />
+    <constant name="x3t_align" value="-0.000012" />
+    <constant name="x4t_align" value="-0.017488" />
+    <constant name="x5t_align" value="-0.000064" />
+    <constant name="x6t_align" value="-0.000141" />
+    <constant name="x7t_align" value="0.000002" />
+    <constant name="x8t_align" value="0.000573" />
+    <constant name="x9t_align" value="0.000000" />
+    <constant name="x10t_align" value="-0.000000" />
+    <constant name="y1t_align" value="0.000000" />
+    <constant name="y2t_align" value="0.000000" />
+    <constant name="y3t_align" value="-0.094679" />
+    <constant name="y4t_align" value="-0.174440" />
+    <constant name="y5t_align" value="0.118670" />
+    <constant name="y6t_align" value="-0.001400" />
+    <constant name="y7t_align" value="0.047526" />
+    <constant name="y8t_align" value="0.011511" />
+    <constant name="y9t_align" value="0.000000" />
+    <constant name="y10t_align" value="0.000000" />
+    <constant name="z1t_align" value="0.000000" />
+    <constant name="z2t_align" value="0.000000" />
+    <constant name="z3t_align" value="-0.002463" />
+    <constant name="z4t_align" value="-0.003986" />
+    <constant name="z5t_align" value="0.003089" />
+    <constant name="z6t_align" value="-0.000032" />
+    <constant name="z7t_align" value="0.001236" />
+    <constant name="z8t_align" value="0.000281" />
+    <constant name="z9t_align" value="0.000000" />
+    <constant name="z10t_align" value="0.000000" />
+    <constant name="rx1t_align" value="0.000000" />
+    <constant name="rx2t_align" value="-0.000000" />
+    <constant name="rx3t_align" value="0.000000" />
+    <constant name="rx4t_align" value="-0.000000" />
+    <constant name="rx5t_align" value="0.000000" />
+    <constant name="rx6t_align" value="-0.000000" />
+    <constant name="rx7t_align" value="0.000000" />
+    <constant name="rx8t_align" value="-0.000000" />
+    <constant name="rx9t_align" value="0.000000" />
+    <constant name="rx10t_align" value="-0.000000" />
+    <constant name="ry1t_align" value="0.000000" />
+    <constant name="ry2t_align" value="0.000000" />
+    <constant name="ry3t_align" value="0.000000" />
+    <constant name="ry4t_align" value="0.000000" />
+    <constant name="ry5t_align" value="0.000000" />
+    <constant name="ry6t_align" value="0.000000" />
+    <constant name="ry7t_align" value="0.000000" />
+    <constant name="ry8t_align" value="0.000000" />
+    <constant name="ry9t_align" value="0.000000" />
+    <constant name="ry10t_align" value="0.000000" />
+    <constant name="rz1t_align" value="0.000000" />
+    <constant name="rz2t_align" value="0.000000" />
+    <constant name="rz3t_align" value="0.000000" />
+    <constant name="rz4t_align" value="0.000000" />
+    <constant name="rz5t_align" value="0.000000" />
+    <constant name="rz6t_align" value="0.000000" />
+    <constant name="rz7t_align" value="0.000000" />
+    <constant name="rz8t_align" value="0.000000" />
+    <constant name="rz9t_align" value="0.000000" />
+    <constant name="rz10t_align" value="0.000000" />
+    <constant name="x1b_align" value="0.000000" />
+    <constant name="x2b_align" value="-0.000000" />
+    <constant name="x3b_align" value="-0.068351" />
+    <constant name="x4b_align" value="0.000012" />
+    <constant name="x5b_align" value="-0.100385" />
+    <constant name="x6b_align" value="0.000012" />
+    <constant name="x7b_align" value="-0.025606" />
+    <constant name="x8b_align" value="0.000007" />
+    <constant name="x9b_align" value="0.000000" />
+    <constant name="x10b_align" value="-0.000000" />
+    <constant name="y1b_align" value="0.000000" />
+    <constant name="y2b_align" value="0.000000" />
+    <constant name="y3b_align" value="0.681109" />
+    <constant name="y4b_align" value="0.061551" />
+    <constant name="y5b_align" value="1.004204" />
+    <constant name="y6b_align" value="0.037831" />
+    <constant name="y7b_align" value="0.506463" />
+    <constant name="y8b_align" value="0.015775" />
+    <constant name="y9b_align" value="0.000000" />
+    <constant name="y10b_align" value="0.000000" />
+    <constant name="z1b_align" value="0.000000" />
+    <constant name="z2b_align" value="0.000000" />
+    <constant name="z3b_align" value="-0.013322" />
+    <constant name="z4b_align" value="-0.001371" />
+    <constant name="z5b_align" value="-0.019651" />
+    <constant name="z6b_align" value="-0.000843" />
+    <constant name="z7b_align" value="-0.010587" />
+    <constant name="z8b_align" value="-0.000352" />
+    <constant name="z9b_align" value="0.000000" />
+    <constant name="z10b_align" value="0.000000" />
+    <constant name="rx1b_align" value="0.000000" />
+    <constant name="rx2b_align" value="-0.000000" />
+    <constant name="rx3b_align" value="0.000000" />
+    <constant name="rx4b_align" value="-0.000000" />
+    <constant name="rx5b_align" value="0.000000" />
+    <constant name="rx6b_align" value="-0.000000" />
+    <constant name="rx7b_align" value="0.000000" />
+    <constant name="rx8b_align" value="-0.000000" />
+    <constant name="rx9b_align" value="0.000000" />
+    <constant name="rx10b_align" value="-0.000000" />
+    <constant name="ry1b_align" value="0.000000" />
+    <constant name="ry2b_align" value="0.000000" />
+    <constant name="ry3b_align" value="0.000000" />
+    <constant name="ry4b_align" value="0.000000" />
+    <constant name="ry5b_align" value="0.000000" />
+    <constant name="ry6b_align" value="0.000000" />
+    <constant name="ry7b_align" value="0.000000" />
+    <constant name="ry8b_align" value="0.000000" />
+    <constant name="ry9b_align" value="0.000000" />
+    <constant name="ry10b_align" value="0.000000" />
+    <constant name="rz1b_align" value="0.000000" />
+    <constant name="rz2b_align" value="0.000000" />
+    <constant name="rz3b_align" value="0.000000" />
+    <constant name="rz4b_align" value="0.000000" />
+    <constant name="rz5b_align" value="0.000000" />
+    <constant name="rz6b_align" value="0.000000" />
+    <constant name="rz7b_align" value="0.000000" />
+    <constant name="rz8b_align" value="0.000000" />
+    <constant name="rz9b_align" value="0.000000" />
+    <constant name="rz10b_align" value="0.000000" />
 
         <!-- Positions of sensor centers above/below nominal beam -->
         <constant name="y1t" value="36.894" />
@@ -604,134 +604,134 @@
         <constant name="mod2_rx10b" value="mod_rx10b" />
         <constant name="mod2_ry10b" value="mod_ry10b+y_rot_bot_pivot" />
         <constant name="mod2_rz10b" value="mod_rz10b" />
-    	
-    	<!-- final constants -->
-	<constant name="final_x1t" value="mod2_x1t+x1t_align" />
-	<constant name="final_x2t" value="mod2_x2t+x2t_align" />
-	<constant name="final_x3t" value="mod2_x3t+x3t_align" />
-	<constant name="final_x4t" value="mod2_x4t+x4t_align" />
-	<constant name="final_x5t" value="mod2_x5t+x5t_align" />
-	<constant name="final_x6t" value="mod2_x6t+x6t_align" />
-	<constant name="final_x7t" value="mod2_x7t+x7t_align" />
-	<constant name="final_x8t" value="mod2_x8t+x8t_align" />
-	<constant name="final_x9t" value="mod2_x9t+x9t_align" />
-	<constant name="final_x10t" value="mod2_x10t+x10t_align" />
-	<constant name="final_y1t" value="mod2_y1t+y1t_align" />
-	<constant name="final_y2t" value="mod2_y2t+y2t_align" />
-	<constant name="final_y3t" value="mod2_y3t+y3t_align" />
-	<constant name="final_y4t" value="mod2_y4t+y4t_align" />
-	<constant name="final_y5t" value="mod2_y5t+y5t_align" />
-	<constant name="final_y6t" value="mod2_y6t+y6t_align" />
-	<constant name="final_y7t" value="mod2_y7t+y7t_align" />
-	<constant name="final_y8t" value="mod2_y8t+y8t_align" />
-	<constant name="final_y9t" value="mod2_y9t+y9t_align" />
-	<constant name="final_y10t" value="mod2_y10t+y10t_align" />
-	<constant name="final_z1t" value="mod2_z1t+z1t_align" />
-	<constant name="final_z2t" value="mod2_z2t+z2t_align" />
-	<constant name="final_z3t" value="mod2_z3t+z3t_align" />
-	<constant name="final_z4t" value="mod2_z4t+z4t_align" />
-	<constant name="final_z5t" value="mod2_z5t+z5t_align" />
-	<constant name="final_z6t" value="mod2_z6t+z6t_align" />
-	<constant name="final_z7t" value="mod2_z7t+z7t_align" />
-	<constant name="final_z8t" value="mod2_z8t+z8t_align" />
-	<constant name="final_z9t" value="mod2_z9t+z9t_align" />
-	<constant name="final_z10t" value="mod2_z10t+z10t_align" />
-	<constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
-	<constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
-	<constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
-	<constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
-	<constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
-	<constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
-	<constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
-	<constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
-	<constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
-	<constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
-	<constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
-	<constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
-	<constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
-	<constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
-	<constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
-	<constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
-	<constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
-	<constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
-	<constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
-	<constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
-	<constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
-	<constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
-	<constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
-	<constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
-	<constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
-	<constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
-	<constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
-	<constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
-	<constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
-	<constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
-	<constant name="final_x1b" value="mod2_x1b+x1b_align" />
-	<constant name="final_x2b" value="mod2_x2b+x2b_align" />
-	<constant name="final_x3b" value="mod2_x3b+x3b_align" />
-	<constant name="final_x4b" value="mod2_x4b+x4b_align" />
-	<constant name="final_x5b" value="mod2_x5b+x5b_align" />
-	<constant name="final_x6b" value="mod2_x6b+x6b_align" />
-	<constant name="final_x7b" value="mod2_x7b+x7b_align" />
-	<constant name="final_x8b" value="mod2_x8b+x8b_align" />
-	<constant name="final_x9b" value="mod2_x9b+x9b_align" />
-	<constant name="final_x10b" value="mod2_x10b+x10b_align" />
-	<constant name="final_y1b" value="mod2_y1b+y1b_align" />
-	<constant name="final_y2b" value="mod2_y2b+y2b_align" />
-	<constant name="final_y3b" value="mod2_y3b+y3b_align" />
-	<constant name="final_y4b" value="mod2_y4b+y4b_align" />
-	<constant name="final_y5b" value="mod2_y5b+y5b_align" />
-	<constant name="final_y6b" value="mod2_y6b+y6b_align" />
-	<constant name="final_y7b" value="mod2_y7b+y7b_align" />
-	<constant name="final_y8b" value="mod2_y8b+y8b_align" />
-	<constant name="final_y9b" value="mod2_y9b+y9b_align" />
-	<constant name="final_y10b" value="mod2_y10b+y10b_align" />
-	<constant name="final_z1b" value="mod2_z1b+z1b_align" />
-	<constant name="final_z2b" value="mod2_z2b+z2b_align" />
-	<constant name="final_z3b" value="mod2_z3b+z3b_align" />
-	<constant name="final_z4b" value="mod2_z4b+z4b_align" />
-	<constant name="final_z5b" value="mod2_z5b+z5b_align" />
-	<constant name="final_z6b" value="mod2_z6b+z6b_align" />
-	<constant name="final_z7b" value="mod2_z7b+z7b_align" />
-	<constant name="final_z8b" value="mod2_z8b+z8b_align" />
-	<constant name="final_z9b" value="mod2_z9b+z9b_align" />
-	<constant name="final_z10b" value="mod2_z10b+z10b_align" />
-	<constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
-	<constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
-	<constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
-	<constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
-	<constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
-	<constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
-	<constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
-	<constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
-	<constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
-	<constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
-	<constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
-	<constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
-	<constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
-	<constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
-	<constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
-	<constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
-	<constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
-	<constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
-	<constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
-	<constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
-	<constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
-	<constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
-	<constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
-	<constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
-	<constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
-	<constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
-	<constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
-	<constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
-	<constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
-	<constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
-    	
-    	
+        
+        <!-- final constants -->
+    <constant name="final_x1t" value="mod2_x1t+x1t_align" />
+    <constant name="final_x2t" value="mod2_x2t+x2t_align" />
+    <constant name="final_x3t" value="mod2_x3t+x3t_align" />
+    <constant name="final_x4t" value="mod2_x4t+x4t_align" />
+    <constant name="final_x5t" value="mod2_x5t+x5t_align" />
+    <constant name="final_x6t" value="mod2_x6t+x6t_align" />
+    <constant name="final_x7t" value="mod2_x7t+x7t_align" />
+    <constant name="final_x8t" value="mod2_x8t+x8t_align" />
+    <constant name="final_x9t" value="mod2_x9t+x9t_align" />
+    <constant name="final_x10t" value="mod2_x10t+x10t_align" />
+    <constant name="final_y1t" value="mod2_y1t+y1t_align" />
+    <constant name="final_y2t" value="mod2_y2t+y2t_align" />
+    <constant name="final_y3t" value="mod2_y3t+y3t_align" />
+    <constant name="final_y4t" value="mod2_y4t+y4t_align" />
+    <constant name="final_y5t" value="mod2_y5t+y5t_align" />
+    <constant name="final_y6t" value="mod2_y6t+y6t_align" />
+    <constant name="final_y7t" value="mod2_y7t+y7t_align" />
+    <constant name="final_y8t" value="mod2_y8t+y8t_align" />
+    <constant name="final_y9t" value="mod2_y9t+y9t_align" />
+    <constant name="final_y10t" value="mod2_y10t+y10t_align" />
+    <constant name="final_z1t" value="mod2_z1t+z1t_align" />
+    <constant name="final_z2t" value="mod2_z2t+z2t_align" />
+    <constant name="final_z3t" value="mod2_z3t+z3t_align" />
+    <constant name="final_z4t" value="mod2_z4t+z4t_align" />
+    <constant name="final_z5t" value="mod2_z5t+z5t_align" />
+    <constant name="final_z6t" value="mod2_z6t+z6t_align" />
+    <constant name="final_z7t" value="mod2_z7t+z7t_align" />
+    <constant name="final_z8t" value="mod2_z8t+z8t_align" />
+    <constant name="final_z9t" value="mod2_z9t+z9t_align" />
+    <constant name="final_z10t" value="mod2_z10t+z10t_align" />
+    <constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
+    <constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
+    <constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
+    <constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
+    <constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
+    <constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
+    <constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
+    <constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
+    <constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
+    <constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
+    <constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
+    <constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
+    <constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
+    <constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
+    <constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
+    <constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
+    <constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
+    <constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
+    <constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
+    <constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
+    <constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
+    <constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
+    <constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
+    <constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
+    <constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
+    <constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
+    <constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
+    <constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
+    <constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
+    <constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
+    <constant name="final_x1b" value="mod2_x1b+x1b_align" />
+    <constant name="final_x2b" value="mod2_x2b+x2b_align" />
+    <constant name="final_x3b" value="mod2_x3b+x3b_align" />
+    <constant name="final_x4b" value="mod2_x4b+x4b_align" />
+    <constant name="final_x5b" value="mod2_x5b+x5b_align" />
+    <constant name="final_x6b" value="mod2_x6b+x6b_align" />
+    <constant name="final_x7b" value="mod2_x7b+x7b_align" />
+    <constant name="final_x8b" value="mod2_x8b+x8b_align" />
+    <constant name="final_x9b" value="mod2_x9b+x9b_align" />
+    <constant name="final_x10b" value="mod2_x10b+x10b_align" />
+    <constant name="final_y1b" value="mod2_y1b+y1b_align" />
+    <constant name="final_y2b" value="mod2_y2b+y2b_align" />
+    <constant name="final_y3b" value="mod2_y3b+y3b_align" />
+    <constant name="final_y4b" value="mod2_y4b+y4b_align" />
+    <constant name="final_y5b" value="mod2_y5b+y5b_align" />
+    <constant name="final_y6b" value="mod2_y6b+y6b_align" />
+    <constant name="final_y7b" value="mod2_y7b+y7b_align" />
+    <constant name="final_y8b" value="mod2_y8b+y8b_align" />
+    <constant name="final_y9b" value="mod2_y9b+y9b_align" />
+    <constant name="final_y10b" value="mod2_y10b+y10b_align" />
+    <constant name="final_z1b" value="mod2_z1b+z1b_align" />
+    <constant name="final_z2b" value="mod2_z2b+z2b_align" />
+    <constant name="final_z3b" value="mod2_z3b+z3b_align" />
+    <constant name="final_z4b" value="mod2_z4b+z4b_align" />
+    <constant name="final_z5b" value="mod2_z5b+z5b_align" />
+    <constant name="final_z6b" value="mod2_z6b+z6b_align" />
+    <constant name="final_z7b" value="mod2_z7b+z7b_align" />
+    <constant name="final_z8b" value="mod2_z8b+z8b_align" />
+    <constant name="final_z9b" value="mod2_z9b+z9b_align" />
+    <constant name="final_z10b" value="mod2_z10b+z10b_align" />
+    <constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
+    <constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
+    <constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
+    <constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
+    <constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
+    <constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
+    <constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
+    <constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
+    <constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
+    <constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
+    <constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
+    <constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
+    <constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
+    <constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
+    <constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
+    <constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
+    <constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
+    <constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
+    <constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
+    <constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
+    <constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
+    <constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
+    <constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
+    <constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
+    <constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
+    <constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
+    <constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
+    <constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
+    <constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
+    <constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
+        
+        
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001" />
             <fraction n="1.0" ref="Vacuum" />
@@ -820,7 +820,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2" />
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v7/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v7/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v7/compact.xml	Wed Mar  9 11:43:24 2016
@@ -488,7 +488,7 @@
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001"/>
             <fraction n="1.0" ref="Vacuum" />
@@ -577,7 +577,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v8-4/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v8-4/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v8-4/compact.xml	Wed Mar  9 11:43:24 2016
@@ -3,9 +3,9 @@
     
     <info name="HPS-TestRun-v8-4">
         <comment>
-		  HPS JLab Test Run detector with dipole field starting at z=0
-		  Alignment based on millepede: compact-u3-6-float-1351-v8-10k.xml
-		</comment>
+          HPS JLab Test Run detector with dipole field starting at z=0
+          Alignment based on millepede: compact-u3-6-float-1351-v8-10k.xml
+        </comment>
     </info>
 
     <define>
@@ -65,127 +65,127 @@
 <!--        <constant name="x_off" value = "-15.0"/> -->
         <constant name="x_off" value="0.0" /> 
 
-		<!-- alignment corrections -->
-	<constant name="x1t_align" value="0.000000" />
-	<constant name="x2t_align" value="0.000000" />
-	<constant name="x3t_align" value="0.000014" />
-	<constant name="x4t_align" value="0.015024" />
-	<constant name="x5t_align" value="0.000045" />
-	<constant name="x6t_align" value="-0.003411" />
-	<constant name="x7t_align" value="0.000000" />
-	<constant name="x8t_align" value="0.000000" />
-	<constant name="x9t_align" value="0.000000" />
-	<constant name="x10t_align" value="0.000000" />
-	<constant name="y1t_align" value="0.000000" />
-	<constant name="y2t_align" value="0.000000" />
-	<constant name="y3t_align" value="0.112932" />
-	<constant name="y4t_align" value="0.149860" />
-	<constant name="y5t_align" value="-0.082467" />
-	<constant name="y6t_align" value="-0.033966" />
-	<constant name="y7t_align" value="0.000000" />
-	<constant name="y8t_align" value="0.000000" />
-	<constant name="y9t_align" value="0.000000" />
-	<constant name="y10t_align" value="0.000000" />
-	<constant name="z1t_align" value="-0.000000" />
-	<constant name="z2t_align" value="0.000000" />
-	<constant name="z3t_align" value="0.002938" />
-	<constant name="z4t_align" value="0.003424" />
-	<constant name="z5t_align" value="-0.002147" />
-	<constant name="z6t_align" value="-0.000776" />
-	<constant name="z7t_align" value="-0.000000" />
-	<constant name="z8t_align" value="0.000000" />
-	<constant name="z9t_align" value="-0.000000" />
-	<constant name="z10t_align" value="0.000000" />
-	<constant name="rx1t_align" value="0.000000" />
-	<constant name="rx2t_align" value="0.000000" />
-	<constant name="rx3t_align" value="0.000000" />
-	<constant name="rx4t_align" value="0.000000" />
-	<constant name="rx5t_align" value="0.000000" />
-	<constant name="rx6t_align" value="0.000000" />
-	<constant name="rx7t_align" value="0.000000" />
-	<constant name="rx8t_align" value="0.000000" />
-	<constant name="rx9t_align" value="0.000000" />
-	<constant name="rx10t_align" value="0.000000" />
-	<constant name="ry1t_align" value="0.000000" />
-	<constant name="ry2t_align" value="0.000000" />
-	<constant name="ry3t_align" value="0.000000" />
-	<constant name="ry4t_align" value="0.000000" />
-	<constant name="ry5t_align" value="0.000000" />
-	<constant name="ry6t_align" value="0.000000" />
-	<constant name="ry7t_align" value="0.000000" />
-	<constant name="ry8t_align" value="0.000000" />
-	<constant name="ry9t_align" value="0.000000" />
-	<constant name="ry10t_align" value="0.000000" />
-	<constant name="rz1t_align" value="-0.000000" />
-	<constant name="rz2t_align" value="0.000000" />
-	<constant name="rz3t_align" value="-0.000000" />
-	<constant name="rz4t_align" value="0.000000" />
-	<constant name="rz5t_align" value="-0.000000" />
-	<constant name="rz6t_align" value="0.000000" />
-	<constant name="rz7t_align" value="-0.000000" />
-	<constant name="rz8t_align" value="0.000000" />
-	<constant name="rz9t_align" value="-0.000000" />
-	<constant name="rz10t_align" value="0.000000" />
-	<constant name="x1b_align" value="0.000000" />
-	<constant name="x2b_align" value="0.000000" />
-	<constant name="x3b_align" value="0.008443" />
-	<constant name="x4b_align" value="-0.000012" />
-	<constant name="x5b_align" value="0.004437" />
-	<constant name="x6b_align" value="-0.000010" />
-	<constant name="x7b_align" value="0.000000" />
-	<constant name="x8b_align" value="0.000000" />
-	<constant name="x9b_align" value="0.000000" />
-	<constant name="x10b_align" value="0.000000" />
-	<constant name="y1b_align" value="0.000000" />
-	<constant name="y2b_align" value="0.000000" />
-	<constant name="y3b_align" value="-0.084138" />
-	<constant name="y4b_align" value="-0.061835" />
-	<constant name="y5b_align" value="-0.044388" />
-	<constant name="y6b_align" value="-0.032317" />
-	<constant name="y7b_align" value="0.000000" />
-	<constant name="y8b_align" value="0.000000" />
-	<constant name="y9b_align" value="0.000000" />
-	<constant name="y10b_align" value="0.000000" />
-	<constant name="z1b_align" value="0.000000" />
-	<constant name="z2b_align" value="0.000000" />
-	<constant name="z3b_align" value="0.001646" />
-	<constant name="z4b_align" value="0.001377" />
-	<constant name="z5b_align" value="0.000869" />
-	<constant name="z6b_align" value="0.000720" />
-	<constant name="z7b_align" value="0.000000" />
-	<constant name="z8b_align" value="0.000000" />
-	<constant name="z9b_align" value="0.000000" />
-	<constant name="z10b_align" value="0.000000" />
-	<constant name="rx1b_align" value="0.000000" />
-	<constant name="rx2b_align" value="0.000000" />
-	<constant name="rx3b_align" value="0.000000" />
-	<constant name="rx4b_align" value="0.000000" />
-	<constant name="rx5b_align" value="0.000000" />
-	<constant name="rx6b_align" value="0.000000" />
-	<constant name="rx7b_align" value="0.000000" />
-	<constant name="rx8b_align" value="0.000000" />
-	<constant name="rx9b_align" value="0.000000" />
-	<constant name="rx10b_align" value="0.000000" />
-	<constant name="ry1b_align" value="0.000000" />
-	<constant name="ry2b_align" value="0.000000" />
-	<constant name="ry3b_align" value="0.000000" />
-	<constant name="ry4b_align" value="0.000000" />
-	<constant name="ry5b_align" value="0.000000" />
-	<constant name="ry6b_align" value="0.000000" />
-	<constant name="ry7b_align" value="0.000000" />
-	<constant name="ry8b_align" value="0.000000" />
-	<constant name="ry9b_align" value="0.000000" />
-	<constant name="ry10b_align" value="0.000000" />
-	<constant name="rz1b_align" value="0.000000" />
-	<constant name="rz2b_align" value="0.000000" />
-	<constant name="rz3b_align" value="0.000000" />
-	<constant name="rz4b_align" value="0.000000" />
-	<constant name="rz5b_align" value="0.000000" />
-	<constant name="rz6b_align" value="0.000000" />
-	<constant name="rz7b_align" value="0.000000" />
-	<constant name="rz8b_align" value="0.000000" />
-	<constant name="rz9b_align" value="0.000000" />
-	<constant name="rz10b_align" value="0.000000" />
+        <!-- alignment corrections -->
+    <constant name="x1t_align" value="0.000000" />
+    <constant name="x2t_align" value="0.000000" />
+    <constant name="x3t_align" value="0.000014" />
+    <constant name="x4t_align" value="0.015024" />
+    <constant name="x5t_align" value="0.000045" />
+    <constant name="x6t_align" value="-0.003411" />
+    <constant name="x7t_align" value="0.000000" />
+    <constant name="x8t_align" value="0.000000" />
+    <constant name="x9t_align" value="0.000000" />
+    <constant name="x10t_align" value="0.000000" />
+    <constant name="y1t_align" value="0.000000" />
+    <constant name="y2t_align" value="0.000000" />
+    <constant name="y3t_align" value="0.112932" />
+    <constant name="y4t_align" value="0.149860" />
+    <constant name="y5t_align" value="-0.082467" />
+    <constant name="y6t_align" value="-0.033966" />
+    <constant name="y7t_align" value="0.000000" />
+    <constant name="y8t_align" value="0.000000" />
+    <constant name="y9t_align" value="0.000000" />
+    <constant name="y10t_align" value="0.000000" />
+    <constant name="z1t_align" value="-0.000000" />
+    <constant name="z2t_align" value="0.000000" />
+    <constant name="z3t_align" value="0.002938" />
+    <constant name="z4t_align" value="0.003424" />
+    <constant name="z5t_align" value="-0.002147" />
+    <constant name="z6t_align" value="-0.000776" />
+    <constant name="z7t_align" value="-0.000000" />
+    <constant name="z8t_align" value="0.000000" />
+    <constant name="z9t_align" value="-0.000000" />
+    <constant name="z10t_align" value="0.000000" />
+    <constant name="rx1t_align" value="0.000000" />
+    <constant name="rx2t_align" value="0.000000" />
+    <constant name="rx3t_align" value="0.000000" />
+    <constant name="rx4t_align" value="0.000000" />
+    <constant name="rx5t_align" value="0.000000" />
+    <constant name="rx6t_align" value="0.000000" />
+    <constant name="rx7t_align" value="0.000000" />
+    <constant name="rx8t_align" value="0.000000" />
+    <constant name="rx9t_align" value="0.000000" />
+    <constant name="rx10t_align" value="0.000000" />
+    <constant name="ry1t_align" value="0.000000" />
+    <constant name="ry2t_align" value="0.000000" />
+    <constant name="ry3t_align" value="0.000000" />
+    <constant name="ry4t_align" value="0.000000" />
+    <constant name="ry5t_align" value="0.000000" />
+    <constant name="ry6t_align" value="0.000000" />
+    <constant name="ry7t_align" value="0.000000" />
+    <constant name="ry8t_align" value="0.000000" />
+    <constant name="ry9t_align" value="0.000000" />
+    <constant name="ry10t_align" value="0.000000" />
+    <constant name="rz1t_align" value="-0.000000" />
+    <constant name="rz2t_align" value="0.000000" />
+    <constant name="rz3t_align" value="-0.000000" />
+    <constant name="rz4t_align" value="0.000000" />
+    <constant name="rz5t_align" value="-0.000000" />
+    <constant name="rz6t_align" value="0.000000" />
+    <constant name="rz7t_align" value="-0.000000" />
+    <constant name="rz8t_align" value="0.000000" />
+    <constant name="rz9t_align" value="-0.000000" />
+    <constant name="rz10t_align" value="0.000000" />
+    <constant name="x1b_align" value="0.000000" />
+    <constant name="x2b_align" value="0.000000" />
+    <constant name="x3b_align" value="0.008443" />
+    <constant name="x4b_align" value="-0.000012" />
+    <constant name="x5b_align" value="0.004437" />
+    <constant name="x6b_align" value="-0.000010" />
+    <constant name="x7b_align" value="0.000000" />
+    <constant name="x8b_align" value="0.000000" />
+    <constant name="x9b_align" value="0.000000" />
+    <constant name="x10b_align" value="0.000000" />
+    <constant name="y1b_align" value="0.000000" />
+    <constant name="y2b_align" value="0.000000" />
+    <constant name="y3b_align" value="-0.084138" />
+    <constant name="y4b_align" value="-0.061835" />
+    <constant name="y5b_align" value="-0.044388" />
+    <constant name="y6b_align" value="-0.032317" />
+    <constant name="y7b_align" value="0.000000" />
+    <constant name="y8b_align" value="0.000000" />
+    <constant name="y9b_align" value="0.000000" />
+    <constant name="y10b_align" value="0.000000" />
+    <constant name="z1b_align" value="0.000000" />
+    <constant name="z2b_align" value="0.000000" />
+    <constant name="z3b_align" value="0.001646" />
+    <constant name="z4b_align" value="0.001377" />
+    <constant name="z5b_align" value="0.000869" />
+    <constant name="z6b_align" value="0.000720" />
+    <constant name="z7b_align" value="0.000000" />
+    <constant name="z8b_align" value="0.000000" />
+    <constant name="z9b_align" value="0.000000" />
+    <constant name="z10b_align" value="0.000000" />
+    <constant name="rx1b_align" value="0.000000" />
+    <constant name="rx2b_align" value="0.000000" />
+    <constant name="rx3b_align" value="0.000000" />
+    <constant name="rx4b_align" value="0.000000" />
+    <constant name="rx5b_align" value="0.000000" />
+    <constant name="rx6b_align" value="0.000000" />
+    <constant name="rx7b_align" value="0.000000" />
+    <constant name="rx8b_align" value="0.000000" />
+    <constant name="rx9b_align" value="0.000000" />
+    <constant name="rx10b_align" value="0.000000" />
+    <constant name="ry1b_align" value="0.000000" />
+    <constant name="ry2b_align" value="0.000000" />
+    <constant name="ry3b_align" value="0.000000" />
+    <constant name="ry4b_align" value="0.000000" />
+    <constant name="ry5b_align" value="0.000000" />
+    <constant name="ry6b_align" value="0.000000" />
+    <constant name="ry7b_align" value="0.000000" />
+    <constant name="ry8b_align" value="0.000000" />
+    <constant name="ry9b_align" value="0.000000" />
+    <constant name="ry10b_align" value="0.000000" />
+    <constant name="rz1b_align" value="0.000000" />
+    <constant name="rz2b_align" value="0.000000" />
+    <constant name="rz3b_align" value="0.000000" />
+    <constant name="rz4b_align" value="0.000000" />
+    <constant name="rz5b_align" value="0.000000" />
+    <constant name="rz6b_align" value="0.000000" />
+    <constant name="rz7b_align" value="0.000000" />
+    <constant name="rz8b_align" value="0.000000" />
+    <constant name="rz9b_align" value="0.000000" />
+    <constant name="rz10b_align" value="0.000000" />
 
         <!-- Positions of sensor centers above/below nominal beam -->
         <constant name="y1t" value="36.894" />
@@ -585,134 +585,134 @@
         <constant name="mod2_rx10b" value="mod_rx10b" />
         <constant name="mod2_ry10b" value="mod_ry10b+y_rot_bot_pivot" />
         <constant name="mod2_rz10b" value="mod_rz10b" />
-    	
-    	<!-- final constants -->
-	<constant name="final_x1t" value="mod2_x1t+x1t_align" />
-	<constant name="final_x2t" value="mod2_x2t+x2t_align" />
-	<constant name="final_x3t" value="mod2_x3t+x3t_align" />
-	<constant name="final_x4t" value="mod2_x4t+x4t_align" />
-	<constant name="final_x5t" value="mod2_x5t+x5t_align" />
-	<constant name="final_x6t" value="mod2_x6t+x6t_align" />
-	<constant name="final_x7t" value="mod2_x7t+x7t_align" />
-	<constant name="final_x8t" value="mod2_x8t+x8t_align" />
-	<constant name="final_x9t" value="mod2_x9t+x9t_align" />
-	<constant name="final_x10t" value="mod2_x10t+x10t_align" />
-	<constant name="final_y1t" value="mod2_y1t+y1t_align" />
-	<constant name="final_y2t" value="mod2_y2t+y2t_align" />
-	<constant name="final_y3t" value="mod2_y3t+y3t_align" />
-	<constant name="final_y4t" value="mod2_y4t+y4t_align" />
-	<constant name="final_y5t" value="mod2_y5t+y5t_align" />
-	<constant name="final_y6t" value="mod2_y6t+y6t_align" />
-	<constant name="final_y7t" value="mod2_y7t+y7t_align" />
-	<constant name="final_y8t" value="mod2_y8t+y8t_align" />
-	<constant name="final_y9t" value="mod2_y9t+y9t_align" />
-	<constant name="final_y10t" value="mod2_y10t+y10t_align" />
-	<constant name="final_z1t" value="mod2_z1t+z1t_align" />
-	<constant name="final_z2t" value="mod2_z2t+z2t_align" />
-	<constant name="final_z3t" value="mod2_z3t+z3t_align" />
-	<constant name="final_z4t" value="mod2_z4t+z4t_align" />
-	<constant name="final_z5t" value="mod2_z5t+z5t_align" />
-	<constant name="final_z6t" value="mod2_z6t+z6t_align" />
-	<constant name="final_z7t" value="mod2_z7t+z7t_align" />
-	<constant name="final_z8t" value="mod2_z8t+z8t_align" />
-	<constant name="final_z9t" value="mod2_z9t+z9t_align" />
-	<constant name="final_z10t" value="mod2_z10t+z10t_align" />
-	<constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
-	<constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
-	<constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
-	<constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
-	<constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
-	<constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
-	<constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
-	<constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
-	<constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
-	<constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
-	<constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
-	<constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
-	<constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
-	<constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
-	<constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
-	<constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
-	<constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
-	<constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
-	<constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
-	<constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
-	<constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
-	<constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
-	<constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
-	<constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
-	<constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
-	<constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
-	<constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
-	<constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
-	<constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
-	<constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
-	<constant name="final_x1b" value="mod2_x1b+x1b_align" />
-	<constant name="final_x2b" value="mod2_x2b+x2b_align" />
-	<constant name="final_x3b" value="mod2_x3b+x3b_align" />
-	<constant name="final_x4b" value="mod2_x4b+x4b_align" />
-	<constant name="final_x5b" value="mod2_x5b+x5b_align" />
-	<constant name="final_x6b" value="mod2_x6b+x6b_align" />
-	<constant name="final_x7b" value="mod2_x7b+x7b_align" />
-	<constant name="final_x8b" value="mod2_x8b+x8b_align" />
-	<constant name="final_x9b" value="mod2_x9b+x9b_align" />
-	<constant name="final_x10b" value="mod2_x10b+x10b_align" />
-	<constant name="final_y1b" value="mod2_y1b+y1b_align" />
-	<constant name="final_y2b" value="mod2_y2b+y2b_align" />
-	<constant name="final_y3b" value="mod2_y3b+y3b_align" />
-	<constant name="final_y4b" value="mod2_y4b+y4b_align" />
-	<constant name="final_y5b" value="mod2_y5b+y5b_align" />
-	<constant name="final_y6b" value="mod2_y6b+y6b_align" />
-	<constant name="final_y7b" value="mod2_y7b+y7b_align" />
-	<constant name="final_y8b" value="mod2_y8b+y8b_align" />
-	<constant name="final_y9b" value="mod2_y9b+y9b_align" />
-	<constant name="final_y10b" value="mod2_y10b+y10b_align" />
-	<constant name="final_z1b" value="mod2_z1b+z1b_align" />
-	<constant name="final_z2b" value="mod2_z2b+z2b_align" />
-	<constant name="final_z3b" value="mod2_z3b+z3b_align" />
-	<constant name="final_z4b" value="mod2_z4b+z4b_align" />
-	<constant name="final_z5b" value="mod2_z5b+z5b_align" />
-	<constant name="final_z6b" value="mod2_z6b+z6b_align" />
-	<constant name="final_z7b" value="mod2_z7b+z7b_align" />
-	<constant name="final_z8b" value="mod2_z8b+z8b_align" />
-	<constant name="final_z9b" value="mod2_z9b+z9b_align" />
-	<constant name="final_z10b" value="mod2_z10b+z10b_align" />
-	<constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
-	<constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
-	<constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
-	<constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
-	<constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
-	<constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
-	<constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
-	<constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
-	<constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
-	<constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
-	<constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
-	<constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
-	<constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
-	<constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
-	<constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
-	<constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
-	<constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
-	<constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
-	<constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
-	<constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
-	<constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
-	<constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
-	<constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
-	<constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
-	<constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
-	<constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
-	<constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
-	<constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
-	<constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
-	<constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
-    	
-    	
+        
+        <!-- final constants -->
+    <constant name="final_x1t" value="mod2_x1t+x1t_align" />
+    <constant name="final_x2t" value="mod2_x2t+x2t_align" />
+    <constant name="final_x3t" value="mod2_x3t+x3t_align" />
+    <constant name="final_x4t" value="mod2_x4t+x4t_align" />
+    <constant name="final_x5t" value="mod2_x5t+x5t_align" />
+    <constant name="final_x6t" value="mod2_x6t+x6t_align" />
+    <constant name="final_x7t" value="mod2_x7t+x7t_align" />
+    <constant name="final_x8t" value="mod2_x8t+x8t_align" />
+    <constant name="final_x9t" value="mod2_x9t+x9t_align" />
+    <constant name="final_x10t" value="mod2_x10t+x10t_align" />
+    <constant name="final_y1t" value="mod2_y1t+y1t_align" />
+    <constant name="final_y2t" value="mod2_y2t+y2t_align" />
+    <constant name="final_y3t" value="mod2_y3t+y3t_align" />
+    <constant name="final_y4t" value="mod2_y4t+y4t_align" />
+    <constant name="final_y5t" value="mod2_y5t+y5t_align" />
+    <constant name="final_y6t" value="mod2_y6t+y6t_align" />
+    <constant name="final_y7t" value="mod2_y7t+y7t_align" />
+    <constant name="final_y8t" value="mod2_y8t+y8t_align" />
+    <constant name="final_y9t" value="mod2_y9t+y9t_align" />
+    <constant name="final_y10t" value="mod2_y10t+y10t_align" />
+    <constant name="final_z1t" value="mod2_z1t+z1t_align" />
+    <constant name="final_z2t" value="mod2_z2t+z2t_align" />
+    <constant name="final_z3t" value="mod2_z3t+z3t_align" />
+    <constant name="final_z4t" value="mod2_z4t+z4t_align" />
+    <constant name="final_z5t" value="mod2_z5t+z5t_align" />
+    <constant name="final_z6t" value="mod2_z6t+z6t_align" />
+    <constant name="final_z7t" value="mod2_z7t+z7t_align" />
+    <constant name="final_z8t" value="mod2_z8t+z8t_align" />
+    <constant name="final_z9t" value="mod2_z9t+z9t_align" />
+    <constant name="final_z10t" value="mod2_z10t+z10t_align" />
+    <constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
+    <constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
+    <constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
+    <constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
+    <constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
+    <constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
+    <constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
+    <constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
+    <constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
+    <constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
+    <constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
+    <constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
+    <constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
+    <constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
+    <constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
+    <constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
+    <constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
+    <constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
+    <constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
+    <constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
+    <constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
+    <constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
+    <constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
+    <constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
+    <constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
+    <constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
+    <constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
+    <constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
+    <constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
+    <constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
+    <constant name="final_x1b" value="mod2_x1b+x1b_align" />
+    <constant name="final_x2b" value="mod2_x2b+x2b_align" />
+    <constant name="final_x3b" value="mod2_x3b+x3b_align" />
+    <constant name="final_x4b" value="mod2_x4b+x4b_align" />
+    <constant name="final_x5b" value="mod2_x5b+x5b_align" />
+    <constant name="final_x6b" value="mod2_x6b+x6b_align" />
+    <constant name="final_x7b" value="mod2_x7b+x7b_align" />
+    <constant name="final_x8b" value="mod2_x8b+x8b_align" />
+    <constant name="final_x9b" value="mod2_x9b+x9b_align" />
+    <constant name="final_x10b" value="mod2_x10b+x10b_align" />
+    <constant name="final_y1b" value="mod2_y1b+y1b_align" />
+    <constant name="final_y2b" value="mod2_y2b+y2b_align" />
+    <constant name="final_y3b" value="mod2_y3b+y3b_align" />
+    <constant name="final_y4b" value="mod2_y4b+y4b_align" />
+    <constant name="final_y5b" value="mod2_y5b+y5b_align" />
+    <constant name="final_y6b" value="mod2_y6b+y6b_align" />
+    <constant name="final_y7b" value="mod2_y7b+y7b_align" />
+    <constant name="final_y8b" value="mod2_y8b+y8b_align" />
+    <constant name="final_y9b" value="mod2_y9b+y9b_align" />
+    <constant name="final_y10b" value="mod2_y10b+y10b_align" />
+    <constant name="final_z1b" value="mod2_z1b+z1b_align" />
+    <constant name="final_z2b" value="mod2_z2b+z2b_align" />
+    <constant name="final_z3b" value="mod2_z3b+z3b_align" />
+    <constant name="final_z4b" value="mod2_z4b+z4b_align" />
+    <constant name="final_z5b" value="mod2_z5b+z5b_align" />
+    <constant name="final_z6b" value="mod2_z6b+z6b_align" />
+    <constant name="final_z7b" value="mod2_z7b+z7b_align" />
+    <constant name="final_z8b" value="mod2_z8b+z8b_align" />
+    <constant name="final_z9b" value="mod2_z9b+z9b_align" />
+    <constant name="final_z10b" value="mod2_z10b+z10b_align" />
+    <constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
+    <constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
+    <constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
+    <constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
+    <constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
+    <constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
+    <constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
+    <constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
+    <constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
+    <constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
+    <constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
+    <constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
+    <constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
+    <constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
+    <constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
+    <constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
+    <constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
+    <constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
+    <constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
+    <constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
+    <constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
+    <constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
+    <constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
+    <constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
+    <constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
+    <constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
+    <constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
+    <constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
+    <constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
+    <constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
+        
+        
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001" />
             <fraction n="1.0" ref="Vacuum" />
@@ -801,7 +801,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2" />
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v8-5/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v8-5/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v8-5/compact.xml	Wed Mar  9 11:43:24 2016
@@ -3,9 +3,9 @@
     
     <info name="HPS-TestRun-v8-5">
         <comment>
-	  HPS JLab Test Run detector with dipole field starting at z=0
-	  Based on millepede-u3-6-float-then-u7-8float-then-u3-6-float-then-u1-2-float-then-u3-6-float-then-u9-10-float-then-u7-10-float-then-u3-6-float-then-u1-4-float-then-u9-10-float-1351-v8-10k.res.txt
-	</comment>
+      HPS JLab Test Run detector with dipole field starting at z=0
+      Based on millepede-u3-6-float-then-u7-8float-then-u3-6-float-then-u1-2-float-then-u3-6-float-then-u9-10-float-then-u7-10-float-then-u3-6-float-then-u1-4-float-then-u9-10-float-1351-v8-10k.res.txt
+    </comment>
     </info>
 
     <define>
@@ -65,127 +65,127 @@
 <!--        <constant name="x_off" value = "-15.0"/> -->
         <constant name="x_off" value="0.0" /> 
 
-		<!-- alignment corrections -->
-	<constant name="x1t_align" value="0.000000" />
-	<constant name="x2t_align" value="0.000338" />
-	<constant name="x3t_align" value="0.000013" />
-	<constant name="x4t_align" value="0.014360" />
-	<constant name="x5t_align" value="0.000051" />
-	<constant name="x6t_align" value="-0.004610" />
-	<constant name="x7t_align" value="-0.000000" />
-	<constant name="x8t_align" value="-0.000200" />
-	<constant name="x9t_align" value="0.000023" />
-	<constant name="x10t_align" value="0.003314" />
-	<constant name="y1t_align" value="0.003643" />
-	<constant name="y2t_align" value="0.003372" />
-	<constant name="y3t_align" value="0.106214" />
-	<constant name="y4t_align" value="0.143235" />
-	<constant name="y5t_align" value="-0.094779" />
-	<constant name="y6t_align" value="-0.045906" />
-	<constant name="y7t_align" value="-0.004270" />
-	<constant name="y8t_align" value="-0.004014" />
-	<constant name="y9t_align" value="0.069062" />
-	<constant name="y10t_align" value="0.066775" />
-	<constant name="z1t_align" value="0.000095" />
-	<constant name="z2t_align" value="0.000077" />
-	<constant name="z3t_align" value="0.002763" />
-	<constant name="z4t_align" value="0.003273" />
-	<constant name="z5t_align" value="-0.002467" />
-	<constant name="z6t_align" value="-0.001049" />
-	<constant name="z7t_align" value="-0.000111" />
-	<constant name="z8t_align" value="-0.000098" />
-	<constant name="z9t_align" value="0.001796" />
-	<constant name="z10t_align" value="0.001633" />
-	<constant name="rx1t_align" value="0.000000" />
-	<constant name="rx2t_align" value="0.000000" />
-	<constant name="rx3t_align" value="0.000000" />
-	<constant name="rx4t_align" value="0.000000" />
-	<constant name="rx5t_align" value="0.000000" />
-	<constant name="rx6t_align" value="0.000000" />
-	<constant name="rx7t_align" value="0.000000" />
-	<constant name="rx8t_align" value="0.000000" />
-	<constant name="rx9t_align" value="0.000000" />
-	<constant name="rx10t_align" value="0.000000" />
-	<constant name="ry1t_align" value="0.000000" />
-	<constant name="ry2t_align" value="0.000000" />
-	<constant name="ry3t_align" value="0.000000" />
-	<constant name="ry4t_align" value="0.000000" />
-	<constant name="ry5t_align" value="0.000000" />
-	<constant name="ry6t_align" value="0.000000" />
-	<constant name="ry7t_align" value="0.000000" />
-	<constant name="ry8t_align" value="0.000000" />
-	<constant name="ry9t_align" value="0.000000" />
-	<constant name="ry10t_align" value="0.000000" />
-	<constant name="rz1t_align" value="-0.000000" />
-	<constant name="rz2t_align" value="0.000000" />
-	<constant name="rz3t_align" value="-0.000000" />
-	<constant name="rz4t_align" value="0.000000" />
-	<constant name="rz5t_align" value="-0.000000" />
-	<constant name="rz6t_align" value="0.000000" />
-	<constant name="rz7t_align" value="-0.000000" />
-	<constant name="rz8t_align" value="0.000000" />
-	<constant name="rz9t_align" value="-0.000000" />
-	<constant name="rz10t_align" value="0.000000" />
-	<constant name="x1b_align" value="-0.000240" />
-	<constant name="x2b_align" value="0.000001" />
-	<constant name="x3b_align" value="0.008881" />
-	<constant name="x4b_align" value="-0.000013" />
-	<constant name="x5b_align" value="0.005242" />
-	<constant name="x6b_align" value="-0.000013" />
-	<constant name="x7b_align" value="0.000171" />
-	<constant name="x8b_align" value="-0.000002" />
-	<constant name="x9b_align" value="-0.002390" />
-	<constant name="x10b_align" value="0.000002" />
-	<constant name="y1b_align" value="0.002386" />
-	<constant name="y2b_align" value="0.002507" />
-	<constant name="y3b_align" value="-0.088503" />
-	<constant name="y4b_align" value="-0.066488" />
-	<constant name="y5b_align" value="-0.052443" />
-	<constant name="y6b_align" value="-0.040809" />
-	<constant name="y7b_align" value="-0.003389" />
-	<constant name="y8b_align" value="-0.003634" />
-	<constant name="y9b_align" value="0.047254" />
-	<constant name="y10b_align" value="0.047194" />
-	<constant name="z1b_align" value="-0.000047" />
-	<constant name="z2b_align" value="-0.000056" />
-	<constant name="z3b_align" value="0.001731" />
-	<constant name="z4b_align" value="0.001481" />
-	<constant name="z5b_align" value="0.001026" />
-	<constant name="z6b_align" value="0.000909" />
-	<constant name="z7b_align" value="0.000071" />
-	<constant name="z8b_align" value="0.000081" />
-	<constant name="z9b_align" value="-0.000988" />
-	<constant name="z10b_align" value="-0.001051" />
-	<constant name="rx1b_align" value="0.000000" />
-	<constant name="rx2b_align" value="0.000000" />
-	<constant name="rx3b_align" value="0.000000" />
-	<constant name="rx4b_align" value="0.000000" />
-	<constant name="rx5b_align" value="0.000000" />
-	<constant name="rx6b_align" value="0.000000" />
-	<constant name="rx7b_align" value="0.000000" />
-	<constant name="rx8b_align" value="0.000000" />
-	<constant name="rx9b_align" value="0.000000" />
-	<constant name="rx10b_align" value="0.000000" />
-	<constant name="ry1b_align" value="0.000000" />
-	<constant name="ry2b_align" value="0.000000" />
-	<constant name="ry3b_align" value="0.000000" />
-	<constant name="ry4b_align" value="0.000000" />
-	<constant name="ry5b_align" value="0.000000" />
-	<constant name="ry6b_align" value="0.000000" />
-	<constant name="ry7b_align" value="0.000000" />
-	<constant name="ry8b_align" value="0.000000" />
-	<constant name="ry9b_align" value="0.000000" />
-	<constant name="ry10b_align" value="0.000000" />
-	<constant name="rz1b_align" value="0.000000" />
-	<constant name="rz2b_align" value="0.000000" />
-	<constant name="rz3b_align" value="0.000000" />
-	<constant name="rz4b_align" value="0.000000" />
-	<constant name="rz5b_align" value="0.000000" />
-	<constant name="rz6b_align" value="0.000000" />
-	<constant name="rz7b_align" value="0.000000" />
-	<constant name="rz8b_align" value="0.000000" />
-	<constant name="rz9b_align" value="0.000000" />
-	<constant name="rz10b_align" value="0.000000" />
+        <!-- alignment corrections -->
+    <constant name="x1t_align" value="0.000000" />
+    <constant name="x2t_align" value="0.000338" />
+    <constant name="x3t_align" value="0.000013" />
+    <constant name="x4t_align" value="0.014360" />
+    <constant name="x5t_align" value="0.000051" />
+    <constant name="x6t_align" value="-0.004610" />
+    <constant name="x7t_align" value="-0.000000" />
+    <constant name="x8t_align" value="-0.000200" />
+    <constant name="x9t_align" value="0.000023" />
+    <constant name="x10t_align" value="0.003314" />
+    <constant name="y1t_align" value="0.003643" />
+    <constant name="y2t_align" value="0.003372" />
+    <constant name="y3t_align" value="0.106214" />
+    <constant name="y4t_align" value="0.143235" />
+    <constant name="y5t_align" value="-0.094779" />
+    <constant name="y6t_align" value="-0.045906" />
+    <constant name="y7t_align" value="-0.004270" />
+    <constant name="y8t_align" value="-0.004014" />
+    <constant name="y9t_align" value="0.069062" />
+    <constant name="y10t_align" value="0.066775" />
+    <constant name="z1t_align" value="0.000095" />
+    <constant name="z2t_align" value="0.000077" />
+    <constant name="z3t_align" value="0.002763" />
+    <constant name="z4t_align" value="0.003273" />
+    <constant name="z5t_align" value="-0.002467" />
+    <constant name="z6t_align" value="-0.001049" />
+    <constant name="z7t_align" value="-0.000111" />
+    <constant name="z8t_align" value="-0.000098" />
+    <constant name="z9t_align" value="0.001796" />
+    <constant name="z10t_align" value="0.001633" />
+    <constant name="rx1t_align" value="0.000000" />
+    <constant name="rx2t_align" value="0.000000" />
+    <constant name="rx3t_align" value="0.000000" />
+    <constant name="rx4t_align" value="0.000000" />
+    <constant name="rx5t_align" value="0.000000" />
+    <constant name="rx6t_align" value="0.000000" />
+    <constant name="rx7t_align" value="0.000000" />
+    <constant name="rx8t_align" value="0.000000" />
+    <constant name="rx9t_align" value="0.000000" />
+    <constant name="rx10t_align" value="0.000000" />
+    <constant name="ry1t_align" value="0.000000" />
+    <constant name="ry2t_align" value="0.000000" />
+    <constant name="ry3t_align" value="0.000000" />
+    <constant name="ry4t_align" value="0.000000" />
+    <constant name="ry5t_align" value="0.000000" />
+    <constant name="ry6t_align" value="0.000000" />
+    <constant name="ry7t_align" value="0.000000" />
+    <constant name="ry8t_align" value="0.000000" />
+    <constant name="ry9t_align" value="0.000000" />
+    <constant name="ry10t_align" value="0.000000" />
+    <constant name="rz1t_align" value="-0.000000" />
+    <constant name="rz2t_align" value="0.000000" />
+    <constant name="rz3t_align" value="-0.000000" />
+    <constant name="rz4t_align" value="0.000000" />
+    <constant name="rz5t_align" value="-0.000000" />
+    <constant name="rz6t_align" value="0.000000" />
+    <constant name="rz7t_align" value="-0.000000" />
+    <constant name="rz8t_align" value="0.000000" />
+    <constant name="rz9t_align" value="-0.000000" />
+    <constant name="rz10t_align" value="0.000000" />
+    <constant name="x1b_align" value="-0.000240" />
+    <constant name="x2b_align" value="0.000001" />
+    <constant name="x3b_align" value="0.008881" />
+    <constant name="x4b_align" value="-0.000013" />
+    <constant name="x5b_align" value="0.005242" />
+    <constant name="x6b_align" value="-0.000013" />
+    <constant name="x7b_align" value="0.000171" />
+    <constant name="x8b_align" value="-0.000002" />
+    <constant name="x9b_align" value="-0.002390" />
+    <constant name="x10b_align" value="0.000002" />
+    <constant name="y1b_align" value="0.002386" />
+    <constant name="y2b_align" value="0.002507" />
+    <constant name="y3b_align" value="-0.088503" />
+    <constant name="y4b_align" value="-0.066488" />
+    <constant name="y5b_align" value="-0.052443" />
+    <constant name="y6b_align" value="-0.040809" />
+    <constant name="y7b_align" value="-0.003389" />
+    <constant name="y8b_align" value="-0.003634" />
+    <constant name="y9b_align" value="0.047254" />
+    <constant name="y10b_align" value="0.047194" />
+    <constant name="z1b_align" value="-0.000047" />
+    <constant name="z2b_align" value="-0.000056" />
+    <constant name="z3b_align" value="0.001731" />
+    <constant name="z4b_align" value="0.001481" />
+    <constant name="z5b_align" value="0.001026" />
+    <constant name="z6b_align" value="0.000909" />
+    <constant name="z7b_align" value="0.000071" />
+    <constant name="z8b_align" value="0.000081" />
+    <constant name="z9b_align" value="-0.000988" />
+    <constant name="z10b_align" value="-0.001051" />
+    <constant name="rx1b_align" value="0.000000" />
+    <constant name="rx2b_align" value="0.000000" />
+    <constant name="rx3b_align" value="0.000000" />
+    <constant name="rx4b_align" value="0.000000" />
+    <constant name="rx5b_align" value="0.000000" />
+    <constant name="rx6b_align" value="0.000000" />
+    <constant name="rx7b_align" value="0.000000" />
+    <constant name="rx8b_align" value="0.000000" />
+    <constant name="rx9b_align" value="0.000000" />
+    <constant name="rx10b_align" value="0.000000" />
+    <constant name="ry1b_align" value="0.000000" />
+    <constant name="ry2b_align" value="0.000000" />
+    <constant name="ry3b_align" value="0.000000" />
+    <constant name="ry4b_align" value="0.000000" />
+    <constant name="ry5b_align" value="0.000000" />
+    <constant name="ry6b_align" value="0.000000" />
+    <constant name="ry7b_align" value="0.000000" />
+    <constant name="ry8b_align" value="0.000000" />
+    <constant name="ry9b_align" value="0.000000" />
+    <constant name="ry10b_align" value="0.000000" />
+    <constant name="rz1b_align" value="0.000000" />
+    <constant name="rz2b_align" value="0.000000" />
+    <constant name="rz3b_align" value="0.000000" />
+    <constant name="rz4b_align" value="0.000000" />
+    <constant name="rz5b_align" value="0.000000" />
+    <constant name="rz6b_align" value="0.000000" />
+    <constant name="rz7b_align" value="0.000000" />
+    <constant name="rz8b_align" value="0.000000" />
+    <constant name="rz9b_align" value="0.000000" />
+    <constant name="rz10b_align" value="0.000000" />
 
         <!-- Positions of sensor centers above/below nominal beam -->
         <constant name="y1t" value="36.894" />
@@ -585,134 +585,134 @@
         <constant name="mod2_rx10b" value="mod_rx10b" />
         <constant name="mod2_ry10b" value="mod_ry10b+y_rot_bot_pivot" />
         <constant name="mod2_rz10b" value="mod_rz10b" />
-    	
-    	<!-- final constants -->
-	<constant name="final_x1t" value="mod2_x1t+x1t_align" />
-	<constant name="final_x2t" value="mod2_x2t+x2t_align" />
-	<constant name="final_x3t" value="mod2_x3t+x3t_align" />
-	<constant name="final_x4t" value="mod2_x4t+x4t_align" />
-	<constant name="final_x5t" value="mod2_x5t+x5t_align" />
-	<constant name="final_x6t" value="mod2_x6t+x6t_align" />
-	<constant name="final_x7t" value="mod2_x7t+x7t_align" />
-	<constant name="final_x8t" value="mod2_x8t+x8t_align" />
-	<constant name="final_x9t" value="mod2_x9t+x9t_align" />
-	<constant name="final_x10t" value="mod2_x10t+x10t_align" />
-	<constant name="final_y1t" value="mod2_y1t+y1t_align" />
-	<constant name="final_y2t" value="mod2_y2t+y2t_align" />
-	<constant name="final_y3t" value="mod2_y3t+y3t_align" />
-	<constant name="final_y4t" value="mod2_y4t+y4t_align" />
-	<constant name="final_y5t" value="mod2_y5t+y5t_align" />
-	<constant name="final_y6t" value="mod2_y6t+y6t_align" />
-	<constant name="final_y7t" value="mod2_y7t+y7t_align" />
-	<constant name="final_y8t" value="mod2_y8t+y8t_align" />
-	<constant name="final_y9t" value="mod2_y9t+y9t_align" />
-	<constant name="final_y10t" value="mod2_y10t+y10t_align" />
-	<constant name="final_z1t" value="mod2_z1t+z1t_align" />
-	<constant name="final_z2t" value="mod2_z2t+z2t_align" />
-	<constant name="final_z3t" value="mod2_z3t+z3t_align" />
-	<constant name="final_z4t" value="mod2_z4t+z4t_align" />
-	<constant name="final_z5t" value="mod2_z5t+z5t_align" />
-	<constant name="final_z6t" value="mod2_z6t+z6t_align" />
-	<constant name="final_z7t" value="mod2_z7t+z7t_align" />
-	<constant name="final_z8t" value="mod2_z8t+z8t_align" />
-	<constant name="final_z9t" value="mod2_z9t+z9t_align" />
-	<constant name="final_z10t" value="mod2_z10t+z10t_align" />
-	<constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
-	<constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
-	<constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
-	<constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
-	<constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
-	<constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
-	<constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
-	<constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
-	<constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
-	<constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
-	<constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
-	<constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
-	<constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
-	<constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
-	<constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
-	<constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
-	<constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
-	<constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
-	<constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
-	<constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
-	<constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
-	<constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
-	<constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
-	<constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
-	<constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
-	<constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
-	<constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
-	<constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
-	<constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
-	<constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
-	<constant name="final_x1b" value="mod2_x1b+x1b_align" />
-	<constant name="final_x2b" value="mod2_x2b+x2b_align" />
-	<constant name="final_x3b" value="mod2_x3b+x3b_align" />
-	<constant name="final_x4b" value="mod2_x4b+x4b_align" />
-	<constant name="final_x5b" value="mod2_x5b+x5b_align" />
-	<constant name="final_x6b" value="mod2_x6b+x6b_align" />
-	<constant name="final_x7b" value="mod2_x7b+x7b_align" />
-	<constant name="final_x8b" value="mod2_x8b+x8b_align" />
-	<constant name="final_x9b" value="mod2_x9b+x9b_align" />
-	<constant name="final_x10b" value="mod2_x10b+x10b_align" />
-	<constant name="final_y1b" value="mod2_y1b+y1b_align" />
-	<constant name="final_y2b" value="mod2_y2b+y2b_align" />
-	<constant name="final_y3b" value="mod2_y3b+y3b_align" />
-	<constant name="final_y4b" value="mod2_y4b+y4b_align" />
-	<constant name="final_y5b" value="mod2_y5b+y5b_align" />
-	<constant name="final_y6b" value="mod2_y6b+y6b_align" />
-	<constant name="final_y7b" value="mod2_y7b+y7b_align" />
-	<constant name="final_y8b" value="mod2_y8b+y8b_align" />
-	<constant name="final_y9b" value="mod2_y9b+y9b_align" />
-	<constant name="final_y10b" value="mod2_y10b+y10b_align" />
-	<constant name="final_z1b" value="mod2_z1b+z1b_align" />
-	<constant name="final_z2b" value="mod2_z2b+z2b_align" />
-	<constant name="final_z3b" value="mod2_z3b+z3b_align" />
-	<constant name="final_z4b" value="mod2_z4b+z4b_align" />
-	<constant name="final_z5b" value="mod2_z5b+z5b_align" />
-	<constant name="final_z6b" value="mod2_z6b+z6b_align" />
-	<constant name="final_z7b" value="mod2_z7b+z7b_align" />
-	<constant name="final_z8b" value="mod2_z8b+z8b_align" />
-	<constant name="final_z9b" value="mod2_z9b+z9b_align" />
-	<constant name="final_z10b" value="mod2_z10b+z10b_align" />
-	<constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
-	<constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
-	<constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
-	<constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
-	<constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
-	<constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
-	<constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
-	<constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
-	<constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
-	<constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
-	<constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
-	<constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
-	<constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
-	<constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
-	<constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
-	<constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
-	<constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
-	<constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
-	<constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
-	<constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
-	<constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
-	<constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
-	<constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
-	<constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
-	<constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
-	<constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
-	<constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
-	<constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
-	<constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
-	<constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
-    	
-    	
+        
+        <!-- final constants -->
+    <constant name="final_x1t" value="mod2_x1t+x1t_align" />
+    <constant name="final_x2t" value="mod2_x2t+x2t_align" />
+    <constant name="final_x3t" value="mod2_x3t+x3t_align" />
+    <constant name="final_x4t" value="mod2_x4t+x4t_align" />
+    <constant name="final_x5t" value="mod2_x5t+x5t_align" />
+    <constant name="final_x6t" value="mod2_x6t+x6t_align" />
+    <constant name="final_x7t" value="mod2_x7t+x7t_align" />
+    <constant name="final_x8t" value="mod2_x8t+x8t_align" />
+    <constant name="final_x9t" value="mod2_x9t+x9t_align" />
+    <constant name="final_x10t" value="mod2_x10t+x10t_align" />
+    <constant name="final_y1t" value="mod2_y1t+y1t_align" />
+    <constant name="final_y2t" value="mod2_y2t+y2t_align" />
+    <constant name="final_y3t" value="mod2_y3t+y3t_align" />
+    <constant name="final_y4t" value="mod2_y4t+y4t_align" />
+    <constant name="final_y5t" value="mod2_y5t+y5t_align" />
+    <constant name="final_y6t" value="mod2_y6t+y6t_align" />
+    <constant name="final_y7t" value="mod2_y7t+y7t_align" />
+    <constant name="final_y8t" value="mod2_y8t+y8t_align" />
+    <constant name="final_y9t" value="mod2_y9t+y9t_align" />
+    <constant name="final_y10t" value="mod2_y10t+y10t_align" />
+    <constant name="final_z1t" value="mod2_z1t+z1t_align" />
+    <constant name="final_z2t" value="mod2_z2t+z2t_align" />
+    <constant name="final_z3t" value="mod2_z3t+z3t_align" />
+    <constant name="final_z4t" value="mod2_z4t+z4t_align" />
+    <constant name="final_z5t" value="mod2_z5t+z5t_align" />
+    <constant name="final_z6t" value="mod2_z6t+z6t_align" />
+    <constant name="final_z7t" value="mod2_z7t+z7t_align" />
+    <constant name="final_z8t" value="mod2_z8t+z8t_align" />
+    <constant name="final_z9t" value="mod2_z9t+z9t_align" />
+    <constant name="final_z10t" value="mod2_z10t+z10t_align" />
+    <constant name="final_rx1t" value="mod2_rx1t+rx1t_align" />
+    <constant name="final_rx2t" value="mod2_rx2t+rx2t_align" />
+    <constant name="final_rx3t" value="mod2_rx3t+rx3t_align" />
+    <constant name="final_rx4t" value="mod2_rx4t+rx4t_align" />
+    <constant name="final_rx5t" value="mod2_rx5t+rx5t_align" />
+    <constant name="final_rx6t" value="mod2_rx6t+rx6t_align" />
+    <constant name="final_rx7t" value="mod2_rx7t+rx7t_align" />
+    <constant name="final_rx8t" value="mod2_rx8t+rx8t_align" />
+    <constant name="final_rx9t" value="mod2_rx9t+rx9t_align" />
+    <constant name="final_rx10t" value="mod2_rx10t+rx10t_align" />
+    <constant name="final_ry1t" value="mod2_ry1t+ry1t_align" />
+    <constant name="final_ry2t" value="mod2_ry2t+ry2t_align" />
+    <constant name="final_ry3t" value="mod2_ry3t+ry3t_align" />
+    <constant name="final_ry4t" value="mod2_ry4t+ry4t_align" />
+    <constant name="final_ry5t" value="mod2_ry5t+ry5t_align" />
+    <constant name="final_ry6t" value="mod2_ry6t+ry6t_align" />
+    <constant name="final_ry7t" value="mod2_ry7t+ry7t_align" />
+    <constant name="final_ry8t" value="mod2_ry8t+ry8t_align" />
+    <constant name="final_ry9t" value="mod2_ry9t+ry9t_align" />
+    <constant name="final_ry10t" value="mod2_ry10t+ry10t_align" />
+    <constant name="final_rz1t" value="mod2_rz1t+rz1t_align" />
+    <constant name="final_rz2t" value="mod2_rz2t+rz2t_align" />
+    <constant name="final_rz3t" value="mod2_rz3t+rz3t_align" />
+    <constant name="final_rz4t" value="mod2_rz4t+rz4t_align" />
+    <constant name="final_rz5t" value="mod2_rz5t+rz5t_align" />
+    <constant name="final_rz6t" value="mod2_rz6t+rz6t_align" />
+    <constant name="final_rz7t" value="mod2_rz7t+rz7t_align" />
+    <constant name="final_rz8t" value="mod2_rz8t+rz8t_align" />
+    <constant name="final_rz9t" value="mod2_rz9t+rz9t_align" />
+    <constant name="final_rz10t" value="mod2_rz10t+rz10t_align" />
+    <constant name="final_x1b" value="mod2_x1b+x1b_align" />
+    <constant name="final_x2b" value="mod2_x2b+x2b_align" />
+    <constant name="final_x3b" value="mod2_x3b+x3b_align" />
+    <constant name="final_x4b" value="mod2_x4b+x4b_align" />
+    <constant name="final_x5b" value="mod2_x5b+x5b_align" />
+    <constant name="final_x6b" value="mod2_x6b+x6b_align" />
+    <constant name="final_x7b" value="mod2_x7b+x7b_align" />
+    <constant name="final_x8b" value="mod2_x8b+x8b_align" />
+    <constant name="final_x9b" value="mod2_x9b+x9b_align" />
+    <constant name="final_x10b" value="mod2_x10b+x10b_align" />
+    <constant name="final_y1b" value="mod2_y1b+y1b_align" />
+    <constant name="final_y2b" value="mod2_y2b+y2b_align" />
+    <constant name="final_y3b" value="mod2_y3b+y3b_align" />
+    <constant name="final_y4b" value="mod2_y4b+y4b_align" />
+    <constant name="final_y5b" value="mod2_y5b+y5b_align" />
+    <constant name="final_y6b" value="mod2_y6b+y6b_align" />
+    <constant name="final_y7b" value="mod2_y7b+y7b_align" />
+    <constant name="final_y8b" value="mod2_y8b+y8b_align" />
+    <constant name="final_y9b" value="mod2_y9b+y9b_align" />
+    <constant name="final_y10b" value="mod2_y10b+y10b_align" />
+    <constant name="final_z1b" value="mod2_z1b+z1b_align" />
+    <constant name="final_z2b" value="mod2_z2b+z2b_align" />
+    <constant name="final_z3b" value="mod2_z3b+z3b_align" />
+    <constant name="final_z4b" value="mod2_z4b+z4b_align" />
+    <constant name="final_z5b" value="mod2_z5b+z5b_align" />
+    <constant name="final_z6b" value="mod2_z6b+z6b_align" />
+    <constant name="final_z7b" value="mod2_z7b+z7b_align" />
+    <constant name="final_z8b" value="mod2_z8b+z8b_align" />
+    <constant name="final_z9b" value="mod2_z9b+z9b_align" />
+    <constant name="final_z10b" value="mod2_z10b+z10b_align" />
+    <constant name="final_rx1b" value="mod2_rx1b+rx1b_align" />
+    <constant name="final_rx2b" value="mod2_rx2b+rx2b_align" />
+    <constant name="final_rx3b" value="mod2_rx3b+rx3b_align" />
+    <constant name="final_rx4b" value="mod2_rx4b+rx4b_align" />
+    <constant name="final_rx5b" value="mod2_rx5b+rx5b_align" />
+    <constant name="final_rx6b" value="mod2_rx6b+rx6b_align" />
+    <constant name="final_rx7b" value="mod2_rx7b+rx7b_align" />
+    <constant name="final_rx8b" value="mod2_rx8b+rx8b_align" />
+    <constant name="final_rx9b" value="mod2_rx9b+rx9b_align" />
+    <constant name="final_rx10b" value="mod2_rx10b+rx10b_align" />
+    <constant name="final_ry1b" value="mod2_ry1b+ry1b_align" />
+    <constant name="final_ry2b" value="mod2_ry2b+ry2b_align" />
+    <constant name="final_ry3b" value="mod2_ry3b+ry3b_align" />
+    <constant name="final_ry4b" value="mod2_ry4b+ry4b_align" />
+    <constant name="final_ry5b" value="mod2_ry5b+ry5b_align" />
+    <constant name="final_ry6b" value="mod2_ry6b+ry6b_align" />
+    <constant name="final_ry7b" value="mod2_ry7b+ry7b_align" />
+    <constant name="final_ry8b" value="mod2_ry8b+ry8b_align" />
+    <constant name="final_ry9b" value="mod2_ry9b+ry9b_align" />
+    <constant name="final_ry10b" value="mod2_ry10b+ry10b_align" />
+    <constant name="final_rz1b" value="mod2_rz1b+rz1b_align" />
+    <constant name="final_rz2b" value="mod2_rz2b+rz2b_align" />
+    <constant name="final_rz3b" value="mod2_rz3b+rz3b_align" />
+    <constant name="final_rz4b" value="mod2_rz4b+rz4b_align" />
+    <constant name="final_rz5b" value="mod2_rz5b+rz5b_align" />
+    <constant name="final_rz6b" value="mod2_rz6b+rz6b_align" />
+    <constant name="final_rz7b" value="mod2_rz7b+rz7b_align" />
+    <constant name="final_rz8b" value="mod2_rz8b+rz8b_align" />
+    <constant name="final_rz9b" value="mod2_rz9b+rz9b_align" />
+    <constant name="final_rz10b" value="mod2_rz10b+rz10b_align" />
+        
+        
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001" />
             <fraction n="1.0" ref="Vacuum" />
@@ -801,7 +801,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2" />
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPS-TestRun-v8/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPS-TestRun-v8/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPS-TestRun-v8/compact.xml	Wed Mar  9 11:43:24 2016
@@ -64,127 +64,127 @@
 <!--        <constant name="x_off" value = "-15.0"/> -->
         <constant name="x_off" value = "0.0"/> 
 
-		<!-- alignment corrections -->
-	<constant name="x1t_align" value="0.000000"/>
-	<constant name="x2t_align" value="0.000000"/>
-	<constant name="x3t_align" value="0.000000"/>
-	<constant name="x4t_align" value="0.000000"/>
-	<constant name="x5t_align" value="0.000000"/>
-	<constant name="x6t_align" value="0.000000"/>
-	<constant name="x7t_align" value="0.000000"/>
-	<constant name="x8t_align" value="0.000000"/>
-	<constant name="x9t_align" value="0.000000"/>
-	<constant name="x10t_align" value="0.000000"/>
-	<constant name="y1t_align" value="0.000000"/>
-	<constant name="y2t_align" value="0.000000"/>
-	<constant name="y3t_align" value="0.000000"/>
-	<constant name="y4t_align" value="0.000000"/>
-	<constant name="y5t_align" value="0.000000"/>
-	<constant name="y6t_align" value="0.000000"/>
-	<constant name="y7t_align" value="0.000000"/>
-	<constant name="y8t_align" value="0.000000"/>
-	<constant name="y9t_align" value="0.000000"/>
-	<constant name="y10t_align" value="0.000000"/>
-	<constant name="z1t_align" value="0.000000"/>
-	<constant name="z2t_align" value="0.000000"/>
-	<constant name="z3t_align" value="0.000000"/>
-	<constant name="z4t_align" value="0.000000"/>
-	<constant name="z5t_align" value="0.000000"/>
-	<constant name="z6t_align" value="0.000000"/>
-	<constant name="z7t_align" value="0.000000"/>
-	<constant name="z8t_align" value="0.000000"/>
-	<constant name="z9t_align" value="0.000000"/>
-	<constant name="z10t_align" value="0.000000"/>
-	<constant name="rx1t_align" value="0.000000"/>
-	<constant name="rx2t_align" value="0.000000"/>
-	<constant name="rx3t_align" value="0.000000"/>
-	<constant name="rx4t_align" value="0.000000"/>
-	<constant name="rx5t_align" value="0.000000"/>
-	<constant name="rx6t_align" value="0.000000"/>
-	<constant name="rx7t_align" value="0.000000"/>
-	<constant name="rx8t_align" value="0.000000"/>
-	<constant name="rx9t_align" value="0.000000"/>
-	<constant name="rx10t_align" value="0.000000"/>
-	<constant name="ry1t_align" value="0.000000"/>
-	<constant name="ry2t_align" value="0.000000"/>
-	<constant name="ry3t_align" value="0.000000"/>
-	<constant name="ry4t_align" value="0.000000"/>
-	<constant name="ry5t_align" value="0.000000"/>
-	<constant name="ry6t_align" value="0.000000"/>
-	<constant name="ry7t_align" value="0.000000"/>
-	<constant name="ry8t_align" value="0.000000"/>
-	<constant name="ry9t_align" value="0.000000"/>
-	<constant name="ry10t_align" value="0.000000"/>
-	<constant name="rz1t_align" value="0.000000"/>
-	<constant name="rz2t_align" value="0.000000"/>
-	<constant name="rz3t_align" value="0.000000"/>
-	<constant name="rz4t_align" value="0.000000"/>
-	<constant name="rz5t_align" value="0.000000"/>
-	<constant name="rz6t_align" value="0.000000"/>
-	<constant name="rz7t_align" value="0.000000"/>
-	<constant name="rz8t_align" value="0.000000"/>
-	<constant name="rz9t_align" value="0.000000"/>
-	<constant name="rz10t_align" value="0.000000"/>
-	<constant name="x1b_align" value="0.000000"/>
-	<constant name="x2b_align" value="0.000000"/>
-	<constant name="x3b_align" value="0.000000"/>
-	<constant name="x4b_align" value="0.000000"/>
-	<constant name="x5b_align" value="0.000000"/>
-	<constant name="x6b_align" value="0.000000"/>
-	<constant name="x7b_align" value="0.000000"/>
-	<constant name="x8b_align" value="0.000000"/>
-	<constant name="x9b_align" value="0.000000"/>
-	<constant name="x10b_align" value="0.000000"/>
-	<constant name="y1b_align" value="0.000000"/>
-	<constant name="y2b_align" value="0.000000"/>
-	<constant name="y3b_align" value="0.000000"/>
-	<constant name="y4b_align" value="0.000000"/>
-	<constant name="y5b_align" value="0.000000"/>
-	<constant name="y6b_align" value="0.000000"/>
-	<constant name="y7b_align" value="0.000000"/>
-	<constant name="y8b_align" value="0.000000"/>
-	<constant name="y9b_align" value="0.000000"/>
-	<constant name="y10b_align" value="0.000000"/>
-	<constant name="z1b_align" value="0.000000"/>
-	<constant name="z2b_align" value="0.000000"/>
-	<constant name="z3b_align" value="0.000000"/>
-	<constant name="z4b_align" value="0.000000"/>
-	<constant name="z5b_align" value="0.000000"/>
-	<constant name="z6b_align" value="0.000000"/>
-	<constant name="z7b_align" value="0.000000"/>
-	<constant name="z8b_align" value="0.000000"/>
-	<constant name="z9b_align" value="0.000000"/>
-	<constant name="z10b_align" value="0.000000"/>
-	<constant name="rx1b_align" value="0.000000"/>
-	<constant name="rx2b_align" value="0.000000"/>
-	<constant name="rx3b_align" value="0.000000"/>
-	<constant name="rx4b_align" value="0.000000"/>
-	<constant name="rx5b_align" value="0.000000"/>
-	<constant name="rx6b_align" value="0.000000"/>
-	<constant name="rx7b_align" value="0.000000"/>
-	<constant name="rx8b_align" value="0.000000"/>
-	<constant name="rx9b_align" value="0.000000"/>
-	<constant name="rx10b_align" value="0.000000"/>
-	<constant name="ry1b_align" value="0.000000"/>
-	<constant name="ry2b_align" value="0.000000"/>
-	<constant name="ry3b_align" value="0.000000"/>
-	<constant name="ry4b_align" value="0.000000"/>
-	<constant name="ry5b_align" value="0.000000"/>
-	<constant name="ry6b_align" value="0.000000"/>
-	<constant name="ry7b_align" value="0.000000"/>
-	<constant name="ry8b_align" value="0.000000"/>
-	<constant name="ry9b_align" value="0.000000"/>
-	<constant name="ry10b_align" value="0.000000"/>
-	<constant name="rz1b_align" value="0.000000"/>
-	<constant name="rz2b_align" value="0.000000"/>
-	<constant name="rz3b_align" value="0.000000"/>
-	<constant name="rz4b_align" value="0.000000"/>
-	<constant name="rz5b_align" value="0.000000"/>
-	<constant name="rz6b_align" value="0.000000"/>
-	<constant name="rz7b_align" value="0.000000"/>
-	<constant name="rz8b_align" value="0.000000"/>
-	<constant name="rz9b_align" value="0.000000"/>
-	<constant name="rz10b_align" value="0.000000"/>
+        <!-- alignment corrections -->
+    <constant name="x1t_align" value="0.000000"/>
+    <constant name="x2t_align" value="0.000000"/>
+    <constant name="x3t_align" value="0.000000"/>
+    <constant name="x4t_align" value="0.000000"/>
+    <constant name="x5t_align" value="0.000000"/>
+    <constant name="x6t_align" value="0.000000"/>
+    <constant name="x7t_align" value="0.000000"/>
+    <constant name="x8t_align" value="0.000000"/>
+    <constant name="x9t_align" value="0.000000"/>
+    <constant name="x10t_align" value="0.000000"/>
+    <constant name="y1t_align" value="0.000000"/>
+    <constant name="y2t_align" value="0.000000"/>
+    <constant name="y3t_align" value="0.000000"/>
+    <constant name="y4t_align" value="0.000000"/>
+    <constant name="y5t_align" value="0.000000"/>
+    <constant name="y6t_align" value="0.000000"/>
+    <constant name="y7t_align" value="0.000000"/>
+    <constant name="y8t_align" value="0.000000"/>
+    <constant name="y9t_align" value="0.000000"/>
+    <constant name="y10t_align" value="0.000000"/>
+    <constant name="z1t_align" value="0.000000"/>
+    <constant name="z2t_align" value="0.000000"/>
+    <constant name="z3t_align" value="0.000000"/>
+    <constant name="z4t_align" value="0.000000"/>
+    <constant name="z5t_align" value="0.000000"/>
+    <constant name="z6t_align" value="0.000000"/>
+    <constant name="z7t_align" value="0.000000"/>
+    <constant name="z8t_align" value="0.000000"/>
+    <constant name="z9t_align" value="0.000000"/>
+    <constant name="z10t_align" value="0.000000"/>
+    <constant name="rx1t_align" value="0.000000"/>
+    <constant name="rx2t_align" value="0.000000"/>
+    <constant name="rx3t_align" value="0.000000"/>
+    <constant name="rx4t_align" value="0.000000"/>
+    <constant name="rx5t_align" value="0.000000"/>
+    <constant name="rx6t_align" value="0.000000"/>
+    <constant name="rx7t_align" value="0.000000"/>
+    <constant name="rx8t_align" value="0.000000"/>
+    <constant name="rx9t_align" value="0.000000"/>
+    <constant name="rx10t_align" value="0.000000"/>
+    <constant name="ry1t_align" value="0.000000"/>
+    <constant name="ry2t_align" value="0.000000"/>
+    <constant name="ry3t_align" value="0.000000"/>
+    <constant name="ry4t_align" value="0.000000"/>
+    <constant name="ry5t_align" value="0.000000"/>
+    <constant name="ry6t_align" value="0.000000"/>
+    <constant name="ry7t_align" value="0.000000"/>
+    <constant name="ry8t_align" value="0.000000"/>
+    <constant name="ry9t_align" value="0.000000"/>
+    <constant name="ry10t_align" value="0.000000"/>
+    <constant name="rz1t_align" value="0.000000"/>
+    <constant name="rz2t_align" value="0.000000"/>
+    <constant name="rz3t_align" value="0.000000"/>
+    <constant name="rz4t_align" value="0.000000"/>
+    <constant name="rz5t_align" value="0.000000"/>
+    <constant name="rz6t_align" value="0.000000"/>
+    <constant name="rz7t_align" value="0.000000"/>
+    <constant name="rz8t_align" value="0.000000"/>
+    <constant name="rz9t_align" value="0.000000"/>
+    <constant name="rz10t_align" value="0.000000"/>
+    <constant name="x1b_align" value="0.000000"/>
+    <constant name="x2b_align" value="0.000000"/>
+    <constant name="x3b_align" value="0.000000"/>
+    <constant name="x4b_align" value="0.000000"/>
+    <constant name="x5b_align" value="0.000000"/>
+    <constant name="x6b_align" value="0.000000"/>
+    <constant name="x7b_align" value="0.000000"/>
+    <constant name="x8b_align" value="0.000000"/>
+    <constant name="x9b_align" value="0.000000"/>
+    <constant name="x10b_align" value="0.000000"/>
+    <constant name="y1b_align" value="0.000000"/>
+    <constant name="y2b_align" value="0.000000"/>
+    <constant name="y3b_align" value="0.000000"/>
+    <constant name="y4b_align" value="0.000000"/>
+    <constant name="y5b_align" value="0.000000"/>
+    <constant name="y6b_align" value="0.000000"/>
+    <constant name="y7b_align" value="0.000000"/>
+    <constant name="y8b_align" value="0.000000"/>
+    <constant name="y9b_align" value="0.000000"/>
+    <constant name="y10b_align" value="0.000000"/>
+    <constant name="z1b_align" value="0.000000"/>
+    <constant name="z2b_align" value="0.000000"/>
+    <constant name="z3b_align" value="0.000000"/>
+    <constant name="z4b_align" value="0.000000"/>
+    <constant name="z5b_align" value="0.000000"/>
+    <constant name="z6b_align" value="0.000000"/>
+    <constant name="z7b_align" value="0.000000"/>
+    <constant name="z8b_align" value="0.000000"/>
+    <constant name="z9b_align" value="0.000000"/>
+    <constant name="z10b_align" value="0.000000"/>
+    <constant name="rx1b_align" value="0.000000"/>
+    <constant name="rx2b_align" value="0.000000"/>
+    <constant name="rx3b_align" value="0.000000"/>
+    <constant name="rx4b_align" value="0.000000"/>
+    <constant name="rx5b_align" value="0.000000"/>
+    <constant name="rx6b_align" value="0.000000"/>
+    <constant name="rx7b_align" value="0.000000"/>
+    <constant name="rx8b_align" value="0.000000"/>
+    <constant name="rx9b_align" value="0.000000"/>
+    <constant name="rx10b_align" value="0.000000"/>
+    <constant name="ry1b_align" value="0.000000"/>
+    <constant name="ry2b_align" value="0.000000"/>
+    <constant name="ry3b_align" value="0.000000"/>
+    <constant name="ry4b_align" value="0.000000"/>
+    <constant name="ry5b_align" value="0.000000"/>
+    <constant name="ry6b_align" value="0.000000"/>
+    <constant name="ry7b_align" value="0.000000"/>
+    <constant name="ry8b_align" value="0.000000"/>
+    <constant name="ry9b_align" value="0.000000"/>
+    <constant name="ry10b_align" value="0.000000"/>
+    <constant name="rz1b_align" value="0.000000"/>
+    <constant name="rz2b_align" value="0.000000"/>
+    <constant name="rz3b_align" value="0.000000"/>
+    <constant name="rz4b_align" value="0.000000"/>
+    <constant name="rz5b_align" value="0.000000"/>
+    <constant name="rz6b_align" value="0.000000"/>
+    <constant name="rz7b_align" value="0.000000"/>
+    <constant name="rz8b_align" value="0.000000"/>
+    <constant name="rz9b_align" value="0.000000"/>
+    <constant name="rz10b_align" value="0.000000"/>
 
         <!-- Positions of sensor centers above/below nominal beam -->
         <constant name="y1t" value="36.894" />
@@ -584,134 +584,134 @@
         <constant name="mod2_rx10b" value="mod_rx10b"/>
         <constant name="mod2_ry10b" value="mod_ry10b+y_rot_bot_pivot"/>
         <constant name="mod2_rz10b" value="mod_rz10b"/>
-    	
-    	<!-- final constants -->
-	<constant name="final_x1t" value="mod2_x1t+x1t_align"/>
-	<constant name="final_x2t" value="mod2_x2t+x2t_align"/>
-	<constant name="final_x3t" value="mod2_x3t+x3t_align"/>
-	<constant name="final_x4t" value="mod2_x4t+x4t_align"/>
-	<constant name="final_x5t" value="mod2_x5t+x5t_align"/>
-	<constant name="final_x6t" value="mod2_x6t+x6t_align"/>
-	<constant name="final_x7t" value="mod2_x7t+x7t_align"/>
-	<constant name="final_x8t" value="mod2_x8t+x8t_align"/>
-	<constant name="final_x9t" value="mod2_x9t+x9t_align"/>
-	<constant name="final_x10t" value="mod2_x10t+x10t_align"/>
-	<constant name="final_y1t" value="mod2_y1t+y1t_align"/>
-	<constant name="final_y2t" value="mod2_y2t+y2t_align"/>
-	<constant name="final_y3t" value="mod2_y3t+y3t_align"/>
-	<constant name="final_y4t" value="mod2_y4t+y4t_align"/>
-	<constant name="final_y5t" value="mod2_y5t+y5t_align"/>
-	<constant name="final_y6t" value="mod2_y6t+y6t_align"/>
-	<constant name="final_y7t" value="mod2_y7t+y7t_align"/>
-	<constant name="final_y8t" value="mod2_y8t+y8t_align"/>
-	<constant name="final_y9t" value="mod2_y9t+y9t_align"/>
-	<constant name="final_y10t" value="mod2_y10t+y10t_align"/>
-	<constant name="final_z1t" value="mod2_z1t+z1t_align"/>
-	<constant name="final_z2t" value="mod2_z2t+z2t_align"/>
-	<constant name="final_z3t" value="mod2_z3t+z3t_align"/>
-	<constant name="final_z4t" value="mod2_z4t+z4t_align"/>
-	<constant name="final_z5t" value="mod2_z5t+z5t_align"/>
-	<constant name="final_z6t" value="mod2_z6t+z6t_align"/>
-	<constant name="final_z7t" value="mod2_z7t+z7t_align"/>
-	<constant name="final_z8t" value="mod2_z8t+z8t_align"/>
-	<constant name="final_z9t" value="mod2_z9t+z9t_align"/>
-	<constant name="final_z10t" value="mod2_z10t+z10t_align"/>
-	<constant name="final_rx1t" value="mod2_rx1t+rx1t_align"/>
-	<constant name="final_rx2t" value="mod2_rx2t+rx2t_align"/>
-	<constant name="final_rx3t" value="mod2_rx3t+rx3t_align"/>
-	<constant name="final_rx4t" value="mod2_rx4t+rx4t_align"/>
-	<constant name="final_rx5t" value="mod2_rx5t+rx5t_align"/>
-	<constant name="final_rx6t" value="mod2_rx6t+rx6t_align"/>
-	<constant name="final_rx7t" value="mod2_rx7t+rx7t_align"/>
-	<constant name="final_rx8t" value="mod2_rx8t+rx8t_align"/>
-	<constant name="final_rx9t" value="mod2_rx9t+rx9t_align"/>
-	<constant name="final_rx10t" value="mod2_rx10t+rx10t_align"/>
-	<constant name="final_ry1t" value="mod2_ry1t+ry1t_align"/>
-	<constant name="final_ry2t" value="mod2_ry2t+ry2t_align"/>
-	<constant name="final_ry3t" value="mod2_ry3t+ry3t_align"/>
-	<constant name="final_ry4t" value="mod2_ry4t+ry4t_align"/>
-	<constant name="final_ry5t" value="mod2_ry5t+ry5t_align"/>
-	<constant name="final_ry6t" value="mod2_ry6t+ry6t_align"/>
-	<constant name="final_ry7t" value="mod2_ry7t+ry7t_align"/>
-	<constant name="final_ry8t" value="mod2_ry8t+ry8t_align"/>
-	<constant name="final_ry9t" value="mod2_ry9t+ry9t_align"/>
-	<constant name="final_ry10t" value="mod2_ry10t+ry10t_align"/>
-	<constant name="final_rz1t" value="mod2_rz1t+rz1t_align"/>
-	<constant name="final_rz2t" value="mod2_rz2t+rz2t_align"/>
-	<constant name="final_rz3t" value="mod2_rz3t+rz3t_align"/>
-	<constant name="final_rz4t" value="mod2_rz4t+rz4t_align"/>
-	<constant name="final_rz5t" value="mod2_rz5t+rz5t_align"/>
-	<constant name="final_rz6t" value="mod2_rz6t+rz6t_align"/>
-	<constant name="final_rz7t" value="mod2_rz7t+rz7t_align"/>
-	<constant name="final_rz8t" value="mod2_rz8t+rz8t_align"/>
-	<constant name="final_rz9t" value="mod2_rz9t+rz9t_align"/>
-	<constant name="final_rz10t" value="mod2_rz10t+rz10t_align"/>
-	<constant name="final_x1b" value="mod2_x1b+x1b_align"/>
-	<constant name="final_x2b" value="mod2_x2b+x2b_align"/>
-	<constant name="final_x3b" value="mod2_x3b+x3b_align"/>
-	<constant name="final_x4b" value="mod2_x4b+x4b_align"/>
-	<constant name="final_x5b" value="mod2_x5b+x5b_align"/>
-	<constant name="final_x6b" value="mod2_x6b+x6b_align"/>
-	<constant name="final_x7b" value="mod2_x7b+x7b_align"/>
-	<constant name="final_x8b" value="mod2_x8b+x8b_align"/>
-	<constant name="final_x9b" value="mod2_x9b+x9b_align"/>
-	<constant name="final_x10b" value="mod2_x10b+x10b_align"/>
-	<constant name="final_y1b" value="mod2_y1b+y1b_align"/>
-	<constant name="final_y2b" value="mod2_y2b+y2b_align"/>
-	<constant name="final_y3b" value="mod2_y3b+y3b_align"/>
-	<constant name="final_y4b" value="mod2_y4b+y4b_align"/>
-	<constant name="final_y5b" value="mod2_y5b+y5b_align"/>
-	<constant name="final_y6b" value="mod2_y6b+y6b_align"/>
-	<constant name="final_y7b" value="mod2_y7b+y7b_align"/>
-	<constant name="final_y8b" value="mod2_y8b+y8b_align"/>
-	<constant name="final_y9b" value="mod2_y9b+y9b_align"/>
-	<constant name="final_y10b" value="mod2_y10b+y10b_align"/>
-	<constant name="final_z1b" value="mod2_z1b+z1b_align"/>
-	<constant name="final_z2b" value="mod2_z2b+z2b_align"/>
-	<constant name="final_z3b" value="mod2_z3b+z3b_align"/>
-	<constant name="final_z4b" value="mod2_z4b+z4b_align"/>
-	<constant name="final_z5b" value="mod2_z5b+z5b_align"/>
-	<constant name="final_z6b" value="mod2_z6b+z6b_align"/>
-	<constant name="final_z7b" value="mod2_z7b+z7b_align"/>
-	<constant name="final_z8b" value="mod2_z8b+z8b_align"/>
-	<constant name="final_z9b" value="mod2_z9b+z9b_align"/>
-	<constant name="final_z10b" value="mod2_z10b+z10b_align"/>
-	<constant name="final_rx1b" value="mod2_rx1b+rx1b_align"/>
-	<constant name="final_rx2b" value="mod2_rx2b+rx2b_align"/>
-	<constant name="final_rx3b" value="mod2_rx3b+rx3b_align"/>
-	<constant name="final_rx4b" value="mod2_rx4b+rx4b_align"/>
-	<constant name="final_rx5b" value="mod2_rx5b+rx5b_align"/>
-	<constant name="final_rx6b" value="mod2_rx6b+rx6b_align"/>
-	<constant name="final_rx7b" value="mod2_rx7b+rx7b_align"/>
-	<constant name="final_rx8b" value="mod2_rx8b+rx8b_align"/>
-	<constant name="final_rx9b" value="mod2_rx9b+rx9b_align"/>
-	<constant name="final_rx10b" value="mod2_rx10b+rx10b_align"/>
-	<constant name="final_ry1b" value="mod2_ry1b+ry1b_align"/>
-	<constant name="final_ry2b" value="mod2_ry2b+ry2b_align"/>
-	<constant name="final_ry3b" value="mod2_ry3b+ry3b_align"/>
-	<constant name="final_ry4b" value="mod2_ry4b+ry4b_align"/>
-	<constant name="final_ry5b" value="mod2_ry5b+ry5b_align"/>
-	<constant name="final_ry6b" value="mod2_ry6b+ry6b_align"/>
-	<constant name="final_ry7b" value="mod2_ry7b+ry7b_align"/>
-	<constant name="final_ry8b" value="mod2_ry8b+ry8b_align"/>
-	<constant name="final_ry9b" value="mod2_ry9b+ry9b_align"/>
-	<constant name="final_ry10b" value="mod2_ry10b+ry10b_align"/>
-	<constant name="final_rz1b" value="mod2_rz1b+rz1b_align"/>
-	<constant name="final_rz2b" value="mod2_rz2b+rz2b_align"/>
-	<constant name="final_rz3b" value="mod2_rz3b+rz3b_align"/>
-	<constant name="final_rz4b" value="mod2_rz4b+rz4b_align"/>
-	<constant name="final_rz5b" value="mod2_rz5b+rz5b_align"/>
-	<constant name="final_rz6b" value="mod2_rz6b+rz6b_align"/>
-	<constant name="final_rz7b" value="mod2_rz7b+rz7b_align"/>
-	<constant name="final_rz8b" value="mod2_rz8b+rz8b_align"/>
-	<constant name="final_rz9b" value="mod2_rz9b+rz9b_align"/>
-	<constant name="final_rz10b" value="mod2_rz10b+rz10b_align"/>
-    	
-    	
+        
+        <!-- final constants -->
+    <constant name="final_x1t" value="mod2_x1t+x1t_align"/>
+    <constant name="final_x2t" value="mod2_x2t+x2t_align"/>
+    <constant name="final_x3t" value="mod2_x3t+x3t_align"/>
+    <constant name="final_x4t" value="mod2_x4t+x4t_align"/>
+    <constant name="final_x5t" value="mod2_x5t+x5t_align"/>
+    <constant name="final_x6t" value="mod2_x6t+x6t_align"/>
+    <constant name="final_x7t" value="mod2_x7t+x7t_align"/>
+    <constant name="final_x8t" value="mod2_x8t+x8t_align"/>
+    <constant name="final_x9t" value="mod2_x9t+x9t_align"/>
+    <constant name="final_x10t" value="mod2_x10t+x10t_align"/>
+    <constant name="final_y1t" value="mod2_y1t+y1t_align"/>
+    <constant name="final_y2t" value="mod2_y2t+y2t_align"/>
+    <constant name="final_y3t" value="mod2_y3t+y3t_align"/>
+    <constant name="final_y4t" value="mod2_y4t+y4t_align"/>
+    <constant name="final_y5t" value="mod2_y5t+y5t_align"/>
+    <constant name="final_y6t" value="mod2_y6t+y6t_align"/>
+    <constant name="final_y7t" value="mod2_y7t+y7t_align"/>
+    <constant name="final_y8t" value="mod2_y8t+y8t_align"/>
+    <constant name="final_y9t" value="mod2_y9t+y9t_align"/>
+    <constant name="final_y10t" value="mod2_y10t+y10t_align"/>
+    <constant name="final_z1t" value="mod2_z1t+z1t_align"/>
+    <constant name="final_z2t" value="mod2_z2t+z2t_align"/>
+    <constant name="final_z3t" value="mod2_z3t+z3t_align"/>
+    <constant name="final_z4t" value="mod2_z4t+z4t_align"/>
+    <constant name="final_z5t" value="mod2_z5t+z5t_align"/>
+    <constant name="final_z6t" value="mod2_z6t+z6t_align"/>
+    <constant name="final_z7t" value="mod2_z7t+z7t_align"/>
+    <constant name="final_z8t" value="mod2_z8t+z8t_align"/>
+    <constant name="final_z9t" value="mod2_z9t+z9t_align"/>
+    <constant name="final_z10t" value="mod2_z10t+z10t_align"/>
+    <constant name="final_rx1t" value="mod2_rx1t+rx1t_align"/>
+    <constant name="final_rx2t" value="mod2_rx2t+rx2t_align"/>
+    <constant name="final_rx3t" value="mod2_rx3t+rx3t_align"/>
+    <constant name="final_rx4t" value="mod2_rx4t+rx4t_align"/>
+    <constant name="final_rx5t" value="mod2_rx5t+rx5t_align"/>
+    <constant name="final_rx6t" value="mod2_rx6t+rx6t_align"/>
+    <constant name="final_rx7t" value="mod2_rx7t+rx7t_align"/>
+    <constant name="final_rx8t" value="mod2_rx8t+rx8t_align"/>
+    <constant name="final_rx9t" value="mod2_rx9t+rx9t_align"/>
+    <constant name="final_rx10t" value="mod2_rx10t+rx10t_align"/>
+    <constant name="final_ry1t" value="mod2_ry1t+ry1t_align"/>
+    <constant name="final_ry2t" value="mod2_ry2t+ry2t_align"/>
+    <constant name="final_ry3t" value="mod2_ry3t+ry3t_align"/>
+    <constant name="final_ry4t" value="mod2_ry4t+ry4t_align"/>
+    <constant name="final_ry5t" value="mod2_ry5t+ry5t_align"/>
+    <constant name="final_ry6t" value="mod2_ry6t+ry6t_align"/>
+    <constant name="final_ry7t" value="mod2_ry7t+ry7t_align"/>
+    <constant name="final_ry8t" value="mod2_ry8t+ry8t_align"/>
+    <constant name="final_ry9t" value="mod2_ry9t+ry9t_align"/>
+    <constant name="final_ry10t" value="mod2_ry10t+ry10t_align"/>
+    <constant name="final_rz1t" value="mod2_rz1t+rz1t_align"/>
+    <constant name="final_rz2t" value="mod2_rz2t+rz2t_align"/>
+    <constant name="final_rz3t" value="mod2_rz3t+rz3t_align"/>
+    <constant name="final_rz4t" value="mod2_rz4t+rz4t_align"/>
+    <constant name="final_rz5t" value="mod2_rz5t+rz5t_align"/>
+    <constant name="final_rz6t" value="mod2_rz6t+rz6t_align"/>
+    <constant name="final_rz7t" value="mod2_rz7t+rz7t_align"/>
+    <constant name="final_rz8t" value="mod2_rz8t+rz8t_align"/>
+    <constant name="final_rz9t" value="mod2_rz9t+rz9t_align"/>
+    <constant name="final_rz10t" value="mod2_rz10t+rz10t_align"/>
+    <constant name="final_x1b" value="mod2_x1b+x1b_align"/>
+    <constant name="final_x2b" value="mod2_x2b+x2b_align"/>
+    <constant name="final_x3b" value="mod2_x3b+x3b_align"/>
+    <constant name="final_x4b" value="mod2_x4b+x4b_align"/>
+    <constant name="final_x5b" value="mod2_x5b+x5b_align"/>
+    <constant name="final_x6b" value="mod2_x6b+x6b_align"/>
+    <constant name="final_x7b" value="mod2_x7b+x7b_align"/>
+    <constant name="final_x8b" value="mod2_x8b+x8b_align"/>
+    <constant name="final_x9b" value="mod2_x9b+x9b_align"/>
+    <constant name="final_x10b" value="mod2_x10b+x10b_align"/>
+    <constant name="final_y1b" value="mod2_y1b+y1b_align"/>
+    <constant name="final_y2b" value="mod2_y2b+y2b_align"/>
+    <constant name="final_y3b" value="mod2_y3b+y3b_align"/>
+    <constant name="final_y4b" value="mod2_y4b+y4b_align"/>
+    <constant name="final_y5b" value="mod2_y5b+y5b_align"/>
+    <constant name="final_y6b" value="mod2_y6b+y6b_align"/>
+    <constant name="final_y7b" value="mod2_y7b+y7b_align"/>
+    <constant name="final_y8b" value="mod2_y8b+y8b_align"/>
+    <constant name="final_y9b" value="mod2_y9b+y9b_align"/>
+    <constant name="final_y10b" value="mod2_y10b+y10b_align"/>
+    <constant name="final_z1b" value="mod2_z1b+z1b_align"/>
+    <constant name="final_z2b" value="mod2_z2b+z2b_align"/>
+    <constant name="final_z3b" value="mod2_z3b+z3b_align"/>
+    <constant name="final_z4b" value="mod2_z4b+z4b_align"/>
+    <constant name="final_z5b" value="mod2_z5b+z5b_align"/>
+    <constant name="final_z6b" value="mod2_z6b+z6b_align"/>
+    <constant name="final_z7b" value="mod2_z7b+z7b_align"/>
+    <constant name="final_z8b" value="mod2_z8b+z8b_align"/>
+    <constant name="final_z9b" value="mod2_z9b+z9b_align"/>
+    <constant name="final_z10b" value="mod2_z10b+z10b_align"/>
+    <constant name="final_rx1b" value="mod2_rx1b+rx1b_align"/>
+    <constant name="final_rx2b" value="mod2_rx2b+rx2b_align"/>
+    <constant name="final_rx3b" value="mod2_rx3b+rx3b_align"/>
+    <constant name="final_rx4b" value="mod2_rx4b+rx4b_align"/>
+    <constant name="final_rx5b" value="mod2_rx5b+rx5b_align"/>
+    <constant name="final_rx6b" value="mod2_rx6b+rx6b_align"/>
+    <constant name="final_rx7b" value="mod2_rx7b+rx7b_align"/>
+    <constant name="final_rx8b" value="mod2_rx8b+rx8b_align"/>
+    <constant name="final_rx9b" value="mod2_rx9b+rx9b_align"/>
+    <constant name="final_rx10b" value="mod2_rx10b+rx10b_align"/>
+    <constant name="final_ry1b" value="mod2_ry1b+ry1b_align"/>
+    <constant name="final_ry2b" value="mod2_ry2b+ry2b_align"/>
+    <constant name="final_ry3b" value="mod2_ry3b+ry3b_align"/>
+    <constant name="final_ry4b" value="mod2_ry4b+ry4b_align"/>
+    <constant name="final_ry5b" value="mod2_ry5b+ry5b_align"/>
+    <constant name="final_ry6b" value="mod2_ry6b+ry6b_align"/>
+    <constant name="final_ry7b" value="mod2_ry7b+ry7b_align"/>
+    <constant name="final_ry8b" value="mod2_ry8b+ry8b_align"/>
+    <constant name="final_ry9b" value="mod2_ry9b+ry9b_align"/>
+    <constant name="final_ry10b" value="mod2_ry10b+ry10b_align"/>
+    <constant name="final_rz1b" value="mod2_rz1b+rz1b_align"/>
+    <constant name="final_rz2b" value="mod2_rz2b+rz2b_align"/>
+    <constant name="final_rz3b" value="mod2_rz3b+rz3b_align"/>
+    <constant name="final_rz4b" value="mod2_rz4b+rz4b_align"/>
+    <constant name="final_rz5b" value="mod2_rz5b+rz5b_align"/>
+    <constant name="final_rz6b" value="mod2_rz6b+rz6b_align"/>
+    <constant name="final_rz7b" value="mod2_rz7b+rz7b_align"/>
+    <constant name="final_rz8b" value="mod2_rz8b+rz8b_align"/>
+    <constant name="final_rz9b" value="mod2_rz9b+rz9b_align"/>
+    <constant name="final_rz10b" value="mod2_rz10b+rz10b_align"/>
+        
+        
     </define>
     
     <materials>      
-    	<!-- Set the world material to vacuum. -->
+        <!-- Set the world material to vacuum. -->
         <material name="WorldMaterial">
             <D type="density" unit="g/cm3" value="0.0000000000000001"/>
             <fraction n="1.0" ref="Vacuum" />
@@ -800,7 +800,7 @@
             </layer>
             <layer id="2">
                 <module_placement name="TestRunModuleFieldDef" id="0" x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0" ry="0" rz="-PI/2"/>
-			</layer>
+            </layer>
         </detector>     
         
         <detector id="13" name="Ecal" type="HPSEcal3" insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">

Modified: java/trunk/detector-data/detectors/HPSTestRunTracker2014-v0/compact.xml
 =============================================================================
--- java/trunk/detector-data/detectors/HPSTestRunTracker2014-v0/compact.xml	(original)
+++ java/trunk/detector-data/detectors/HPSTestRunTracker2014-v0/compact.xml	Wed Mar  9 11:43:24 2016
@@ -7,9 +7,9 @@
   </info> 
   
   <define>
-	<!-- units -->
-	<constant name="mm" value="0.1*cm"/>
-	<constant name="inch" value="25.4*mm"/>
+    <!-- units -->
+    <constant name="mm" value="0.1*cm"/>
+    <constant name="inch" value="25.4*mm"/>
 
     <!-- world -->
     <constant name="world_side" value="500.0*cm" />
@@ -17,48 +17,48 @@
     <constant name="world_y" value="world_side" />
     <constant name="world_z" value="world_side" />
   
- 	 <!-- tracking region -->
- 	<constant name="tracking_region_radius" value="200.0*cm"/>
+     <!-- tracking region -->
+    <constant name="tracking_region_radius" value="200.0*cm"/>
     <constant name="tracking_region_min" value="5.0*cm"/>
     <constant name="tracking_region_zmax" value="131.8*cm"/>
     
      <!--  dipole magnet and  B-field -->
-	<constant name="dipoleMagnetPositionZ" value="45.72*cm" />
-	<constant name="dipoleMagnetHeight" value="17.78*cm" />
-	<constant name="dipoleMagnetWidth" value="41.6052*cm" />
-	<constant name="dipoleMagnetLength" value="dipoleMagnetPositionZ*2.0" />
-	<constant name="constBFieldY" value="-0.491" />
+    <constant name="dipoleMagnetPositionZ" value="45.72*cm" />
+    <constant name="dipoleMagnetHeight" value="17.78*cm" />
+    <constant name="dipoleMagnetWidth" value="41.6052*cm" />
+    <constant name="dipoleMagnetLength" value="dipoleMagnetPositionZ*2.0" />
+    <constant name="constBFieldY" value="-0.491" />
  
-	<!-- ECAL -->
+    <!-- ECAL -->
     <constant name="ecal_front" value="13.3/2*mm" />
-	<constant name="ecal_back" value="16/2*mm" />
-	<constant name="ecal_z" value="160/2*mm" />
-   	<constant name="ecal_dx" value="41.27*mm" />
+    <constant name="ecal_back" value="16/2*mm" />
+    <constant name="ecal_z" value="160/2*mm" />
+    <constant name="ecal_dx" value="41.27*mm" />
  
   </define>
   
   <materials>
-  	<!-- Set the world material to vacuum. -->
+    <!-- Set the world material to vacuum. -->
     <material name="WorldMaterial">
-    	<D type="density" unit="g/cm3" value="0.0000000000000001"/>
-    	<fraction n="1.0" ref="Vacuum" />
+        <D type="density" unit="g/cm3" value="0.0000000000000001"/>
+        <fraction n="1.0" ref="Vacuum" />
     </material>
     <!-- Set tracking material to vacuum. -->
     <material name="TrackingMaterial">
       <D type="density" unit="g/cm3" value="0.0000000000000001" />
       <fraction n="1.0" ref="Vacuum" />
     </material>
-	<!-- ECal crystal material. -->
-	<material name="LeadTungstate">
-		<D value="8.28" unit="g/cm3" />
-		<composite n="1" ref="Pb" />
-		<composite n="1" ref="W" />
-		<composite n="4" ref="O" />
-	</material>
+    <!-- ECal crystal material. -->
+    <material name="LeadTungstate">
+        <D value="8.28" unit="g/cm3" />
+        <composite n="1" ref="Pb" />
+        <composite n="1" ref="W" />
+        <composite n="4" ref="O" />
+    </material>
   </materials>
   
   <display>
-	
+    
     <vis name="SensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="true"/>
     <vis name="ActiveSensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="true" visible="true"/>
     <vis name="CarbonFiberVis" alpha="1.0" r="0.88" g="0.88" b="0.88" drawingStyle="solid" lineStyle="unbroken" showDaughters="true" visible="true"/>
@@ -72,14 +72,14 @@
     <vis name="BasePlateVis" alpha="1.0" r="0.35" g="0.35" b="0.35" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/>
     <vis name="LayerVis" alpha="0.0" r="0.0" g="0.0" b="1.0" drawingStyle="wireframe" showDaughters="true" visible="false"/>
     <vis name="ComponentVis" alpha="0.0" r="0.0" g="0.2" b="0.4" drawingStyle="solid" showDaughters="false" visible="false"/>
-	<vis name="BeamPlaneVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="false" visible="true"/>
+    <vis name="BeamPlaneVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="false" visible="true"/>
 
     <vis name="ECALVis" r="0.8" g="0.5" b="0.1" />
   </display>
   
   <detectors>
     <detector id="1" name="Tracker" type="HPSTestRunTracker2014" readout="TrackerHits">
-	   <millepede_constants>
+       <millepede_constants>
             <!-- top translations -->
             <millepede_constant name="11101" value="0.0"/>
             <millepede_constant name="11102" value="0.0"/>
@@ -234,43 +234,43 @@
      
     </detector>
 
-	<detector id="30" name="TrackerFieldDef" type="HPSTracker2"
-		readout="TrackerHitsThin">
-		<comment>The Silicon Vertex Tracker</comment>
-		<module name="TestRunModuleFieldDef">
-			<box x="dipoleMagnetWidth*4+1" y="dipoleMagnetHeight*4+1" />
-			<module_component thickness="0.000000001*cm"
-				material="Vacuum" sensitive="true">
-				<dimensions x="dipoleMagnetWidth*4" y="dipoleMagnetHeight*4" />
-			</module_component>
-		</module>
-		<layer id="1">
-			<module_placement name="TestRunModuleFieldDef" id="0"
-				x="0" y="0" z="dipoleMagnetPositionZ-dipoleMagnetLength/2" rx="0"
-				ry="0" rz="-PI/2" />
-		</layer>
-		<layer id="2">
-			<module_placement name="TestRunModuleFieldDef" id="0"
-				x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0"
-				ry="0" rz="-PI/2" />
-		</layer>
-	</detector>
-
-	<detector id="13" name="Ecal" type="HPSEcal3"
-		insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">
-		<comment>The crystal ECal</comment>
-		<material name="LeadTungstate" />
-		<dimensions x1="ecal_front" y1="ecal_front" x2="ecal_back"
-			y2="ecal_back" z="ecal_z" />
-		<!-- Measurements as found in installation by Stepan -->
-		<!-- Moving ecal halves out by 6.5mm from SVT ecal-track matching - Pelle -->
-		<!-- Moving ecal face to reflect latest survey calculation 2/17/14 - Pelle -->
-		<layout beamgap="43.5*mm" nx="46" ny="5" dface="147.0*cm">
-			<remove ixmin="-10" ixmax="-2" iymin="-1" iymax="1" />
-			<top dx="ecal_dx" dy="0." dz="0." />
-			<bottom dx="ecal_dx" dy="0." dz="0." />
-		</layout>
-	</detector>
+    <detector id="30" name="TrackerFieldDef" type="HPSTracker2"
+        readout="TrackerHitsThin">
+        <comment>The Silicon Vertex Tracker</comment>
+        <module name="TestRunModuleFieldDef">
+            <box x="dipoleMagnetWidth*4+1" y="dipoleMagnetHeight*4+1" />
+            <module_component thickness="0.000000001*cm"
+                material="Vacuum" sensitive="true">
+                <dimensions x="dipoleMagnetWidth*4" y="dipoleMagnetHeight*4" />
+            </module_component>
+        </module>
+        <layer id="1">
+            <module_placement name="TestRunModuleFieldDef" id="0"
+                x="0" y="0" z="dipoleMagnetPositionZ-dipoleMagnetLength/2" rx="0"
+                ry="0" rz="-PI/2" />
+        </layer>
+        <layer id="2">
+            <module_placement name="TestRunModuleFieldDef" id="0"
+                x="0" y="0" z="dipoleMagnetPositionZ+dipoleMagnetLength/2" rx="0"
+                ry="0" rz="-PI/2" />
+        </layer>
+    </detector>
+
+    <detector id="13" name="Ecal" type="HPSEcal3"
+        insideTrackingVolume="false" readout="EcalHits" vis="ECALVis">
+        <comment>The crystal ECal</comment>
+        <material name="LeadTungstate" />
+        <dimensions x1="ecal_front" y1="ecal_front" x2="ecal_back"
+            y2="ecal_back" z="ecal_z" />
+        <!-- Measurements as found in installation by Stepan -->
+        <!-- Moving ecal halves out by 6.5mm from SVT ecal-track matching - Pelle -->
+        <!-- Moving ecal face to reflect latest survey calculation 2/17/14 - Pelle -->
+        <layout beamgap="43.5*mm" nx="46" ny="5" dface="147.0*cm">
+            <remove ixmin="-10" ixmax="-2" iymin="-1" iymax="1" />
+            <top dx="ecal_dx" dy="0." dz="0." />
+            <bottom dx="ecal_dx" dy="0." dz="0." />
+        </layout>
+    </detector>
     
      
     
@@ -279,28 +279,28 @@
     <readout name="TrackerHits">
       <id>system:6,barrel:3,layer:4,module:12,sensor:1,side:32:-2,strip:12</id>
     </readout>
-	<readout name="TrackerHitsThin">
-		<id>system:6,barrel:3,layer:4,module:12,sensor:1,side:32:-2,strip:12</id>
-	</readout>
-
-	<readout name="EcalHits">
-		<segmentation type="GridXYZ" gridSizeX="0.0" gridSizeY="0.0"
-			gridSizeZ="0.0" />
-		<id>system:6,layer:2,ix:-8,iy:-6</id>
-	</readout>
+    <readout name="TrackerHitsThin">
+        <id>system:6,barrel:3,layer:4,module:12,sensor:1,side:32:-2,strip:12</id>
+    </readout>
+
+    <readout name="EcalHits">
+        <segmentation type="GridXYZ" gridSizeX="0.0" gridSizeY="0.0"
+            gridSizeZ="0.0" />
+        <id>system:6,layer:2,ix:-8,iy:-6</id>
+    </readout>
   </readouts>
 
-	<fields>
-		<field type="BoxDipole" name="AnalyzingDipole" x="0*cm" y="0*cm"
-			z="dipoleMagnetPositionZ" dx="dipoleMagnetWidth/2.0" dy="dipoleMagnetHeight/2.0"
-			dz="dipoleMagnetLength/2.0" bx="0.0" by="constBFieldY" bz="0.0" />
-	</fields>
+    <fields>
+        <field type="BoxDipole" name="AnalyzingDipole" x="0*cm" y="0*cm"
+            z="dipoleMagnetPositionZ" dx="dipoleMagnetWidth/2.0" dy="dipoleMagnetHeight/2.0"
+            dz="dipoleMagnetLength/2.0" bx="0.0" by="constBFieldY" bz="0.0" />
+    </fields>
 
 <!-- 
-	<includes>
-		<gdmlFile
-			ref="http://www.lcsim.org/test/gdml/testRunDownstreamVacuumFlange.gdml" />
-	</includes>
+    <includes>
+        <gdmlFile
+            ref="http://www.lcsim.org/test/gdml/testRunDownstreamVacuumFlange.gdml" />
+    </includes>
     -->
  
 </lccdd>

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTestRunTracker2014Converter.java	Wed Mar  9 11:43:24 2016
@@ -21,21 +21,21 @@
  */
 public class HPSTestRunTracker2014Converter extends HPSTracker2014ConverterBase {
 
-	public HPSTestRunTracker2014Converter() {
-		super();
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#initializeBuilder(org.jdom.Element)
-	 */
-	protected HPSTrackerJavaBuilder initializeBuilder(Element node) {
-	     return new HPSTestRunTracker2014JavaBuilder(_debug,node);
-	 }
+    public HPSTestRunTracker2014Converter() {
+        super();
+    }
     
-	/* (non-Javadoc)
-	 * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#getSubdetectorType()
-	 */
-	public Class getSubdetectorType() {
+    /* (non-Javadoc)
+     * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#initializeBuilder(org.jdom.Element)
+     */
+    protected HPSTrackerJavaBuilder initializeBuilder(Element node) {
+         return new HPSTestRunTracker2014JavaBuilder(_debug,node);
+     }
+    
+    /* (non-Javadoc)
+     * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#getSubdetectorType()
+     */
+    public Class getSubdetectorType() {
         return HPSTestRunTracker2014.class;
     }
 
@@ -53,5 +53,5 @@
     protected int getModuleNumber(String surveyVolume) {
         return HPSTrackerBuilder.getHalfFromName(surveyVolume).equals("top") ? 0 : 1;
     }
-	
+    
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	Wed Mar  9 11:43:24 2016
@@ -71,7 +71,7 @@
      * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#makeIdentifierHelper(org.lcsim.geometry.compact.Subdetector, org.lcsim.detector.DetectorIdentifierHelper.SystemMap)
      */
     public IIdentifierHelper makeIdentifierHelper(Subdetector subdetector, SystemMap systemMap) {
-    	return new SiTrackerIdentifierHelper(subdetector.getDetectorElement(), makeIdentifierDictionary(subdetector), systemMap);
+        return new SiTrackerIdentifierHelper(subdetector.getDetectorElement(), makeIdentifierDictionary(subdetector), systemMap);
     }
 
     

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTrackerConverter.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTrackerConverter.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTrackerConverter.java	Wed Mar  9 11:43:24 2016
@@ -238,7 +238,7 @@
     {
         //double moduleX = moduleParameters.getDimension(0);
         //double moduleY = moduleParameters.getDimension(1);        
-    	double moduleY = moduleParameters.getDimension(0);
+        double moduleY = moduleParameters.getDimension(0);
         double moduleX = moduleParameters.getDimension(1);
         Box box = (Box)moduleVolume.getSolid();
         double moduleZ = box.getZHalfLength() * 2;                        
@@ -375,7 +375,7 @@
     /*
     private void configSensor(SiSensor sensor)
     {
-    	//
+        //
         Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();                                                        
         
         Polygon3D pside = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/HpsTracker2.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/HpsTracker2.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/HpsTracker2.java	Wed Mar  9 11:43:24 2016
@@ -19,89 +19,89 @@
     private boolean debug = false;
     
     // List of stereo layers composing the SVT
-	List<SvtStereoLayer> stereoPairs = new ArrayList<SvtStereoLayer>(); 
-	
-	public HpsTracker2(String name, IDetectorElement parent) {
-		super(name, parent);
-	}
-	
-	/**
-	 * Get a collection of stereo pairs ({@link SvtStereoLayer}) composing the SVT.
-	 * 
-	 * @return List of stereo pairs
-	 */
-	public List<SvtStereoLayer> getStereoPairs(){
-	    return Collections.unmodifiableList(stereoPairs);
-	}
+    List<SvtStereoLayer> stereoPairs = new ArrayList<SvtStereoLayer>(); 
+    
+    public HpsTracker2(String name, IDetectorElement parent) {
+        super(name, parent);
+    }
+    
+    /**
+     * Get a collection of stereo pairs ({@link SvtStereoLayer}) composing the SVT.
+     * 
+     * @return List of stereo pairs
+     */
+    public List<SvtStereoLayer> getStereoPairs(){
+        return Collections.unmodifiableList(stereoPairs);
+    }
 
-	/**
-	 * Get the collection of {@link HpsSiSensor} composing the SVT. 
-	 * 
-	 * @return List of sensors
-	 */
-	public List<HpsSiSensor> getSensors(){
-	    List<HpsSiSensor> list = this.findDescendants(HpsSiSensor.class);
-	    if(debug) {
-	        System.out.printf("%s: found %d HpsSiSensors\n",getClass().getSimpleName(), list.size());
-	        System.out.printf("%s: %45s %5s %5s\n",getClass().getSimpleName(), "<name>", "<layerID>", "<moduleID>");
-	        for(HpsSiSensor sensor : list) {
-	            System.out.printf("%s: %45s %5d %5d\n",getClass().getSimpleName(), sensor.getName(), sensor.getLayerNumber(), sensor.getModuleNumber());
-	        }
-	    }
-	    return list;
-	}
-	
-	/**
-	 * Get a {@link HpsSiSensor} by layer and module number.
-	 * 
-	 * @param layer The SVT layer number
-	 * @param module The SVT module number
-	 * @return Corresponding sensor
-	 */
-	public HpsSiSensor getSensor(int layer, int module){
-	    for(HpsSiSensor sensor : this.getSensors()){
-	        if(sensor.getLayerNumber() == layer && sensor.getModuleNumber() == module) 
-	            return sensor; 
-	    }
-	    return null;
-	}
-	
-	/**
-	 * Get the maximum layer number present in the collection of {@link HpsSiSensor}.
-	 * 
-	 * @return maximum layer number
-	 */
-	private int getMaxLayerNumber(){
-	    int maxLayerNumber = 0;
-	    for(HpsSiSensor sensor : this.getSensors()){
-	       if(sensor.getLayerNumber() > maxLayerNumber) maxLayerNumber = sensor.getLayerNumber();
-	    }
-	    return maxLayerNumber; 
-	}
+    /**
+     * Get the collection of {@link HpsSiSensor} composing the SVT. 
+     * 
+     * @return List of sensors
+     */
+    public List<HpsSiSensor> getSensors(){
+        List<HpsSiSensor> list = this.findDescendants(HpsSiSensor.class);
+        if(debug) {
+            System.out.printf("%s: found %d HpsSiSensors\n",getClass().getSimpleName(), list.size());
+            System.out.printf("%s: %45s %5s %5s\n",getClass().getSimpleName(), "<name>", "<layerID>", "<moduleID>");
+            for(HpsSiSensor sensor : list) {
+                System.out.printf("%s: %45s %5d %5d\n",getClass().getSimpleName(), sensor.getName(), sensor.getLayerNumber(), sensor.getModuleNumber());
+            }
+        }
+        return list;
+    }
+    
+    /**
+     * Get a {@link HpsSiSensor} by layer and module number.
+     * 
+     * @param layer The SVT layer number
+     * @param module The SVT module number
+     * @return Corresponding sensor
+     */
+    public HpsSiSensor getSensor(int layer, int module){
+        for(HpsSiSensor sensor : this.getSensors()){
+            if(sensor.getLayerNumber() == layer && sensor.getModuleNumber() == module) 
+                return sensor; 
+        }
+        return null;
+    }
+    
+    /**
+     * Get the maximum layer number present in the collection of {@link HpsSiSensor}.
+     * 
+     * @return maximum layer number
+     */
+    private int getMaxLayerNumber(){
+        int maxLayerNumber = 0;
+        for(HpsSiSensor sensor : this.getSensors()){
+           if(sensor.getLayerNumber() > maxLayerNumber) maxLayerNumber = sensor.getLayerNumber();
+        }
+        return maxLayerNumber; 
+    }
 
-	/**
-	 * Get the maximum module number present in the collection of {@link HpsSiSensor}.
-	 * 
-	 * @return maximum module number
-	 */
-	private int getMaxModuleNumber(){
-	    int maxModuleID = 0; 
-	    for(HpsSiSensor sensor : this.getSensors()){
-	       if(sensor.getModuleNumber() > maxModuleID) maxModuleID = sensor.getModuleNumber();
-	    }
-	    return maxModuleID; 
-	}
-	
-	/**
-	 * Method that loops through the collection of {@link HpsSiSensor} and creates 
-	 * stereo layers. A stereo layer is composed of two adjacent sensors (stereo and axial)
-	 * with the same module number.
-	 */
-	public void createStereoLayers(){
+    /**
+     * Get the maximum module number present in the collection of {@link HpsSiSensor}.
+     * 
+     * @return maximum module number
+     */
+    private int getMaxModuleNumber(){
+        int maxModuleID = 0; 
+        for(HpsSiSensor sensor : this.getSensors()){
+           if(sensor.getModuleNumber() > maxModuleID) maxModuleID = sensor.getModuleNumber();
+        }
+        return maxModuleID; 
+    }
+    
+    /**
+     * Method that loops through the collection of {@link HpsSiSensor} and creates 
+     * stereo layers. A stereo layer is composed of two adjacent sensors (stereo and axial)
+     * with the same module number.
+     */
+    public void createStereoLayers(){
 
-	    //System.out.printf("%s: create stereo layers\n",getClass().getSimpleName());
+        //System.out.printf("%s: create stereo layers\n",getClass().getSimpleName());
         
-	    HpsSiSensor firstSensor = null;
+        HpsSiSensor firstSensor = null;
         HpsSiSensor secondSensor = null;
 
         //System.out.printf("%s: %10s %10s %42s %42s\n",getClass().getSimpleName(), "layerID/moduleID", "layerID/moduleID", "sensor1", "sensor2");

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/SvtStereoLayer.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/SvtStereoLayer.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/subdetector/SvtStereoLayer.java	Wed Mar  9 11:43:24 2016
@@ -9,76 +9,76 @@
  */
 public class SvtStereoLayer {
 
-	
-	// Layer number to which the stereo pair belongs to
-	private int stereoLayerNumber = 0; 
-	
-	// The axial and stereo sensors
-	private HpsSiSensor axialSensor = null; 
-	private HpsSiSensor stereoSensor = null;
-	
-	
-	/**
-	 * Ctor
-	 * 
-	 * @param layerNumber  Layer number to which the stereo pair belongs to
-	 * @param firstSensor  The first sensor in the stereo layer 
-	 * @param secondSensor The second sensor in the stereo layer
-	 */
-	public SvtStereoLayer(int stereoLayerNumber, HpsSiSensor firstSensor, HpsSiSensor secondSensor){
-		this.stereoLayerNumber = stereoLayerNumber;
-		if(firstSensor.isAxial()){
-		    this.axialSensor = firstSensor; 
-		    this.stereoSensor = secondSensor; 
-		} else { 
-		    this.axialSensor = secondSensor; 
-		    this.stereoSensor = firstSensor; 
-		}
-	}
-	
-	
-	/**
-	 * Get the axial sensor of the stereo pair
-	 * 
-	 * @return Axial sensor. Returns null if it hasn't been set yet.
-	 */
-	public HpsSiSensor getAxialSensor(){
-		return axialSensor; 
-	}
-	
-	/**
-	 * Get the stereo sensor of the stereo pair
-	 * 
-	 * @return Stereo sensor. Returns null if it hasn't been set yet.
-	 */
-	public HpsSiSensor getStereoSensor(){
-		return stereoSensor; 
-	}
+    
+    // Layer number to which the stereo pair belongs to
+    private int stereoLayerNumber = 0; 
+    
+    // The axial and stereo sensors
+    private HpsSiSensor axialSensor = null; 
+    private HpsSiSensor stereoSensor = null;
+    
+    
+    /**
+     * Ctor
+     * 
+     * @param layerNumber  Layer number to which the stereo pair belongs to
+     * @param firstSensor  The first sensor in the stereo layer 
+     * @param secondSensor The second sensor in the stereo layer
+     */
+    public SvtStereoLayer(int stereoLayerNumber, HpsSiSensor firstSensor, HpsSiSensor secondSensor){
+        this.stereoLayerNumber = stereoLayerNumber;
+        if(firstSensor.isAxial()){
+            this.axialSensor = firstSensor; 
+            this.stereoSensor = secondSensor; 
+        } else { 
+            this.axialSensor = secondSensor; 
+            this.stereoSensor = firstSensor; 
+        }
+    }
+    
+    
+    /**
+     * Get the axial sensor of the stereo pair
+     * 
+     * @return Axial sensor. Returns null if it hasn't been set yet.
+     */
+    public HpsSiSensor getAxialSensor(){
+        return axialSensor; 
+    }
+    
+    /**
+     * Get the stereo sensor of the stereo pair
+     * 
+     * @return Stereo sensor. Returns null if it hasn't been set yet.
+     */
+    public HpsSiSensor getStereoSensor(){
+        return stereoSensor; 
+    }
 
-	/**
-	 * Get the layer number to which the stereo pair belongs to.
-	 * 
-	 * @return stereo layer number
-	 */
-	public int getLayerNumber(){
-		return stereoLayerNumber; 
-	}
-	
-	/**
-	 * Return a string describing the stereo pair
-	 * 
-	 * @return stereo pair description
-	 */
-	@Override
-	public String toString(){
-	    StringBuffer buffer = new StringBuffer();
-	    buffer.append("[ Stereo Pair ]: Layer number: " + this.getLayerNumber() + "\n");
-	    buffer.append("\t\tAxial Sensor: ");
-	    buffer.append(axialSensor == null ? "None" : axialSensor.getName());
-	    buffer.append("\tStereo Sensor: ");
-		buffer.append(stereoSensor == null ? "None" : stereoSensor.getName());
-		return buffer.toString(); 
-	}
+    /**
+     * Get the layer number to which the stereo pair belongs to.
+     * 
+     * @return stereo layer number
+     */
+    public int getLayerNumber(){
+        return stereoLayerNumber; 
+    }
+    
+    /**
+     * Return a string describing the stereo pair
+     * 
+     * @return stereo pair description
+     */
+    @Override
+    public String toString(){
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("[ Stereo Pair ]: Layer number: " + this.getLayerNumber() + "\n");
+        buffer.append("\t\tAxial Sensor: ");
+        buffer.append(axialSensor == null ? "None" : axialSensor.getName());
+        buffer.append("\tStereo Sensor: ");
+        buffer.append(stereoSensor == null ? "None" : stereoSensor.getName());
+        return buffer.toString(); 
+    }
 
 }
 

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java	Wed Mar  9 11:43:24 2016
@@ -14,85 +14,85 @@
  * @author Omar Moreno <[log in to unmask]>
  */
 public class HpsTestRunSiSensor extends HpsSiSensor {
-	
-	
-	protected int fpgaID;
-	protected int hybridID;
-			
-	
-	/**
-	 * This class constructor matches the signature of <code>SiSensor</code>.
-	 * @param sensorid The sensor ID.
-	 * @param name The name of the sensor.
-	 * @param parent The parent DetectorElement.
-	 * @param support The physical support path.
-	 * @param id The identifier of the sensor.
-	 */
-	public HpsTestRunSiSensor(
+    
+    
+    protected int fpgaID;
+    protected int hybridID;
+            
+    
+    /**
+     * This class constructor matches the signature of <code>SiSensor</code>.
+     * @param sensorid The sensor ID.
+     * @param name The name of the sensor.
+     * @param parent The parent DetectorElement.
+     * @param support The physical support path.
+     * @param id The identifier of the sensor.
+     */
+    public HpsTestRunSiSensor(
             int sensorid,
             String name,
             IDetectorElement parent,
             String support,
             IIdentifier id)
     {
-		super(sensorid, name, parent, support, id);
+        super(sensorid, name, parent, support, id);
     }
-	
-	
+    
+    
 
-	/**
-	 * Get the FPGA ID associated with this sensor.
-	 * 
-	 * @return The FPGA ID
-	 */
-	public int getFpgaID() {
-		return fpgaID;
-	}
+    /**
+     * Get the FPGA ID associated with this sensor.
+     * 
+     * @return The FPGA ID
+     */
+    public int getFpgaID() {
+        return fpgaID;
+    }
 
-	/**
-	 * Get the hybrid ID associated with this sensor.
-	 * 
-	 * @return The hybrid ID
-	 */
-	public int getHybridID() {
-		return hybridID;
-	}
+    /**
+     * Get the hybrid ID associated with this sensor.
+     * 
+     * @return The hybrid ID
+     */
+    public int getHybridID() {
+        return hybridID;
+    }
 
-	@Override
-	public int getFebID(){
-	    throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
-	}
-	
-	@Override
-	public int getFebHybridID(){
-	    throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
-	}
+    @Override
+    public int getFebID(){
+        throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
+    }
+    
+    @Override
+    public int getFebHybridID(){
+        throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
+    }
 
-	/**
-	 * Set the FPGA ID associated with this sensor.
-	 * 
-	 * @param The FPGA ID
-	 */
-	public void setFpgaID(int fpgaID) {
-		this.fpgaID = fpgaID;
-	}
+    /**
+     * Set the FPGA ID associated with this sensor.
+     * 
+     * @param The FPGA ID
+     */
+    public void setFpgaID(int fpgaID) {
+        this.fpgaID = fpgaID;
+    }
 
-	/**
-	 * Set the hybrid ID associated with this sensor.
-	 * 
-	 * @param The hybrid ID.
-	 */
-	public void setHybridID(int hybridID) {
-		this.hybridID = hybridID;
-	}
-	
-	@Override
-	public void setFebID(int febID) {
-	    throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
-	}
-	
-	@Override
-	public void setFebHybridID(int febHybridID) {
-	    throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
-	}
+    /**
+     * Set the hybrid ID associated with this sensor.
+     * 
+     * @param The hybrid ID.
+     */
+    public void setHybridID(int hybridID) {
+        this.hybridID = hybridID;
+    }
+    
+    @Override
+    public void setFebID(int febID) {
+        throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
+    }
+    
+    @Override
+    public void setFebHybridID(int febHybridID) {
+        throw new RuntimeException("This method is not supported for the HpsTestRunSiSensor.");
+    }
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014GeometryDefinition.java	Wed Mar  9 11:43:24 2016
@@ -29,7 +29,7 @@
     protected static final boolean use30mradRotation = true;
     protected static final boolean useFakeHalfModuleAxialPos = false;
 
-    // Global position references	
+    // Global position references   
     protected static final double target_pos_wrt_base_plate_x = 162.3; //from Marco's 3D model
     protected static final double target_pos_wrt_base_plate_y = 80.55; //from Tim's sketchup //68.75; //from Marco's 3D model
     protected static final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model
@@ -208,7 +208,7 @@
         protected void setPos() {
             final double ball_pos_base_x = -1.0*target_pos_wrt_base_plate_x;
             final double ball_pos_base_y = -1.0*target_pos_wrt_base_plate_y;
-            final double ball_pos_base_z = target_pos_wrt_base_plate_z;		
+            final double ball_pos_base_z = target_pos_wrt_base_plate_z;     
             final double vee_pos_base_x = ball_pos_base_x + BasePlate.base_plate_width;
             final double vee_pos_base_y = ball_pos_base_y;
             final double vee_pos_base_z = ball_pos_base_z;
@@ -230,7 +230,7 @@
 
 
     public static class BasePlate extends SurveyVolume {
-        // Base plate references	
+        // Base plate references    
         public static final double base_plate_thickness = 0.25*inch;
         public static final double base_plate_width = 385.00;
         public static final double base_plate_length = 1216.00;
@@ -281,7 +281,7 @@
         public CSupport(String name, SurveyVolume mother) {
             super(name,mother, null);
             init();
-        }			
+        }           
         private void calcAndSetFlatPos() {
             if(use30mradRotation) {
                 // find the rotation to place the flat point
@@ -462,7 +462,7 @@
         // this is referenced to the pin position of the c-support
         private static final double ball_pos_csup_bearings_bottom_x = 240.0 - 265.0 + 14.0;
         private static final double ball_pos_csup_bearings_bottom_y = (-6.0 + 22.0);
-        private static final double ball_pos_csup_bearings_bottom_z = 14.7;		
+        private static final double ball_pos_csup_bearings_bottom_z = 14.7;     
         private static final double vee_pos_csup_bearings_bottom_x = 240.0- 129.0;
         private static final double vee_pos_csup_bearings_bottom_y = (-6.0 + 22.0);
         private static final double vee_pos_csup_bearings_bottom_z = 14.7;
@@ -499,12 +499,12 @@
 
             // make vectors
             setBallPos(ball_pos_csup_bearings_bottom_x,ball_pos_csup_bearings_bottom_y,ball_pos_csup_bearings_bottom_z);
-            setVeePos(vee_pos_csup_bearings_bottom_x,vee_pos_csup_bearings_bottom_y,vee_pos_csup_bearings_bottom_z);	
+            setVeePos(vee_pos_csup_bearings_bottom_x,vee_pos_csup_bearings_bottom_y,vee_pos_csup_bearings_bottom_z);    
             setFlatPos(flat_pos_csup_bearings_bottom_x,flat_pos_csup_bearings_bottom_y,flat_pos_csup_bearings_bottom_z);
 
 
             // create the coordinate system of the c-support bearings
-            //HPSTestRunTracker2014GeomDef.Coord csup_bearings_bottom_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_csup_bearings_bottom, vee_pos_csup_bearings_bottom, flat_pos_csup_bearings_bottom);		
+            //HPSTestRunTracker2014GeomDef.Coord csup_bearings_bottom_coord = new HPSTestRunTracker2014GeomDef.Coord(ball_pos_csup_bearings_bottom, vee_pos_csup_bearings_bottom, flat_pos_csup_bearings_bottom);       
 
             // since we don't care (no volume is built) about the local position of the bearings in the pin coord system we'll get rid of it
             // and find the bearings position in the base coordinate system directly
@@ -579,11 +579,11 @@
 
         public SupportPlateBottom(String name, SurveyVolume mother, SurveyVolume referenceGeom, String material) {
             super(mother, referenceGeom, name, material);
-            init();				
+            init();             
         }
         public SupportPlateBottom(String name, SurveyVolume mother, List<SurveyVolume> referenceGeom, String material) {
             super(mother, referenceGeom, name, material);
-            init();				
+            init();             
         }
         protected void setPos() {
             if(debug) System.out.printf("%s: setPos for %s\n",this.getClass().getSimpleName(),getName());
@@ -755,11 +755,11 @@
         public TestRunModule(String name, SurveyVolume mother, int layer, String half) {
             super(name, mother,null,layer, half);
             init();
-        }			
+        }           
         public TestRunModule(String name, SurveyVolume mother, SurveyVolume ref, int layer, String half) {
             super(name, mother,null,ref,layer, half);
             init();
-        }			
+        }           
         protected abstract double getColdBlockThickness();
         protected abstract double getModuleBoxLength();
         protected abstract double getModuleBoxWidth();
@@ -771,7 +771,7 @@
         }
         protected void setCenter() {
             setCenter(getModuleBoxLength()/2.0-5.0, 0.0, getModuleBoxWidth()/2.0-box_extra_width/5.0); 
-        }			
+        }           
         protected void setPos() {
 
             if(debug) System.out.printf("%s: setPos for %s\n",this.getClass().getSimpleName(),getName());
@@ -787,7 +787,7 @@
                 case 2:
                     ballPos = new BasicHep3Vector(25.0, 561.1, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth);
                     veePos = new BasicHep3Vector(95.0, 561.1, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth);
-                    flatPos = new BasicHep3Vector(60.0, 567.10, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth);	
+                    flatPos = new BasicHep3Vector(60.0, 567.10, SupportPlateBottom.pedestal_height_L2-SupportPlateBottom.support_plate_pocket_depth);   
                     break;
                 case 3:
                     ballPos = new BasicHep3Vector(25.0, 461.1, SupportPlateBottom.pedestal_height_L3-SupportPlateBottom.support_plate_pocket_depth);
@@ -938,7 +938,7 @@
         // Distance from CF edge to screw hole: 30mm
         // Distance from screw hole to edge of cold block: 33.75mm
         // Distance from edge of cold block to hole/ball position: 5mm
-        protected static final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - Sensor.length/2.0;	
+        protected static final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - Sensor.length/2.0;   
         protected static final double half_module_thickness = TestRunHalfModule.getHybridThickness() + TestRunHalfModule.getCFThickness() + HalfModuleLamination.thickness;
         protected static final double half_module_length = TestRunHalfModule.getCFLength();
         protected static final double half_module_width = 6.83 + Sensor.width;
@@ -1038,7 +1038,7 @@
             if(useFakeHalfModuleAxialPos) {
                 ball_pos_halfmod_local_x = ball_pos_halfmod_local_x*2.0;
                 ball_pos_halfmod_local_y = -2.0*ball_pos_halfmod_local_y;
-            }				
+            }               
             final double ball_pos_halfmod_local_z =  dist_lower_sensor_edge_to_cold_block_mounting_surface + Sensor.width/2.0;
             
             
@@ -1118,7 +1118,7 @@
 //            final double vee_pos_halfmod_local_z =  ball_pos_halfmod_local_z;
 //            final double flat_pos_halfmod_local_x =  ball_pos_halfmod_local_x;
 //            final double flat_pos_halfmod_local_y =  ball_pos_halfmod_local_y + Sensor.getSensorThickness()/2.0;
-//            final double flat_pos_halfmod_local_z =  ball_pos_halfmod_local_z;		
+//            final double flat_pos_halfmod_local_z =  ball_pos_halfmod_local_z;        
 //            ballPos = new BasicHep3Vector(ball_pos_halfmod_local_x, ball_pos_halfmod_local_y, ball_pos_halfmod_local_z);
 //            veePos = new BasicHep3Vector(vee_pos_halfmod_local_x, vee_pos_halfmod_local_y,vee_pos_halfmod_local_z);
 //            flatPos = new BasicHep3Vector(flat_pos_halfmod_local_x, flat_pos_halfmod_local_y,flat_pos_halfmod_local_z);
@@ -1235,7 +1235,7 @@
 
     }
 
-    public static abstract class TestRunColdBlock extends SurveyVolume {		
+    public static abstract class TestRunColdBlock extends SurveyVolume {        
         private int layer;
         public TestRunColdBlock(String name, SurveyVolume mother, int layer) {
             super(name, mother, null);
@@ -1284,7 +1284,7 @@
         }
     }
 
-    public static class TestRunColdBlockL13 extends TestRunColdBlock {			
+    public static class TestRunColdBlockL13 extends TestRunColdBlock {          
         protected static final double coldblock_L13_length = 82.00;
         protected static final double coldblock_L13_width = 52.50;
         protected static final double coldblock_L13_thickness = 6.00;
@@ -1306,7 +1306,7 @@
         }
     }
 
-    public static class TestRunColdBlockL45 extends TestRunColdBlock {			
+    public static class TestRunColdBlockL45 extends TestRunColdBlock {          
         protected static final double coldblock_L45_length = 82.00;
         protected static final double coldblock_L45_width = 51.00;
         protected static final double coldblock_L45_thickness = 6.00;
@@ -1358,7 +1358,7 @@
 //            if(useSiStripsConvention) {
 //                setBallPos(0,0,0);
 //                setVeePos(ballPos.x(), ballPos.y(), ballPos.z() + getSensorWidth()/2.0);
-//                setFlatPos(ballPos.x() + getSensorLength()/2.0,ballPos.y(), ballPos.z());					
+//                setFlatPos(ballPos.x() + getSensorLength()/2.0,ballPos.y(), ballPos.z());                 
 //            } else {
 //                setBallPos(0,0,0);
 //                setVeePos(ballPos.x() + getSensorLength()/2.0, ballPos.y(), ballPos.z());
@@ -1392,7 +1392,7 @@
         }
         protected double getLength() {
             return length;
-        }			
+        }           
     }
 
     /**

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014JavaBuilder.java	Wed Mar  9 11:43:24 2016
@@ -28,175 +28,175 @@
  */
 public class HPSTestRunTracker2014JavaBuilder extends HPSTrackerJavaBuilder {
 
-	
-	
-	/**
-	 * Default constructor
-	 * @param node 
-	 */
-	public HPSTestRunTracker2014JavaBuilder(boolean debugFlag, Element node) {
-		super(debugFlag, node);
-	}
-	
-	
-	
-	/**
-	 * Build the JAVA geometry objects from the geometry definition.
-	 * @param trackingVolume - the reference volume.
-	 */
-	public void build(ILogicalVolume trackingVolume) {
-
-		// build geometry
+    
+    
+    /**
+     * Default constructor
+     * @param node 
+     */
+    public HPSTestRunTracker2014JavaBuilder(boolean debugFlag, Element node) {
+        super(debugFlag, node);
+    }
+    
+    
+    
+    /**
+     * Build the JAVA geometry objects from the geometry definition.
+     * @param trackingVolume - the reference volume.
+     */
+    public void build(ILogicalVolume trackingVolume) {
+
+        // build geometry
         setBuilder(createGeometryDefinition(_debug, node));
-		
-		if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
-
-		if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
-		
-		_builder.build();
-
-		if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
-
-		if(isDebug()) System.out.printf("%s: build the JAVA geometry objects\n", getClass().getSimpleName());
-		
-		// initialize the list to store a reference to each object
-		javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
-
-		// Go through the list of volumes to build that is created in the generic builder class
-		JavaSurveyVolume trackingGeometry = new JavaSurveyVolume(_builder.getSurveyVolume(org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume.class), trackingVolume);
-		add(trackingGeometry);
-		//setBaseTrackerGeometry(new GhostJavaBaseGeom(_builder.getBaseGeometry(Base.class), trackingGeometry));
+        
+        if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
+
+        if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
+        
+        _builder.build();
+
+        if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
+
+        if(isDebug()) System.out.printf("%s: build the JAVA geometry objects\n", getClass().getSimpleName());
+        
+        // initialize the list to store a reference to each object
+        javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
+
+        // Go through the list of volumes to build that is created in the generic builder class
+        JavaSurveyVolume trackingGeometry = new JavaSurveyVolume(_builder.getSurveyVolume(org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume.class), trackingVolume);
+        add(trackingGeometry);
+        //setBaseTrackerGeometry(new GhostJavaBaseGeom(_builder.getBaseGeometry(Base.class), trackingGeometry));
         setBaseTrackerGeometry(new JavaSurveyVolume(_builder.getSurveyVolume(TrackerEnvelope.class), trackingGeometry,1));
         add(getBaseTrackerGeometry());
-		JavaSurveyVolume basePlateGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(BasePlate.class), getBaseTrackerGeometry());
-		add(basePlateGeometry);
-		// skip the c-support, this is purely a reference volume in the builder so should have no use here!?
-		//JavaBaseGeometry cSupportGeometry = new GhostJavaBaseGeom(_builder.getBaseGeometry(CSupport.class), baseTrackerGeometry);
-		//add(cSupportGeometry);
-		JavaSurveyVolume supportBottomGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportBottom.class), getBaseTrackerGeometry());
-		add(supportBottomGeometry);
-		JavaSurveyVolume supportPlateBottomGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportPlateBottom.class), getBaseTrackerGeometry());
-		add(supportPlateBottomGeometry);
-		JavaSurveyVolume supportTopGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportTop.class), getBaseTrackerGeometry());
-		add(supportTopGeometry);
-		JavaSurveyVolume supportPlateTopGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportPlateTop.class), getBaseTrackerGeometry());
-		add(supportPlateTopGeometry);
-
-		// build modules	
-		
-		if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
-
-		// Loop over all modules created
-		for(BaseModuleBundle mod : _builder.modules) {
-			TestRunModuleBundle m = (TestRunModuleBundle) mod;
-		    if(isDebug()) { 
-				System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf());
-				m.print();
-			}
-
-			// Find the mother among the objects using its name, should probably have a better way...
-			String name_mother = m.getMother().getName();
-			JavaSurveyVolume mother = null;
-			for(JavaSurveyVolume g : javaSurveyVolumes) {
-				if(g.getName().equals(name_mother)) {
-					mother = g;
-					break;
-				}
-			}
-			// Check that it had a mother
-			if(mother==null) throw new RuntimeException("Cound't find mother to module " + m.module.getName());
-
-			if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
-			
-			// put the module in the list of objects that will be added to LCDD
-			addTestRunModule(m, mother);
-			
-			if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
-
-			
-		}
-		
-		if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
-
-		
-		if(isDebug()) System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
-		if(isDebug()) {
-		    System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
-		    System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
-		    for(JavaSurveyVolume bg : javaSurveyVolumes) {
-		        System.out.printf("-------\n%s\n", bg.toString());
-		    }
-		}
-
-
-		// Set visualization features
-		//setVis();
-
-
-	}
-
-	/**
-	 * Rules for adding the JAVA module geometry.
-	 * @param bundle - module to be added
-	 * @param mother - mother JAVA geometry object
-	 */
-	protected void addTestRunModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) {
-		
-		if(isDebug()) {
-			System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName());
-			bundle.print();
-		}
-		
-		// Create the module
-		JavaSurveyVolume lcddM = new JavaGhostSurveyVolume(bundle.module, mother);
-		add(lcddM);
-		
-		// add half modules
-		if(bundle.halfModuleAxial!=null)  addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM);     
+        JavaSurveyVolume basePlateGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(BasePlate.class), getBaseTrackerGeometry());
+        add(basePlateGeometry);
+        // skip the c-support, this is purely a reference volume in the builder so should have no use here!?
+        //JavaBaseGeometry cSupportGeometry = new GhostJavaBaseGeom(_builder.getBaseGeometry(CSupport.class), baseTrackerGeometry);
+        //add(cSupportGeometry);
+        JavaSurveyVolume supportBottomGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportBottom.class), getBaseTrackerGeometry());
+        add(supportBottomGeometry);
+        JavaSurveyVolume supportPlateBottomGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportPlateBottom.class), getBaseTrackerGeometry());
+        add(supportPlateBottomGeometry);
+        JavaSurveyVolume supportTopGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportTop.class), getBaseTrackerGeometry());
+        add(supportTopGeometry);
+        JavaSurveyVolume supportPlateTopGeometry = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SupportPlateTop.class), getBaseTrackerGeometry());
+        add(supportPlateTopGeometry);
+
+        // build modules    
+        
+        if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
+
+        // Loop over all modules created
+        for(BaseModuleBundle mod : _builder.modules) {
+            TestRunModuleBundle m = (TestRunModuleBundle) mod;
+            if(isDebug()) { 
+                System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf());
+                m.print();
+            }
+
+            // Find the mother among the objects using its name, should probably have a better way...
+            String name_mother = m.getMother().getName();
+            JavaSurveyVolume mother = null;
+            for(JavaSurveyVolume g : javaSurveyVolumes) {
+                if(g.getName().equals(name_mother)) {
+                    mother = g;
+                    break;
+                }
+            }
+            // Check that it had a mother
+            if(mother==null) throw new RuntimeException("Cound't find mother to module " + m.module.getName());
+
+            if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
+            
+            // put the module in the list of objects that will be added to LCDD
+            addTestRunModule(m, mother);
+            
+            if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
+
+            
+        }
+        
+        if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
+
+        
+        if(isDebug()) System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
+        if(isDebug()) {
+            System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
+            System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
+            for(JavaSurveyVolume bg : javaSurveyVolumes) {
+                System.out.printf("-------\n%s\n", bg.toString());
+            }
+        }
+
+
+        // Set visualization features
+        //setVis();
+
+
+    }
+
+    /**
+     * Rules for adding the JAVA module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother JAVA geometry object
+     */
+    protected void addTestRunModule(TestRunModuleBundle bundle, JavaSurveyVolume mother) {
+        
+        if(isDebug()) {
+            System.out.printf("%s: addModule %s containing:\n",this.getClass().getSimpleName(), bundle.module.getName());
+            bundle.print();
+        }
+        
+        // Create the module
+        JavaSurveyVolume lcddM = new JavaGhostSurveyVolume(bundle.module, mother);
+        add(lcddM);
+        
+        // add half modules
+        if(bundle.halfModuleAxial!=null)  addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM);     
         if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
-		
-		
-		if(isDebug()) {
-			System.out.printf("%s: DONE addModule %s \n",this.getClass().getSimpleName(), bundle.module.getName());
-		}
-		
-	}
-	
-	
-	/**
-	 * Rules for adding the JAVA half module geometry.
-	 * @param bundle - module to be added
-	 * @param mother - mother JAVA geometry object
-	 */
-	private void addHalfModule(TestRunHalfModuleBundle bundle, JavaSurveyVolume mother) {
-		// Create the half-module
-		// This is not a ghost element but reflects the module 
-		// concept in the old compact description
-		// TODO fix the layer IDs
-		int oldCompactModuleId = 0;
-		JavaSurveyVolume lcddHM = new JavaSurveyVolume(bundle.halfModule, mother,oldCompactModuleId);
-		add(lcddHM);
-		
-		// ComponentNumber is taken from old geometry where it is simply a counter when adding the xml daughters to the TestRunModule.
-		// It is simply 0 for sensor and 1 for carbon fiber in the old geometry 
-		int componentNumber = ((Sensor)bundle.sensor).getId();
-
-		// create the sensor
-		JavaSurveyVolume lcddS = new JavaSurveyVolume(bundle.sensor, lcddHM, componentNumber);
-		add(lcddS);
-
-		// create the active sensor
-		JavaSurveyVolume lcddAS = new JavaSurveyVolume(bundle.activeSensor, lcddS, componentNumber);
-		add(lcddAS);
-		
-//		if(isDebug()) {
-//			System.out.printf("%s: added sensor %s \n",this.getClass().getSimpleName(), lcddS.getName());
-//			System.out.printf("%s: local coordinate system\n%s\n",this.getClass().getSimpleName(), bundle.sensor.getCoord().toString());
-//			dsd
-//		}
-		
-		
-	}
+        
+        
+        if(isDebug()) {
+            System.out.printf("%s: DONE addModule %s \n",this.getClass().getSimpleName(), bundle.module.getName());
+        }
+        
+    }
+    
+    
+    /**
+     * Rules for adding the JAVA half module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother JAVA geometry object
+     */
+    private void addHalfModule(TestRunHalfModuleBundle bundle, JavaSurveyVolume mother) {
+        // Create the half-module
+        // This is not a ghost element but reflects the module 
+        // concept in the old compact description
+        // TODO fix the layer IDs
+        int oldCompactModuleId = 0;
+        JavaSurveyVolume lcddHM = new JavaSurveyVolume(bundle.halfModule, mother,oldCompactModuleId);
+        add(lcddHM);
+        
+        // ComponentNumber is taken from old geometry where it is simply a counter when adding the xml daughters to the TestRunModule.
+        // It is simply 0 for sensor and 1 for carbon fiber in the old geometry 
+        int componentNumber = ((Sensor)bundle.sensor).getId();
+
+        // create the sensor
+        JavaSurveyVolume lcddS = new JavaSurveyVolume(bundle.sensor, lcddHM, componentNumber);
+        add(lcddS);
+
+        // create the active sensor
+        JavaSurveyVolume lcddAS = new JavaSurveyVolume(bundle.activeSensor, lcddS, componentNumber);
+        add(lcddAS);
+        
+//      if(isDebug()) {
+//          System.out.printf("%s: added sensor %s \n",this.getClass().getSimpleName(), lcddS.getName());
+//          System.out.printf("%s: local coordinate system\n%s\n",this.getClass().getSimpleName(), bundle.sensor.getCoord().toString());
+//          dsd
+//      }
+        
+        
+    }
 
 
 
@@ -206,8 +206,8 @@
     }
 
 
-	
-	
-	
+    
+    
+    
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTestRunTracker2014LCDDBuilder.java	Wed Mar  9 11:43:24 2016
@@ -26,157 +26,157 @@
 public class HPSTestRunTracker2014LCDDBuilder extends HPSTrackerLCDDBuilder {
 
 
-	public HPSTestRunTracker2014LCDDBuilder(boolean debugFlag, Element node, LCDD lcdd, SensitiveDetector sens) {
-		super(debugFlag, node, lcdd, sens);
-	}
+    public HPSTestRunTracker2014LCDDBuilder(boolean debugFlag, Element node, LCDD lcdd, SensitiveDetector sens) {
+        super(debugFlag, node, lcdd, sens);
+    }
 
-	
-	public void setBuilder() {
-	    setBuilder();
-	}
-	
-	public void build(Volume worldVolume) {
-		
-		// set and build geometry
+    
+    public void setBuilder() {
+        setBuilder();
+    }
+    
+    public void build(Volume worldVolume) {
+        
+        // set and build geometry
         setBuilder(createGeometryDefinition(_debug, node));
         
-		if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
+        if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
 
-		if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
+        if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
 
-		_builder.build();
+        _builder.build();
 
-		if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
+        if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
 
 
-		if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName());
+        if(isDebug()) System.out.printf("%s: build the LCDD geometry objects\n", getClass().getSimpleName());
 
-		
-		// Go through the list of volumes to build that is created in the generic builder class
-		// TODO this is manual now since I don't have a way of knowing in the generic builder class what is a ghost volume at this point.
-		LCDDSurveyVolume trackingGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume.class), worldVolume);
-		add(trackingGeometry);
-		baseSurveyVolume = new LCDDSurveyVolume(_builder.getSurveyVolume(TrackerEnvelope.class), lcdd, trackingGeometry);
-		add(baseSurveyVolume);
-		LCDDSurveyVolume basePlateGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(BasePlate.class), lcdd, baseSurveyVolume);
-		add(basePlateGeometry);
-		// TODO I don't think this c-support has any use at all since the coordinates of it has been already used in the builder. Should remove?
-		LCDDSurveyVolume cSupportGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(CSupport.class), baseSurveyVolume);
-		add(cSupportGeometry);
-		LCDDSurveyVolume supportBottomGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportBottom.class), baseSurveyVolume);
-		add(supportBottomGeometry);
-		LCDDSurveyVolume supportPlateBottomGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(SupportPlateBottom.class), lcdd, baseSurveyVolume);
-		add(supportPlateBottomGeometry);
-		LCDDSurveyVolume supportTopGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportTop.class), baseSurveyVolume);
-		add(supportTopGeometry);
-		LCDDSurveyVolume supportPlateTopGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(SupportPlateTop.class), lcdd, baseSurveyVolume);
-		add(supportPlateTopGeometry);
+        
+        // Go through the list of volumes to build that is created in the generic builder class
+        // TODO this is manual now since I don't have a way of knowing in the generic builder class what is a ghost volume at this point.
+        LCDDSurveyVolume trackingGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(org.lcsim.geometry.compact.converter.HPSTrackerGeometryDefinition.TrackingVolume.class), worldVolume);
+        add(trackingGeometry);
+        baseSurveyVolume = new LCDDSurveyVolume(_builder.getSurveyVolume(TrackerEnvelope.class), lcdd, trackingGeometry);
+        add(baseSurveyVolume);
+        LCDDSurveyVolume basePlateGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(BasePlate.class), lcdd, baseSurveyVolume);
+        add(basePlateGeometry);
+        // TODO I don't think this c-support has any use at all since the coordinates of it has been already used in the builder. Should remove?
+        LCDDSurveyVolume cSupportGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(CSupport.class), baseSurveyVolume);
+        add(cSupportGeometry);
+        LCDDSurveyVolume supportBottomGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportBottom.class), baseSurveyVolume);
+        add(supportBottomGeometry);
+        LCDDSurveyVolume supportPlateBottomGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(SupportPlateBottom.class), lcdd, baseSurveyVolume);
+        add(supportPlateBottomGeometry);
+        LCDDSurveyVolume supportTopGeometry = new LCDDGhostSurveyVolume(_builder.getSurveyVolume(SupportTop.class), baseSurveyVolume);
+        add(supportTopGeometry);
+        LCDDSurveyVolume supportPlateTopGeometry = new LCDDSurveyVolume(_builder.getSurveyVolume(SupportPlateTop.class), lcdd, baseSurveyVolume);
+        add(supportPlateTopGeometry);
 
-		// build modules	
+        // build modules    
 
-		if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName());
+        if(isDebug()) System.out.printf("%s: build modules\n", getClass().getSimpleName());
 
-		// Loop over all modules created
-		for(BaseModuleBundle mod : _builder.modules) {
-		    TestRunModuleBundle m = (TestRunModuleBundle) mod;
-			if(isDebug()) { 
-				System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf());
-				m.print();
-			}
+        // Loop over all modules created
+        for(BaseModuleBundle mod : _builder.modules) {
+            TestRunModuleBundle m = (TestRunModuleBundle) mod;
+            if(isDebug()) { 
+                System.out.printf("%s: module layer %d half %s\n", getClass().getSimpleName(),m.getLayer(),m.getHalf());
+                m.print();
+            }
 
-			// Find the mother among the LCDD objects using its name, should probably have a better way...
-			String name_mother = m.getMother().getName();
-			LCDDSurveyVolume mother = null;
-			for(LCDDSurveyVolume g : lcddSurveyVolumes) {
-				if(g.getName().equals(name_mother)) {
-					mother = g;
-					break;
-				}
-			}
-			// Check that it had a mother
-			if(mother==null) throw new RuntimeException("Cound't find mother to module layer " + m.getLayer() + " half "+ m.getHalf());
+            // Find the mother among the LCDD objects using its name, should probably have a better way...
+            String name_mother = m.getMother().getName();
+            LCDDSurveyVolume mother = null;
+            for(LCDDSurveyVolume g : lcddSurveyVolumes) {
+                if(g.getName().equals(name_mother)) {
+                    mother = g;
+                    break;
+                }
+            }
+            // Check that it had a mother
+            if(mother==null) throw new RuntimeException("Cound't find mother to module layer " + m.getLayer() + " half "+ m.getHalf());
 
-			if(isDebug()) System.out.printf("%s: found mother %s for module layer %d half %s\n", getClass().getSimpleName(),mother.getName(),m.getLayer(),m.getHalf());
+            if(isDebug()) System.out.printf("%s: found mother %s for module layer %d half %s\n", getClass().getSimpleName(),mother.getName(),m.getLayer(),m.getHalf());
 
-			// add the module to the list of objects that will be added to LCDD
-			addTestRunModule(m, mother);
+            // add the module to the list of objects that will be added to LCDD
+            addTestRunModule(m, mother);
 
-		}
+        }
 
 
 
-		if(isDebug()) {
-		    System.out.printf("%s: DONE building the LCDD geometry objects\n", getClass().getSimpleName());
-		    System.out.printf("%s: List of all %d LCDD geometry objects built\n", this.getClass().getSimpleName(), lcddSurveyVolumes.size());
-		    for(SurveyVolumeImpl bg : lcddSurveyVolumes) {
-		        System.out.printf("-------\n%s\n", bg.toString());
-		    }
-		}
+        if(isDebug()) {
+            System.out.printf("%s: DONE building the LCDD geometry objects\n", getClass().getSimpleName());
+            System.out.printf("%s: List of all %d LCDD geometry objects built\n", this.getClass().getSimpleName(), lcddSurveyVolumes.size());
+            for(SurveyVolumeImpl bg : lcddSurveyVolumes) {
+                System.out.printf("-------\n%s\n", bg.toString());
+            }
+        }
 
 
 
-		// Set visualization features
-		setVisualization();
+        // Set visualization features
+        setVisualization();
 
 
-	}
+    }
 
 
-	/**
-	 * Rules for adding the LCDD module geometry.
-	 * @param bundle - module to be added
-	 * @param mother - mother LCDD geometry object
-	 */
-	protected void addTestRunModule(TestRunModuleBundle bundle, LCDDSurveyVolume mother) {
-		// This could perhaps be fixed if there is a relation with daughters in geometry definition?
-		// create the module
-		LCDDSurveyVolume lcddM = new LCDDSurveyVolume(bundle.module, lcdd, mother);
-		add(lcddM);
-		if(bundle.halfModuleAxial!=null)  addTestRunHalfModule(bundle.halfModuleAxial,lcddM);
-		if(bundle.coldBlock!=null)        add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));		
-		if(bundle.halfModuleStereo!=null) addTestRunHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
+    /**
+     * Rules for adding the LCDD module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother LCDD geometry object
+     */
+    protected void addTestRunModule(TestRunModuleBundle bundle, LCDDSurveyVolume mother) {
+        // This could perhaps be fixed if there is a relation with daughters in geometry definition?
+        // create the module
+        LCDDSurveyVolume lcddM = new LCDDSurveyVolume(bundle.module, lcdd, mother);
+        add(lcddM);
+        if(bundle.halfModuleAxial!=null)  addTestRunHalfModule(bundle.halfModuleAxial,lcddM);
+        if(bundle.coldBlock!=null)        add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));     
+        if(bundle.halfModuleStereo!=null) addTestRunHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
 //        if(bundle.halfModuleAxial!=null)  addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleAxial,lcddM);
 //        if(bundle.coldBlock!=null)        add(new LCDDSurveyVolume(bundle.coldBlock, lcdd, lcddM));     
 //        if(bundle.halfModuleStereo!=null) addHalfModule((TestRunHalfModuleBundle)bundle.halfModuleStereo,lcddM);
 
-	}
+    }
 
-	/**
-	 * Rules for adding the LCDD half module geometry.
-	 * @param bundle - module to be added
-	 * @param mother - mother LCDD geometry object
-	 */
-	protected void addTestRunHalfModule(HalfModuleBundle bundle2, LCDDSurveyVolume mother) {
-		// This could perhaps be fixed if there is a relation with daughters in geometry definition?
-	    TestRunHalfModuleBundle bundle = (TestRunHalfModuleBundle) bundle2;
-	    
-	    // create the half-module
-		LCDDSurveyVolume lcddHM = new LCDDSurveyVolume(bundle.halfModule, lcdd, mother);
-		add(lcddHM);
-		// create the sensor
-		LCDDSurveyVolume lcddS = new LCDDSurveyVolume(bundle.sensor, lcdd, lcddHM);
-		add(lcddS);
-		// create the active sensor
-		LCDDSurveyVolume lcddAS = new LCDDSurveyVolume(bundle.activeSensor, lcdd, lcddS);
-		add(lcddAS);
-		// create the lamination
-		LCDDSurveyVolume lcddL = new LCDDSurveyVolume(bundle.lamination, lcdd, lcddHM);
-		add(lcddL);
-		// create the carbon fiber frame
-		LCDDSurveyVolume lcddCF = new LCDDSurveyVolume(bundle.carbonFiber, lcdd, lcddHM);
-		add(lcddCF);
-		// create the hybrid frame
-		LCDDSurveyVolume lcddH = new LCDDSurveyVolume(bundle.hybrid, lcdd, lcddHM);
-		add(lcddH);
+    /**
+     * Rules for adding the LCDD half module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother LCDD geometry object
+     */
+    protected void addTestRunHalfModule(HalfModuleBundle bundle2, LCDDSurveyVolume mother) {
+        // This could perhaps be fixed if there is a relation with daughters in geometry definition?
+        TestRunHalfModuleBundle bundle = (TestRunHalfModuleBundle) bundle2;
+        
+        // create the half-module
+        LCDDSurveyVolume lcddHM = new LCDDSurveyVolume(bundle.halfModule, lcdd, mother);
+        add(lcddHM);
+        // create the sensor
+        LCDDSurveyVolume lcddS = new LCDDSurveyVolume(bundle.sensor, lcdd, lcddHM);
+        add(lcddS);
+        // create the active sensor
+        LCDDSurveyVolume lcddAS = new LCDDSurveyVolume(bundle.activeSensor, lcdd, lcddS);
+        add(lcddAS);
+        // create the lamination
+        LCDDSurveyVolume lcddL = new LCDDSurveyVolume(bundle.lamination, lcdd, lcddHM);
+        add(lcddL);
+        // create the carbon fiber frame
+        LCDDSurveyVolume lcddCF = new LCDDSurveyVolume(bundle.carbonFiber, lcdd, lcddHM);
+        add(lcddCF);
+        // create the hybrid frame
+        LCDDSurveyVolume lcddH = new LCDDSurveyVolume(bundle.hybrid, lcdd, lcddHM);
+        add(lcddH);
 
-	}
+    }
 
 
     @Override
     public HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug,
             Element node) {
         return new HPSTestRunTracker2014GeometryDefinition(_debug, node);
-    }	
+    }   
 
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTracker2014JavaBuilder.java	Wed Mar  9 11:43:24 2016
@@ -28,122 +28,122 @@
  */
 public class HPSTracker2014JavaBuilder extends HPSTestRunTracker2014JavaBuilder {
 
-	
-	
-	/**
-	 * Default constructor
-	 * @param node 
-	 */
-	public HPSTracker2014JavaBuilder(boolean debugFlag, Element node) {
-		super(debugFlag, node);
-	}
-	
-	
-	
-	
-	/**
-	 * Build the JAVA geometry objects from the geometry definition.
-	 * @param trackingVolume - the reference volume.
-	 */
-	public void build(ILogicalVolume trackingVolume) {
-
-		// build geometry
+    
+    
+    /**
+     * Default constructor
+     * @param node 
+     */
+    public HPSTracker2014JavaBuilder(boolean debugFlag, Element node) {
+        super(debugFlag, node);
+    }
+    
+    
+    
+    
+    /**
+     * Build the JAVA geometry objects from the geometry definition.
+     * @param trackingVolume - the reference volume.
+     */
+    public void build(ILogicalVolume trackingVolume) {
+
+        // build geometry
         setBuilder(createGeometryDefinition(this._debug, node));
-		
-		if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
-
-		if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
-		
-		_builder.build();
-
-		if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
-
-		if(isDebug()) System.out.printf("%s: build the JAVA geometry objects\n", getClass().getSimpleName());
-		
-		// initialize the list to store a reference to each object
-		javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
-
-		// Go through the list of volumes to build that is created in the generic builder class
-		JavaSurveyVolume tracking = new JavaSurveyVolume(_builder.getSurveyVolume(TrackingVolume.class), trackingVolume);
-		add(tracking);
-		JavaSurveyVolume chamber = new JavaGhostSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), tracking);
-		add(chamber);
-		setBaseTrackerGeometry(new JavaSurveyVolume(_builder.getSurveyVolume(SvtBox.class), chamber,1));
-		add(getBaseTrackerGeometry());
-		JavaSurveyVolume svtBoxBasePlate = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SvtBoxBasePlate.class), getBaseTrackerGeometry());
-		add(svtBoxBasePlate);
-
-		
-		// build modules	
-		
-		if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
-
-		// Loop over all modules created
-		for(BaseModuleBundle mod : _builder.modules) {
-			BaseModuleBundle m = mod;
-		    if(isDebug()) { 
-				System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf());
-				m.print();
-			}
-
-			// Find the mother among the objects using its name, should probably have a better way...
-			String name_mother = m.getMother().getName();
-			JavaSurveyVolume mother = null;
-			for(JavaSurveyVolume g : javaSurveyVolumes) {
-				if(g.getName().equals(name_mother)) {
-					mother = g;
-					break;
-				}
-			}
-			// Check that it had a mother
-			if(mother==null) throw new RuntimeException("Cound't find mother to module " + m.module.getName());
-
-			if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
-			
-			// put the module in the list of objects that will be added to LCDD
-			addModule(m, mother);
-			
-			if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
-
-			
-		}
-		
-		if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
-
-		
-		//System.out.printf("%s: Built %d JAVA geometry objects\n", getClass().getSimpleName(),javaSurveyVolumes.size());
-		
-		if(isDebug()) {
-		    System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
-		    System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
-		    for(JavaSurveyVolume bg : javaSurveyVolumes) {
-		        System.out.printf("-------\n%s\n", bg.toString());
-		    }
-		}
-
-
-		// Set visualization features
-		//setVis();
-
-
-	}
-
-	/**
-	 * Rules for adding the JAVA module geometry.
-	 * @param bundle - module to be added
-	 * @param mother - mother JAVA geometry object
-	 */
-	private void addModule(BaseModuleBundle bundle, JavaSurveyVolume mother) {
-	    if(bundle instanceof TestRunModuleBundle) {
-	           addTestRunModule((TestRunModuleBundle) bundle, mother);
-	       } else if(bundle instanceof LongModuleBundle) {
-	           addLongModule((LongModuleBundle) bundle, mother);
-	       } else {
-	           throw new RuntimeException("The bundle is of unknown class type!");
-	       }
-	}
-	
-	/**
+        
+        if(_builder==null) throw new RuntimeException("need to set builder class before calling build!");
+
+        if(isDebug()) System.out.printf("%s: build the base geometry objects\n", getClass().getSimpleName());
+        
+        _builder.build();
+
+        if(isDebug()) System.out.printf("%s: DONE build the base geometry objects\n", getClass().getSimpleName());
+
+        if(isDebug()) System.out.printf("%s: build the JAVA geometry objects\n", getClass().getSimpleName());
+        
+        // initialize the list to store a reference to each object
+        javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
+
+        // Go through the list of volumes to build that is created in the generic builder class
+        JavaSurveyVolume tracking = new JavaSurveyVolume(_builder.getSurveyVolume(TrackingVolume.class), trackingVolume);
+        add(tracking);
+        JavaSurveyVolume chamber = new JavaGhostSurveyVolume(_builder.getSurveyVolume(PSVacuumChamber.class), tracking);
+        add(chamber);
+        setBaseTrackerGeometry(new JavaSurveyVolume(_builder.getSurveyVolume(SvtBox.class), chamber,1));
+        add(getBaseTrackerGeometry());
+        JavaSurveyVolume svtBoxBasePlate = new JavaGhostSurveyVolume(_builder.getSurveyVolume(SvtBoxBasePlate.class), getBaseTrackerGeometry());
+        add(svtBoxBasePlate);
+
+        
+        // build modules    
+        
+        if(isDebug()) System.out.printf("%s: build JAVA modules\n", getClass().getSimpleName());
+
+        // Loop over all modules created
+        for(BaseModuleBundle mod : _builder.modules) {
+            BaseModuleBundle m = mod;
+            if(isDebug()) { 
+                System.out.printf("%s: build module %s (layer %d half %s)\n", getClass().getSimpleName(),m.module.getName(),m.getLayer(),m.getHalf());
+                m.print();
+            }
+
+            // Find the mother among the objects using its name, should probably have a better way...
+            String name_mother = m.getMother().getName();
+            JavaSurveyVolume mother = null;
+            for(JavaSurveyVolume g : javaSurveyVolumes) {
+                if(g.getName().equals(name_mother)) {
+                    mother = g;
+                    break;
+                }
+            }
+            // Check that it had a mother
+            if(mother==null) throw new RuntimeException("Cound't find mother to module " + m.module.getName());
+
+            if(isDebug()) System.out.printf("%s: found mother %s to module %s\n", getClass().getSimpleName(),mother.getName(),m.module.getName());
+            
+            // put the module in the list of objects that will be added to LCDD
+            addModule(m, mother);
+            
+            if(isDebug()) System.out.printf("%s: DONE build module %s\n", getClass().getSimpleName(), m.module.getName());
+
+            
+        }
+        
+        if(isDebug()) System.out.printf("%s: DONE build JAVA modules\n", getClass().getSimpleName());
+
+        
+        //System.out.printf("%s: Built %d JAVA geometry objects\n", getClass().getSimpleName(),javaSurveyVolumes.size());
+        
+        if(isDebug()) {
+            System.out.printf("%s: DONE building the JAVA geometry objects\n", getClass().getSimpleName());
+            System.out.printf("%s: List of all the JAVA geometry objects built\n", this.getClass().getSimpleName());
+            for(JavaSurveyVolume bg : javaSurveyVolumes) {
+                System.out.printf("-------\n%s\n", bg.toString());
+            }
+        }
+
+
+        // Set visualization features
+        //setVis();
+
+
+    }
+
+    /**
+     * Rules for adding the JAVA module geometry.
+     * @param bundle - module to be added
+     * @param mother - mother JAVA geometry object
+     */
+    private void addModule(BaseModuleBundle bundle, JavaSurveyVolume mother) {
+        if(bundle instanceof TestRunModuleBundle) {
+               addTestRunModule((TestRunModuleBundle) bundle, mother);
+           } else if(bundle instanceof LongModuleBundle) {
+               addLongModule((LongModuleBundle) bundle, mother);
+           } else {
+               throw new RuntimeException("The bundle is of unknown class type!");
+           }
+    }
+    
+    /**
      * Rules for adding the LCDD module geometry.
      * @param bundle - module to be added
      * @param mother - mother LCDD geometry object
@@ -191,12 +191,12 @@
         
         
     }
-	
+    
     @Override
     public HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, Element node) {
         return new HPSTracker2014GeometryDefinition(debug, node);
     }
-	
-	
+    
+    
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerGeometryDefinition.java	Wed Mar  9 11:43:24 2016
@@ -41,7 +41,7 @@
     protected static final boolean use30mradRotation = true;
     protected static final boolean useFakeHalfModuleAxialPos = false;
 
-    // Global position references	
+    // Global position references   
     protected static final double target_pos_wrt_base_plate_x = 162.3; //from Marco's 3D model
     protected static final double target_pos_wrt_base_plate_y = 80.55; //from Tim's sketchup //68.75; //from Marco's 3D model
     protected static final double target_pos_wrt_base_plate_z = 926.59; //from Marco's 3D model

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerJavaBuilder.java	Wed Mar  9 11:43:24 2016
@@ -15,158 +15,158 @@
 
 public abstract class HPSTrackerJavaBuilder implements IHPSTrackerJavaBuilder {
 
-	protected boolean _debug = false;
-	private JavaSurveyVolume baseSurveyVolume;
-	protected List<JavaSurveyVolume> javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
-	protected DetectorIdentifierHelper detectorIdentifierHelper;
-	protected IIdentifierDictionary identifierDictionary;
-	protected Subdetector subdet;
-	protected List<IDetectorElement> layerDetectorElements = new ArrayList<IDetectorElement>();
-	protected List<IDetectorElement> moduleDetectorElements = new ArrayList<IDetectorElement>();
-	protected IDetectorElement baseDetectorElement = null;
-	public HPSTrackerBuilder _builder = null;
+    protected boolean _debug = false;
+    private JavaSurveyVolume baseSurveyVolume;
+    protected List<JavaSurveyVolume> javaSurveyVolumes = new ArrayList<JavaSurveyVolume>();
+    protected DetectorIdentifierHelper detectorIdentifierHelper;
+    protected IIdentifierDictionary identifierDictionary;
+    protected Subdetector subdet;
+    protected List<IDetectorElement> layerDetectorElements = new ArrayList<IDetectorElement>();
+    protected List<IDetectorElement> moduleDetectorElements = new ArrayList<IDetectorElement>();
+    protected IDetectorElement baseDetectorElement = null;
+    public HPSTrackerBuilder _builder = null;
     protected Element node = null;
-	
-	public HPSTrackerJavaBuilder(boolean debugFlag, Element node) {
-		this._debug=debugFlag;
-		this.node  = node;
-	}	
-	
-	public abstract void build(ILogicalVolume trackingVolume);
-	public abstract HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, Element node);
+    
+    public HPSTrackerJavaBuilder(boolean debugFlag, Element node) {
+        this._debug=debugFlag;
+        this.node  = node;
+    }   
+    
+    public abstract void build(ILogicalVolume trackingVolume);
+    public abstract HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, Element node);
 
-	
-	/**
-	 * Add to list of objects.
-	 * @param geom - object to add.
-	 */
-	public void add(JavaSurveyVolume geom) {
-		javaSurveyVolumes.add(geom);
-	}
-	
-	public void setBuilder(HPSTrackerBuilder b) {
-		_builder = b;
-	}
-	
-	public void build() {
-		_builder.build();
-	}
-	
-	public void setDebug(boolean debug) {
-		_debug = debug;
-	}
-	
-	public boolean isDebug() {
-		return _debug;
-	}
+    
+    /**
+     * Add to list of objects.
+     * @param geom - object to add.
+     */
+    public void add(JavaSurveyVolume geom) {
+        javaSurveyVolumes.add(geom);
+    }
+    
+    public void setBuilder(HPSTrackerBuilder b) {
+        _builder = b;
+    }
+    
+    public void build() {
+        _builder.build();
+    }
+    
+    public void setDebug(boolean debug) {
+        _debug = debug;
+    }
+    
+    public boolean isDebug() {
+        return _debug;
+    }
 
 
-	public DetectorIdentifierHelper getDetectorIdentifierHelper() {
-		return detectorIdentifierHelper;
-	}
+    public DetectorIdentifierHelper getDetectorIdentifierHelper() {
+        return detectorIdentifierHelper;
+    }
 
-	public void setDetectorIdentifierHelper(
-			DetectorIdentifierHelper detectorIdentifierHelper) {
-		this.detectorIdentifierHelper = detectorIdentifierHelper;
-	}
+    public void setDetectorIdentifierHelper(
+            DetectorIdentifierHelper detectorIdentifierHelper) {
+        this.detectorIdentifierHelper = detectorIdentifierHelper;
+    }
 
-	public IIdentifierDictionary getIdentifierDictionary() {
-		return identifierDictionary;
-	}
+    public IIdentifierDictionary getIdentifierDictionary() {
+        return identifierDictionary;
+    }
 
-	public void setIdentifierDictionary(
-			IIdentifierDictionary identifierDictionary) {
-		this.identifierDictionary = identifierDictionary;
-	}
+    public void setIdentifierDictionary(
+            IIdentifierDictionary identifierDictionary) {
+        this.identifierDictionary = identifierDictionary;
+    }
 
 
-	public void setSubdetector(Subdetector subdet) {
-		this.subdet = subdet;
-	}
+    public void setSubdetector(Subdetector subdet) {
+        this.subdet = subdet;
+    }
 
-	public Subdetector getSubdetector() {
-		return this.subdet;
-	}
+    public Subdetector getSubdetector() {
+        return this.subdet;
+    }
 
-	
+    
 
-	
+    
 
-	// This finds specific type. I would like to use the ID for this but can't, I think.
-	// TODO there must be a factory instance to do this
-	public SiTrackerModule getModuleDetectorElement(SiTrackerModule testElement) {
-		if(isDebug()) System.out.printf("%s: getModuleDetectorElement for module  %s path: \"%s\"\n", this.getClass().getSimpleName(),testElement.getName(),testElement.getGeometry().getPathString());
-		SiTrackerModule element = null;
-		for(IDetectorElement e : moduleDetectorElements) {
-			SiTrackerModule m = (SiTrackerModule) e;
-			if(isDebug()) System.out.printf("%s: compare with module  %s path: %s\"%s\" \n", this.getClass().getSimpleName(),m.getName(),m.getGeometry().getPathString());
-			if(m.getGeometry().getPathString().equals(testElement.getGeometry().getPathString())) {
-				if(element!=null) throw new RuntimeException("two DE sharing extended ID?");
-				if(isDebug()) System.out.printf("%s: found it\n", this.getClass().getSimpleName());
-				element = m;
-			}
-		}
-		return element;
-	}
+    // This finds specific type. I would like to use the ID for this but can't, I think.
+    // TODO there must be a factory instance to do this
+    public SiTrackerModule getModuleDetectorElement(SiTrackerModule testElement) {
+        if(isDebug()) System.out.printf("%s: getModuleDetectorElement for module  %s path: \"%s\"\n", this.getClass().getSimpleName(),testElement.getName(),testElement.getGeometry().getPathString());
+        SiTrackerModule element = null;
+        for(IDetectorElement e : moduleDetectorElements) {
+            SiTrackerModule m = (SiTrackerModule) e;
+            if(isDebug()) System.out.printf("%s: compare with module  %s path: %s\"%s\" \n", this.getClass().getSimpleName(),m.getName(),m.getGeometry().getPathString());
+            if(m.getGeometry().getPathString().equals(testElement.getGeometry().getPathString())) {
+                if(element!=null) throw new RuntimeException("two DE sharing extended ID?");
+                if(isDebug()) System.out.printf("%s: found it\n", this.getClass().getSimpleName());
+                element = m;
+            }
+        }
+        return element;
+    }
 
-	
-	// Find detector elements
-	// TODO This should be using some global geometry code like DetectorElementStore?
-	public IDetectorElement getLayerDetectorElement(IExpandedIdentifier expId) {
-		IDetectorElement element = null;
-		if(isDebug()) System.out.printf("%s: search among %d layer DEs\n", this.getClass().getSimpleName(), layerDetectorElements.size());
-		for(IDetectorElement e : layerDetectorElements) {
-			if(isDebug()) System.out.printf("%s: test %s\n", this.getClass().getSimpleName(),e.getName());
-			ExpandedIdentifier eId = (ExpandedIdentifier) e.getExpandedIdentifier();
-			if(eId.equals(expId)) { // TODO order matters as expId is an interface without that function!?
-				//check that only one was found
-				if(element!=null) throw new RuntimeException("two DE sharing extended ID?");
-				if(isDebug()) System.out.printf("%s: found it\n", this.getClass().getSimpleName());
-				element = e;
-			}
+    
+    // Find detector elements
+    // TODO This should be using some global geometry code like DetectorElementStore?
+    public IDetectorElement getLayerDetectorElement(IExpandedIdentifier expId) {
+        IDetectorElement element = null;
+        if(isDebug()) System.out.printf("%s: search among %d layer DEs\n", this.getClass().getSimpleName(), layerDetectorElements.size());
+        for(IDetectorElement e : layerDetectorElements) {
+            if(isDebug()) System.out.printf("%s: test %s\n", this.getClass().getSimpleName(),e.getName());
+            ExpandedIdentifier eId = (ExpandedIdentifier) e.getExpandedIdentifier();
+            if(eId.equals(expId)) { // TODO order matters as expId is an interface without that function!?
+                //check that only one was found
+                if(element!=null) throw new RuntimeException("two DE sharing extended ID?");
+                if(isDebug()) System.out.printf("%s: found it\n", this.getClass().getSimpleName());
+                element = e;
+            }
 
-		}
-		return element;
-	}
+        }
+        return element;
+    }
 
 
-	public void addLayerDetectorElement(IDetectorElement e) {
-		IExpandedIdentifier expId = e.getExpandedIdentifier();
-		if(getLayerDetectorElement(expId) != null) 
-			throw new RuntimeException("Trying to add an existing layer detector element.");
-		layerDetectorElements.add(e);
-	}
+    public void addLayerDetectorElement(IDetectorElement e) {
+        IExpandedIdentifier expId = e.getExpandedIdentifier();
+        if(getLayerDetectorElement(expId) != null) 
+            throw new RuntimeException("Trying to add an existing layer detector element.");
+        layerDetectorElements.add(e);
+    }
 
-	public void addBaseDetectorElement(IDetectorElement e) {
-	    baseDetectorElement = e;
-	}
+    public void addBaseDetectorElement(IDetectorElement e) {
+        baseDetectorElement = e;
+    }
 
-	public IDetectorElement getBaseDetectorElement() {
-	    return baseDetectorElement;
-	}
+    public IDetectorElement getBaseDetectorElement() {
+        return baseDetectorElement;
+    }
 
-	public void addModuleDetectorElement(IDetectorElement e) {
-		if(!(e instanceof SiTrackerModule)) 
-			throw new RuntimeException("Trying to add an existing module of wrong type.");
-		if(getModuleDetectorElement((SiTrackerModule) e) != null) 
-			throw new RuntimeException("Trying to add an already existing module detector element.");
-		layerDetectorElements.add(e);
-	}
-	
+    public void addModuleDetectorElement(IDetectorElement e) {
+        if(!(e instanceof SiTrackerModule)) 
+            throw new RuntimeException("Trying to add an existing module of wrong type.");
+        if(getModuleDetectorElement((SiTrackerModule) e) != null) 
+            throw new RuntimeException("Trying to add an already existing module detector element.");
+        layerDetectorElements.add(e);
+    }
+    
 
-	/**
-	 * @return the baseTrackerGeometry
-	 */
-	public JavaSurveyVolume getBaseTrackerGeometry() {
-		return baseSurveyVolume;
-	}
+    /**
+     * @return the baseTrackerGeometry
+     */
+    public JavaSurveyVolume getBaseTrackerGeometry() {
+        return baseSurveyVolume;
+    }
 
-	/**
-	 * @param baseTrackerGeometry the baseTrackerGeometry to set
-	 */
-	public void setBaseTrackerGeometry(JavaSurveyVolume baseTrackerGeometry) {
-		this.baseSurveyVolume = baseTrackerGeometry;
-	}
+    /**
+     * @param baseTrackerGeometry the baseTrackerGeometry to set
+     */
+    public void setBaseTrackerGeometry(JavaSurveyVolume baseTrackerGeometry) {
+        this.baseSurveyVolume = baseTrackerGeometry;
+    }
 
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerLCDDBuilder.java	Wed Mar  9 11:43:24 2016
@@ -10,24 +10,24 @@
 
 public abstract class HPSTrackerLCDDBuilder  implements IHPSTrackerLCDDBuilder {
 
-	public boolean _debug = false;
-	protected LCDD lcdd = null;
-	protected LCDDSurveyVolume baseSurveyVolume;
-	protected List<LCDDSurveyVolume> lcddSurveyVolumes = new ArrayList<LCDDSurveyVolume>();
-	private SensitiveDetector sensitiveDetector;
-	public HPSTrackerBuilder _builder = null;
+    public boolean _debug = false;
+    protected LCDD lcdd = null;
+    protected LCDDSurveyVolume baseSurveyVolume;
+    protected List<LCDDSurveyVolume> lcddSurveyVolumes = new ArrayList<LCDDSurveyVolume>();
+    private SensitiveDetector sensitiveDetector;
+    public HPSTrackerBuilder _builder = null;
     protected Element node;
 
-	
-	
-	public HPSTrackerLCDDBuilder(boolean debugFlag, Element node, LCDD lcdd2, SensitiveDetector sens) {
-		setDebug(debugFlag);
-		setLCDD(lcdd2);
-		setSensitiveDetector(sens);
-		setNode(node);
-	}
-	
-	/**
+    
+    
+    public HPSTrackerLCDDBuilder(boolean debugFlag, Element node, LCDD lcdd2, SensitiveDetector sens) {
+        setDebug(debugFlag);
+        setLCDD(lcdd2);
+        setSensitiveDetector(sens);
+        setNode(node);
+    }
+    
+    /**
      * Build the LCDD geometry objects.
      * @param worldVolume - the reference volume.
      */
@@ -37,93 +37,93 @@
     public abstract void setBuilder();
     
     public abstract HPSTrackerGeometryDefinition createGeometryDefinition(boolean debug, Element node);
-	
+    
 
-	public void setNode(Element node) {
+    public void setNode(Element node) {
         this.node = node;
-	}
-	
+    }
+    
     public void setSensitiveDetector(SensitiveDetector sens) {
-		this.sensitiveDetector = sens;
-	}
+        this.sensitiveDetector = sens;
+    }
 
-	public SensitiveDetector getSensitiveDetector() {
-		return this.sensitiveDetector;
-	}
+    public SensitiveDetector getSensitiveDetector() {
+        return this.sensitiveDetector;
+    }
 
-	public void setBuilder(HPSTrackerBuilder b) {
-		_builder = b;
-	}
-	
-	public HPSTrackerBuilder getBuilder() {
-	    return _builder;
-	}
-	
-	public void build() {
-		_builder.build();
-	}
-	
-	public void setDebug(boolean debug) {
-		_debug = debug;
-	}
-	
-	public boolean isDebug() {
-		return _debug;
-	}
-	
-	/**
-	 * Add to list of objects.
-	 * @param geom - object to add.
-	 */
-	public void add(LCDDSurveyVolume geom) {
-		lcddSurveyVolumes.add(geom);
-	}
+    public void setBuilder(HPSTrackerBuilder b) {
+        _builder = b;
+    }
+    
+    public HPSTrackerBuilder getBuilder() {
+        return _builder;
+    }
+    
+    public void build() {
+        _builder.build();
+    }
+    
+    public void setDebug(boolean debug) {
+        _debug = debug;
+    }
+    
+    public boolean isDebug() {
+        return _debug;
+    }
+    
+    /**
+     * Add to list of objects.
+     * @param geom - object to add.
+     */
+    public void add(LCDDSurveyVolume geom) {
+        lcddSurveyVolumes.add(geom);
+    }
 
-	
-	
+    
+    
 
-	public void setLCDD(LCDD lcdd) {
-		this.lcdd = lcdd;
-	}
+    public void setLCDD(LCDD lcdd) {
+        this.lcdd = lcdd;
+    }
 
-	public LCDD getLCDD() {
-		return lcdd;
-	}
+    public LCDD getLCDD() {
+        return lcdd;
+    }
 
-	public LCDDSurveyVolume getBaseLCDD() {
-		return baseSurveyVolume;
-	}
+    public LCDDSurveyVolume getBaseLCDD() {
+        return baseSurveyVolume;
+    }
 
-	public void setVisualization() {
-	
-		if(isDebug()) System.out.printf("%s: Set LCDD visualization for %d LCDD geometry objects \n", getClass().getSimpleName(), lcddSurveyVolumes.size());
-		for(SurveyVolumeImpl g : lcddSurveyVolumes) {
-		    String name = g.getName();
-			if(isDebug()) System.out.printf("%s: Set LCDD vis for %s \n", getClass().getSimpleName(), name);			
-			if(name.contains("base_plate")) g.setVisName("BasePlateVis");
+    public void setVisualization() {
+    
+        if(isDebug()) System.out.printf("%s: Set LCDD visualization for %d LCDD geometry objects \n", getClass().getSimpleName(), lcddSurveyVolumes.size());
+        for(SurveyVolumeImpl g : lcddSurveyVolumes) {
+            String name = g.getName();
+            if(isDebug()) System.out.printf("%s: Set LCDD vis for %s \n", getClass().getSimpleName(), name);            
+            if(name.contains("base_plate")) g.setVisName("BasePlateVis");
             else if(name.equals("base")) g.setVisName("SvtBoxVis");
-			else if(name.contains("chamber")) g.setVisName("ChamberVis");
-			else if(name.contains("support_bottom") || name.contains("support_top")) g.setVisName("SupportVolumeVis");
-			else if(name.contains("support_plate")) g.setVisName("SupportPlateVis");
-			else if(name.startsWith("module_")) {
-			    if(name.endsWith("halfmodule_axial") || name.endsWith("halfmodule_stereo")) g.setVisName("HalfModuleVis");
-			    else if(name.endsWith("cold")) g.setVisName("ColdBlockVis");
-			    else if(name.endsWith("lamination")) g.setVisName("KaptonVis");
-			    else if(name.endsWith("sensor")) g.setVisName("SensorVis");
-			    else if(name.endsWith("sensor_active")) g.setVisName("SensorVis");
-			    else if(name.endsWith("cf")) g.setVisName("CarbonFiberVis");
-			    else if(name.endsWith("hybrid")) g.setVisName("HybridVis");
-			    else {
-			        //this must be a module then?
-			        g.setVisName("ModuleVis");
-			    }
-			}
-			else {
-				if(isDebug()) System.out.printf("%s: No LCDD vis for %s \n", getClass().getSimpleName(), name);
-			}
-		}
-		if(isDebug()) System.out.printf("%s: DONE Set LCDD vis \n", getClass().getSimpleName());
-	}
-	
+            else if(name.contains("chamber")) g.setVisName("ChamberVis");
+            else if(name.contains("support_bottom") || name.contains("support_top")) g.setVisName("SupportVolumeVis");
+            else if(name.contains("support_plate")) g.setVisName("SupportPlateVis");
+            else if(name.startsWith("module_")) {
+                if(name.endsWith("halfmodule_axial") || name.endsWith("halfmodule_stereo")) g.setVisName("HalfModuleVis");
+                else if(name.endsWith("cold")) g.setVisName("ColdBlockVis");
+                else if(name.endsWith("lamination")) g.setVisName("KaptonVis");
+                else if(name.endsWith("sensor")) g.setVisName("SensorVis");
+                else if(name.endsWith("sensor_active")) g.setVisName("SensorVis");
+                else if(name.endsWith("cf")) g.setVisName("CarbonFiberVis");
+                else if(name.endsWith("hybrid")) g.setVisName("HybridVis");
+                else {
+                    //this must be a module then?
+                    g.setVisName("ModuleVis");
+                }
+            }
+            else {
+                if(isDebug()) System.out.printf("%s: No LCDD vis for %s \n", getClass().getSimpleName(), name);
+            }
+        }
+        if(isDebug()) System.out.printf("%s: DONE Set LCDD vis \n", getClass().getSimpleName());
+    }
+    
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerJavaBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerJavaBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerJavaBuilder.java	Wed Mar  9 11:43:24 2016
@@ -7,25 +7,25 @@
 
 public interface IHPSTrackerJavaBuilder {
 
-	/**
-	 * Build the JAVA geometry objects from the geometry definition.
-	 * @param trackingVolume - the reference volume.
-	 */
-	public void build(ILogicalVolume trackingVolume);
-	
-	public DetectorIdentifierHelper getDetectorIdentifierHelper();
+    /**
+     * Build the JAVA geometry objects from the geometry definition.
+     * @param trackingVolume - the reference volume.
+     */
+    public void build(ILogicalVolume trackingVolume);
+    
+    public DetectorIdentifierHelper getDetectorIdentifierHelper();
 
-	public void setDetectorIdentifierHelper(
-			DetectorIdentifierHelper detectorIdentifierHelper);
+    public void setDetectorIdentifierHelper(
+            DetectorIdentifierHelper detectorIdentifierHelper);
 
-	public IIdentifierDictionary getIdentifierDictionary();
+    public IIdentifierDictionary getIdentifierDictionary();
 
-	public void setIdentifierDictionary(
-			IIdentifierDictionary identifierDictionary);
+    public void setIdentifierDictionary(
+            IIdentifierDictionary identifierDictionary);
 
 
-	public void setSubdetector(Subdetector subdet);
+    public void setSubdetector(Subdetector subdet);
 
-	public Subdetector getSubdetector();
-	
+    public Subdetector getSubdetector();
+    
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerLCDDBuilder.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerLCDDBuilder.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/IHPSTrackerLCDDBuilder.java	Wed Mar  9 11:43:24 2016
@@ -5,11 +5,11 @@
 
 public interface IHPSTrackerLCDDBuilder {
 
-	public  void setSensitiveDetector(SensitiveDetector sens);
+    public  void setSensitiveDetector(SensitiveDetector sens);
 
-	public  SensitiveDetector getSensitiveDetector();
-	
-	public void build(Volume worldVolume);
+    public  SensitiveDetector getSensitiveDetector();
+    
+    public void build(Volume worldVolume);
 
-	public void setVisualization();
+    public void setVisualization();
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java	Wed Mar  9 11:43:24 2016
@@ -7,22 +7,22 @@
  * @author Per Hansson Adrian <[log in to unmask]>
  */
 public class JavaGhostSurveyVolume extends JavaSurveyVolume {
-	
-	/**
-	 * Initialize with base and mother. This is typically for a reference geometry object 
-	 * that is used for referencing coordinate systems but that doesn't have a volume itself.
-	 * @param surveyVolume - object used to get geometry definitions
-	 * @param mother - mother object
-	 */
-	public JavaGhostSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother) {
-		super(surveyVolume);
-		if(isDebug()) System.out.printf("%s: constructing JAVA ghost object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
-		setMother(mother);
-		mother.addDaughter(this);
-		setPositionAndRotation(surveyVolume);
-		if(isDebug()) System.out.printf("%s: DONE constructing JAVA object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-	}
-	
+    
+    /**
+     * Initialize with base and mother. This is typically for a reference geometry object 
+     * that is used for referencing coordinate systems but that doesn't have a volume itself.
+     * @param surveyVolume - object used to get geometry definitions
+     * @param mother - mother object
+     */
+    public JavaGhostSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother) {
+        super(surveyVolume);
+        if(isDebug()) System.out.printf("%s: constructing JAVA ghost object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
+        setMother(mother);
+        mother.addDaughter(this);
+        setPositionAndRotation(surveyVolume);
+        if(isDebug()) System.out.printf("%s: DONE constructing JAVA object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+    }
+    
 
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java	Wed Mar  9 11:43:24 2016
@@ -26,120 +26,120 @@
  * @author Per Hansson Adrian <[log in to unmask]>
  */
 public class JavaSurveyVolume extends SurveyVolumeImpl {
-	private Box box= null;
-	private ILogicalVolume volume = null;
-	private ITranslation3D pos = null;
-	private IRotation3D rot = null;
-	private IPhysicalVolume physVolume = null;
-	private JavaSurveyVolume mother = null;
-	public List<JavaSurveyVolume> daughters = new ArrayList<JavaSurveyVolume>();
-	private int componentId = -1;
-	
-	/**
-	 *  Default constructor
-	 */
-	public JavaSurveyVolume(SurveyVolume surveyVolume) {
-	    super(surveyVolume);
-	}
-
-	/**
-	 * Construct a JAVA geometry object from its geometry definition and an already built logical volume. 
-	 * This is typically used by the tracking volume.
-	 * @param surveyVolume - input geometry definition
-	 * @param vol - logical volume
-	 */
-	public JavaSurveyVolume(SurveyVolume surveyVolume, ILogicalVolume vol) {
-	    super(surveyVolume);
-		if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (given logical volume %s)\n", this.getClass().getSimpleName(),surveyVolume.getName(),vol.getName());
-		// this must be tracking volume. May change in the future and is probably weird to make this requirement here. 
-		if(!surveyVolume.getName().contains("tracking")) throw new RuntimeException("this constructor is only used with the tracking volume!?");
-		setVolume(vol);
-		// since it's tracking volume, set the pos and rotation trivially
-		Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
-		setPos(new Translation3D(0,0,0));
-		setRot(new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
-		if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-	}
-	
-	/**
-	 * Construct a JAVA geometry object from its geometry definition. 
-	 * @param surveyVolume - input geometry definition
-	 * @param mother - reference to mother JAVA definition
-	 * @param volumeId - component id number 
-	 */
-	public JavaSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother, int volumeId) {
-	    super(surveyVolume);
+    private Box box= null;
+    private ILogicalVolume volume = null;
+    private ITranslation3D pos = null;
+    private IRotation3D rot = null;
+    private IPhysicalVolume physVolume = null;
+    private JavaSurveyVolume mother = null;
+    public List<JavaSurveyVolume> daughters = new ArrayList<JavaSurveyVolume>();
+    private int componentId = -1;
+    
+    /**
+     *  Default constructor
+     */
+    public JavaSurveyVolume(SurveyVolume surveyVolume) {
+        super(surveyVolume);
+    }
+
+    /**
+     * Construct a JAVA geometry object from its geometry definition and an already built logical volume. 
+     * This is typically used by the tracking volume.
+     * @param surveyVolume - input geometry definition
+     * @param vol - logical volume
+     */
+    public JavaSurveyVolume(SurveyVolume surveyVolume, ILogicalVolume vol) {
+        super(surveyVolume);
+        if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (given logical volume %s)\n", this.getClass().getSimpleName(),surveyVolume.getName(),vol.getName());
+        // this must be tracking volume. May change in the future and is probably weird to make this requirement here. 
+        if(!surveyVolume.getName().contains("tracking")) throw new RuntimeException("this constructor is only used with the tracking volume!?");
+        setVolume(vol);
+        // since it's tracking volume, set the pos and rotation trivially
+        Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+        setPos(new Translation3D(0,0,0));
+        setRot(new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
+        if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+    }
+    
+    /**
+     * Construct a JAVA geometry object from its geometry definition. 
+     * @param surveyVolume - input geometry definition
+     * @param mother - reference to mother JAVA definition
+     * @param volumeId - component id number 
+     */
+    public JavaSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother, int volumeId) {
+        super(surveyVolume);
         if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (volumeID %d, mother %s)\n", this.getClass().getSimpleName(),surveyVolume.getName(),volumeId,mother==null?"null":mother.getName());
-		setComponentId(volumeId);
-		setMother(mother);
-		mother.addDaughter(this);
-		buildBox();
-		buildVolume();
-		setPositionAndRotation(surveyVolume);
-		if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-	}
-
-	protected boolean hasCoordinateSystemInfo() {
-		return pos!=null && rot!=null;
-	}
-	
-	
-	public void buildPhysVolume() {
-		if(isDebug()) System.out.printf("%s: build phys volume for %s with mother %s and physical mother %s\n", this.getClass().getSimpleName(),getName(),getMother().getName(),getPhysMother().getName());
-		JavaSurveyVolume physMother =  getPhysMother();
-		setPhysVolume(new PhysicalVolume(new Transform3D(getPos(), getRot()), getName(), volume, physMother.getVolume(),getComponentId()));
-	}
-	
-	public void buildBox() {
-		Hep3Vector b = VecOp.mult(0.5,getBoxDim());
-		if(isDebug()) System.out.printf("%s: build box for %s with dimensions %s \n", this.getClass().getSimpleName(),getName(), b);
-		setBox(new Box(getName() + "Box", b.x(), b.y(), b.z())); 
-	}
-	public void buildVolume() {
-		if(isDebug()) System.out.printf("%s: build volume for %s with material %s\n", this.getClass().getSimpleName(),getName(), MaterialStore.getInstance().get(getMaterial()));
-			setVolume(new LogicalVolume(getName() + "_volume", box, MaterialStore.getInstance().get(getMaterial())));
-		
-	}
-	public void setPositionAndRotation(SurveyVolume base) {
-		if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
-		
-		// no mother, this must be the world/tracking volume!?
-		if(base.getMother()==null) throw new RuntimeException("trying to set coordinates w/o mother defined for "+base.getName());
-		
-		// Vector from origin to center of box locally 
-		Hep3Vector box_center_base_local = base.getCenter();
-		
-		// find the physical mother i.e. not a ghost volume and compound transformations to it
-		JavaSurveyVolume physMother =  getPhysMother();
-		if(isDebug()) System.out.printf("%s: physical mother to transform to is %s; find the transform to it\n", this.getClass().getSimpleName(),physMother.getName());
-		Transform3D trf = HPSTrackerBuilder.getTransform(base.getCoord().getTransformation(),base.getMother(),physMother.getName()); 
-		if(isDebug()) System.out.printf("%s: found transform to physical mother \n%s\n\n", this.getClass().getSimpleName(),trf.toString());
-		
-		// find the position of the center in the physical mother coord
-		Hep3Vector box_center_base = trf.transformed(box_center_base_local);
-		
-		// find the position of the center of the box in the mother coordinate system, make sure to use the physical mother coordinates
-		if(isDebug()) System.out.printf("%s: find center of box in physical mother coord %s \n", this.getClass().getSimpleName(),physMother.getName());
-		// hack since my getTransform function needs a mother TODO Fix this!
-		SurveyVolume gm = base;
-		if(isDebug()) System.out.printf("%s: look for physical mother %s starting from mother %s \n", this.getClass().getSimpleName(),physMother.getName(),gm.getMother()!=null?gm.getMother().getName():"-- no mother --");
-		while((gm=gm.getMother()).getName()!=physMother.getName()) {
-			if(isDebug()) System.out.printf("%s: gm is %s \n", this.getClass().getSimpleName(),gm.getName());
-			//gm = gm.getMother();
-		}
-		if(isDebug()) System.out.printf("%s: found physical mother %s with center at %s \n", this.getClass().getSimpleName(),gm.getName(), gm.getCenter());
-		
-		Hep3Vector mother_center = gm.getCenter();
-
-		// now calculate the position of this box center in the mother LCDD coordinates
-		Hep3Vector box_center = VecOp.sub(box_center_base, mother_center);
-
-		//Find LCDD Euler rotation angles from coordinate system unit vectors
-		//Note that this has to be rotation wrt to physical mother and not just mother as normally is the case
-		//Use apache lib to get angles, but in principle I should already have it from the trf above
-		//Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
-		if(isDebug()) System.out.printf("%s: find LCDD Cardan rotation angles - need to find mother to physical mother transform \n", this.getClass().getSimpleName(),physMother.getName());
-		Hep3Vector base_u = base.getCoord().u();
+        setComponentId(volumeId);
+        setMother(mother);
+        mother.addDaughter(this);
+        buildBox();
+        buildVolume();
+        setPositionAndRotation(surveyVolume);
+        if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+    }
+
+    protected boolean hasCoordinateSystemInfo() {
+        return pos!=null && rot!=null;
+    }
+    
+    
+    public void buildPhysVolume() {
+        if(isDebug()) System.out.printf("%s: build phys volume for %s with mother %s and physical mother %s\n", this.getClass().getSimpleName(),getName(),getMother().getName(),getPhysMother().getName());
+        JavaSurveyVolume physMother =  getPhysMother();
+        setPhysVolume(new PhysicalVolume(new Transform3D(getPos(), getRot()), getName(), volume, physMother.getVolume(),getComponentId()));
+    }
+    
+    public void buildBox() {
+        Hep3Vector b = VecOp.mult(0.5,getBoxDim());
+        if(isDebug()) System.out.printf("%s: build box for %s with dimensions %s \n", this.getClass().getSimpleName(),getName(), b);
+        setBox(new Box(getName() + "Box", b.x(), b.y(), b.z())); 
+    }
+    public void buildVolume() {
+        if(isDebug()) System.out.printf("%s: build volume for %s with material %s\n", this.getClass().getSimpleName(),getName(), MaterialStore.getInstance().get(getMaterial()));
+            setVolume(new LogicalVolume(getName() + "_volume", box, MaterialStore.getInstance().get(getMaterial())));
+        
+    }
+    public void setPositionAndRotation(SurveyVolume base) {
+        if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
+        
+        // no mother, this must be the world/tracking volume!?
+        if(base.getMother()==null) throw new RuntimeException("trying to set coordinates w/o mother defined for "+base.getName());
+        
+        // Vector from origin to center of box locally 
+        Hep3Vector box_center_base_local = base.getCenter();
+        
+        // find the physical mother i.e. not a ghost volume and compound transformations to it
+        JavaSurveyVolume physMother =  getPhysMother();
+        if(isDebug()) System.out.printf("%s: physical mother to transform to is %s; find the transform to it\n", this.getClass().getSimpleName(),physMother.getName());
+        Transform3D trf = HPSTrackerBuilder.getTransform(base.getCoord().getTransformation(),base.getMother(),physMother.getName()); 
+        if(isDebug()) System.out.printf("%s: found transform to physical mother \n%s\n\n", this.getClass().getSimpleName(),trf.toString());
+        
+        // find the position of the center in the physical mother coord
+        Hep3Vector box_center_base = trf.transformed(box_center_base_local);
+        
+        // find the position of the center of the box in the mother coordinate system, make sure to use the physical mother coordinates
+        if(isDebug()) System.out.printf("%s: find center of box in physical mother coord %s \n", this.getClass().getSimpleName(),physMother.getName());
+        // hack since my getTransform function needs a mother TODO Fix this!
+        SurveyVolume gm = base;
+        if(isDebug()) System.out.printf("%s: look for physical mother %s starting from mother %s \n", this.getClass().getSimpleName(),physMother.getName(),gm.getMother()!=null?gm.getMother().getName():"-- no mother --");
+        while((gm=gm.getMother()).getName()!=physMother.getName()) {
+            if(isDebug()) System.out.printf("%s: gm is %s \n", this.getClass().getSimpleName(),gm.getName());
+            //gm = gm.getMother();
+        }
+        if(isDebug()) System.out.printf("%s: found physical mother %s with center at %s \n", this.getClass().getSimpleName(),gm.getName(), gm.getCenter());
+        
+        Hep3Vector mother_center = gm.getCenter();
+
+        // now calculate the position of this box center in the mother LCDD coordinates
+        Hep3Vector box_center = VecOp.sub(box_center_base, mother_center);
+
+        //Find LCDD Euler rotation angles from coordinate system unit vectors
+        //Note that this has to be rotation wrt to physical mother and not just mother as normally is the case
+        //Use apache lib to get angles, but in principle I should already have it from the trf above
+        //Hep3Vector lcdd_rot_angles = HPSTestRunTracker2014.getEulerAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+        if(isDebug()) System.out.printf("%s: find LCDD Cardan rotation angles - need to find mother to physical mother transform \n", this.getClass().getSimpleName(),physMother.getName());
+        Hep3Vector base_u = base.getCoord().u();
         Hep3Vector base_v = base.getCoord().v();
         Hep3Vector base_w = base.getCoord().w();
         if(isDebug()) System.out.printf("%s: unit vectors in mother coord: %s, %s, %s\n", this.getClass().getSimpleName(),base_u.toString(),base_v.toString(),base_w.toString());
@@ -169,22 +169,22 @@
             //System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
         }
         
-		Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(base_u, base_v, base_w, unit_u, unit_v, unit_w);
-
-
-		// Create the LCDD position
-		setPos(new Translation3D(box_center.x(), box_center.y(), box_center.z()));
-		setRot(new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
-		
-		if(isDebug()) {
-			
-		    System.out.printf("%s: SurveyVolume information for %s:\n", this.getClass().getSimpleName(), base.getName());
+        Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(base_u, base_v, base_w, unit_u, unit_v, unit_w);
+
+
+        // Create the LCDD position
+        setPos(new Translation3D(box_center.x(), box_center.y(), box_center.z()));
+        setRot(new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
+        
+        if(isDebug()) {
+            
+            System.out.printf("%s: SurveyVolume information for %s:\n", this.getClass().getSimpleName(), base.getName());
             System.out.printf("%s: box_center_base_local       %s\n", this.getClass().getSimpleName(), box_center_base_local.toString());
-			System.out.printf("%s: box_center_base             %s\n", this.getClass().getSimpleName(), box_center_base.toString());
-			System.out.printf("%s: mother center               %s\n", this.getClass().getSimpleName(), base.getMother()==null?" <no mother> ":mother_center.toString());
-			System.out.printf("%s: box_center                  %s\n", this.getClass().getSimpleName(), box_center.toString());
-			System.out.printf("%s: pos                         %s\n", this.getClass().getSimpleName(), getPos().toString());
-			Hep3Vector box_center_tracking_xcheck = HPSTrackerBuilder.transformToTracking(box_center_base_local, base);
+            System.out.printf("%s: box_center_base             %s\n", this.getClass().getSimpleName(), box_center_base.toString());
+            System.out.printf("%s: mother center               %s\n", this.getClass().getSimpleName(), base.getMother()==null?" <no mother> ":mother_center.toString());
+            System.out.printf("%s: box_center                  %s\n", this.getClass().getSimpleName(), box_center.toString());
+            System.out.printf("%s: pos                         %s\n", this.getClass().getSimpleName(), getPos().toString());
+            Hep3Vector box_center_tracking_xcheck = HPSTrackerBuilder.transformToTracking(box_center_base_local, base);
             System.out.printf("%s: box_center_tracking_xcheck  %s (for %s)\n", this.getClass().getSimpleName(), box_center_tracking_xcheck==null ? " <null> " : box_center_tracking_xcheck.toString(),base.getName());
             Hep3Vector box_center_envelope_xcheck2 = HPSTrackerBuilder.transformToParent(box_center_base_local, base, "base");
             System.out.printf("%s: box_center_base_xcheck2     %s (for %s)\n", this.getClass().getSimpleName(), box_center_envelope_xcheck2==null ? " <null> " : box_center_envelope_xcheck2.toString(),base.getName());
@@ -203,90 +203,90 @@
                 System.out.printf("%s: origin_base_in          %s\n", this.getClass().getSimpleName(), origin_base_in==null ? " <null> " : origin_base_in.toString());
             }
             System.out.printf("%s: euler                       %s\n", this.getClass().getSimpleName(), lcdd_rot_angles.toString());
-			System.out.printf("%s: rot                         %s\n", this.getClass().getSimpleName(), getRot().toString());
-			
-		}
-		
-	}
-
-	/**
-	 * Find the first non-ghost volume among parents.  
-	 * @return mother object
-	 */
-	public JavaSurveyVolume getPhysMother() {
-		//if(isDebug()) System.out.printf("%s: finding physical mother to %s\n", this.getClass().getSimpleName(), getName());
-		if(mother==null) throw new RuntimeException("Trying to get phys mother but there is no mother!");
-		if(mother instanceof JavaGhostSurveyVolume) {
-			return mother.getPhysMother();
-		} else {
-			//if(isDebug()) System.out.printf("%s: found a non-ghost volume: %s\n", this.getClass().getSimpleName(), mother.getName());
-			return mother;
-		}
-	}
-	
-	
-	public ILogicalVolume getVolume() {
-		return volume;
-	}
-	protected void setVolume(ILogicalVolume volume) {
-		this.volume = volume;
-	}
-	protected Box getBox() {
-		return box;
-	}
-	protected void setBox(Box b) {
-		box = b;
-	}	
-	protected ITranslation3D getPos() {
-		return pos;
-	}
-	protected void setPos(ITranslation3D iTranslation3D) {
-		this.pos = iTranslation3D;
-	}
-	protected IRotation3D getRot() {
-		return rot;
-	}
-	protected void setRot(IRotation3D iRotation3D) {
-		this.rot = iRotation3D;
-	}
-	public JavaSurveyVolume getMother() {
-		return mother;
-	}
-	protected void setMother(JavaSurveyVolume mother) {
-		this.mother = mother;
-	}
-	public IPhysicalVolume getPhysVolume() {
-		return physVolume;
-	}
-	protected void setPhysVolume(PhysicalVolume physVolume) {
-		this.physVolume = physVolume;
-	}
-
-	public List<JavaSurveyVolume> getDaughters() {
-		return daughters;
-	}
-
-	protected void addDaughter(JavaSurveyVolume o) {
-		getDaughters().add(o);
-	}
-
-	public int getComponentId() {
-		return componentId;
-	}
-
-	public void setComponentId(int componentId) {
-		this.componentId = componentId;
-	}
-	
-	public String toString() {
-		String s = "JavaBaseGeometry " + getName() + "\n";
-		if(getPos()!=null && getRot()!=null) {
-			s += "Position: "  + getPos().toString() + "\n";
-			s += "Rotation: " + getRot().toString() + "\n";
-		} else {
-			s+= " - no position/rotation info -\n";
-		}
-		return s;
-	}
+            System.out.printf("%s: rot                         %s\n", this.getClass().getSimpleName(), getRot().toString());
+            
+        }
+        
+    }
+
+    /**
+     * Find the first non-ghost volume among parents.  
+     * @return mother object
+     */
+    public JavaSurveyVolume getPhysMother() {
+        //if(isDebug()) System.out.printf("%s: finding physical mother to %s\n", this.getClass().getSimpleName(), getName());
+        if(mother==null) throw new RuntimeException("Trying to get phys mother but there is no mother!");
+        if(mother instanceof JavaGhostSurveyVolume) {
+            return mother.getPhysMother();
+        } else {
+            //if(isDebug()) System.out.printf("%s: found a non-ghost volume: %s\n", this.getClass().getSimpleName(), mother.getName());
+            return mother;
+        }
+    }
+    
+    
+    public ILogicalVolume getVolume() {
+        return volume;
+    }
+    protected void setVolume(ILogicalVolume volume) {
+        this.volume = volume;
+    }
+    protected Box getBox() {
+        return box;
+    }
+    protected void setBox(Box b) {
+        box = b;
+    }   
+    protected ITranslation3D getPos() {
+        return pos;
+    }
+    protected void setPos(ITranslation3D iTranslation3D) {
+        this.pos = iTranslation3D;
+    }
+    protected IRotation3D getRot() {
+        return rot;
+    }
+    protected void setRot(IRotation3D iRotation3D) {
+        this.rot = iRotation3D;
+    }
+    public JavaSurveyVolume getMother() {
+        return mother;
+    }
+    protected void setMother(JavaSurveyVolume mother) {
+        this.mother = mother;
+    }
+    public IPhysicalVolume getPhysVolume() {
+        return physVolume;
+    }
+    protected void setPhysVolume(PhysicalVolume physVolume) {
+        this.physVolume = physVolume;
+    }
+
+    public List<JavaSurveyVolume> getDaughters() {
+        return daughters;
+    }
+
+    protected void addDaughter(JavaSurveyVolume o) {
+        getDaughters().add(o);
+    }
+
+    public int getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(int componentId) {
+        this.componentId = componentId;
+    }
+    
+    public String toString() {
+        String s = "JavaBaseGeometry " + getName() + "\n";
+        if(getPos()!=null && getRot()!=null) {
+            s += "Position: "  + getPos().toString() + "\n";
+            s += "Rotation: " + getRot().toString() + "\n";
+        } else {
+            s+= " - no position/rotation info -\n";
+        }
+        return s;
+    }
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java	Wed Mar  9 11:43:24 2016
@@ -10,20 +10,20 @@
  */
 public class LCDDGhostSurveyVolume extends LCDDSurveyVolume {
 
-	
-	
-	/**
-	 * Initialize with base and mother. This is typically for a reference geometry object 
-	 * that is used for referencing coordinate systems but that doesn't have a volume itself.
-	 * @param base - object used to get geometry definitions
-	 * @param mother - mother LCDD object
-	 */
-	public LCDDGhostSurveyVolume(SurveyVolume base, LCDDSurveyVolume mother) {
-		super(base);
-		if(isDebug()) System.out.printf("%s: constructing LCDD ghost object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName());
-		setMother(mother);
-		mother.addDaughter(this);
-		if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
-	}
-	
+    
+    
+    /**
+     * Initialize with base and mother. This is typically for a reference geometry object 
+     * that is used for referencing coordinate systems but that doesn't have a volume itself.
+     * @param base - object used to get geometry definitions
+     * @param mother - mother LCDD object
+     */
+    public LCDDGhostSurveyVolume(SurveyVolume base, LCDDSurveyVolume mother) {
+        super(base);
+        if(isDebug()) System.out.printf("%s: constructing LCDD ghost object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName());
+        setMother(mother);
+        mother.addDaughter(this);
+        if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
+    }
+    
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java	Wed Mar  9 11:43:24 2016
@@ -25,233 +25,233 @@
  * @author Per Hansson Adrian <[log in to unmask]>
  */
 public class LCDDSurveyVolume extends SurveyVolumeImpl  {
-	Box box= null;
-	Volume volume = null;
-	private Position pos = null;
-	private Rotation rot = null;
-	private PhysVol physVolume = null;
-	LCDD lcdd = null;
-	private LCDDSurveyVolume mother = null;
-	protected Map<String,Integer> physVolId = null;
-	public List<LCDDSurveyVolume> daughters = new ArrayList<LCDDSurveyVolume>();
-	/**
-	 *  Default constructor
-	 *  @param surveyVolume - core geometry definitions
-	 */
-	public LCDDSurveyVolume(SurveyVolume surveyVolume) {
-	   super(surveyVolume);
-	}
-	
-	/**
-	 * Initialize this object with a known volume and no mother. Typically the world volume would use this.
-	 * @param surveyVolume - core geometry definitions
-	 * @param vol - given volume
-	 */
-	public LCDDSurveyVolume(SurveyVolume surveyVolume, Volume volume) {
-		super(surveyVolume);
-		if(isDebug()) System.out.printf("%s: constructing LCDD object %s with volume name %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),volume.getName());
-		setVolume(volume);
-		if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-		Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
-		setPos(new Position(getName() + "_position", 0, 0, 0));
-		setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
-		if(isDebug()) System.out.printf("%s: DONE  %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-	}
-	
-	/**
-	 * Interface to the LCDD converter geometry for the geometry definition. 
-	 * @param surveyVolume - core geometry definition
-	 * @param lcdd - lcdd file 
-	 * @param mother - reference to mother LCDD definition
-	 */
-	public LCDDSurveyVolume(SurveyVolume surveyVolume, LCDD lcdd, LCDDSurveyVolume mother) {
-	    super(surveyVolume);
-	    if(isDebug()) System.out.printf("%s: constructing LCDD object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
-		this.lcdd = lcdd;
-		setMother(mother);
-		mother.addDaughter(this);
-		buildBox();
-		buildVolume();
-		setPositionAndRotation(surveyVolume);
-		//buildPhysVolume(mother);
-		if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
-	}
-
-	
-	public void buildPhysVolume() {
-
-	    if(isDebug()) System.out.printf("%s: build phys volume for %s with mother %s and physical mother %s\n", this.getClass().getSimpleName(),getName(),getMother().getName(),getPhysMother().getName());
-	    LCDDSurveyVolume physMother =  getPhysMother();
-	    setPhysVolume(new PhysVol(volume, physMother.getVolume(), getPos(), getRot()));
-	    //if(isDebug()) System.out.printf("%s: build phys volume for %s\n", this.getClass().getSimpleName(),getName());
-		//setPhysVolume(new PhysVol(volume, getMother().getVolume(), getPos(), getRot()));
-	}
-	public void buildBox() {
-		if(isDebug()) System.out.printf("%s: build box for %s\n", getClass().getSimpleName(),getName());
-		setBox(new Box(getName() + "Box", getBoxDim().x(), getBoxDim().y(), getBoxDim().z())); 
-	}
-	public void buildVolume() {
-		if(isDebug()) System.out.printf("%s: build volume for %s with material %s\n", this.getClass().getSimpleName(),getName(),getMaterial());
-		try {
-			Material mat = lcdd.getMaterial(getMaterial());
-			setVolume(new Volume(getName() + "_volume", box, mat));
-		} catch (JDOMException e) {
-			e.printStackTrace();
-		}
-	}
-	
-	
-	public void setPositionAndRotation(SurveyVolume base) {
-		if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
-		
-		// NOTE:
-		// This sets position and reference w.r.t. mother coordinate system. 
-		// If I'm not building that volume this will be wrong. 
-		// TODO Similar to in the JAVA converter this should be something like the physical mother.
-		
-		if(base.getMother()==null) throw new RuntimeException("trying to set coordinates w/o mother defined for "+base.getName());
-		
-		// Vector from origin to center of box locally 
-		Hep3Vector box_center_base_local = base.getCenter();
-		
-		//translate to the mother coordinate system
-		LCDDSurveyVolume physMother = getPhysMother();
-		if(isDebug()) System.out.printf("%s: physical mother to transform to is %s; find the transform to it\n", this.getClass().getSimpleName(),physMother.getName());
-		Transform3D trf = HPSTrackerBuilder.getTransform(base.getCoord().getTransformation(),base.getMother(),physMother.getName()); 
-		if(isDebug()) System.out.printf("%s: found transform to physical mother \n%s\n\n", this.getClass().getSimpleName(),trf.toString());
-		
-		// find the position of the center in the physical mother coord
-		Hep3Vector box_center_base = trf.transformed(box_center_base_local);
-		
-		// find the position of the center of the box in the mother coordinate system, make sure to use the physical mother coordinates
-		if(isDebug()) System.out.printf("%s: find center of box in physical mother coord %s \n", this.getClass().getSimpleName(),physMother.getName());
-		// hack since my getTransform function needs a mother TODO Fix this!
-		SurveyVolume gm = base;
-		if(isDebug()) System.out.printf("%s: look for physical mother %s starting from mother %s \n", this.getClass().getSimpleName(),physMother.getName(),gm.getMother()!=null?gm.getMother().getName():"-- no mother --");
-		while((gm=gm.getMother()).getName()!=physMother.getName()) {
-			if(isDebug()) System.out.printf("%s: gm is %s \n", this.getClass().getSimpleName(),gm.getName());
-			//gm = gm.getMother();
-		}
-		if(isDebug()) System.out.printf("%s: found physical mother %s with center at %s \n", this.getClass().getSimpleName(),gm.getName(), gm.getCenter());
-
-		Hep3Vector mother_center = gm.getCenter();
-		
-		// find the position of the center in the mother coord
-		Hep3Vector box_center = VecOp.sub(box_center_base, mother_center);
-		
-		//Find LCDD Euler rotation angles from coordinate system unit vectors
-		//Note that this has to be rotation wrt to physical mother and not just mother as normally is the case
-		if(isDebug()) System.out.printf("%s: find LCDD Cardan rotation angles - need to find mother to physical mother transform \n", this.getClass().getSimpleName(),physMother.getName());
-		Hep3Vector base_u = base.getCoord().u();
-		Hep3Vector base_v = base.getCoord().v();
-		Hep3Vector base_w = base.getCoord().w();
+    Box box= null;
+    Volume volume = null;
+    private Position pos = null;
+    private Rotation rot = null;
+    private PhysVol physVolume = null;
+    LCDD lcdd = null;
+    private LCDDSurveyVolume mother = null;
+    protected Map<String,Integer> physVolId = null;
+    public List<LCDDSurveyVolume> daughters = new ArrayList<LCDDSurveyVolume>();
+    /**
+     *  Default constructor
+     *  @param surveyVolume - core geometry definitions
+     */
+    public LCDDSurveyVolume(SurveyVolume surveyVolume) {
+       super(surveyVolume);
+    }
+    
+    /**
+     * Initialize this object with a known volume and no mother. Typically the world volume would use this.
+     * @param surveyVolume - core geometry definitions
+     * @param vol - given volume
+     */
+    public LCDDSurveyVolume(SurveyVolume surveyVolume, Volume volume) {
+        super(surveyVolume);
+        if(isDebug()) System.out.printf("%s: constructing LCDD object %s with volume name %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),volume.getName());
+        setVolume(volume);
+        if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+        Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+        setPos(new Position(getName() + "_position", 0, 0, 0));
+        setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
+        if(isDebug()) System.out.printf("%s: DONE  %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+    }
+    
+    /**
+     * Interface to the LCDD converter geometry for the geometry definition. 
+     * @param surveyVolume - core geometry definition
+     * @param lcdd - lcdd file 
+     * @param mother - reference to mother LCDD definition
+     */
+    public LCDDSurveyVolume(SurveyVolume surveyVolume, LCDD lcdd, LCDDSurveyVolume mother) {
+        super(surveyVolume);
+        if(isDebug()) System.out.printf("%s: constructing LCDD object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
+        this.lcdd = lcdd;
+        setMother(mother);
+        mother.addDaughter(this);
+        buildBox();
+        buildVolume();
+        setPositionAndRotation(surveyVolume);
+        //buildPhysVolume(mother);
+        if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+    }
+
+    
+    public void buildPhysVolume() {
+
+        if(isDebug()) System.out.printf("%s: build phys volume for %s with mother %s and physical mother %s\n", this.getClass().getSimpleName(),getName(),getMother().getName(),getPhysMother().getName());
+        LCDDSurveyVolume physMother =  getPhysMother();
+        setPhysVolume(new PhysVol(volume, physMother.getVolume(), getPos(), getRot()));
+        //if(isDebug()) System.out.printf("%s: build phys volume for %s\n", this.getClass().getSimpleName(),getName());
+        //setPhysVolume(new PhysVol(volume, getMother().getVolume(), getPos(), getRot()));
+    }
+    public void buildBox() {
+        if(isDebug()) System.out.printf("%s: build box for %s\n", getClass().getSimpleName(),getName());
+        setBox(new Box(getName() + "Box", getBoxDim().x(), getBoxDim().y(), getBoxDim().z())); 
+    }
+    public void buildVolume() {
+        if(isDebug()) System.out.printf("%s: build volume for %s with material %s\n", this.getClass().getSimpleName(),getName(),getMaterial());
+        try {
+            Material mat = lcdd.getMaterial(getMaterial());
+            setVolume(new Volume(getName() + "_volume", box, mat));
+        } catch (JDOMException e) {
+            e.printStackTrace();
+        }
+    }
+    
+    
+    public void setPositionAndRotation(SurveyVolume base) {
+        if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
+        
+        // NOTE:
+        // This sets position and reference w.r.t. mother coordinate system. 
+        // If I'm not building that volume this will be wrong. 
+        // TODO Similar to in the JAVA converter this should be something like the physical mother.
+        
+        if(base.getMother()==null) throw new RuntimeException("trying to set coordinates w/o mother defined for "+base.getName());
+        
+        // Vector from origin to center of box locally 
+        Hep3Vector box_center_base_local = base.getCenter();
+        
+        //translate to the mother coordinate system
+        LCDDSurveyVolume physMother = getPhysMother();
+        if(isDebug()) System.out.printf("%s: physical mother to transform to is %s; find the transform to it\n", this.getClass().getSimpleName(),physMother.getName());
+        Transform3D trf = HPSTrackerBuilder.getTransform(base.getCoord().getTransformation(),base.getMother(),physMother.getName()); 
+        if(isDebug()) System.out.printf("%s: found transform to physical mother \n%s\n\n", this.getClass().getSimpleName(),trf.toString());
+        
+        // find the position of the center in the physical mother coord
+        Hep3Vector box_center_base = trf.transformed(box_center_base_local);
+        
+        // find the position of the center of the box in the mother coordinate system, make sure to use the physical mother coordinates
+        if(isDebug()) System.out.printf("%s: find center of box in physical mother coord %s \n", this.getClass().getSimpleName(),physMother.getName());
+        // hack since my getTransform function needs a mother TODO Fix this!
+        SurveyVolume gm = base;
+        if(isDebug()) System.out.printf("%s: look for physical mother %s starting from mother %s \n", this.getClass().getSimpleName(),physMother.getName(),gm.getMother()!=null?gm.getMother().getName():"-- no mother --");
+        while((gm=gm.getMother()).getName()!=physMother.getName()) {
+            if(isDebug()) System.out.printf("%s: gm is %s \n", this.getClass().getSimpleName(),gm.getName());
+            //gm = gm.getMother();
+        }
+        if(isDebug()) System.out.printf("%s: found physical mother %s with center at %s \n", this.getClass().getSimpleName(),gm.getName(), gm.getCenter());
+
+        Hep3Vector mother_center = gm.getCenter();
+        
+        // find the position of the center in the mother coord
+        Hep3Vector box_center = VecOp.sub(box_center_base, mother_center);
+        
+        //Find LCDD Euler rotation angles from coordinate system unit vectors
+        //Note that this has to be rotation wrt to physical mother and not just mother as normally is the case
+        if(isDebug()) System.out.printf("%s: find LCDD Cardan rotation angles - need to find mother to physical mother transform \n", this.getClass().getSimpleName(),physMother.getName());
+        Hep3Vector base_u = base.getCoord().u();
+        Hep3Vector base_v = base.getCoord().v();
+        Hep3Vector base_w = base.getCoord().w();
         if(isDebug()) System.out.printf("%s: unit vectors in mother coord: %s, %s, %s\n", this.getClass().getSimpleName(),base_u.toString(),base_v.toString(),base_w.toString());
-		Hep3Vector unit_u = new BasicHep3Vector(1,0,0);
-		Hep3Vector unit_v = new BasicHep3Vector(0,1,0);
-		Hep3Vector unit_w = new BasicHep3Vector(0,0,1);
-		if(!base.getMother().getName().equals(physMother.getName())) {
-		    if(isDebug()) System.out.printf("%s: Need to get unit vectors in physical mother %s coord system\n", this.getClass().getSimpleName(),physMother.getName());
+        Hep3Vector unit_u = new BasicHep3Vector(1,0,0);
+        Hep3Vector unit_v = new BasicHep3Vector(0,1,0);
+        Hep3Vector unit_w = new BasicHep3Vector(0,0,1);
+        if(!base.getMother().getName().equals(physMother.getName())) {
+            if(isDebug()) System.out.printf("%s: Need to get unit vectors in physical mother %s coord system\n", this.getClass().getSimpleName(),physMother.getName());
             Transform3D trf_mother = HPSTrackerBuilder.getTransform(base.getMother().getCoord().getTransformation(),base.getMother().getMother(),physMother.getName()); 
             if(isDebug()) System.out.printf("%s: found transform from mother to physical mother \n%s\n", this.getClass().getSimpleName(),trf_mother.toString());
-			//unit_u = VecOp.unit(trf_mother.rotated(unit_u));
-			//unit_v = VecOp.unit(trf_mother.rotated(unit_v));
-			//unit_w = VecOp.unit(trf_mother.rotated(unit_w));
-			base_u = VecOp.unit(trf_mother.rotated(base_u));
+            //unit_u = VecOp.unit(trf_mother.rotated(unit_u));
+            //unit_v = VecOp.unit(trf_mother.rotated(unit_v));
+            //unit_w = VecOp.unit(trf_mother.rotated(unit_w));
+            base_u = VecOp.unit(trf_mother.rotated(base_u));
             base_v = VecOp.unit(trf_mother.rotated(base_v));
             base_w = VecOp.unit(trf_mother.rotated(base_w));
             
-		} else {
-			if(isDebug()) System.out.printf("%s: mother and physical mother is the same so unit vectors didn't change\n",getClass().getSimpleName());
-		}
-		
-		if(isDebug()) {
-		    if(isDebug()) System.out.printf("%s: final unit vectors to get Cardan angles from : \n%s, %s, %s -> %s, %s, %s \n", 
-		                                    this.getClass().getSimpleName(),
-		                                    base_u.toString(),base_v.toString(),base_w.toString(),	            
-		                                    unit_u.toString(),unit_v.toString(),unit_w.toString());
-			//System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
-		}
+        } else {
+            if(isDebug()) System.out.printf("%s: mother and physical mother is the same so unit vectors didn't change\n",getClass().getSimpleName());
+        }
+        
+        if(isDebug()) {
+            if(isDebug()) System.out.printf("%s: final unit vectors to get Cardan angles from : \n%s, %s, %s -> %s, %s, %s \n", 
+                                            this.getClass().getSimpleName(),
+                                            base_u.toString(),base_v.toString(),base_w.toString(),              
+                                            unit_u.toString(),unit_v.toString(),unit_w.toString());
+            //System.out.printf("%s: unit vectors u %s v %s w %s\n", this.getClass().getSimpleName(),base.getCoord().u().toString(),base.getCoord().v().toString(),base.getCoord().w().toString());
+        }
         Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(base_u, base_v, base_w, unit_u, unit_v, unit_w);
         
-		
-		// Create the LCDD position and rotation
-		setPos(new Position(getName() + "_position",box_center.x(), box_center.y(), box_center.z()));
-		setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
-		
-		if(isDebug()) {
-		    System.out.printf("%s: SurveyVolume information for %s:\n", this.getClass().getSimpleName(), base.getName());
+        
+        // Create the LCDD position and rotation
+        setPos(new Position(getName() + "_position",box_center.x(), box_center.y(), box_center.z()));
+        setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
+        
+        if(isDebug()) {
+            System.out.printf("%s: SurveyVolume information for %s:\n", this.getClass().getSimpleName(), base.getName());
             System.out.printf("%s: box_center_base_local  %s\n", this.getClass().getSimpleName(), box_center_base_local.toString());
-			System.out.printf("%s: box_center_base        %s\n", this.getClass().getSimpleName(), box_center_base.toString());
-			System.out.printf("%s: mother center          %s\n", this.getClass().getSimpleName(), mother_center.toString());
-			System.out.printf("%s: box_center             %s\n", this.getClass().getSimpleName(), box_center.toString());
-			System.out.printf("%s: pos                    %s\n", this.getClass().getSimpleName(), getPos().toString());
-			System.out.printf("%s: euler                  %s\n", this.getClass().getSimpleName(), lcdd_rot_angles.toString());
+            System.out.printf("%s: box_center_base        %s\n", this.getClass().getSimpleName(), box_center_base.toString());
+            System.out.printf("%s: mother center          %s\n", this.getClass().getSimpleName(), mother_center.toString());
+            System.out.printf("%s: box_center             %s\n", this.getClass().getSimpleName(), box_center.toString());
+            System.out.printf("%s: pos                    %s\n", this.getClass().getSimpleName(), getPos().toString());
+            System.out.printf("%s: euler                  %s\n", this.getClass().getSimpleName(), lcdd_rot_angles.toString());
             System.out.printf("%s: rot                    %s\n", this.getClass().getSimpleName(), getRot().toString());
-			
-			//calculate the position in tracking volume separately as a xcheck
-			Hep3Vector box_center_tracking_xcheck = HPSTrackerBuilder.transformToTracking(box_center_base_local, base);
-			System.out.printf("%s: box_center_tracking_xcheck  %s (for %s)\n", this.getClass().getSimpleName(), box_center_tracking_xcheck.toString(), base.getName());
-		}
-		
-	}
-	/**
-	 * Find the first non-ghost volume among parents.  
-	 * @return mother object
-	 */
-	public LCDDSurveyVolume getPhysMother() {
-		//if(isDebug()) System.out.printf("%s: finding physical mother to %s\n", this.getClass().getSimpleName(), getName());
-		if(mother==null) throw new RuntimeException("Trying to get phys mother but there is no mother!");
-		if(mother instanceof LCDDGhostSurveyVolume) {
-			return mother.getPhysMother();
-		} else {
-			//if(isDebug()) System.out.printf("%s: found a non-ghost volume: %s\n", this.getClass().getSimpleName(), mother.getName());
-			return mother;
-		}
-	}
-	
-	public Volume getVolume() {
-		return volume;
-	}
-	public void setVolume(Volume volume) {
-		this.volume = volume;
-	}
-	public Box getBox() {
-		return box;
-	}
-	public void setBox(Box b) {
-		box = b;
-	}	
-	public Position getPos() {
-		return pos;
-	}
-	public void setPos(Position pos) {
-		this.pos = pos;
-	}
-	public Rotation getRot() {
-		return rot;
-	}
-	public void setRot(Rotation rot) {
-		this.rot = rot;
-	}
-	public LCDDSurveyVolume getMother() {
-		return mother;
-	}
-	public void setMother(LCDDSurveyVolume mother) {
-		this.mother = mother;
-	}
-	public PhysVol getPhysVolume() {
-		return physVolume;
-	}
-	public void setPhysVolume(PhysVol physVolume) {
-		this.physVolume = physVolume;
-	}
-	public List<LCDDSurveyVolume> getDaughters() {
-		return daughters;
-	}
-	public void addDaughter(LCDDSurveyVolume o) {
-		getDaughters().add(o);
-	}
-	 public String toString() {
+            
+            //calculate the position in tracking volume separately as a xcheck
+            Hep3Vector box_center_tracking_xcheck = HPSTrackerBuilder.transformToTracking(box_center_base_local, base);
+            System.out.printf("%s: box_center_tracking_xcheck  %s (for %s)\n", this.getClass().getSimpleName(), box_center_tracking_xcheck.toString(), base.getName());
+        }
+        
+    }
+    /**
+     * Find the first non-ghost volume among parents.  
+     * @return mother object
+     */
+    public LCDDSurveyVolume getPhysMother() {
+        //if(isDebug()) System.out.printf("%s: finding physical mother to %s\n", this.getClass().getSimpleName(), getName());
+        if(mother==null) throw new RuntimeException("Trying to get phys mother but there is no mother!");
+        if(mother instanceof LCDDGhostSurveyVolume) {
+            return mother.getPhysMother();
+        } else {
+            //if(isDebug()) System.out.printf("%s: found a non-ghost volume: %s\n", this.getClass().getSimpleName(), mother.getName());
+            return mother;
+        }
+    }
+    
+    public Volume getVolume() {
+        return volume;
+    }
+    public void setVolume(Volume volume) {
+        this.volume = volume;
+    }
+    public Box getBox() {
+        return box;
+    }
+    public void setBox(Box b) {
+        box = b;
+    }   
+    public Position getPos() {
+        return pos;
+    }
+    public void setPos(Position pos) {
+        this.pos = pos;
+    }
+    public Rotation getRot() {
+        return rot;
+    }
+    public void setRot(Rotation rot) {
+        this.rot = rot;
+    }
+    public LCDDSurveyVolume getMother() {
+        return mother;
+    }
+    public void setMother(LCDDSurveyVolume mother) {
+        this.mother = mother;
+    }
+    public PhysVol getPhysVolume() {
+        return physVolume;
+    }
+    public void setPhysVolume(PhysVol physVolume) {
+        this.physVolume = physVolume;
+    }
+    public List<LCDDSurveyVolume> getDaughters() {
+        return daughters;
+    }
+    public void addDaughter(LCDDSurveyVolume o) {
+        getDaughters().add(o);
+    }
+     public String toString() {
         String s = getClass().getSimpleName() +": " + getName() + "\n";
         if(getPos()!=null && getRot()!=null)    {
             double x = Double.valueOf(getPos().getAttributeValue("x"));

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java	Wed Mar  9 11:43:24 2016
@@ -9,113 +9,113 @@
 
 public class MilleParameter {
     private static double corrScaleFactor = -1.;
-	private int id;
-	private double value; 
-	private double presigma;
-	private static final Map<Integer,String> dMap;
-	private static final Map<Integer,String> tMap;
-	private static final Map<Integer,String> hMap;
-	static {
-		dMap = new HashMap<Integer,String>();
-		dMap.put(1, "x");dMap.put(2, "y"); dMap.put(3, "z");
-		tMap = new HashMap<Integer,String>();
-		tMap.put(1, "");tMap.put(2, "r");
-		hMap = new HashMap<Integer,String>();
-		hMap.put(1, "t");hMap.put(2, "b");
-		}
-	public static final int half_offset = 10000;
-	public static final int type_offset = 1000; 
-	public static final int dimension_offset = 100;
-	public static enum Type {
-	    TRANSLATION(1), ROTATION(2);
-	    private int value;
-	    private Type(int value) {this.value = value;}
-	    public int getType() {return this.value;}
-	};
-	
-	public MilleParameter(String line) {
-		String[] vals = StringUtils.split(line);// line.split("\\s+");
-		if(vals.length <3) {
-			System.out.println("this line is ill-formatted (" + vals.length + ")");
-			System.out.println(line);
-			System.exit(1);
-		}
-		try {
-		//for(String v : vals) System.out.println("\"" + v + "\"");
-		setId(Integer.parseInt(vals[0]));
-		setValue( corrScaleFactor * Double.parseDouble(vals[1]) );
-		setPresigma(Double.parseDouble(vals[2]));
-		
-		} catch (NumberFormatException e) {
-			System.out.println(vals[0] + " " + vals[1] + " " + vals[2]);
-			throw new RuntimeException("problem parsing string ", e);
-		}
-	}
-	
-	public MilleParameter(int id, double value, double presigma) {
-	    setId(id);
-	    setValue(value);
-	    setPresigma(presigma);
-	}
-	
-	public String getXMLName() {
-		String d = dMap.get(getDim());
-		String t = tMap.get(getType());
-		String h = hMap.get(getHalf());
-		int s = getSensor();
-		return String.format("%s%s%d%s_align", t,d,s,h);
-		
-	}
+    private int id;
+    private double value; 
+    private double presigma;
+    private static final Map<Integer,String> dMap;
+    private static final Map<Integer,String> tMap;
+    private static final Map<Integer,String> hMap;
+    static {
+        dMap = new HashMap<Integer,String>();
+        dMap.put(1, "x");dMap.put(2, "y"); dMap.put(3, "z");
+        tMap = new HashMap<Integer,String>();
+        tMap.put(1, "");tMap.put(2, "r");
+        hMap = new HashMap<Integer,String>();
+        hMap.put(1, "t");hMap.put(2, "b");
+        }
+    public static final int half_offset = 10000;
+    public static final int type_offset = 1000; 
+    public static final int dimension_offset = 100;
+    public static enum Type {
+        TRANSLATION(1), ROTATION(2);
+        private int value;
+        private Type(int value) {this.value = value;}
+        public int getType() {return this.value;}
+    };
+    
+    public MilleParameter(String line) {
+        String[] vals = StringUtils.split(line);// line.split("\\s+");
+        if(vals.length <3) {
+            System.out.println("this line is ill-formatted (" + vals.length + ")");
+            System.out.println(line);
+            System.exit(1);
+        }
+        try {
+        //for(String v : vals) System.out.println("\"" + v + "\"");
+        setId(Integer.parseInt(vals[0]));
+        setValue( corrScaleFactor * Double.parseDouble(vals[1]) );
+        setPresigma(Double.parseDouble(vals[2]));
+        
+        } catch (NumberFormatException e) {
+            System.out.println(vals[0] + " " + vals[1] + " " + vals[2]);
+            throw new RuntimeException("problem parsing string ", e);
+        }
+    }
+    
+    public MilleParameter(int id, double value, double presigma) {
+        setId(id);
+        setValue(value);
+        setPresigma(presigma);
+    }
+    
+    public String getXMLName() {
+        String d = dMap.get(getDim());
+        String t = tMap.get(getType());
+        String h = hMap.get(getHalf());
+        int s = getSensor();
+        return String.format("%s%s%d%s_align", t,d,s,h);
+        
+    }
 
-	public int getDim() {
-		int h = (int) (getHalf() * half_offset);
-		int t = (int) (getType() * type_offset);
-		return (int) Math.floor((id- h -t)/(double)dimension_offset);
-	}
-	
-	public int getSensor() {
-		int h = (int) (getHalf() * half_offset);
-		int t = (int) (getType() * type_offset);
-		int d = (int) (getDim() * dimension_offset);
-		return (id - h - t -d);
-	}
+    public int getDim() {
+        int h = (int) (getHalf() * half_offset);
+        int t = (int) (getType() * type_offset);
+        return (int) Math.floor((id- h -t)/(double)dimension_offset);
+    }
+    
+    public int getSensor() {
+        int h = (int) (getHalf() * half_offset);
+        int t = (int) (getType() * type_offset);
+        int d = (int) (getDim() * dimension_offset);
+        return (id - h - t -d);
+    }
 
-	public int getType() {
-		int h = (int) (getHalf() * half_offset);
-		return (int) Math.floor((id -h)/(double)type_offset);
-	}
+    public int getType() {
+        int h = (int) (getHalf() * half_offset);
+        return (int) Math.floor((id -h)/(double)type_offset);
+    }
 
-	public int getHalf() {
-		return (int)Math.floor(id/(double)half_offset);
-	}
+    public int getHalf() {
+        return (int)Math.floor(id/(double)half_offset);
+    }
 
-	public int getId() {
-		return id;
-	}
+    public int getId() {
+        return id;
+    }
 
-	public void setId(int id) {
-		this.id = id;
-	}
+    public void setId(int id) {
+        this.id = id;
+    }
 
-	public double getValue() {
-		return value;
-	}
+    public double getValue() {
+        return value;
+    }
 
-	public void setValue(double value) {
-		this.value = value;
-	}
+    public void setValue(double value) {
+        this.value = value;
+    }
 
-	public double getPresigma() {
-		return presigma;
-	}
+    public double getPresigma() {
+        return presigma;
+    }
 
-	public void setPresigma(double presigma) {
-		this.presigma = presigma;
-	}
-	
-	public String toString() {
-	    return String.format("Milleparameter id=%d half=%d type=%d dim=%d sensor=%d value=%f", this.getId(), this.getHalf(), this.getType(), this.getDim(), this.getSensor(), this.getValue());
-	}
+    public void setPresigma(double presigma) {
+        this.presigma = presigma;
+    }
+    
+    public String toString() {
+        return String.format("Milleparameter id=%d half=%d type=%d dim=%d sensor=%d value=%f", this.getId(), this.getHalf(), this.getType(), this.getDim(), this.getSensor(), this.getValue());
+    }
 
 
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyCoordinateSystem.java	Wed Mar  9 11:43:24 2016
@@ -13,26 +13,26 @@
 import org.lcsim.detector.Translation3D;
 
      /**
-	 * Class describing a simple coordinate system used to define the {@link SurveyVolume}.
-	 * 
-	 *    @author Per Hansson Adrian <[log in to unmask]>
-	 */
-	public class SurveyCoordinateSystem {
-	    private final boolean debug = false;
-		private Hep3Vector origin;
-		private Hep3Vector u;
-		private Hep3Vector v;
-		private Hep3Vector w;
+     * Class describing a simple coordinate system used to define the {@link SurveyVolume}.
+     * 
+     *    @author Per Hansson Adrian <[log in to unmask]>
+     */
+    public class SurveyCoordinateSystem {
+        private final boolean debug = false;
+        private Hep3Vector origin;
+        private Hep3Vector u;
+        private Hep3Vector v;
+        private Hep3Vector w;
 
-//		public SurveyCoordinateSystem(Hep3Vector org, Hep3Vector unit_x, Hep3Vector unit_y, Hep3Vector unit_z) {
-//			origin = org;
-//			u = unit_x;
-//			v = unit_y;
-//			w = unit_z;
-//		}
+//      public SurveyCoordinateSystem(Hep3Vector org, Hep3Vector unit_x, Hep3Vector unit_y, Hep3Vector unit_z) {
+//          origin = org;
+//          u = unit_x;
+//          v = unit_y;
+//          w = unit_z;
+//      }
 
-		
-		public SurveyCoordinateSystem(Hep3Vector ball, Hep3Vector vee, Hep3Vector flat) {
+        
+        public SurveyCoordinateSystem(Hep3Vector ball, Hep3Vector vee, Hep3Vector flat) {
             origin = ball;
             Hep3Vector ball_to_vee = VecOp.sub(vee, ball);
             u = VecOp.unit(ball_to_vee);
@@ -41,61 +41,61 @@
             v = VecOp.cross(w, u);
             check();
         }
-		
-		private void check() {
-		    checkUnitLength();
-		    checkAngles();
-		}
+        
+        private void check() {
+            checkUnitLength();
+            checkAngles();
+        }
 
-		private void checkUnitLength() {
-		    if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) {
-		        throw new RuntimeException("Error: the unit vectors of the  coordinate system is ill-defined " + toString());
-		    }
-		}
+        private void checkUnitLength() {
+            if(u.magnitude()-1>0.00001 || v.magnitude()-1>0.00001 || v.magnitude()-1>0.00001) {
+                throw new RuntimeException("Error: the unit vectors of the  coordinate system is ill-defined " + toString());
+            }
+        }
 
-		private void checkAngles() {
-		    if( (VecOp.dot(u, v)-1)>0.00001 ||  (VecOp.dot(u, w)-1)>0.00001 ||  (VecOp.dot(v, w)-1)>0.00001 ) {
-		        throw new RuntimeException("Error: the angles in coordinate system is ill-defined " + toString());
-		    }
-		}
-		
-		
-		/**
-		 * Transform this coordinate system to another one.
-		 * @param t
-		 */
-		public void transform(Transform3D t) {
-		    Transform3D t_this = getTransformation();
-		    Hep3Vector v = t_this.getTranslation().getTranslationVector();
-		    Hep3Vector vrot = t.rotated(v);
-		    Hep3Vector vrottrans = t.translated(vrot);
-		    origin = vrottrans;
+        private void checkAngles() {
+            if( (VecOp.dot(u, v)-1)>0.00001 ||  (VecOp.dot(u, w)-1)>0.00001 ||  (VecOp.dot(v, w)-1)>0.00001 ) {
+                throw new RuntimeException("Error: the angles in coordinate system is ill-defined " + toString());
+            }
+        }
+        
+        
+        /**
+         * Transform this coordinate system to another one.
+         * @param t
+         */
+        public void transform(Transform3D t) {
+            Transform3D t_this = getTransformation();
+            Hep3Vector v = t_this.getTranslation().getTranslationVector();
+            Hep3Vector vrot = t.rotated(v);
+            Hep3Vector vrottrans = t.translated(vrot);
+            origin = vrottrans;
             rotate(t.getRotation());
             //System.out.printf("monkey transform\n"); 
             //System.out.printf("v %s\n",v.toString());
             //System.out.printf("vrot %s\n",vrot.toString());
             //System.out.printf("vrottrans %s\n",vrottrans.toString());
-		    check();
-		}
-		
-		public void rotate(IRotation3D r) {
-			r.rotate(u);
-			r.rotate(v);
-			r.rotate(w);
-		}
+            check();
+        }
+        
+        public void rotate(IRotation3D r) {
+            r.rotate(u);
+            r.rotate(v);
+            r.rotate(w);
+        }
 
-		public void translate(Hep3Vector translation) {
-			// update origin with local translation in u,v,w
-		    //origin = VecOp.add(origin, translation);
-		    translate(new Translation3D(translation));
-		}
+        public void translate(Hep3Vector translation) {
+            // update origin with local translation in u,v,w
+            //origin = VecOp.add(origin, translation);
+            translate(new Translation3D(translation));
+        }
 
-		public void translate(Translation3D t) {
-		    origin = t.translated(getTransformation().getTranslation().getTranslationVector());
-		}
+        public void translate(Translation3D t) {
+            origin = t.translated(getTransformation().getTranslation().getTranslationVector());
+        }
 
-		
-		public void rotateApache(Rotation r) {
+        
+        public void rotateApache(Rotation r) {
             if(debug) System.out.printf("%s: apply apache rotation to this coord system\n%s\n", getClass().getSimpleName(),toString());
             this.u = new BasicHep3Vector(r.applyTo(new Vector3D(u.v())).toArray());
             this.v = new BasicHep3Vector(r.applyTo(new Vector3D(v.v())).toArray());
@@ -104,52 +104,52 @@
         }
         
         public Hep3Vector origin() {
-			return origin;
-		}
-		public Hep3Vector u() {
-			return u;
-		}
-		public Hep3Vector v() {
-			return v;
-		}
-		public Hep3Vector w() {
-			return w;
-		}
-		public void u(Hep3Vector vec) {
+            return origin;
+        }
+        public Hep3Vector u() {
+            return u;
+        }
+        public Hep3Vector v() {
+            return v;
+        }
+        public Hep3Vector w() {
+            return w;
+        }
+        public void u(Hep3Vector vec) {
             u = vec;
-		}
+        }
         public void v(Hep3Vector vec) {
             v = vec;
         }
         public void w(Hep3Vector vec) {
             w = vec;
         }
-		
+        
         public String toString() {
-			String str = "origin " + origin.toString() + "\nu " + u.toString() + "\nv " + v.toString() + "\nw " + w.toString();
-			return str;
+            String str = "origin " + origin.toString() + "\nu " + u.toString() + "\nv " + v.toString() + "\nw " + w.toString();
+            return str;
         }
-	
-		
-		/**
-		 * Find @ITransform3D to the coordinate system defined by the input. 
-		 * @return resulting 3D transform 
-		 */
-		public Transform3D getTransformation() {
-			// Find the transform between the two frames - use transform classes here (not really needed)
-			Translation3D translation = new Translation3D(origin.x(), origin.y(), origin.z());
-			//RotationGeant trackingToEnvelopeRotation = new RotationGeant(0, 0, 0);
-			Rotation3D rotation = new Rotation3D(
-					new BasicHep3Matrix(
-							u.x(),v.x(),w.x(),
-							u.y(),v.y(),w.y(),
-							u.z(),v.z(),w.z()
-							));
-			Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation);
-			return envelopeToSupportTransform;
-		}
-		
-		
-		
-		
-	}
+    
+        
+        /**
+         * Find @ITransform3D to the coordinate system defined by the input. 
+         * @return resulting 3D transform 
+         */
+        public Transform3D getTransformation() {
+            // Find the transform between the two frames - use transform classes here (not really needed)
+            Translation3D translation = new Translation3D(origin.x(), origin.y(), origin.z());
+            //RotationGeant trackingToEnvelopeRotation = new RotationGeant(0, 0, 0);
+            Rotation3D rotation = new Rotation3D(
+                    new BasicHep3Matrix(
+                            u.x(),v.x(),w.x(),
+                            u.y(),v.y(),w.y(),
+                            u.z(),v.z(),w.z()
+                            ));
+            Transform3D envelopeToSupportTransform = new Transform3D(translation, rotation);
+            return envelopeToSupportTransform;
+        }
+        
+        
+        
+        
+    }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java	Wed Mar  9 11:43:24 2016
@@ -20,66 +20,66 @@
  * 
  */
 public abstract class SurveyVolume {
-	protected boolean debug = false;
-	private String name;
-	private String material = "Vacuum";
-	private SurveyVolume mother = null;
-	protected List<SurveyVolume> referenceGeom = null;
-	private SurveyCoordinateSystem coord;
-	protected  Hep3Vector ballPos;
-	protected  Hep3Vector veePos;
-	protected  Hep3Vector flatPos;
-	private Hep3Vector center;
-	private Hep3Vector boxDim;
-	private AlignmentCorrection alignmentCorrections;
-	
-	public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection) {
-		setName(name);
-		setMother(m);
-		setAlignmentCorrection(alignmentCorrection);
-	}
-	
-	public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
-		setName(name);
-		setMother(m);
-		setAlignmentCorrection(alignmentCorrection);
-		addReferenceGeom(ref);
-	}
-	
-	public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, List<SurveyVolume> ref) {
-		setName(name);
-		setMother(m);
-		setAlignmentCorrection(alignmentCorrection);
-		addReferenceGeom(ref);
-	}
-	
-	protected abstract void setPos();
-	protected abstract void setCenter();
-	protected abstract void setBoxDim();
-
-	/**
-	 * 
-	 * Initialize the volume. 
-	 * This needs to be called at the top level implementation of the {@link SurveyVolume} to properly setup
-	 * the coordinate systems. It takes care of applying user supplied custom transformations and alignment corrections
-	 * in the order given in the function below. That order must be preserved to get a uniform behavior. 
-	 * 
-	 */
-	protected void init() {
-	    if(debug) System.out.printf("%s: init SurveyVolume %s\n",this.getClass().getSimpleName(),getName());
+    protected boolean debug = false;
+    private String name;
+    private String material = "Vacuum";
+    private SurveyVolume mother = null;
+    protected List<SurveyVolume> referenceGeom = null;
+    private SurveyCoordinateSystem coord;
+    protected  Hep3Vector ballPos;
+    protected  Hep3Vector veePos;
+    protected  Hep3Vector flatPos;
+    private Hep3Vector center;
+    private Hep3Vector boxDim;
+    private AlignmentCorrection alignmentCorrections;
+    
+    public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection) {
+        setName(name);
+        setMother(m);
+        setAlignmentCorrection(alignmentCorrection);
+    }
+    
+    public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, SurveyVolume ref) {
+        setName(name);
+        setMother(m);
+        setAlignmentCorrection(alignmentCorrection);
+        addReferenceGeom(ref);
+    }
+    
+    public SurveyVolume(String name, SurveyVolume m, AlignmentCorrection alignmentCorrection, List<SurveyVolume> ref) {
+        setName(name);
+        setMother(m);
+        setAlignmentCorrection(alignmentCorrection);
+        addReferenceGeom(ref);
+    }
+    
+    protected abstract void setPos();
+    protected abstract void setCenter();
+    protected abstract void setBoxDim();
+
+    /**
+     * 
+     * Initialize the volume. 
+     * This needs to be called at the top level implementation of the {@link SurveyVolume} to properly setup
+     * the coordinate systems. It takes care of applying user supplied custom transformations and alignment corrections
+     * in the order given in the function below. That order must be preserved to get a uniform behavior. 
+     * 
+     */
+    protected void init() {
+        if(debug) System.out.printf("%s: init SurveyVolume %s\n",this.getClass().getSimpleName(),getName());
         setPos();
-		setCoord();
-		applyReferenceTransformation();
-		setCenter();
-		setBoxDim();
-		applyGenericCoordinateSystemCorrections();
-		applyLocalAlignmentCorrections();
-		if(debug) {
-		    //printCoordInfo();
-		    System.out.printf("%s: init of SurveyVolume %s DONE\n",this.getClass().getSimpleName(),getName());            
-		}
-	}
-	
+        setCoord();
+        applyReferenceTransformation();
+        setCenter();
+        setBoxDim();
+        applyGenericCoordinateSystemCorrections();
+        applyLocalAlignmentCorrections();
+        if(debug) {
+            //printCoordInfo();
+            System.out.printf("%s: init of SurveyVolume %s DONE\n",this.getClass().getSimpleName(),getName());            
+        }
+    }
+    
 
     private void applySurvey(Element node) {
 
@@ -378,254 +378,254 @@
      * Apply a generic correction to the coordinate system of this volume. 
      */
     protected void applyGenericCoordinateSystemCorrections() {
-	    //do nothing here unless overridden
-	   
-	}
-    
-	/**
-	 * Applies a user supplied reference transformation to the module. 
-	 * This is convenient as it allows for intermediary "virtual" mother volumes to be used 
-	 * in referencing a volume to it's physcial mother volume.
-	 */
-	protected void applyReferenceTransformation() {
-
-	        	    
-	    if(referenceGeom!=null) {
-	        
-	        if(debug) System.out.printf("%s: apply reference transformation for %s\n",this.getClass().getSimpleName(),getName());
-	        
-
-	        if(debug) System.out.printf("%s: coord system before %d ref transformations:\n%s\n",this.getClass().getSimpleName(),referenceGeom.size(),getCoord().toString());
-	        
-	        for(SurveyVolume ref : referenceGeom) {
-
-	            if(debug) {
-	                System.out.printf("%s: coord system before ref %s transform:\n%s\n",this.getClass().getSimpleName(),ref.getName(),getCoord().toString());
-	                System.out.printf("%s: Ref %s coord\n%s\n",this.getClass().getSimpleName(), ref.getName(),ref.getCoord().toString());
-	            }
-	            
-	            getCoord().transform(ref.getCoord().getTransformation());
-
-	            if(debug) System.out.printf("%s: coord system after ref %s transform:\n%s\n",this.getClass().getSimpleName(),ref.getName(),getCoord().toString());
-	            
-	        }
-
-	        if(debug) System.out.printf("%s: coord system after ref transformations:\n%s\n",this.getClass().getSimpleName(),getCoord().toString());
-	        
-	    } else {
-	        
-	        if(debug) System.out.printf("%s: no reference transformation exists for %s\n",this.getClass().getSimpleName(),getName());
-	        
-	    }
-
-	}
-	
-	/**
-	 * Apply @link AlignmentCorrection to the volume if they are supplied. 
-	 * 
-	 */
-	private void applyLocalAlignmentCorrections() {
-	    
-	    // Apply alignment corrections to local coordinate system that is already built
-	    boolean debug_local = false;
-	    if(this.coord==null) 
-	        throw new RuntimeException("no coordinate system was set before trying to apply alignment corrections.");
-
-	    if(alignmentCorrections!=null) {
-
-	        
-	        if(alignmentCorrections.getNode()!=null) {
-	            
-	            if(debug_local || debug) System.out.printf("%s: Apply survey results to %s\n",this.getClass().getSimpleName(),this.getName());
-	            
-	            applySurvey(alignmentCorrections.getNode());
-
-	            if(debug_local || debug) System.out.printf("%s: DONE Apply survey results to %s\n",this.getClass().getSimpleName(),this.getName());
-                
-	        }
-	        
-	        
-	        
-	        
-	        
-	        if(debug_local || debug) System.out.printf("%s: Apply alignment corrections to %s\n",this.getClass().getSimpleName(),this.getName());
-
-	        // translate
-	        if(alignmentCorrections.getTranslation()!=null) {			    
-
-	            if(debug_local || debug) System.out.printf("%s: Apply local translation %s\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString());			    
-	            
-	            // rotate into mother coordinate system
-	            Hep3Vector translation_mother = getCoord().getTransformation().rotated(alignmentCorrections.getTranslation());
-	            
-	            if(debug_local || debug) System.out.printf("%s: after rotation apply translation %s to coordinate system\n", this.getClass().getSimpleName(),translation_mother.toString());
-	            
-	            //apply translation
-	            getCoord().translate(translation_mother);
-
-	        } else {
-	            if(debug_local || debug) System.out.printf("%s: No translation to coordinate system\n", this.getClass().getSimpleName());
-	        }
-
-	        // rotate
-	        if(alignmentCorrections.getRotation()!=null) {  
-	            
+        //do nothing here unless overridden
+       
+    }
+    
+    /**
+     * Applies a user supplied reference transformation to the module. 
+     * This is convenient as it allows for intermediary "virtual" mother volumes to be used 
+     * in referencing a volume to it's physcial mother volume.
+     */
+    protected void applyReferenceTransformation() {
+
+                    
+        if(referenceGeom!=null) {
+            
+            if(debug) System.out.printf("%s: apply reference transformation for %s\n",this.getClass().getSimpleName(),getName());
+            
+
+            if(debug) System.out.printf("%s: coord system before %d ref transformations:\n%s\n",this.getClass().getSimpleName(),referenceGeom.size(),getCoord().toString());
+            
+            for(SurveyVolume ref : referenceGeom) {
+
+                if(debug) {
+                    System.out.printf("%s: coord system before ref %s transform:\n%s\n",this.getClass().getSimpleName(),ref.getName(),getCoord().toString());
+                    System.out.printf("%s: Ref %s coord\n%s\n",this.getClass().getSimpleName(), ref.getName(),ref.getCoord().toString());
+                }
+                
+                getCoord().transform(ref.getCoord().getTransformation());
+
+                if(debug) System.out.printf("%s: coord system after ref %s transform:\n%s\n",this.getClass().getSimpleName(),ref.getName(),getCoord().toString());
+                
+            }
+
+            if(debug) System.out.printf("%s: coord system after ref transformations:\n%s\n",this.getClass().getSimpleName(),getCoord().toString());
+            
+        } else {
+            
+            if(debug) System.out.printf("%s: no reference transformation exists for %s\n",this.getClass().getSimpleName(),getName());
+            
+        }
+
+    }
+    
+    /**
+     * Apply @link AlignmentCorrection to the volume if they are supplied. 
+     * 
+     */
+    private void applyLocalAlignmentCorrections() {
+        
+        // Apply alignment corrections to local coordinate system that is already built
+        boolean debug_local = false;
+        if(this.coord==null) 
+            throw new RuntimeException("no coordinate system was set before trying to apply alignment corrections.");
+
+        if(alignmentCorrections!=null) {
+
+            
+            if(alignmentCorrections.getNode()!=null) {
+                
+                if(debug_local || debug) System.out.printf("%s: Apply survey results to %s\n",this.getClass().getSimpleName(),this.getName());
+                
+                applySurvey(alignmentCorrections.getNode());
+
+                if(debug_local || debug) System.out.printf("%s: DONE Apply survey results to %s\n",this.getClass().getSimpleName(),this.getName());
+                
+            }
+            
+            
+            
+            
+            
+            if(debug_local || debug) System.out.printf("%s: Apply alignment corrections to %s\n",this.getClass().getSimpleName(),this.getName());
+
+            // translate
+            if(alignmentCorrections.getTranslation()!=null) {               
+
+                if(debug_local || debug) System.out.printf("%s: Apply local translation %s\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString());               
+                
+                // rotate into mother coordinate system
+                Hep3Vector translation_mother = getCoord().getTransformation().rotated(alignmentCorrections.getTranslation());
+                
+                if(debug_local || debug) System.out.printf("%s: after rotation apply translation %s to coordinate system\n", this.getClass().getSimpleName(),translation_mother.toString());
+                
+                //apply translation
+                getCoord().translate(translation_mother);
+
+            } else {
+                if(debug_local || debug) System.out.printf("%s: No translation to coordinate system\n", this.getClass().getSimpleName());
+            }
+
+            // rotate
+            if(alignmentCorrections.getRotation()!=null) {  
+                
                 if(debug_local || debug) {
                     System.out.printf("%s: Apply rotation matrix:\n", this.getClass().getSimpleName());   
                     TransformationUtils.printMatrix(alignmentCorrections.getRotation().getMatrix());
                     System.out.printf("%s: coord system before:\n%s\n", this.getClass().getSimpleName(),getCoord().toString());   
                 }
 
-	            
-	            // correct rotation of the local unit vectors
-	            Vector3D u_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(1,0,0));
-	            Vector3D v_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(0,1,0));
-	            Vector3D w_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(0,0,1));
-
-	            // rotate the local unit vectors to the mother coordinates
-	            
-	            Hep3Vector u_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(u_rot_local.toArray()));
-	            Hep3Vector v_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(v_rot_local.toArray()));
-	            Hep3Vector w_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(w_rot_local.toArray()));
+                
+                // correct rotation of the local unit vectors
+                Vector3D u_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(1,0,0));
+                Vector3D v_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(0,1,0));
+                Vector3D w_rot_local = alignmentCorrections.getRotation().applyTo(new Vector3D(0,0,1));
+
+                // rotate the local unit vectors to the mother coordinates
+                
+                Hep3Vector u_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(u_rot_local.toArray()));
+                Hep3Vector v_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(v_rot_local.toArray()));
+                Hep3Vector w_rot = getCoord().getTransformation().getRotation().rotated(new BasicHep3Vector(w_rot_local.toArray()));
                
-	            getCoord().u(u_rot);
-	            getCoord().v(v_rot);
-	            getCoord().w(w_rot);
+                getCoord().u(u_rot);
+                getCoord().v(v_rot);
+                getCoord().w(w_rot);
 
                 if(debug_local || debug) {
                     System.out.printf("%s: coord system after:\n%s\n", this.getClass().getSimpleName(),getCoord().toString());   
                 }
 
-	            
-	            
-
-	        } else {
-	            if(debug_local || debug) System.out.printf("%s: No rotation to coordinate system\n", this.getClass().getSimpleName());
-	        }
-
-	        if(debug_local || debug) System.out.printf("%s: coordinate system after alignment corrections:\n%s\n",this.getClass().getSimpleName(),getCoord().toString());
-
-	    } else {
+                
+                
+
+            } else {
+                if(debug_local || debug) System.out.printf("%s: No rotation to coordinate system\n", this.getClass().getSimpleName());
+            }
+
+            if(debug_local || debug) System.out.printf("%s: coordinate system after alignment corrections:\n%s\n",this.getClass().getSimpleName(),getCoord().toString());
+
+        } else {
             if(debug_local || debug) System.out.printf("%s: no alignment corrections exist for %s\n",this.getClass().getSimpleName(),this.getName());
-	    }
-
-	}
-	
-	private void setAlignmentCorrection(AlignmentCorrection alignmentCorrection) {
+        }
+
+    }
+    
+    private void setAlignmentCorrection(AlignmentCorrection alignmentCorrection) {
         this.alignmentCorrections = alignmentCorrection;
     }
     public  void setBallPos(double x, double y, double z) {
-		ballPos = new BasicHep3Vector(x,y,z);
-	}
-	public  void setVeePos(double x, double y, double z) {
-		veePos = new BasicHep3Vector(x,y,z);
-	}
-	public  void setFlatPos(double x, double y, double z) {
-		flatPos = new BasicHep3Vector(x,y,z);
-	}
-	public  Hep3Vector getBallPos() {
-		return ballPos;
-	}
-	public  Hep3Vector getVeePos() {
-		return veePos;
-	}
-	public  Hep3Vector getFlatPos() {
-		return flatPos;
-	}
-	public void setCoord() {
-		if(ballPos==null || veePos==null || flatPos==null) {
-			throw new RuntimeException("Need to set ball, vee and flat before building coord system!");
-		}
-		
-		coord = new SurveyCoordinateSystem(ballPos, veePos, flatPos);					
-		
-		if(this.debug) {
-		    System.out.printf("%s: setCoord \n%s\n", this.getClass().getSimpleName(), coord.toString());
-		}
-	}
-	public SurveyCoordinateSystem getCoord() {
-		if(coord == null) {
-			throw new RuntimeException("Need to setCoord!");
-		}
-		return coord;
-	}
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public Hep3Vector getCenter() {
-		return center;
-	}
-	public void setCenter(Hep3Vector center) {
-		this.center = center;
-	}
-	public void setCenter(double x, double y, double z) {
-		this.center = new BasicHep3Vector(x,y,z);
-	}
-	public Hep3Vector getBoxDim() {
-		return boxDim;
-	}
-	public void setBoxDim(double x, double y, double z) {
-		this.boxDim = new BasicHep3Vector(x,y,z);
-	}
-	public SurveyVolume getMother() {
-		return mother;
-	}
-	public void setMother(SurveyVolume mother) {
-		this.mother = mother;
-	}
-	public void addReferenceGeom(SurveyVolume refGeom) {
-	    if(refGeom!=null) { // check that it's not a dummy call
-	        if(referenceGeom == null) {
-	            referenceGeom = new ArrayList<SurveyVolume>();
-	        }
-	        referenceGeom.add(refGeom);
-	    }
-	}
-	public void addReferenceGeom(List<SurveyVolume> refGeomList) {
-		if(referenceGeom == null) {
-			referenceGeom = new ArrayList<SurveyVolume>();
-		}
-		referenceGeom.addAll(refGeomList);
-	}
-	public void printSurveyPos() {
-	    if(debug) {
-	        System.out.printf("%s: Survey pos for %s:\n",getClass().getSimpleName(),getName());
-	        System.out.printf("%s: ballPos   %s\n",getClass().getSimpleName(), ballPos.toString());
-	        System.out.printf("%s: veePos    %s\n",getClass().getSimpleName(), veePos.toString());
-	        System.out.printf("%s: flatPos   %s\n",getClass().getSimpleName(), flatPos.toString());
-	    }
-	}
-	public String getMaterial() {
-		return material;
-	}
-	public void setMaterial(String material) {
-		this.material = material;
-	}
-	public String toString() {
-		String s = "==\n" + getName() + " with mother " + (getMother()==null?"<no mother>":getMother().getName()) + ":\n";
-		if( getCenter()!=null) s += "Center of box: " + getCenter().toString() + "\n";
+        ballPos = new BasicHep3Vector(x,y,z);
+    }
+    public  void setVeePos(double x, double y, double z) {
+        veePos = new BasicHep3Vector(x,y,z);
+    }
+    public  void setFlatPos(double x, double y, double z) {
+        flatPos = new BasicHep3Vector(x,y,z);
+    }
+    public  Hep3Vector getBallPos() {
+        return ballPos;
+    }
+    public  Hep3Vector getVeePos() {
+        return veePos;
+    }
+    public  Hep3Vector getFlatPos() {
+        return flatPos;
+    }
+    public void setCoord() {
+        if(ballPos==null || veePos==null || flatPos==null) {
+            throw new RuntimeException("Need to set ball, vee and flat before building coord system!");
+        }
+        
+        coord = new SurveyCoordinateSystem(ballPos, veePos, flatPos);                   
+        
+        if(this.debug) {
+            System.out.printf("%s: setCoord \n%s\n", this.getClass().getSimpleName(), coord.toString());
+        }
+    }
+    public SurveyCoordinateSystem getCoord() {
+        if(coord == null) {
+            throw new RuntimeException("Need to setCoord!");
+        }
+        return coord;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public Hep3Vector getCenter() {
+        return center;
+    }
+    public void setCenter(Hep3Vector center) {
+        this.center = center;
+    }
+    public void setCenter(double x, double y, double z) {
+        this.center = new BasicHep3Vector(x,y,z);
+    }
+    public Hep3Vector getBoxDim() {
+        return boxDim;
+    }
+    public void setBoxDim(double x, double y, double z) {
+        this.boxDim = new BasicHep3Vector(x,y,z);
+    }
+    public SurveyVolume getMother() {
+        return mother;
+    }
+    public void setMother(SurveyVolume mother) {
+        this.mother = mother;
+    }
+    public void addReferenceGeom(SurveyVolume refGeom) {
+        if(refGeom!=null) { // check that it's not a dummy call
+            if(referenceGeom == null) {
+                referenceGeom = new ArrayList<SurveyVolume>();
+            }
+            referenceGeom.add(refGeom);
+        }
+    }
+    public void addReferenceGeom(List<SurveyVolume> refGeomList) {
+        if(referenceGeom == null) {
+            referenceGeom = new ArrayList<SurveyVolume>();
+        }
+        referenceGeom.addAll(refGeomList);
+    }
+    public void printSurveyPos() {
+        if(debug) {
+            System.out.printf("%s: Survey pos for %s:\n",getClass().getSimpleName(),getName());
+            System.out.printf("%s: ballPos   %s\n",getClass().getSimpleName(), ballPos.toString());
+            System.out.printf("%s: veePos    %s\n",getClass().getSimpleName(), veePos.toString());
+            System.out.printf("%s: flatPos   %s\n",getClass().getSimpleName(), flatPos.toString());
+        }
+    }
+    public String getMaterial() {
+        return material;
+    }
+    public void setMaterial(String material) {
+        this.material = material;
+    }
+    public String toString() {
+        String s = "==\n" + getName() + " with mother " + (getMother()==null?"<no mother>":getMother().getName()) + ":\n";
+        if( getCenter()!=null) s += "Center of box: " + getCenter().toString() + "\n";
         if( getBoxDim()!=null) s += "Box dimensions: " + getBoxDim().toString() + "\n";
-		if(this.coord==null)   s += " No coord system \n";
-		else {
-		    s += getName() + " origin " + getCoord().origin() + " u " + getCoord().u()+ " v " + getCoord().v()+ " w " + getCoord().w();
-		}
+        if(this.coord==null)   s += " No coord system \n";
+        else {
+            s += getName() + " origin " + getCoord().origin() + " u " + getCoord().u()+ " v " + getCoord().v()+ " w " + getCoord().w();
+        }
         s += "AlignmentCorrections: \n";
-		if(this.alignmentCorrections!=null) {
-		    s += "Milleparameters: ";
-		    if(this.alignmentCorrections.getMilleParameters()!=null) {
-		        for(MilleParameter mp : this.alignmentCorrections.getMilleParameters()) s += mp.getId() + " ";
-		    } else {
-		        s += "no MP params associated.";
-		    }
-		    s +=  "(" + this.getName() + ")" + " \n";
-		} else {
-		    s+= " no alignment corrections associated.\n";
-		}
-		SurveyVolume m = getMother();
-		while(m!=null) {    
+        if(this.alignmentCorrections!=null) {
+            s += "Milleparameters: ";
+            if(this.alignmentCorrections.getMilleParameters()!=null) {
+                for(MilleParameter mp : this.alignmentCorrections.getMilleParameters()) s += mp.getId() + " ";
+            } else {
+                s += "no MP params associated.";
+            }
+            s +=  "(" + this.getName() + ")" + " \n";
+        } else {
+            s+= " no alignment corrections associated.\n";
+        }
+        SurveyVolume m = getMother();
+        while(m!=null) {    
             Hep3Vector origin_m = HPSTrackerBuilder.transformToParent(new BasicHep3Vector(0, 0, 0), this, m.getName());
             String unitVecStr = "";
             if(getCoord()!=null) {
@@ -638,12 +638,12 @@
             //origin_m = VecOp.mult(0.0393701, origin_m);
             //s += String.format("%s origin in %s : (%.4f %.4f %.4f) (inch)\n",getName(), m.getName(), origin_m.x(),origin_m.y(),origin_m.z());            
             m = m.getMother();
-		}
-		
-		
-		return s;
-	}
-	
-
-	
+        }
+        
+        
+        return s;
+    }
+    
+
+    
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java	Wed Mar  9 11:43:24 2016
@@ -21,7 +21,7 @@
     public abstract void setPositionAndRotation(SurveyVolume base);
 
     public String getName() {
-    	return surveyVolume.getName();
+        return surveyVolume.getName();
     }
     
     protected Hep3Vector getBoxDim() {
@@ -33,7 +33,7 @@
     }
 
     public boolean isDebug() {
-    	return debug;
+        return debug;
     }
 
     public abstract String toString();

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeVisualization.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeVisualization.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeVisualization.java	Wed Mar  9 11:43:24 2016
@@ -7,14 +7,14 @@
  * @author Per Hansson Adrian <[log in to unmask]>
  */
 public class SurveyVolumeVisualization {
-	protected String visName = "";
-	public SurveyVolumeVisualization() {}
-	public String getVisName() {
-		return visName;
-	}
-	protected void setVisName(String visName) {
-		this.visName = visName;
-	}
-	
-	
+    protected String visName = "";
+    public SurveyVolumeVisualization() {}
+    public String getVisName() {
+        return visName;
+    }
+    protected void setVisName(String visName) {
+        this.visName = visName;
+    }
+    
+    
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SvtAlignmentConstantsReader.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SvtAlignmentConstantsReader.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/SvtAlignmentConstantsReader.java	Wed Mar  9 11:43:24 2016
@@ -14,16 +14,16 @@
  * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
 public class SvtAlignmentConstantsReader {
-	
-	private SvtAlignmentConstantsReader() {
-	}
+    
+    private SvtAlignmentConstantsReader() {
+    }
 
-	/**
-	 * Read SVT alignment constants from the conditions database table <i>svt_alignments</i> and create a list of 
-	 * <code>MilleParameter</code> objects from it.
-	 * 
-	 * @return the Millepede parameter list
-	 */
+    /**
+     * Read SVT alignment constants from the conditions database table <i>svt_alignments</i> and create a list of 
+     * <code>MilleParameter</code> objects from it.
+     * 
+     * @return the Millepede parameter list
+     */
     static List<MilleParameter> readMilleParameters() {
 
         final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSMuonCalorimeter2.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSMuonCalorimeter2.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSMuonCalorimeter2.java	Wed Mar  9 11:43:24 2016
@@ -8,13 +8,13 @@
 
 public class HPSMuonCalorimeter2 extends LCDDSubdetector
 {
-	HPSMuonCalorimeter2(Element e) throws JDOMException 
-	{
-		super(e);
-	}
+    HPSMuonCalorimeter2(Element e) throws JDOMException 
+    {
+        super(e);
+    }
 
-	void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException 
-	{
+    void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException 
+    {
         String name = node.getAttributeValue("name");
         System.out.println("HPSMuonCalorimeter2.addToLCDD - " + name);
         int id = node.getAttribute("id").getIntValue();
@@ -22,7 +22,7 @@
         
         Element parameters = node.getChild("parameters");
         if (parameters == null) {
-        	throw new RuntimeException("parameters element missing");
+            throw new RuntimeException("parameters element missing");
         }
                 
         double frontFaceToTarget = parameters.getAttribute("front_face_to_target").getDoubleValue();
@@ -40,16 +40,16 @@
         System.out.println("stripSpacingZ = " + stripSpacingZ);
         
         for (Object layerObject : node.getChildren("layer")) {
-        	Element layerElement = (Element)layerObject;
-        	int layerId = layerElement.getAttribute("id").getIntValue();
-        	System.out.println("layer = " + layerId);
-        	for (Object sliceObject : layerElement.getChildren("slice")) {
-        		Element sliceElement = (Element)sliceObject;
-        		if (sliceElement.getAttribute("thickness") != null) {
-        			double thickness = sliceElement.getAttribute("thickness").getDoubleValue();
-        			System.out.println("slice thickness = " + thickness);
-        		}
-        	}
+            Element layerElement = (Element)layerObject;
+            int layerId = layerElement.getAttribute("id").getIntValue();
+            System.out.println("layer = " + layerId);
+            for (Object sliceObject : layerElement.getChildren("slice")) {
+                Element sliceElement = (Element)sliceObject;
+                if (sliceElement.getAttribute("thickness") != null) {
+                    double thickness = sliceElement.getAttribute("thickness").getDoubleValue();
+                    System.out.println("slice thickness = " + thickness);
+                }
+            }
         }
-	}
+    }
 }

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	Wed Mar  9 11:43:24 2016
@@ -30,58 +30,58 @@
  */
 public class HPSTestRunTracker2014 extends HPSTracker2014Base
 {
-	public HPSTestRunTracker2014(Element node) throws JDOMException
-	{
-		super(node);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.lcsim.geometry.compact.converter.lcdd.HPSTracker2014Base#initializeBuilder(org.lcsim.geometry.compact.converter.lcdd.util.LCDD, org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector)
-	 */
-	protected HPSTrackerLCDDBuilder initializeBuilder(LCDD lcdd, SensitiveDetector sens) {
-	    HPSTrackerLCDDBuilder b = new HPSTestRunTracker2014LCDDBuilder(_debug,node,lcdd,sens);
-	    return b;
-	}
-	
-	
-
-	/* (non-Javadoc)
+    public HPSTestRunTracker2014(Element node) throws JDOMException
+    {
+        super(node);
+    }
+
+    /* (non-Javadoc)
+     * @see org.lcsim.geometry.compact.converter.lcdd.HPSTracker2014Base#initializeBuilder(org.lcsim.geometry.compact.converter.lcdd.util.LCDD, org.lcsim.geometry.compact.converter.lcdd.util.SensitiveDetector)
+     */
+    protected HPSTrackerLCDDBuilder initializeBuilder(LCDD lcdd, SensitiveDetector sens) {
+        HPSTrackerLCDDBuilder b = new HPSTestRunTracker2014LCDDBuilder(_debug,node,lcdd,sens);
+        return b;
+    }
+    
+    
+
+    /* (non-Javadoc)
      * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#getModuleNumber(org.lcsim.geometry.compact.converter.JavaSurveyVolume)
      */
     protected int getModuleNumber(String surveyVolume) {
         return HPSTrackerBuilder.getHalfFromName(surveyVolume).equals("top") ? 0 : 1;
     }
-	
-	
-	
-	
-	
-	
-	
-	
-	
-
-	
-	
-	
-	private void makeExample(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-	
-	
-	if(_debug) {
-		System.out.println("--- makeExample ----");
-		
-	}
-
-	
-	
-	String volName = "example";
-	Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-	lcdd.add(box);
-	Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	
-	
-	
-	 org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisX = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1., 0., 0.);
+    
+    
+    
+    
+    
+    
+    
+    
+    
+
+    
+    
+    
+    private void makeExample(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+    
+    
+    if(_debug) {
+        System.out.println("--- makeExample ----");
+        
+    }
+
+    
+    
+    String volName = "example";
+    Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+    lcdd.add(box);
+    Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+    
+    
+    
+     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisX = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1., 0., 0.);
      org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisY = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 1., 0.);
      org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisZ = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 0., 1.);
 
@@ -131,11 +131,11 @@
      Rotation rot = new Rotation(volName + "_rotation",0,0,0);
      lcdd.add(pos);
      lcdd.add(rot);
-	
-	
+    
+    
      PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
      if(_debug) {
-    	 System.out.println("Created physical vomume " + basePV.getName());
+         System.out.println("Created physical vomume " + basePV.getName());
      }
      
      
@@ -151,153 +151,153 @@
      lcdd.add(subRot);
      PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
      if(_debug) {
-    	 System.out.println("Created physical vomume " + subBasePV.getName());
+         System.out.println("Created physical vomume " + subBasePV.getName());
      }
-	
+    
      lcdd.add(volumeSub);
      volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
 
-	
+    
      lcdd.add(volume);
-	
-	
-	
-	
-	}
-	
-	
-	private void makeExample2(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample2 ----");
-			
-		}
-		
-		String volName = "example2";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	    
-
-		
-		 org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisX = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1., 0., 0.);
-	     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisY = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 1., 0.);
-	     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisZ = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 0., 1.);
-
-	     double alpha1 = PI / 4.;
-	     double alpha2 = PI / 4.;
-	     double alpha3 = -PI / 4.;
-
-	     org.apache.commons.math3.geometry.euclidean.threed.Rotation r123 = 
-	    		 new org.apache.commons.math3.geometry.euclidean.threed.Rotation(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ, 
-	    				 alpha1, 
-	    				 alpha2, 
-	    				 alpha3);
-	     
-	     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisXPrime = r123.applyTo(axisX);
-	     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisYPrime = r123.applyTo(axisY);
-	     org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisZPrime = r123.applyTo(axisZ);
-
-	     //if(_debug) System.out.println("axisYPrime: " + axisYPrime);
-	     //if(_debug) System.out.println("axisZPrime: " + axisZPrime);
-
-	     
-	     
-	     //double [] rotations = r123.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-	     
-	     
-	     //double [] rotations = r12.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-	     double [] rotations = r123.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-	     
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5,0,0);
-	     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-	     
-	     lcdd.add(volume);
-
-		
-		
-		
-		}
-		
-		
-		
-	private void makeExample3(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample3 ----");
-			
-		}
-		
-		String volName = "example3";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-		/*
-		
-		TestRunModuleL13: survey positions before ref support_plate_top transform
-		Survey pos for module_L1t:
-		ballPos   [      25.000,      676.10,     -4.3500]
-		veePos    [      95.000,      676.10,     -4.3500]
-		flatPos   [      60.000,      670.10,     -4.3500]
-		TestRunModuleL13: Ref support_plate_top coord
-		Coordinate system: 
-		origin [      40.314,      142.71,      138.40]
-		u [     0.99955,    0.030000,      0.0000]
-		v [   -0.030000,     0.99955,      0.0000]
-		w [      0.0000,     -0.0000,      1.0000]
-		TestRunModuleL13: survey positions after ref support_plate_top transform
-		Survey pos for module_L1t:
-		ballPos   [      45.020,      819.25,      134.05]
-		veePos    [      114.99,      821.35,      134.05]
-		flatPos   [      80.184,      814.31,      134.05]
-		TestRunModuleL13: coordinate system:
-		Coordinate system: 
-		origin [      45.020,      819.25,      134.05]
-		u [     0.99955,    0.030000,      0.0000]
-		v [    0.030000,    -0.99955,      0.0000]
-		w [      0.0000,      0.0000,     -1.0000]
-		TestRunModuleL13: translation:
-		[      45.020,      819.25,      134.05]
-		TestRunModuleL13: rotation:
-		[
-		0.999549894704642 0.030000133265350216 0.0
-		0.030000133265350216 -0.999549894704642 0.0
-		0.0 0.0 -1.0
-
-		]
-		
-		
-		
-		LCDDBaseGeom: set position and rotation for volume module_L1t
+    
+    
+    
+    
+    }
+    
+    
+    private void makeExample2(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample2 ----");
+            
+        }
+        
+        String volName = "example2";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+
+        
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisX = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(1., 0., 0.);
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisY = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 1., 0.);
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisZ = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(0., 0., 1.);
+
+         double alpha1 = PI / 4.;
+         double alpha2 = PI / 4.;
+         double alpha3 = -PI / 4.;
+
+         org.apache.commons.math3.geometry.euclidean.threed.Rotation r123 = 
+                 new org.apache.commons.math3.geometry.euclidean.threed.Rotation(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ, 
+                         alpha1, 
+                         alpha2, 
+                         alpha3);
+         
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisXPrime = r123.applyTo(axisX);
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisYPrime = r123.applyTo(axisY);
+         org.apache.commons.math3.geometry.euclidean.threed.Vector3D axisZPrime = r123.applyTo(axisZ);
+
+         //if(_debug) System.out.println("axisYPrime: " + axisYPrime);
+         //if(_debug) System.out.println("axisZPrime: " + axisZPrime);
+
+         
+         
+         //double [] rotations = r123.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+         
+         
+         //double [] rotations = r12.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+         double [] rotations = r123.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+         
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5,0,0);
+         Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+         
+         lcdd.add(volume);
+
+        
+        
+        
+        }
+        
+        
+        
+    private void makeExample3(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample3 ----");
+            
+        }
+        
+        String volName = "example3";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+        /*
+        
+        TestRunModuleL13: survey positions before ref support_plate_top transform
+        Survey pos for module_L1t:
+        ballPos   [      25.000,      676.10,     -4.3500]
+        veePos    [      95.000,      676.10,     -4.3500]
+        flatPos   [      60.000,      670.10,     -4.3500]
+        TestRunModuleL13: Ref support_plate_top coord
+        Coordinate system: 
+        origin [      40.314,      142.71,      138.40]
+        u [     0.99955,    0.030000,      0.0000]
+        v [   -0.030000,     0.99955,      0.0000]
+        w [      0.0000,     -0.0000,      1.0000]
+        TestRunModuleL13: survey positions after ref support_plate_top transform
+        Survey pos for module_L1t:
+        ballPos   [      45.020,      819.25,      134.05]
+        veePos    [      114.99,      821.35,      134.05]
+        flatPos   [      80.184,      814.31,      134.05]
+        TestRunModuleL13: coordinate system:
+        Coordinate system: 
+        origin [      45.020,      819.25,      134.05]
+        u [     0.99955,    0.030000,      0.0000]
+        v [    0.030000,    -0.99955,      0.0000]
+        w [      0.0000,      0.0000,     -1.0000]
+        TestRunModuleL13: translation:
+        [      45.020,      819.25,      134.05]
+        TestRunModuleL13: rotation:
+        [
+        0.999549894704642 0.030000133265350216 0.0
+        0.030000133265350216 -0.999549894704642 0.0
+        0.0 0.0 -1.0
+
+        ]
+        
+        
+        
+        LCDDBaseGeom: set position and rotation for volume module_L1t
 getEulerAngles: u [    0.030000,    -0.99955,      0.0000] v[      0.0000,      0.0000,     -1.0000] -> [      0.0000,      1.0000,      0.0000] [      0.0000,      0.0000,      1.0000]
 Input: u {0.03; -1; 0} v {0; 0; -1} u' {0; 1; 0} v' {0; 0; 1}
 rot matrix:
@@ -314,388 +314,388 @@
 LCDDBaseGeom: rot                    [Element: <rotation/>]
 LCDDBaseGeom: DONE constructing LCDD object module_L1t
 
-		
-
-		*/
-
-		Hep3Vector u = new BasicHep3Vector(1,0,0);
-		Hep3Vector v = new BasicHep3Vector(0,1,0);
-		Hep3Vector w = new BasicHep3Vector(0,0,1);
-		
-		Hep3Vector u_L1 = new BasicHep3Vector(0.99955,    0.030000,      0.0000);
-		Hep3Vector v_L1 = new BasicHep3Vector(0.030000,    -0.99955,      0.0000);
-		Hep3Vector w_L1 = new BasicHep3Vector(0.0000,      0.0000,     -1.0000);
-		
-		
-		
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_L1.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_L1.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w_L1.v());
-
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-		
-		Hep3Vector euler_angles = TransformationUtils.getCardanAngles(v_L1, w_L1, v, w);
-		
-		//Get the generic rotation
-		org.apache.commons.math3.geometry.euclidean.threed.Rotation r = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(v_3D_L1,w_3D_L1,v_3D, w_3D);
-		//Get the angles
-		double rotations[] = r.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-		
-		if(_debug) {
-			System.out.println("getEulerAngles gives euler_angles: " + euler_angles.toString());
-			System.out.println("manual          gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-		}
-			  
-		if((rotations[0]-euler_angles.x())>0.00001 || (rotations[1]-euler_angles.y())>0.00001 || (rotations[2]-euler_angles.z())>0.00001) {
-			//System.("closing the loop in apache rotation didn't work!");
-			//throw new RuntimeException("closing the loop in apache rotation didn't work!");
-		}
-		
-		   
-		
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*4,0,0);
-	     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("HybridVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
-		
-	
-		private void makeExample4(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample4 ----");
-			
-		}
-		
-		String volName = "example4";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	
-		 
-
-		Hep3Vector u = new BasicHep3Vector(1,0,0);
-		Hep3Vector v = new BasicHep3Vector(0,1,0);
-		Hep3Vector w = new BasicHep3Vector(0,0,1);
-	
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-		
-		
-		
-		//set up a rotation about the X axis
-	    org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -1.0*Math.PI);
-	     
-	    // find y' and z'
-	    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
-	    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
-	    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
-	    
-	    
-	    double [] rotations = r1.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-	    
-	    
-	    if(_debug) {
-	    	System.out.println("u_3D:       " + u_3D.toString());
-			System.out.println("v_3D:       " + v_3D.toString());
-			System.out.println("w_3D:       " + w_3D.toString());
-			r1.toString();
-			System.out.println("u_3D_p: " + u_3D_p.toString());
-			System.out.println("v_3D_p: " + v_3D_p.toString());
-			System.out.println("w_3D_p: " + w_3D_p.toString());
-			
-			System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-	    }
-	    
-	 	 
-		
-		//apply to unit vector
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*2,0,0);
-	     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
-		
-	
-		private void makeExample5(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-			
-			
-			if(_debug) {
-				System.out.println("--- makeExample5 ----");
-				
-			}
-			
-			String volName = "example5";
-			Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-			lcdd.add(box);
-			Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-			 
-
-			Hep3Vector u = new BasicHep3Vector(1,0,0);
-			Hep3Vector v = new BasicHep3Vector(0,1,0);
-			Hep3Vector w = new BasicHep3Vector(0,0,1);
-		
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-			
-			
-			
-			//set up a rotation about the X axis
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -1.0*Math.PI);
-		     
-		    // find y' and z'
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
-		    
-		    // set up a rotation about the Z axis
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D_p, -0.03);
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r13 = r3.applyTo(r1);
-		    
-		    
-		    // find y' and z'
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D);
-		    //org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D_p);
-		    //org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D_p);
-		    //org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D_p);
-		    
-		    double [] rotations = r13.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-		    
-		    
-		    if(_debug) {
-		    	System.out.println("u_3D:       " + u_3D.toString());
-				System.out.println("v_3D:       " + v_3D.toString());
-				System.out.println("w_3D:       " + w_3D.toString());
-				r1.toString();
-				System.out.println("u_3D_p: " + u_3D_p.toString());
-				System.out.println("v_3D_p: " + v_3D_p.toString());
-				System.out.println("w_3D_p: " + w_3D_p.toString());
-				r13.toString();
-				System.out.println("u_3D_pp: " + u_3D_pp.toString());
-				System.out.println("v_3D_pp: " + v_3D_pp.toString());
-				System.out.println("w_3D_pp: " + w_3D_pp.toString());
-				System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-		    }
-		    
-		 	 
-			
-			//apply to unit vector
-			
-		     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*3,0,0);
-		     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-		     lcdd.add(pos);
-		     lcdd.add(rot);
-			
-			
-		     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + basePV.getName());
-		     }
-			
-		     
-		     volName = volName + "_sub";
-		     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-		     lcdd.add(boxSub);
-		     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-		     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-		     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-		     lcdd.add(subPos);
-		     lcdd.add(subRot);
-		     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + subBasePV.getName());
-		     }
-			
-		     lcdd.add(volumeSub);
-		     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-		     lcdd.add(volume);
-			
-			
-			
-			
-			}
-			
-		
-		
-
-		private void makeExample5b(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-			
-			
-			if(_debug) {
-				System.out.println("--- makeExample5b ----");
-				
-			}
-			
-			String volName = "example5b";
-			Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-			lcdd.add(box);
-			Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-			 
-
-			Hep3Vector u = new BasicHep3Vector(1,0,0);
-			Hep3Vector v = new BasicHep3Vector(0,1,0);
-			Hep3Vector w = new BasicHep3Vector(0,0,1);
-		
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-			
-			
-			 // set up a rotation about the Z axis
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D, -0.03);
-		     
-		    // find y' and z'
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r3.applyTo(u_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r3.applyTo(v_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r3.applyTo(w_3D);
-		    
-		   
-		    
-		    double [] rotations = r3.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-		    
-		    
-		    if(_debug) {
-		    	System.out.println("u_3D:       " + u_3D.toString());
-				System.out.println("v_3D:       " + v_3D.toString());
-				System.out.println("w_3D:       " + w_3D.toString());
-				r3.toString();
-				System.out.println("u_3D_p: " + u_3D_p.toString());
-				System.out.println("v_3D_p: " + v_3D_p.toString());
-				System.out.println("w_3D_p: " + w_3D_p.toString());
-				System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-		    }
-		    
-		 	 
-			
-			//apply to unit vector
-			
-		     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*3,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1.5,0);
-		     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-		     lcdd.add(pos);
-		     lcdd.add(rot);
-			
-			
-		     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + basePV.getName());
-		     }
-			
-		     
-		     volName = volName + "_sub";
-		     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-		     lcdd.add(boxSub);
-		     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-		     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-		     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-		     lcdd.add(subPos);
-		     lcdd.add(subRot);
-		     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + subBasePV.getName());
-		     }
-			
-		     lcdd.add(volumeSub);
-		     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-		     lcdd.add(volume);
-			
-			
-			
-			
-			}
-			
-		private void makeExample3b(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-			
-			
-			if(_debug) {
-				System.out.println("--- makeExample3b ----");
-				
-			}
-			
-			String volName = "example3b";
-			Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-			lcdd.add(box);
-			Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-			
-			/*
-			
-			TestRunModuleL13: survey positions
+        
+
+        */
+
+        Hep3Vector u = new BasicHep3Vector(1,0,0);
+        Hep3Vector v = new BasicHep3Vector(0,1,0);
+        Hep3Vector w = new BasicHep3Vector(0,0,1);
+        
+        Hep3Vector u_L1 = new BasicHep3Vector(0.99955,    0.030000,      0.0000);
+        Hep3Vector v_L1 = new BasicHep3Vector(0.030000,    -0.99955,      0.0000);
+        Hep3Vector w_L1 = new BasicHep3Vector(0.0000,      0.0000,     -1.0000);
+        
+        
+        
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_L1.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_L1.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w_L1.v());
+
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+        
+        Hep3Vector euler_angles = TransformationUtils.getCardanAngles(v_L1, w_L1, v, w);
+        
+        //Get the generic rotation
+        org.apache.commons.math3.geometry.euclidean.threed.Rotation r = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(v_3D_L1,w_3D_L1,v_3D, w_3D);
+        //Get the angles
+        double rotations[] = r.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+        
+        if(_debug) {
+            System.out.println("getEulerAngles gives euler_angles: " + euler_angles.toString());
+            System.out.println("manual          gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+        }
+              
+        if((rotations[0]-euler_angles.x())>0.00001 || (rotations[1]-euler_angles.y())>0.00001 || (rotations[2]-euler_angles.z())>0.00001) {
+            //System.("closing the loop in apache rotation didn't work!");
+            //throw new RuntimeException("closing the loop in apache rotation didn't work!");
+        }
+        
+           
+        
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*4,0,0);
+         Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("HybridVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
+        
+    
+        private void makeExample4(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample4 ----");
+            
+        }
+        
+        String volName = "example4";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+    
+         
+
+        Hep3Vector u = new BasicHep3Vector(1,0,0);
+        Hep3Vector v = new BasicHep3Vector(0,1,0);
+        Hep3Vector w = new BasicHep3Vector(0,0,1);
+    
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+        
+        
+        
+        //set up a rotation about the X axis
+        org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -1.0*Math.PI);
+         
+        // find y' and z'
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
+        
+        
+        double [] rotations = r1.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+        
+        
+        if(_debug) {
+            System.out.println("u_3D:       " + u_3D.toString());
+            System.out.println("v_3D:       " + v_3D.toString());
+            System.out.println("w_3D:       " + w_3D.toString());
+            r1.toString();
+            System.out.println("u_3D_p: " + u_3D_p.toString());
+            System.out.println("v_3D_p: " + v_3D_p.toString());
+            System.out.println("w_3D_p: " + w_3D_p.toString());
+            
+            System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+        }
+        
+         
+        
+        //apply to unit vector
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*2,0,0);
+         Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
+        
+    
+        private void makeExample5(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+            
+            
+            if(_debug) {
+                System.out.println("--- makeExample5 ----");
+                
+            }
+            
+            String volName = "example5";
+            Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+            lcdd.add(box);
+            Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+             
+
+            Hep3Vector u = new BasicHep3Vector(1,0,0);
+            Hep3Vector v = new BasicHep3Vector(0,1,0);
+            Hep3Vector w = new BasicHep3Vector(0,0,1);
+        
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+            
+            
+            
+            //set up a rotation about the X axis
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -1.0*Math.PI);
+             
+            // find y' and z'
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
+            
+            // set up a rotation about the Z axis
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D_p, -0.03);
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r13 = r3.applyTo(r1);
+            
+            
+            // find y' and z'
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D);
+            //org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D_p);
+            //org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D_p);
+            //org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D_p);
+            
+            double [] rotations = r13.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+            
+            
+            if(_debug) {
+                System.out.println("u_3D:       " + u_3D.toString());
+                System.out.println("v_3D:       " + v_3D.toString());
+                System.out.println("w_3D:       " + w_3D.toString());
+                r1.toString();
+                System.out.println("u_3D_p: " + u_3D_p.toString());
+                System.out.println("v_3D_p: " + v_3D_p.toString());
+                System.out.println("w_3D_p: " + w_3D_p.toString());
+                r13.toString();
+                System.out.println("u_3D_pp: " + u_3D_pp.toString());
+                System.out.println("v_3D_pp: " + v_3D_pp.toString());
+                System.out.println("w_3D_pp: " + w_3D_pp.toString());
+                System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+            }
+            
+             
+            
+            //apply to unit vector
+            
+             Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*3,0,0);
+             Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+             lcdd.add(pos);
+             lcdd.add(rot);
+            
+            
+             PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + basePV.getName());
+             }
+            
+             
+             volName = volName + "_sub";
+             Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+             lcdd.add(boxSub);
+             Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+             Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+             Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+             lcdd.add(subPos);
+             lcdd.add(subRot);
+             PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + subBasePV.getName());
+             }
+            
+             lcdd.add(volumeSub);
+             volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+             lcdd.add(volume);
+            
+            
+            
+            
+            }
+            
+        
+        
+
+        private void makeExample5b(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+            
+            
+            if(_debug) {
+                System.out.println("--- makeExample5b ----");
+                
+            }
+            
+            String volName = "example5b";
+            Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+            lcdd.add(box);
+            Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+             
+
+            Hep3Vector u = new BasicHep3Vector(1,0,0);
+            Hep3Vector v = new BasicHep3Vector(0,1,0);
+            Hep3Vector w = new BasicHep3Vector(0,0,1);
+        
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+            
+            
+             // set up a rotation about the Z axis
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D, -0.03);
+             
+            // find y' and z'
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r3.applyTo(u_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r3.applyTo(v_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r3.applyTo(w_3D);
+            
+           
+            
+            double [] rotations = r3.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+            
+            
+            if(_debug) {
+                System.out.println("u_3D:       " + u_3D.toString());
+                System.out.println("v_3D:       " + v_3D.toString());
+                System.out.println("w_3D:       " + w_3D.toString());
+                r3.toString();
+                System.out.println("u_3D_p: " + u_3D_p.toString());
+                System.out.println("v_3D_p: " + v_3D_p.toString());
+                System.out.println("w_3D_p: " + w_3D_p.toString());
+                System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+            }
+            
+             
+            
+            //apply to unit vector
+            
+             Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*3,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1.5,0);
+             Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+             lcdd.add(pos);
+             lcdd.add(rot);
+            
+            
+             PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + basePV.getName());
+             }
+            
+             
+             volName = volName + "_sub";
+             Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+             lcdd.add(boxSub);
+             Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+             Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+             Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+             lcdd.add(subPos);
+             lcdd.add(subRot);
+             PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + subBasePV.getName());
+             }
+            
+             lcdd.add(volumeSub);
+             volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+             lcdd.add(volume);
+            
+            
+            
+            
+            }
+            
+        private void makeExample3b(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+            
+            
+            if(_debug) {
+                System.out.println("--- makeExample3b ----");
+                
+            }
+            
+            String volName = "example3b";
+            Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+            lcdd.add(box);
+            Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+            
+            /*
+            
+            TestRunModuleL13: survey positions
 Survey pos for module_L1b:
 ballPos   [      25.000,      661.10,      4.3500]
 veePos    [      95.000,      661.10,      4.3500]
@@ -732,11 +732,11 @@
 
 ]
 
-			
-			
-			
-			
-			LCDDBaseGeom: set position and rotation for volume module_L1b
+            
+            
+            
+            
+            LCDDBaseGeom: set position and rotation for volume module_L1b
 getEulerAngles: u [   -0.030000,     0.99955,      0.0000] v[      0.0000,      0.0000,      1.0000] -> [      0.0000,      1.0000,      0.0000] [      0.0000,      0.0000,      1.0000]
 Input: u {-0.03; 1; 0} v {0; 0; 1} u' {0; 1; 0} v' {0; 0; 1}
 rot matrix:
@@ -753,484 +753,484 @@
 LCDDBaseGeom: rot                    [Element: <rotation/>]
 LCDDBaseGeom: DONE constructing LCDD object module_L1b
 
-		
-
-			
-
-			*/
-
-			Hep3Vector u = new BasicHep3Vector(1,0,0);
-			Hep3Vector v = new BasicHep3Vector(0,1,0);
-			Hep3Vector w = new BasicHep3Vector(0,0,1);
-			
-			Hep3Vector u_L1 = new BasicHep3Vector(0.99955,    0.030000,      0.0000);
-			Hep3Vector v_L1 = new BasicHep3Vector(-0.030000,     0.99955,      0.0000);
-			Hep3Vector w_L1 = new BasicHep3Vector(0.0000,      0.0000,     1.0000);
-			
-			
-			
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_L1.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_L1.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w_L1.v());
-
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-			
-			Hep3Vector euler_angles = TransformationUtils.getCardanAngles(v_L1, w_L1, v, w);
-			
-			//Get the generic rotation
-			org.apache.commons.math3.geometry.euclidean.threed.Rotation r = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(v_3D_L1,w_3D_L1,v_3D, w_3D);
-			//Get the angles
-			double rotations[] = r.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-			
-			if(_debug) {
-				System.out.println("getEulerAngles gives euler_angles: " + euler_angles.toString());
-				System.out.println("manual          gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-			}
-				  
-			if((rotations[0]-euler_angles.x())>0.00001 || (rotations[1]-euler_angles.y())>0.00001 || (rotations[2]-euler_angles.z())>0.00001) {
-				//throw new RuntimeException("closing the loop in apache rotation didn't work!");
-			}
-			
-			   
-			
-			
-		     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*4,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1.5,0);
-		     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-		     lcdd.add(pos);
-		     lcdd.add(rot);
-			
-			
-		     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + basePV.getName());
-		     }
-			
-		     
-		     
-		     volName = volName + "_sub";
-		     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-		     lcdd.add(boxSub);
-		     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-		     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-		     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-		     lcdd.add(subPos);
-		     lcdd.add(subRot);
-		     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + subBasePV.getName());
-		     }
-			
-		     lcdd.add(volumeSub);
-		     volumeSub.setVisAttributes(lcdd.getVisAttributes("HybridVis"));
-
-		     lcdd.add(volume);
-			
-			
-			
-			
-			}
-			
-
-		private void makeExample6(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample6 ----");
-			
-		}
-		
-		String volName = "example6";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	    
-	    double [] rotations = {-0.5*Math.PI,0,0};
-	    
-	    
-	    if(_debug) {
-	
-			
-			System.out.println("manual set lcdd angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-	    }
-	    
-	 	 
-		
-		//apply to unit vector
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,0,0);
-	     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
-		
-		
-		
-		private void makeExample66(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-			
-			
-			if(_debug) {
-				System.out.println("--- makeExample66 ----");
-				
-			}
-			
-			String volName = "example66";
-			Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-			lcdd.add(box);
-			Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-			 
-
-			Hep3Vector u = new BasicHep3Vector(1,0,0);
-			Hep3Vector v = new BasicHep3Vector(0,1,0);
-			Hep3Vector w = new BasicHep3Vector(0,0,1);
-		
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-			
-			
-			
-			//set up a rotation about the X axis
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -0.5*Math.PI);
-		     
-		    // find y' and z'
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
-		    
-		    
-		    double [] rotations = r1.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-		    
-		    
-		    if(_debug) {
-		    	System.out.println("u_3D:       " + u_3D.toString());
-				System.out.println("v_3D:       " + v_3D.toString());
-				System.out.println("w_3D:       " + w_3D.toString());
-				r1.toString();
-				System.out.println("u_3D_p: " + u_3D_p.toString());
-				System.out.println("v_3D_p: " + v_3D_p.toString());
-				System.out.println("w_3D_p: " + w_3D_p.toString());
-				
-				System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-		    }
-		    
-		 	 
-			
-			//apply to unit vector
-			
-		     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-4,0,0);
-		     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-		     lcdd.add(pos);
-		     lcdd.add(rot);
-			
-			
-		     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + basePV.getName());
-		     }
-			
-		     
-		     
-		     
-		     volName = volName + "_sub";
-		     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-		     lcdd.add(boxSub);
-		     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-		     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-		     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-		     lcdd.add(subPos);
-		     lcdd.add(subRot);
-		     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + subBasePV.getName());
-		     }
-			
-		     lcdd.add(volumeSub);
-		     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-		     lcdd.add(volume);
-			
-			
-			
-			
-			}
-		
-		
-		
-		
-		
-
-		private void makeExample7(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample7 ----");
-			
-		}
-		
-		String volName = "example7";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	    
-	    double [] rotations = {-0.5*Math.PI,0,-0.25*Math.PI};
-	    
-	    
-	    if(_debug) {
-	
-			
-			System.out.println("manual set lcdd angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-
-	    }
-	    
-	 	 
-		
-		//apply to unit vector
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1,0);
-	     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
-		
-		
-		
-	private void makeExample77(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-			
-			
-			if(_debug) {
-				System.out.println("--- makeExample77 ----");
-				
-			}
-			
-			String volName = "example77";
-			Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-			lcdd.add(box);
-			Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-		
-			 
-
-			Hep3Vector u = new BasicHep3Vector(1,0,0);
-			Hep3Vector v = new BasicHep3Vector(0,1,0);
-			Hep3Vector w = new BasicHep3Vector(0,0,1);
-		
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-			org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-			
-			
-			
-			//set up a rotation about the X axis
-		    org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -0.5*Math.PI);
-		     
-		    // find y' and z'
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
-		    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
-		    
-		    
-		  //set up a rotation about the Z xis
-		   org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D_p, -0.25*Math.PI);
-		   
-		   org.apache.commons.math3.geometry.euclidean.threed.Rotation r13 = r3.applyTo(r1);
-		   
-		   // find y'' and z''
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D);
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D);
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D);
-		    
-		   // find y'' and z'' (cross-check)
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp_2 = r3.applyTo(u_3D_p);
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp_2 = r3.applyTo(v_3D_p);
-		   org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp_2 = r3.applyTo(w_3D_p);
-		    
-		    
-		    double [] rotations = r13.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
-		    
-		    
-		    if(_debug) {
-		    	System.out.println("u_3D:       " + u_3D.toString());
-				System.out.println("v_3D:       " + v_3D.toString());
-				System.out.println("w_3D:       " + w_3D.toString());
-				r1.toString();
-				System.out.println("u_3D_p: " + u_3D_p.toString());
-				System.out.println("v_3D_p: " + v_3D_p.toString());
-				System.out.println("w_3D_p: " + w_3D_p.toString());
-				r13.toString();
-				System.out.println("u_3D_pp: " + u_3D_pp.toString());
-				System.out.println("v_3D_pp: " + v_3D_pp.toString());
-				System.out.println("w_3D_pp: " + w_3D_pp.toString());
-				
-				System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
-				
-				System.out.println("u_3D_pp_2: " + u_3D_pp_2.toString());
-				System.out.println("v_3D_pp_2: " + v_3D_pp_2.toString());
-				System.out.println("w_3D_pp_2: " + w_3D_pp_2.toString());
-		    }
-		    
-		 	 
-			
-			//apply to unit vector
-			
-		     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-4,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1,0);
-		     Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
-		     lcdd.add(pos);
-		     lcdd.add(rot);
-			
-			
-		     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + basePV.getName());
-		     }
-			
-		     
-		     
-		     
-		     volName = volName + "_sub";
-		     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-		     lcdd.add(boxSub);
-		     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-		     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-		     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-		     lcdd.add(subPos);
-		     lcdd.add(subRot);
-		     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-		     if(_debug) {
-		    	 System.out.println("Created physical vomume " + subBasePV.getName());
-		     }
-			
-		     lcdd.add(volumeSub);
-		     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-		     lcdd.add(volume);
-			
-			
-			
-			
-			}
-		
-		
-		
-
-	private void makeExample8(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-	
-	
-	if(_debug) {
-		System.out.println("--- makeExample8 ----");
-		
-	}
-	
-	String volName = "example8";
-	Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-	lcdd.add(box);
-	Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-    
-	
-	Hep3Vector u = new BasicHep3Vector(1,0,0);
-	Hep3Vector v = new BasicHep3Vector(0,1,0);
-	Hep3Vector w = new BasicHep3Vector(0,0,1);
-
-	org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-	org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-	org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-	
-	Hep3Vector u_L1 = new BasicHep3Vector(1/Math.sqrt(2),0,1/Math.sqrt(2));
-	Hep3Vector v_L1 = new BasicHep3Vector(-1/Math.sqrt(2),0,1/Math.sqrt(2));
-	Hep3Vector w_L1 = new BasicHep3Vector(0,-1,0);
-	
-	Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
-	
-	
+        
+
+            
+
+            */
+
+            Hep3Vector u = new BasicHep3Vector(1,0,0);
+            Hep3Vector v = new BasicHep3Vector(0,1,0);
+            Hep3Vector w = new BasicHep3Vector(0,0,1);
+            
+            Hep3Vector u_L1 = new BasicHep3Vector(0.99955,    0.030000,      0.0000);
+            Hep3Vector v_L1 = new BasicHep3Vector(-0.030000,     0.99955,      0.0000);
+            Hep3Vector w_L1 = new BasicHep3Vector(0.0000,      0.0000,     1.0000);
+            
+            
+            
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u_L1.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v_L1.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_L1 = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w_L1.v());
+
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+            
+            Hep3Vector euler_angles = TransformationUtils.getCardanAngles(v_L1, w_L1, v, w);
+            
+            //Get the generic rotation
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(v_3D_L1,w_3D_L1,v_3D, w_3D);
+            //Get the angles
+            double rotations[] = r.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+            
+            if(_debug) {
+                System.out.println("getEulerAngles gives euler_angles: " + euler_angles.toString());
+                System.out.println("manual          gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+            }
+                  
+            if((rotations[0]-euler_angles.x())>0.00001 || (rotations[1]-euler_angles.y())>0.00001 || (rotations[2]-euler_angles.z())>0.00001) {
+                //throw new RuntimeException("closing the loop in apache rotation didn't work!");
+            }
+            
+               
+            
+            
+             Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*4,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1.5,0);
+             Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+             lcdd.add(pos);
+             lcdd.add(rot);
+            
+            
+             PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + basePV.getName());
+             }
+            
+             
+             
+             volName = volName + "_sub";
+             Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+             lcdd.add(boxSub);
+             Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+             Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+             Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+             lcdd.add(subPos);
+             lcdd.add(subRot);
+             PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + subBasePV.getName());
+             }
+            
+             lcdd.add(volumeSub);
+             volumeSub.setVisAttributes(lcdd.getVisAttributes("HybridVis"));
+
+             lcdd.add(volume);
+            
+            
+            
+            
+            }
+            
+
+        private void makeExample6(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample6 ----");
+            
+        }
+        
+        String volName = "example6";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+        double [] rotations = {-0.5*Math.PI,0,0};
+        
+        
+        if(_debug) {
+    
+            
+            System.out.println("manual set lcdd angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+        }
+        
+         
+        
+        //apply to unit vector
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,0,0);
+         Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
+        
+        
+        
+        private void makeExample66(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+            
+            
+            if(_debug) {
+                System.out.println("--- makeExample66 ----");
+                
+            }
+            
+            String volName = "example66";
+            Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+            lcdd.add(box);
+            Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+             
+
+            Hep3Vector u = new BasicHep3Vector(1,0,0);
+            Hep3Vector v = new BasicHep3Vector(0,1,0);
+            Hep3Vector w = new BasicHep3Vector(0,0,1);
+        
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+            
+            
+            
+            //set up a rotation about the X axis
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -0.5*Math.PI);
+             
+            // find y' and z'
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
+            
+            
+            double [] rotations = r1.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+            
+            
+            if(_debug) {
+                System.out.println("u_3D:       " + u_3D.toString());
+                System.out.println("v_3D:       " + v_3D.toString());
+                System.out.println("w_3D:       " + w_3D.toString());
+                r1.toString();
+                System.out.println("u_3D_p: " + u_3D_p.toString());
+                System.out.println("v_3D_p: " + v_3D_p.toString());
+                System.out.println("w_3D_p: " + w_3D_p.toString());
+                
+                System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+            }
+            
+             
+            
+            //apply to unit vector
+            
+             Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-4,0,0);
+             Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+             lcdd.add(pos);
+             lcdd.add(rot);
+            
+            
+             PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + basePV.getName());
+             }
+            
+             
+             
+             
+             volName = volName + "_sub";
+             Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+             lcdd.add(boxSub);
+             Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+             Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+             Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+             lcdd.add(subPos);
+             lcdd.add(subRot);
+             PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + subBasePV.getName());
+             }
+            
+             lcdd.add(volumeSub);
+             volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+             lcdd.add(volume);
+            
+            
+            
+            
+            }
+        
+        
+        
+        
+        
+
+        private void makeExample7(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample7 ----");
+            
+        }
+        
+        String volName = "example7";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+        double [] rotations = {-0.5*Math.PI,0,-0.25*Math.PI};
+        
+        
+        if(_debug) {
+    
+            
+            System.out.println("manual set lcdd angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+
+        }
+        
+         
+        
+        //apply to unit vector
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1,0);
+         Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
+        
+        
+        
+    private void makeExample77(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+            
+            
+            if(_debug) {
+                System.out.println("--- makeExample77 ----");
+                
+            }
+            
+            String volName = "example77";
+            Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+            lcdd.add(box);
+            Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+             
+
+            Hep3Vector u = new BasicHep3Vector(1,0,0);
+            Hep3Vector v = new BasicHep3Vector(0,1,0);
+            Hep3Vector w = new BasicHep3Vector(0,0,1);
+        
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+            
+            
+            
+            //set up a rotation about the X axis
+            org.apache.commons.math3.geometry.euclidean.threed.Rotation r1 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(u_3D, -0.5*Math.PI);
+             
+            // find y' and z'
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_p = r1.applyTo(u_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_p = r1.applyTo(v_3D);
+            org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_p = r1.applyTo(w_3D);
+            
+            
+          //set up a rotation about the Z xis
+           org.apache.commons.math3.geometry.euclidean.threed.Rotation r3 = new org.apache.commons.math3.geometry.euclidean.threed.Rotation(w_3D_p, -0.25*Math.PI);
+           
+           org.apache.commons.math3.geometry.euclidean.threed.Rotation r13 = r3.applyTo(r1);
+           
+           // find y'' and z''
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp = r13.applyTo(u_3D);
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp = r13.applyTo(v_3D);
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp = r13.applyTo(w_3D);
+            
+           // find y'' and z'' (cross-check)
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D_pp_2 = r3.applyTo(u_3D_p);
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D_pp_2 = r3.applyTo(v_3D_p);
+           org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D_pp_2 = r3.applyTo(w_3D_p);
+            
+            
+            double [] rotations = r13.getAngles(org.apache.commons.math3.geometry.euclidean.threed.RotationOrder.XYZ);
+            
+            
+            if(_debug) {
+                System.out.println("u_3D:       " + u_3D.toString());
+                System.out.println("v_3D:       " + v_3D.toString());
+                System.out.println("w_3D:       " + w_3D.toString());
+                r1.toString();
+                System.out.println("u_3D_p: " + u_3D_p.toString());
+                System.out.println("v_3D_p: " + v_3D_p.toString());
+                System.out.println("w_3D_p: " + w_3D_p.toString());
+                r13.toString();
+                System.out.println("u_3D_pp: " + u_3D_pp.toString());
+                System.out.println("v_3D_pp: " + v_3D_pp.toString());
+                System.out.println("w_3D_pp: " + w_3D_pp.toString());
+                
+                System.out.println("gives euler_angles: (" + rotations[0] + "," + rotations[1] + "," + rotations[2] + ")");
+                
+                System.out.println("u_3D_pp_2: " + u_3D_pp_2.toString());
+                System.out.println("v_3D_pp_2: " + v_3D_pp_2.toString());
+                System.out.println("w_3D_pp_2: " + w_3D_pp_2.toString());
+            }
+            
+             
+            
+            //apply to unit vector
+            
+             Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-4,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-1,0);
+             Rotation rot = new Rotation(volName + "_rotation",rotations[0],rotations[1],rotations[2]);
+             lcdd.add(pos);
+             lcdd.add(rot);
+            
+            
+             PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + basePV.getName());
+             }
+            
+             
+             
+             
+             volName = volName + "_sub";
+             Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+             lcdd.add(boxSub);
+             Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+             Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+             Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+             lcdd.add(subPos);
+             lcdd.add(subRot);
+             PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+             if(_debug) {
+                 System.out.println("Created physical vomume " + subBasePV.getName());
+             }
+            
+             lcdd.add(volumeSub);
+             volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+             lcdd.add(volume);
+            
+            
+            
+            
+            }
+        
+        
+        
+
+    private void makeExample8(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
     
     
     if(_debug) {
-
-		
-		System.out.println("euler angles " + euler_angles.toString());
-
+        System.out.println("--- makeExample8 ----");
+        
     }
     
- 	 
-	
-	//apply to unit vector
-	
+    String volName = "example8";
+    Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+    lcdd.add(box);
+    Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+    
+    
+    Hep3Vector u = new BasicHep3Vector(1,0,0);
+    Hep3Vector v = new BasicHep3Vector(0,1,0);
+    Hep3Vector w = new BasicHep3Vector(0,0,1);
+
+    org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+    org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+    org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+    
+    Hep3Vector u_L1 = new BasicHep3Vector(1/Math.sqrt(2),0,1/Math.sqrt(2));
+    Hep3Vector v_L1 = new BasicHep3Vector(-1/Math.sqrt(2),0,1/Math.sqrt(2));
+    Hep3Vector w_L1 = new BasicHep3Vector(0,-1,0);
+    
+    Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
+    
+    
+    
+    
+    if(_debug) {
+
+        
+        System.out.println("euler angles " + euler_angles.toString());
+
+    }
+    
+     
+    
+    //apply to unit vector
+    
      Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-1,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-3,0);
      Rotation rot = new Rotation(volName + "_rotation",euler_angles.x(),euler_angles.y(),euler_angles.z());
      lcdd.add(pos);
      lcdd.add(rot);
-	
-	
+    
+    
      PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
      if(_debug) {
-    	 System.out.println("Created physical vomume " + basePV.getName());
+         System.out.println("Created physical vomume " + basePV.getName());
      }
-	
+    
      
      
      
@@ -1244,197 +1244,197 @@
      lcdd.add(subRot);
      PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
      if(_debug) {
-    	 System.out.println("Created physical vomume " + subBasePV.getName());
+         System.out.println("Created physical vomume " + subBasePV.getName());
      }
-	
+    
      lcdd.add(volumeSub);
      volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
 
      lcdd.add(volume);
-	
-	
-	
-	
-	}
-	
-		
-		
-	private void makeExample9(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample9 ----");
-			
-		}
-		
-		String volName = "example9";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	    
-		
-		Hep3Vector u = new BasicHep3Vector(1,0,0);
-		Hep3Vector v = new BasicHep3Vector(0,1,0);
-		Hep3Vector w = new BasicHep3Vector(0,0,1);
-
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-		
-		Hep3Vector u_L1 = new BasicHep3Vector(1,0,0);
-		Hep3Vector v_L1 = new BasicHep3Vector(0,0,1);
-		Hep3Vector w_L1 = new BasicHep3Vector(0,-1,0);
-		
-		Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
-		
-		
-	    
-	    
-	    if(_debug) {
-
-			
-			System.out.println("euler angles " + euler_angles.toString());
-
-	    }
-	    
-	 	 
-		
-		//apply to unit vector
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-1,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-2,0);
-	     Rotation rot = new Rotation(volName + "_rotation",euler_angles.x(),euler_angles.y(),euler_angles.z());
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
-		
-			
-	
-	
-	
-	private void makeExample10(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
-		
-		
-		if(_debug) {
-			System.out.println("--- makeExample10 ----");
-			
-		}
-		
-		String volName = "example10";
-		Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
-		lcdd.add(box);
-		Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
-	    
-		
-		Hep3Vector u = new BasicHep3Vector(1,0,0);
-		Hep3Vector v = new BasicHep3Vector(0,1,0);
-		Hep3Vector w = new BasicHep3Vector(0,0,1);
-
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
-		org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
-		
-		Hep3Vector u_L1 = new BasicHep3Vector(1/Math.sqrt(2),1/Math.sqrt(2),0);
-		Hep3Vector v_L1 = new BasicHep3Vector(0,0,1);
-		Hep3Vector w_L1 = new BasicHep3Vector(1/Math.sqrt(2),-1/Math.sqrt(2),0);
-		
-		Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
-		
-		
-	    
-	    
-	    if(_debug) {
-
-			
-			System.out.println("euler angles " + euler_angles.toString());
-
-	    }
-	    
-	 	 
-		
-		//apply to unit vector
-		
-	     Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-2,0);
-	     Rotation rot = new Rotation(volName + "_rotation",euler_angles.x(),euler_angles.y(),euler_angles.z());
-	     lcdd.add(pos);
-	     lcdd.add(rot);
-		
-		
-	     PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + basePV.getName());
-	     }
-		
-	     
-	     
-	     
-	     volName = volName + "_sub";
-	     Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
-	     lcdd.add(boxSub);
-	     Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
-	     Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
-	     Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
-	     lcdd.add(subPos);
-	     lcdd.add(subRot);
-	     PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
-	     if(_debug) {
-	    	 System.out.println("Created physical vomume " + subBasePV.getName());
-	     }
-		
-	     lcdd.add(volumeSub);
-	     volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
-
-	     lcdd.add(volume);
-		
-		
-		
-		
-		}
+    
+    
+    
+    
+    }
+    
+        
+        
+    private void makeExample9(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample9 ----");
+            
+        }
+        
+        String volName = "example9";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+        
+        Hep3Vector u = new BasicHep3Vector(1,0,0);
+        Hep3Vector v = new BasicHep3Vector(0,1,0);
+        Hep3Vector w = new BasicHep3Vector(0,0,1);
+
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+        
+        Hep3Vector u_L1 = new BasicHep3Vector(1,0,0);
+        Hep3Vector v_L1 = new BasicHep3Vector(0,0,1);
+        Hep3Vector w_L1 = new BasicHep3Vector(0,-1,0);
+        
+        Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
+        
+        
+        
+        
+        if(_debug) {
+
+            
+            System.out.println("euler angles " + euler_angles.toString());
+
+        }
+        
+         
+        
+        //apply to unit vector
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-1,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-2,0);
+         Rotation rot = new Rotation(volName + "_rotation",euler_angles.x(),euler_angles.y(),euler_angles.z());
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
+        
+            
+    
+    
+    
+    private void makeExample10(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+        
+        
+        if(_debug) {
+            System.out.println("--- makeExample10 ----");
+            
+        }
+        
+        String volName = "example10";
+        Box box = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/4.0);
+        lcdd.add(box);
+        Volume volume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+        
+        
+        Hep3Vector u = new BasicHep3Vector(1,0,0);
+        Hep3Vector v = new BasicHep3Vector(0,1,0);
+        Hep3Vector w = new BasicHep3Vector(0,0,1);
+
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D u_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(u.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D v_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(v.v());
+        org.apache.commons.math3.geometry.euclidean.threed.Vector3D w_3D = new org.apache.commons.math3.geometry.euclidean.threed.Vector3D(w.v());
+        
+        Hep3Vector u_L1 = new BasicHep3Vector(1/Math.sqrt(2),1/Math.sqrt(2),0);
+        Hep3Vector v_L1 = new BasicHep3Vector(0,0,1);
+        Hep3Vector w_L1 = new BasicHep3Vector(1/Math.sqrt(2),-1/Math.sqrt(2),0);
+        
+        Hep3Vector euler_angles = TransformationUtils.getCardanAngles(u_L1, v_L1, u, v);
+        
+        
+        
+        
+        if(_debug) {
+
+            
+            System.out.println("euler angles " + euler_angles.toString());
+
+        }
+        
+         
+        
+        //apply to unit vector
+        
+         Position pos = new Position(volName + "_position",HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width*1.5*-2,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length*-2,0);
+         Rotation rot = new Rotation(volName + "_rotation",euler_angles.x(),euler_angles.y(),euler_angles.z());
+         lcdd.add(pos);
+         lcdd.add(rot);
+        
+        
+         PhysVol basePV = new PhysVol(volume, lcdd.pickMotherVolume(this), pos, rot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + basePV.getName());
+         }
+        
+         
+         
+         
+         volName = volName + "_sub";
+         Box boxSub = new Box(volName + "Box", HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_width, HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0 , HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/8.0);
+         lcdd.add(boxSub);
+         Volume volumeSub = new Volume(volName + "_volume", boxSub, lcdd.getMaterial("Vacuum"));
+         Position subPos = new Position(volName + "_position",0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/4.0*2-HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_length/8.0,HPSTestRunTracker2014GeometryDefinition.TrackerEnvelope.base_height/16.0);
+         Rotation subRot = new Rotation(volName + "_rotation",0,0,0);
+         lcdd.add(subPos);
+         lcdd.add(subRot);
+         PhysVol subBasePV = new PhysVol(volumeSub, volume, subPos, subRot);
+         if(_debug) {
+             System.out.println("Created physical vomume " + subBasePV.getName());
+         }
+        
+         lcdd.add(volumeSub);
+         volumeSub.setVisAttributes(lcdd.getVisAttributes("SensorVis"));
+
+         lcdd.add(volume);
+        
+        
+        
+        
+        }
 
    
-			
-	
-	
-			
-	
-
-	
-	
-
-	
-	
-	
-	
+            
+    
+    
+            
+    
+
+    
+    
+
+    
+    
+    
+    
 
 }
 

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker.java	Wed Mar  9 11:43:24 2016
@@ -69,7 +69,7 @@
         // layer
         for (Iterator i = node.getChildren("layer").iterator(); i.hasNext();)
         {
-        	// Modules are numbered from 0 starting in each layer.
+            // Modules are numbered from 0 starting in each layer.
             int moduleNumber = 0;
 
             Element layerElement = (Element) i.next();

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2.java	Wed Mar  9 11:43:24 2016
@@ -53,79 +53,79 @@
     }
 
     // Place modules within the tracking volume.
-	private void createModulePlacements(LCDD lcdd, int sysId, String subdetName) throws DataConversionException {
-		//Volume trackingVolume = lcdd.getTrackingVolume();
-		Volume momVolume = lcdd.pickMotherVolume(this);
-		// Loop over layers.
+    private void createModulePlacements(LCDD lcdd, int sysId, String subdetName) throws DataConversionException {
+        //Volume trackingVolume = lcdd.getTrackingVolume();
+        Volume momVolume = lcdd.pickMotherVolume(this);
+        // Loop over layers.
         for (Iterator i = node.getChildren("layer").iterator(); i.hasNext();) {        
-        	Element layerElement = (Element)i.next();
-        	int layerNumber = layerElement.getAttribute("id").getIntValue();
-        	// Loop over modules within layer.
-        	for (Iterator j = layerElement.getChildren("module_placement").iterator(); j.hasNext();) {
-        	    
-        		Element modulePlacementElement = (Element)j.next();
-        		String moduleName = modulePlacementElement.getAttributeValue("name");
-        		int moduleNumber = modulePlacementElement.getAttribute("id").getIntValue();
-        		
-        		// Get the position and rotation parameters.  All must be explicitly specified.
-        		double x, y, z;
-        		double rx, ry, rz;
-        		x = modulePlacementElement.getAttribute("x").getDoubleValue();
-        		y = modulePlacementElement.getAttribute("y").getDoubleValue();
-        		z = modulePlacementElement.getAttribute("z").getDoubleValue();
-        		rx = modulePlacementElement.getAttribute("rx").getDoubleValue();
-        		ry = modulePlacementElement.getAttribute("ry").getDoubleValue();
-        		rz = modulePlacementElement.getAttribute("rz").getDoubleValue();
-        		
-        		// Place the module with position and rotation from above.
-        		String modulePlacementName = subdetName + "_" + moduleName + "_layer" + layerNumber + "_module" + moduleNumber;
-        		Position p = new Position(modulePlacementName + "_position", x, y, z);
-        		Rotation r = new Rotation(modulePlacementName + "_rotation", rx, ry, rz);
-        		lcdd.add(p);
-        		lcdd.add(r);        		        		
-        		//PhysVol modulePhysVol = new PhysVol(modules.get(moduleName), trackingVolume, p, r);
-        		PhysVol modulePhysVol = new PhysVol(modules.get(moduleName), momVolume, p, r);
-        		
-        		// Add identifier values to the placement volume.
-        		modulePhysVol.addPhysVolID("system", sysId);
-        		modulePhysVol.addPhysVolID("barrel", 0);
-        		modulePhysVol.addPhysVolID("layer", layerNumber);
-        		modulePhysVol.addPhysVolID("module", moduleNumber);        		
-        	}
-        }
-	}
+            Element layerElement = (Element)i.next();
+            int layerNumber = layerElement.getAttribute("id").getIntValue();
+            // Loop over modules within layer.
+            for (Iterator j = layerElement.getChildren("module_placement").iterator(); j.hasNext();) {
+                
+                Element modulePlacementElement = (Element)j.next();
+                String moduleName = modulePlacementElement.getAttributeValue("name");
+                int moduleNumber = modulePlacementElement.getAttribute("id").getIntValue();
+                
+                // Get the position and rotation parameters.  All must be explicitly specified.
+                double x, y, z;
+                double rx, ry, rz;
+                x = modulePlacementElement.getAttribute("x").getDoubleValue();
+                y = modulePlacementElement.getAttribute("y").getDoubleValue();
+                z = modulePlacementElement.getAttribute("z").getDoubleValue();
+                rx = modulePlacementElement.getAttribute("rx").getDoubleValue();
+                ry = modulePlacementElement.getAttribute("ry").getDoubleValue();
+                rz = modulePlacementElement.getAttribute("rz").getDoubleValue();
+                
+                // Place the module with position and rotation from above.
+                String modulePlacementName = subdetName + "_" + moduleName + "_layer" + layerNumber + "_module" + moduleNumber;
+                Position p = new Position(modulePlacementName + "_position", x, y, z);
+                Rotation r = new Rotation(modulePlacementName + "_rotation", rx, ry, rz);
+                lcdd.add(p);
+                lcdd.add(r);                                
+                //PhysVol modulePhysVol = new PhysVol(modules.get(moduleName), trackingVolume, p, r);
+                PhysVol modulePhysVol = new PhysVol(modules.get(moduleName), momVolume, p, r);
+                
+                // Add identifier values to the placement volume.
+                modulePhysVol.addPhysVolID("system", sysId);
+                modulePhysVol.addPhysVolID("barrel", 0);
+                modulePhysVol.addPhysVolID("layer", layerNumber);
+                modulePhysVol.addPhysVolID("module", moduleNumber);             
+            }
+        }
+    }
 
     // Create the module logical volumes.
-	private void createModules(LCDD lcdd, SensitiveDetector sd) {
+    private void createModules(LCDD lcdd, SensitiveDetector sd) {
         for (Iterator i = node.getChildren("module").iterator(); i.hasNext();) {
             Element module = (Element) i.next();
             String moduleName = module.getAttributeValue("name");
             moduleParameters.put(moduleName, new ModuleParameters(module));
             modules.put(moduleName, makeModule(moduleParameters.get(moduleName), sd, lcdd));
         }
-	}
-
-	private Volume makeModule(ModuleParameters params, SensitiveDetector sd, LCDD lcdd) {
-		double thickness = params.getThickness();
-		double x, y;
-		// x = params.getDimension(0);
-		// y = params.getDimension(1);
-		y = params.getDimension(0); // Y is in X plane in world coordinates.
-		x = params.getDimension(1); // X is in Y plane in world coordinates.
-		// System.out.println("making module with x = " + x + " and y = " + y);
-		Box box = new Box(params.getName() + "Box", x, y, thickness);
-		lcdd.add(box);
-
-		Volume moduleVolume = new Volume(params.getName() + "Volume", box, vacuum);
-		makeModuleComponents(moduleVolume, params, sd, lcdd);
-		lcdd.add(moduleVolume);
-
-		if (params.getVis() != null) {
-			moduleVolume.setVisAttributes(lcdd.getVisAttributes(params.getVis()));
-		}
-
-		return moduleVolume;
-	}
+    }
+
+    private Volume makeModule(ModuleParameters params, SensitiveDetector sd, LCDD lcdd) {
+        double thickness = params.getThickness();
+        double x, y;
+        // x = params.getDimension(0);
+        // y = params.getDimension(1);
+        y = params.getDimension(0); // Y is in X plane in world coordinates.
+        x = params.getDimension(1); // X is in Y plane in world coordinates.
+        // System.out.println("making module with x = " + x + " and y = " + y);
+        Box box = new Box(params.getName() + "Box", x, y, thickness);
+        lcdd.add(box);
+
+        Volume moduleVolume = new Volume(params.getName() + "Volume", box, vacuum);
+        makeModuleComponents(moduleVolume, params, sd, lcdd);
+        lcdd.add(moduleVolume);
+
+        if (params.getVis() != null) {
+            moduleVolume.setVisAttributes(lcdd.getVisAttributes(params.getVis()));
+        }
+
+        return moduleVolume;
+    }
 
     private void makeModuleComponents(Volume moduleVolume, ModuleParameters moduleParameters, SensitiveDetector sd, LCDD lcdd) {
         Box envelope = (Box) lcdd.getSolid(moduleVolume.getSolidRef());

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014.java	Wed Mar  9 11:43:24 2016
@@ -61,7 +61,7 @@
                 return moduleNumber;
     }
 
-    	
+        
 
 }
 

Modified: java/trunk/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.java	Wed Mar  9 11:43:24 2016
@@ -9,21 +9,21 @@
 
 public class HPSTestRunTracker2014 extends AbstractTracker {
 
-	public HPSTestRunTracker2014(Element node) throws JDOMException 
-	{
-		super(node);
-	}
+    public HPSTestRunTracker2014(Element node) throws JDOMException 
+    {
+        super(node);
+    }
 
-	public void appendHepRep(HepRepFactory factory, HepRep heprep) 
-	{
+    public void appendHepRep(HepRepFactory factory, HepRep heprep) 
+    {
         DetectorElementToHepRepConverter.convert(getDetectorElement(), factory, heprep, -1, false, getVisAttributes().getColor());
-	}
-	
-	public boolean isEndcap() {
-		return false;
-	}
-	
-	public boolean isBarrel() {
-		return true;
-	}
+    }
+    
+    public boolean isEndcap() {
+        return false;
+    }
+    
+    public boolean isBarrel() {
+        return true;
+    }
 }

Modified: java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java	Wed Mar  9 11:43:24 2016
@@ -36,8 +36,8 @@
     private static final int TOTAL_NUMBER_OF_STEREO_LAYERS = 10; 
     private static final String SUBDETECTOR_NAME = "Tracker";
     
-	public static final int NUMBER_OF_READOUT_STRIPS = 639;
-	public static final int NUMBER_OF_SENSE_STRIPS = 1277;
+    public static final int NUMBER_OF_READOUT_STRIPS = 639;
+    public static final int NUMBER_OF_SENSE_STRIPS = 1277;
     
     //-----------------//
     //-----------------//
@@ -74,12 +74,12 @@
         for(HpsSiSensor sensor : sensors) {
             assertTrue("[ " + this.getClass().getSimpleName() + " ]: Sensor is of wrong type: " + sensor.getClass().getSimpleName(),
                         sensor instanceof HpsSiSensor);
-			assertTrue("[ " + this.getClass().getSimpleName() + " ]: Wrong number of readout electrodes found.",
-					sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getNCells() == NUMBER_OF_READOUT_STRIPS);
-			
-			assertTrue("[ " + this.getClass().getSimpleName() + " ]: Wrong number of sense electrodes found.",
-					sensor.getSenseElectrodes(ChargeCarrier.HOLE).getNCells() == NUMBER_OF_SENSE_STRIPS);
-			LOGGER.info(sensor.toString());
+            assertTrue("[ " + this.getClass().getSimpleName() + " ]: Wrong number of readout electrodes found.",
+                    sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getNCells() == NUMBER_OF_READOUT_STRIPS);
+            
+            assertTrue("[ " + this.getClass().getSimpleName() + " ]: Wrong number of sense electrodes found.",
+                    sensor.getSenseElectrodes(ChargeCarrier.HOLE).getNCells() == NUMBER_OF_SENSE_STRIPS);
+            LOGGER.info(sensor.toString());
         }
         LOGGER.info("Sensors were all initialized correctly.");
         

Modified: java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDTest.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDTest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014LCDDTest.java	Wed Mar  9 11:43:24 2016
@@ -18,7 +18,7 @@
 {    
    public HPSTestRunTracker2014LCDDTest(String name)
    {
-   	super(name);
+    super(name);
    }
    
    public static TestSuite suite()

Modified: java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014LCDDTest.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014LCDDTest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014LCDDTest.java	Wed Mar  9 11:43:24 2016
@@ -18,7 +18,7 @@
 {    
    public HPSTracker2014LCDDTest(String name)
    {
-   	super(name);
+    super(name);
    }
    
    public static TestSuite suite()

Modified: java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1LCDDTest.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1LCDDTest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1LCDDTest.java	Wed Mar  9 11:43:24 2016
@@ -18,7 +18,7 @@
 {    
    public HPSTracker2014v1LCDDTest(String name)
    {
-   	super(name);
+    super(name);
    }
    
    public static TestSuite suite()

Modified: java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1SurveyLCDDTest.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1SurveyLCDDTest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/geometry/compact/converter/lcdd/HPSTracker2014v1SurveyLCDDTest.java	Wed Mar  9 11:43:24 2016
@@ -18,7 +18,7 @@
 {    
    public HPSTracker2014v1SurveyLCDDTest(String name)
    {
-   	super(name);
+    super(name);
    }
    
    public static TestSuite suite()

Modified: java/trunk/detector-model/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java	(original)
+++ java/trunk/detector-model/src/test/java/org/lcsim/geometry/subdetector/HPSTestRunTracker2014Test.java	Wed Mar  9 11:43:24 2016
@@ -19,36 +19,36 @@
  */
 public class HPSTestRunTracker2014Test extends TestCase {
 
-	
-	Detector det;
-	public HPSTestRunTracker2014Test(String name) {
-		super(name);
-	}
-	
-	protected void setUp() throws Exception {
-		GeometryReader geometryReader = new GeometryReader();
-		geometryReader.setBuildDetailed(true);
-		String pathToCompactFile = "/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml";
+    
+    Detector det;
+    public HPSTestRunTracker2014Test(String name) {
+        super(name);
+    }
+    
+    protected void setUp() throws Exception {
+        GeometryReader geometryReader = new GeometryReader();
+        geometryReader.setBuildDetailed(true);
+        String pathToCompactFile = "/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml";
 
-		InputStream in = HPSTestRunTracker2014Test.class.getResourceAsStream(pathToCompactFile);
-		det = geometryReader.read(in);
-		
-		System.out.printf("%s: detector name converted: %s\n",this.getClass().getSimpleName(), det.getName());
-		
-		
-	}
-	
-	public void test() {
-		
-		
-//	    IDetectorElementStore store =  DetectorElementStore.getInstance();
-//	    System.out.printf("%s: Printing %d DE:\n",this.getClass().getSimpleName(), store.size());
-//	    System.out.printf("%s: %50s %40s %50s %50s\n",this.getClass().getSimpleName(), "name", "pos", "path","mother");
-//	    for(IDetectorElement e : store) {
-//	        System.out.printf("%s: %50s %40s %50s %50s \n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.hasGeometryInfo()?((PhysicalVolumePath)e.getGeometry().getPath()).toString():" - ",e.getParent()==null?" - ":e.getParent().getName());
-//	    }
-		
-		IDetectorElementStore store =  DetectorElementStore.getInstance();
+        InputStream in = HPSTestRunTracker2014Test.class.getResourceAsStream(pathToCompactFile);
+        det = geometryReader.read(in);
+        
+        System.out.printf("%s: detector name converted: %s\n",this.getClass().getSimpleName(), det.getName());
+        
+        
+    }
+    
+    public void test() {
+        
+        
+//      IDetectorElementStore store =  DetectorElementStore.getInstance();
+//      System.out.printf("%s: Printing %d DE:\n",this.getClass().getSimpleName(), store.size());
+//      System.out.printf("%s: %50s %40s %50s %50s\n",this.getClass().getSimpleName(), "name", "pos", "path","mother");
+//      for(IDetectorElement e : store) {
+//          System.out.printf("%s: %50s %40s %50s %50s \n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.hasGeometryInfo()?((PhysicalVolumePath)e.getGeometry().getPath()).toString():" - ",e.getParent()==null?" - ":e.getParent().getName());
+//      }
+        
+        IDetectorElementStore store =  DetectorElementStore.getInstance();
         System.out.printf("%s: Printing %d DE:\n",this.getClass().getSimpleName(), store.size());
         System.out.printf("%s: %50s %40s %50s %50s %s\n",this.getClass().getSimpleName(), "name", "pos", "path","mother", "expId");
         for(IDetectorElement e : store) {
@@ -58,8 +58,8 @@
                 expId = e.getExpandedIdentifier();
             System.out.printf("%s: %50s %40s %50s %50s %s\n",this.getClass().getSimpleName(), e.getName(),e.hasGeometryInfo()?e.getGeometry().getPosition().toString():" - ",e.hasGeometryInfo()?((PhysicalVolumePath)e.getGeometry().getPath()).toString():" - ",e.getParent()==null?" - ":e.getParent().getName(),expId==null?" no expId ":expId.toString());
         }
-		
-	}
+        
+    }
    
 
 }

Modified: java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTest.xml
 =============================================================================
--- java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTest.xml	(original)
+++ java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTest.xml	Wed Mar  9 11:43:24 2016
@@ -50,7 +50,7 @@
 <!--
         <constant name="tracking_region_radius" value="200.0*cm"/>
         <constant name="tracking_region_min" value="5.0*cm"/>
-        <constant name="tracking_region_zmax" value="100.0*cm"/>	
+        <constant name="tracking_region_zmax" value="100.0*cm"/>    
 
         <constant name="xCent1" value="10*cm" />
         <constant name="xCent2" value="20*cm" />

Modified: java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml
 =============================================================================
--- java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	(original)
+++ java/trunk/detector-model/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	Wed Mar  9 11:43:24 2016
@@ -7,9 +7,9 @@
   </info>
   
   <define>
-	<!-- units -->
-	<constant name="mm" value="0.1*cm"/>
-	<constant name="inch" value="25.4*mm"/>
+    <!-- units -->
+    <constant name="mm" value="0.1*cm"/>
+    <constant name="inch" value="25.4*mm"/>
 
     <!-- world -->
     <constant name="world_side" value="500.0*cm" />
@@ -17,8 +17,8 @@
     <constant name="world_y" value="world_side" />
     <constant name="world_z" value="world_side" />
   
- 	 <!-- tracking region -->
- 	<constant name="tracking_region_radius" value="200.0*cm"/>
+     <!-- tracking region -->
+    <constant name="tracking_region_radius" value="200.0*cm"/>
     <constant name="tracking_region_min" value="5.0*cm"/>
     <constant name="tracking_region_zmax" value="131.8*cm"/>
  
@@ -34,7 +34,7 @@
   </materials>
   
   <display>
-	
+    
     <vis name="SensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="true"/>
     <vis name="ActiveSensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="true" visible="true"/>
     <vis name="CarbonFiberVis" alpha="1.0" r="0.88" g="0.88" b="0.88" drawingStyle="solid" lineStyle="unbroken" showDaughters="true" visible="true"/>
@@ -48,7 +48,7 @@
     <vis name="BasePlateVis" alpha="1.0" r="0.35" g="0.35" b="0.35" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/>
     <vis name="LayerVis" alpha="0.0" r="0.0" g="0.0" b="1.0" drawingStyle="wireframe" showDaughters="true" visible="false"/>
     <vis name="ComponentVis" alpha="0.0" r="0.0" g="0.2" b="0.4" drawingStyle="solid" showDaughters="false" visible="false"/>
-	<vis name="BeamPlaneVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="false" visible="true"/>
+    <vis name="BeamPlaneVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" lineStyle="unbroken" showDaughters="false" visible="true"/>
     
   </display>
   

Modified: java/trunk/distribution/src/main/java/org/hps/HPSJavaProperties.java
 =============================================================================
--- java/trunk/distribution/src/main/java/org/hps/HPSJavaProperties.java	(original)
+++ java/trunk/distribution/src/main/java/org/hps/HPSJavaProperties.java	Wed Mar  9 11:43:24 2016
@@ -82,6 +82,11 @@
         return this.properties.getProperty("timestamp");
     }
 
+    /**
+     * Convert this object to a string.
+     *
+     * @return this object converted to a string
+     */
     @Override
     public String toString() {
         final StringBuffer sb = new StringBuffer();

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Association.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Association.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Association.java	Wed Mar  9 11:43:24 2016
@@ -10,52 +10,52 @@
  * @author Kyle McCarty
  */
 public final class Association {
-	private final Point parent;
-	private final Point child;
-	private final Color highlight;
-	
-	/**
-	 * <b>Association</b><br/><br/>
-	 * <code>public <b>Association</b>(Point parentCrystal, Point childCrystal, Color highlightColor)</code><br/><br/>
-	 * Creates an association between a child crystal and a parent
-	 * crystal.
-	 * @param parentCrystal - The crystal with which the child crystal
-	 * is connected.
-	 * @param childCrystal - The connected crystal.
-	 * @param highlightColor - The color in which the child crystal
-	 * should be highlighted.
-	 */
-	public Association(Point parentCrystal, Point childCrystal, Color highlightColor) {
-		parent = parentCrystal;
-		child = childCrystal;
-		highlight = highlightColor;
-	}
-	
-	/**
-	 * <b>getChildCrystal</b><br/><br/>
-	 * <code>public Point <b>getChildCrystal</b>()</code><br/><br/>
-	 * Indicates the indices for the child crystal.
-	 * @return Returns the child crystal's indices in a <code>Point
-	 * </code> object.
-	 */
-	public Point getChildCrystal() { return child; }
-	
-	/**
-	 * <b>getHighlight</b><br/><br/>
-	 * <code>public Color <b>getHighlight</b>()</code><br/><br/>
-	 * Gets the color with which the child crystal should be highlighted
-	 * whenever the parent crystal is selected.
-	 * @return Returns the highlight color as a <code>Color</code> object.
-	 */
-	public Color getHighlight() { return highlight; }
-	
-	/**
-	 * <b>getParentCrystal</b><br/><br/>
-	 * <code>public Point <b>getParentCrystal</b>()</code><br/><br/>
-	 * Indicates the indices for the parent crystal with which the
-	 * child crystal is connected.
-	 * @return Returns the parent crystal's indices in a <code>Point
-	 * </code> object.
-	 */
-	public Point getParentCrystal() { return parent; }
+    private final Point parent;
+    private final Point child;
+    private final Color highlight;
+    
+    /**
+     * <b>Association</b><br/><br/>
+     * <code>public <b>Association</b>(Point parentCrystal, Point childCrystal, Color highlightColor)</code><br/><br/>
+     * Creates an association between a child crystal and a parent
+     * crystal.
+     * @param parentCrystal - The crystal with which the child crystal
+     * is connected.
+     * @param childCrystal - The connected crystal.
+     * @param highlightColor - The color in which the child crystal
+     * should be highlighted.
+     */
+    public Association(Point parentCrystal, Point childCrystal, Color highlightColor) {
+        parent = parentCrystal;
+        child = childCrystal;
+        highlight = highlightColor;
+    }
+    
+    /**
+     * <b>getChildCrystal</b><br/><br/>
+     * <code>public Point <b>getChildCrystal</b>()</code><br/><br/>
+     * Indicates the indices for the child crystal.
+     * @return Returns the child crystal's indices in a <code>Point
+     * </code> object.
+     */
+    public Point getChildCrystal() { return child; }
+    
+    /**
+     * <b>getHighlight</b><br/><br/>
+     * <code>public Color <b>getHighlight</b>()</code><br/><br/>
+     * Gets the color with which the child crystal should be highlighted
+     * whenever the parent crystal is selected.
+     * @return Returns the highlight color as a <code>Color</code> object.
+     */
+    public Color getHighlight() { return highlight; }
+    
+    /**
+     * <b>getParentCrystal</b><br/><br/>
+     * <code>public Point <b>getParentCrystal</b>()</code><br/><br/>
+     * Indicates the indices for the parent crystal with which the
+     * child crystal is connected.
+     * @return Returns the parent crystal's indices in a <code>Point
+     * </code> object.
+     */
+    public Point getParentCrystal() { return parent; }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Cluster.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Cluster.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Cluster.java	Wed Mar  9 11:43:24 2016
@@ -11,161 +11,161 @@
  * @author Kyle McCarty
  */
 public final class Cluster {
-	private final Point center;
-	private final double energy;
-	private final double time;
-	private ArrayList<Point> hitList = new ArrayList<Point>();
-	private ArrayList<Point> shareList = new ArrayList<Point>();
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a
-	 * cluster center.
-	 * @param ix - The cluster center's x-index.
-	 * @param iy - The cluster center's y-index.
-	 */
-	public Cluster(int ix, int iy) { this(new Point(ix, iy), Double.NaN, Double.NaN); }
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a seed
-	 * hit.
-	 * @param clusterCenter - The <code>Point</code> object indicating in
-	 * which crystal the seed hit occurred.
-	 */
-	public Cluster(Point clusterCenter) { this(clusterCenter, Double.NaN, Double.NaN); }
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a
-	 * cluster center.
-	 * @param ix - The cluster center's x-index.
-	 * @param iy - The cluster center's y-index.
-	 * @param energy - The cluster's energy.
-	 */
-	public Cluster(int ix, int iy, double energy) { this(new Point(ix, iy), energy, Double.NaN); }
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a
-	 * cluster center.
-	 * @param ix - The cluster center's x-index.
-	 * @param iy - The cluster center's y-index.
-	 * @param energy - The cluster's energy.
-	 * @param time - The cluster's time-stamp.
-	 */
-	public Cluster(int ix, int iy, double energy, double time) { this(new Point(ix, iy), energy, time); }
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a seed
-	 * hit.
-	 * @param clusterCenter - The <code>Point</code> object indicating in
-	 * which crystal the seed hit occurred.
-	 * @param energy - The cluster's energy.
-	 */
-	public Cluster(Point clusterCenter, double energy) {
-		this(clusterCenter, energy, Double.NaN);
-	}
-	
-	/**
-	 * Creates a new cluster. All clusters are required to have a seed
-	 * hit.
-	 * @param clusterCenter - The <code>Point</code> object indicating in
-	 * which crystal the seed hit occurred.
-	 * @param energy - The cluster's energy.
-	 * @param time - The cluster's time-stamp.
-	 */
-	public Cluster(Point clusterCenter, double energy, double time) {
-		center = clusterCenter;
-		this.energy = energy;
-		this.time = time;
-	}
-	
-	/**
-	 * Adds an <code>Point</code> to the list of this cluster's
-	 * component hits.
-	 * @param ix - The component hit's x-coordinate.
-	 * @param iy - The component hit's y-coordinate.
-	 */
-	public void addComponentHit(int ix, int iy) { hitList.add(new Point(ix, iy)); }
-	
-	/**
-	 * Adds an <code>Point</code> to the list of this cluster's
-	 * component hits.
-	 * @param eHit - The <code>Point</code> object indicating in which
-	 * crystal the hit occurred.
-	 */
-	public void addComponentHit(Point eHit) { hitList.add(eHit); }
-	
-	/**
-	 * Adds an <code>Point</code> to the list of this cluster's shared
-	 * hits.
-	 * @param ix - The shared hit's x-coordinate.
-	 * @param iy - The shared hit's y-coordinate.
-	 */
-	public void addSharedHit(int ix, int iy) { shareList.add(new Point(ix, iy)); }
-	
-	/**
-	 * Adds an <code>Point</code> to the list of this cluster's shared
-	 * hits.
-	 * @param eHit - The <code>Point</code> object indicating in which
-	 * crystal the hit occurred.
-	 */
-	public void addSharedHit(Point eHit) { shareList.add(eHit); }
-	
-	/**
-	 * Gets the hit representing the cluster center.
-	 * @return Returns the cluster center hit as an <code>Point</code>.
-	 */
-	public Point getClusterCenter() { return center; }
-	
-	/**
-	 * Gets the cluster's energy, if it was defined when the cluster
-	 * was constructed.
-	 * @return Returns the energy of the cluster if it was defined,
-	 * and <code>NaN</code> otherwise.
-	 */
-	public double getClusterEnergy() { return energy; }
-	
-	/**
-	 * Gets the time stamp for the cluster in nanoseconds.
-	 * @return Returns the cluster's time stamp.
-	 */
-	public double getClusterTime() { return time; }
-	
-	/**
-	 * Indicates how many component hits compose this cluster. Note
-	 * that this does not include the seed hit or shared hits.
-	 * @return Returns the number of component hits in the cluster
-	 * as an <code>int</code>.
-	 */
-	public int getComponentHitCount() { return hitList.size(); }
-	
-	/**
-	 * Gets the list of hits that make up the cluster, exempting the
-	 * seed hit and shared hits.
-	 * @return Returns the cluster hits as a <code>List</code> object
-	 * composed of <code>Point</code> objects.
-	 */
-	public List<Point> getComponentHits() { return hitList; }
-	
-	/**
-	 * Indicates how many total hits compose this cluster. This includes
-	 * component hits, shared hits, and the seed hit.
-	 * @return Returns the number of component hits in the cluster
-	 * as an <code>int</code>.
-	 */
-	public int getHitCount() { return hitList.size() + shareList.size() + 1; }
-	
-	/**
-	 * Indicates how many shared hits compose this cluster. Note that
-	 * this does not include the seed hit or component hits.
-	 * @return Returns the number of shared hits in the cluster as an
-	 * <code>int</code>.
-	 */
-	public int getSharedHitCount() { return shareList.size(); }
-	
-	/**
-	 * Gets the list of hits that make up the cluster, exempting the
-	 * seed hit and component hits.
-	 * @return Returns the shared hits as a <code>List</code> object
-	 * composed of <code>Point</code> objects.
-	 */
-	public List<Point> getSharedHits() { return shareList; }
+    private final Point center;
+    private final double energy;
+    private final double time;
+    private ArrayList<Point> hitList = new ArrayList<Point>();
+    private ArrayList<Point> shareList = new ArrayList<Point>();
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a
+     * cluster center.
+     * @param ix - The cluster center's x-index.
+     * @param iy - The cluster center's y-index.
+     */
+    public Cluster(int ix, int iy) { this(new Point(ix, iy), Double.NaN, Double.NaN); }
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a seed
+     * hit.
+     * @param clusterCenter - The <code>Point</code> object indicating in
+     * which crystal the seed hit occurred.
+     */
+    public Cluster(Point clusterCenter) { this(clusterCenter, Double.NaN, Double.NaN); }
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a
+     * cluster center.
+     * @param ix - The cluster center's x-index.
+     * @param iy - The cluster center's y-index.
+     * @param energy - The cluster's energy.
+     */
+    public Cluster(int ix, int iy, double energy) { this(new Point(ix, iy), energy, Double.NaN); }
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a
+     * cluster center.
+     * @param ix - The cluster center's x-index.
+     * @param iy - The cluster center's y-index.
+     * @param energy - The cluster's energy.
+     * @param time - The cluster's time-stamp.
+     */
+    public Cluster(int ix, int iy, double energy, double time) { this(new Point(ix, iy), energy, time); }
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a seed
+     * hit.
+     * @param clusterCenter - The <code>Point</code> object indicating in
+     * which crystal the seed hit occurred.
+     * @param energy - The cluster's energy.
+     */
+    public Cluster(Point clusterCenter, double energy) {
+        this(clusterCenter, energy, Double.NaN);
+    }
+    
+    /**
+     * Creates a new cluster. All clusters are required to have a seed
+     * hit.
+     * @param clusterCenter - The <code>Point</code> object indicating in
+     * which crystal the seed hit occurred.
+     * @param energy - The cluster's energy.
+     * @param time - The cluster's time-stamp.
+     */
+    public Cluster(Point clusterCenter, double energy, double time) {
+        center = clusterCenter;
+        this.energy = energy;
+        this.time = time;
+    }
+    
+    /**
+     * Adds an <code>Point</code> to the list of this cluster's
+     * component hits.
+     * @param ix - The component hit's x-coordinate.
+     * @param iy - The component hit's y-coordinate.
+     */
+    public void addComponentHit(int ix, int iy) { hitList.add(new Point(ix, iy)); }
+    
+    /**
+     * Adds an <code>Point</code> to the list of this cluster's
+     * component hits.
+     * @param eHit - The <code>Point</code> object indicating in which
+     * crystal the hit occurred.
+     */
+    public void addComponentHit(Point eHit) { hitList.add(eHit); }
+    
+    /**
+     * Adds an <code>Point</code> to the list of this cluster's shared
+     * hits.
+     * @param ix - The shared hit's x-coordinate.
+     * @param iy - The shared hit's y-coordinate.
+     */
+    public void addSharedHit(int ix, int iy) { shareList.add(new Point(ix, iy)); }
+    
+    /**
+     * Adds an <code>Point</code> to the list of this cluster's shared
+     * hits.
+     * @param eHit - The <code>Point</code> object indicating in which
+     * crystal the hit occurred.
+     */
+    public void addSharedHit(Point eHit) { shareList.add(eHit); }
+    
+    /**
+     * Gets the hit representing the cluster center.
+     * @return Returns the cluster center hit as an <code>Point</code>.
+     */
+    public Point getClusterCenter() { return center; }
+    
+    /**
+     * Gets the cluster's energy, if it was defined when the cluster
+     * was constructed.
+     * @return Returns the energy of the cluster if it was defined,
+     * and <code>NaN</code> otherwise.
+     */
+    public double getClusterEnergy() { return energy; }
+    
+    /**
+     * Gets the time stamp for the cluster in nanoseconds.
+     * @return Returns the cluster's time stamp.
+     */
+    public double getClusterTime() { return time; }
+    
+    /**
+     * Indicates how many component hits compose this cluster. Note
+     * that this does not include the seed hit or shared hits.
+     * @return Returns the number of component hits in the cluster
+     * as an <code>int</code>.
+     */
+    public int getComponentHitCount() { return hitList.size(); }
+    
+    /**
+     * Gets the list of hits that make up the cluster, exempting the
+     * seed hit and shared hits.
+     * @return Returns the cluster hits as a <code>List</code> object
+     * composed of <code>Point</code> objects.
+     */
+    public List<Point> getComponentHits() { return hitList; }
+    
+    /**
+     * Indicates how many total hits compose this cluster. This includes
+     * component hits, shared hits, and the seed hit.
+     * @return Returns the number of component hits in the cluster
+     * as an <code>int</code>.
+     */
+    public int getHitCount() { return hitList.size() + shareList.size() + 1; }
+    
+    /**
+     * Indicates how many shared hits compose this cluster. Note that
+     * this does not include the seed hit or component hits.
+     * @return Returns the number of shared hits in the cluster as an
+     * <code>int</code>.
+     */
+    public int getSharedHitCount() { return shareList.size(); }
+    
+    /**
+     * Gets the list of hits that make up the cluster, exempting the
+     * seed hit and component hits.
+     * @return Returns the shared hits as a <code>List</code> object
+     * composed of <code>Point</code> objects.
+     */
+    public List<Point> getSharedHits() { return shareList; }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/EcalHit.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/EcalHit.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/EcalHit.java	Wed Mar  9 11:43:24 2016
@@ -23,7 +23,7 @@
      * @param energy - The raw energy of the hit.
      **/
     public EcalHit(int ix, int iy, double energy) {
-    	this(new Point(ix, iy), energy);
+        this(new Point(ix, iy), energy);
     }
     
     /**
@@ -32,7 +32,7 @@
      * @param energy - The raw energy of the hit.
      **/
     public EcalHit(Point ixy, double energy) {
-    	loc = ixy;
+        loc = ixy;
         this.energy = energy;
     }
     
@@ -44,7 +44,7 @@
      * @param time - The time-stamp for the hit.
      **/
     public EcalHit(int ix, int iy, double energy, double time) {
-    	this(new Point(ix, iy), energy, time);
+        this(new Point(ix, iy), energy, time);
     }
     
     /**
@@ -54,7 +54,7 @@
      * @param time - The time-stamp for the hit.
      **/
     public EcalHit(Point ixy, double energy, double time) {
-    	loc = ixy;
+        loc = ixy;
         this.energy = energy;
         this.time = time;
     }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Event.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Event.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/event/Event.java	Wed Mar  9 11:43:24 2016
@@ -10,119 +10,119 @@
  * @author Kyle McCarty
  */
 public final class Event {
-	private List<EcalHit> hitList;
-	private List<Point> clusterList;
-	private List<Association> connectList;
-	
-	/**
-	 * <b>Event</b><br/><br/>
-	 * <code>public <b>Event</b>()</code><br/><br/>
-	 * Creates a new <code>Event</code>.
-	 */
-	public Event() { this(10, 10, 10); }
-	
-	/**
-	 * <b>Event</b><br/><br/>
-	 * <code>public <b>Event</b>(int hits, int clusters)</code><br/><br/>
-	 * Creates a new <code>Event</code> and reserves spaces for the
-	 * given number of hits and cluster centers.
-	 * @param hits - The number of hits for which to reserve space.
-	 * @param clusters - The number of cluster centers for which to
-	 * reserve space.
-	 */
-	public Event(int hits, int clusters) { this(hits, clusters, 10); }
-	
-	/**
-	 * <b>Event</b><br/><br/>
-	 * <code>public <b>Event</b>(int hits, int clusters, int associations)</code><br/><br/>
-	 * Creates a new <code>Event</code> and reserves spaces for the
-	 * given number of hits, cluster centers, and crystal associations.
-	 * @param hits - The number of hits for which to reserve space.
-	 * @param clusters - The number of cluster centers for which to
-	 * reserve space.
-	 * @param associations - The number of crystal associations for
-	 * which to reserve space.
-	 */
-	public Event(int hits, int clusters, int associations) {
-		hitList = new ArrayList<EcalHit>(hits);
-		clusterList = new ArrayList<Point>(clusters);
-		connectList = new ArrayList<Association>(associations);
-	}
-	
-	/**
-	 * <b>Event</b><br/><br/>
-	 * <code>public <b>Event</b>(List<EcalHit> hits, List<Point> clusters, List<Association> associations)</code><br/><br/>
-	 * Creates a new <code>Event</code> and sets its contents to those
-	 * of the given lists. The crystal association list will be empty.
-	 * @param hits - The list of calorimeter hits.
-	 * @param clusters - The list of cluster centers.
-	 */
-	public Event(List<EcalHit> hits, List<Point> clusters) {
-		this(hits, clusters, new ArrayList<Association>());
-	}
-	
-	/**
-	 * <b>Event</b><br/><br/>
-	 * <code>public <b>Event</b>(List<EcalHit> hits, List<Point> clusters, List<Association> associations)</code><br/><br/>
-	 * Creates a new <code>Event</code> and sets its contents to those
-	 * of the given lists.
-	 * @param hits - The list of calorimeter hits.
-	 * @param clusters - The list of cluster centers.
-	 * @param associations - The list of crystal associations.
-	 */
-	public Event(List<EcalHit> hits, List<Point> clusters, List<Association> associations) {
-		hitList = hits;
-		clusterList = clusters;
-		connectList = associations;
-	}
-	
-	/**
-	 * <b>addAssociation</b><br/><br/>
-	 * <code>public void <b>addAssociation</b>(Association connectedCrystal)</code><br/><br/>
-	 * Adds a crystal association to the event.
-	 * @param connectedCrystal - The crystal association to add.
-	 */
-	public void addAssociation(Association connectedCrystal) {
-		connectList.add(connectedCrystal);
-	}
-	
-	/**
-	 * <b>addCluster</b><br/><br/>
-	 * <code>public void <b>addCluster</b>(Point cluster)</code><br/><br/>
-	 * Adds a cluster center to the event.
-	 * @param cluster - The cluster center to add.
-	 */
-	public void addCluster(Point cluster) { clusterList.add(cluster); }
-	
-	/**
-	 * <b>addHit</b><br/><br/>
-	 * <code>public void <b>addHit</b>(EcalHit hit)</code><br/><br/>
-	 * Adds a calorimeter hit to the event.
-	 * @param hit - The calorimeter hit to add.
-	 */
-	public void addHit(EcalHit hit) { hitList.add(hit); }
-	
-	/**
-	 * <b>getAssociations</b><br/><br/>
-	 * <code>public List<Association> <b>getAssociations</b>()</code><br/><br/>
-	 * Gets the list of associated crystals for this event.
-	 * @return Returns the associations in a <code>List</code>.
-	 */
-	public List<Association> getAssociations() { return connectList; }
-	
-	/**
-	 * <b>getClusterCenters</b><br/><br/>
-	 * <code>List<Cluster><b>getClusterCenters</b>()</code><br/><br/>
-	 * Gets the list of cluster centers for this event.
-	 * @return Returns the cluster centers in a <code>List</code>.
-	 */
-	public List<Point> getClusterCenters() { return clusterList; }
-	
-	/**
-	 * <b>getHits</b><br/><br/>
-	 * <code>public List<EcalHit> <b>getHits</b>()</code><br/><br/>
-	 * Gets the list of calorimeter hits for this event.
-	 * @return Returns the hits in a <code>List</code>.
-	 */
-	public List<EcalHit> getHits() { return hitList; }
+    private List<EcalHit> hitList;
+    private List<Point> clusterList;
+    private List<Association> connectList;
+    
+    /**
+     * <b>Event</b><br/><br/>
+     * <code>public <b>Event</b>()</code><br/><br/>
+     * Creates a new <code>Event</code>.
+     */
+    public Event() { this(10, 10, 10); }
+    
+    /**
+     * <b>Event</b><br/><br/>
+     * <code>public <b>Event</b>(int hits, int clusters)</code><br/><br/>
+     * Creates a new <code>Event</code> and reserves spaces for the
+     * given number of hits and cluster centers.
+     * @param hits - The number of hits for which to reserve space.
+     * @param clusters - The number of cluster centers for which to
+     * reserve space.
+     */
+    public Event(int hits, int clusters) { this(hits, clusters, 10); }
+    
+    /**
+     * <b>Event</b><br/><br/>
+     * <code>public <b>Event</b>(int hits, int clusters, int associations)</code><br/><br/>
+     * Creates a new <code>Event</code> and reserves spaces for the
+     * given number of hits, cluster centers, and crystal associations.
+     * @param hits - The number of hits for which to reserve space.
+     * @param clusters - The number of cluster centers for which to
+     * reserve space.
+     * @param associations - The number of crystal associations for
+     * which to reserve space.
+     */
+    public Event(int hits, int clusters, int associations) {
+        hitList = new ArrayList<EcalHit>(hits);
+        clusterList = new ArrayList<Point>(clusters);
+        connectList = new ArrayList<Association>(associations);
+    }
+    
+    /**
+     * <b>Event</b><br/><br/>
+     * <code>public <b>Event</b>(List<EcalHit> hits, List<Point> clusters, List<Association> associations)</code><br/><br/>
+     * Creates a new <code>Event</code> and sets its contents to those
+     * of the given lists. The crystal association list will be empty.
+     * @param hits - The list of calorimeter hits.
+     * @param clusters - The list of cluster centers.
+     */
+    public Event(List<EcalHit> hits, List<Point> clusters) {
+        this(hits, clusters, new ArrayList<Association>());
+    }
+    
+    /**
+     * <b>Event</b><br/><br/>
+     * <code>public <b>Event</b>(List<EcalHit> hits, List<Point> clusters, List<Association> associations)</code><br/><br/>
+     * Creates a new <code>Event</code> and sets its contents to those
+     * of the given lists.
+     * @param hits - The list of calorimeter hits.
+     * @param clusters - The list of cluster centers.
+     * @param associations - The list of crystal associations.
+     */
+    public Event(List<EcalHit> hits, List<Point> clusters, List<Association> associations) {
+        hitList = hits;
+        clusterList = clusters;
+        connectList = associations;
+    }
+    
+    /**
+     * <b>addAssociation</b><br/><br/>
+     * <code>public void <b>addAssociation</b>(Association connectedCrystal)</code><br/><br/>
+     * Adds a crystal association to the event.
+     * @param connectedCrystal - The crystal association to add.
+     */
+    public void addAssociation(Association connectedCrystal) {
+        connectList.add(connectedCrystal);
+    }
+    
+    /**
+     * <b>addCluster</b><br/><br/>
+     * <code>public void <b>addCluster</b>(Point cluster)</code><br/><br/>
+     * Adds a cluster center to the event.
+     * @param cluster - The cluster center to add.
+     */
+    public void addCluster(Point cluster) { clusterList.add(cluster); }
+    
+    /**
+     * <b>addHit</b><br/><br/>
+     * <code>public void <b>addHit</b>(EcalHit hit)</code><br/><br/>
+     * Adds a calorimeter hit to the event.
+     * @param hit - The calorimeter hit to add.
+     */
+    public void addHit(EcalHit hit) { hitList.add(hit); }
+    
+    /**
+     * <b>getAssociations</b><br/><br/>
+     * <code>public List<Association> <b>getAssociations</b>()</code><br/><br/>
+     * Gets the list of associated crystals for this event.
+     * @return Returns the associations in a <code>List</code>.
+     */
+    public List<Association> getAssociations() { return connectList; }
+    
+    /**
+     * <b>getClusterCenters</b><br/><br/>
+     * <code>List<Cluster><b>getClusterCenters</b>()</code><br/><br/>
+     * Gets the list of cluster centers for this event.
+     * @return Returns the cluster centers in a <code>List</code>.
+     */
+    public List<Point> getClusterCenters() { return clusterList; }
+    
+    /**
+     * <b>getHits</b><br/><br/>
+     * <code>public List<EcalHit> <b>getHits</b>()</code><br/><br/>
+     * Gets the list of calorimeter hits for this event.
+     * @return Returns the hits in a <code>List</code>.
+     */
+    public List<EcalHit> getHits() { return hitList; }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/EventManager.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/EventManager.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/EventManager.java	Wed Mar  9 11:43:24 2016
@@ -21,16 +21,16 @@
      * may be read.
      * @throws IOException Occurs if there is an error closing the file stream.
      **/
-	public void close() throws IOException;
-	
-	/**
-	 * <b>getEventNumber</b><br/><br/>
+    public void close() throws IOException;
+    
+    /**
+     * <b>getEventNumber</b><br/><br/>
      * <code>public int <b>getEventNumber</b>()</code><br/><br/>
      * Gets the ordinal number for the currently displayed event.
-	 * @return Returns the current event's ordinal number.
-	 */
-	public int getEventNumber();
-	
+     * @return Returns the current event's ordinal number.
+     */
+    public int getEventNumber();
+    
     /**
      * <b>getClusters</b><br/><br/>
      * <code>public ArrayList<Cluster> <b>getClusters</b>()</code><br/><br/>
@@ -38,17 +38,17 @@
      * @return Returns the current clusters as an <code>ArrayList
      * </code> object.
      **/
-	public List<Cluster> getClusters();
-	
-	/**
+    public List<Cluster> getClusters();
+    
+    /**
      * <b>getHits</b><br/><br/>
      * <code>public ArrayList<EcalHit> <b>getHits</b>()</code><br/><br/>
      * Allows access to the current event's list of hits.
      * @return Returns the current hits as an <code>ArrayList</code> object.
      **/
-	public List<EcalHit> getHits();
-	
-	/**
+    public List<EcalHit> getHits();
+    
+    /**
      * <b>nextEvent</b><br/><br/>
      * <code>public boolean <b>nextEvent</b>()</code><br/><br/>
      * Populates the event manager with hits and clusters from the next event.
@@ -56,8 +56,8 @@
      * </code> if it was not.
      * @throws IOException Occurs if there was a file read error.
      **/
-	public boolean nextEvent() throws IOException;
-	
+    public boolean nextEvent() throws IOException;
+    
     /**
      * <b>previousEvent</b><br/><br/>
      * <code>public boolean <b>previousEvent</b>()</code><br/><br/>
@@ -66,5 +66,5 @@
      * </code> if it was not.
      * @throws IOException Occurs if there was a file read error.
      **/
-	public boolean previousEvent() throws IOException;
+    public boolean previousEvent() throws IOException;
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/EventDisplayOutputDriver.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/EventDisplayOutputDriver.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/EventDisplayOutputDriver.java	Wed Mar  9 11:43:24 2016
@@ -97,30 +97,30 @@
                 
                 // Only write clusters if the option is selected.
                 if(outputClusters) {
-	                // Process the clusters.
-	                for (org.lcsim.event.Cluster cluster : clusters) {
-	                    // Get the seed hit for the cluster.
-	                    CalorimeterHit seedHit = (CalorimeterHit)cluster.getCalorimeterHits().get(0);
-	                    int ix = seedHit.getIdentifierFieldValue("ix");
-	                    int iy = seedHit.getIdentifierFieldValue("iy");
-	                    double time = seedHit.getTime();
-	                    
-	                    // Get the cluster's total energy.
-	                    double energy = cluster.getEnergy();
-	                    
-	                    // Write the seed hit to start a cluster.
-	                    writer.append(String.format("Cluster\t%d\t%d\t%f\t%f%n", ix, iy, energy, time));
-	                    
-	                    // Write the component hits to the cluster.
-	                    for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
-	                        // Get each component hit's x/y coordinates.
-	                        ix = hit.getIdentifierFieldValue("ix");
-	                        iy = hit.getIdentifierFieldValue("iy");
-	                        
-	                        // Write them as component hits.
-	                        writer.append(String.format("CompHit\t%d\t%d%n", ix, iy));
-	                    }
-	                }
+                    // Process the clusters.
+                    for (org.lcsim.event.Cluster cluster : clusters) {
+                        // Get the seed hit for the cluster.
+                        CalorimeterHit seedHit = (CalorimeterHit)cluster.getCalorimeterHits().get(0);
+                        int ix = seedHit.getIdentifierFieldValue("ix");
+                        int iy = seedHit.getIdentifierFieldValue("iy");
+                        double time = seedHit.getTime();
+                        
+                        // Get the cluster's total energy.
+                        double energy = cluster.getEnergy();
+                        
+                        // Write the seed hit to start a cluster.
+                        writer.append(String.format("Cluster\t%d\t%d\t%f\t%f%n", ix, iy, energy, time));
+                        
+                        // Write the component hits to the cluster.
+                        for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+                            // Get each component hit's x/y coordinates.
+                            ix = hit.getIdentifierFieldValue("ix");
+                            iy = hit.getIdentifierFieldValue("iy");
+                            
+                            // Write them as component hits.
+                            writer.append(String.format("CompHit\t%d\t%d%n", ix, iy));
+                        }
+                    }
                 }
                 
                 // Append the end of event indicator.
@@ -169,7 +169,7 @@
      * indicates that they will be output.
      */
     public void setIgnoreEmptyEvents(boolean ignoreEmptyEvents) {
-    	this.ignoreEmptyEvents = ignoreEmptyEvents;
+        this.ignoreEmptyEvents = ignoreEmptyEvents;
     }
     
     /**
@@ -179,7 +179,7 @@
      * indicates that they will be output.
      */
     public void setIgnoreNoClusterEvents(boolean ignoreNoClusterEvents) {
-    	this.ignoreNoClusterEvents = ignoreNoClusterEvents;
+        this.ignoreNoClusterEvents = ignoreNoClusterEvents;
     }
     
     /**
@@ -196,6 +196,6 @@
      * will be written and <code>false</code> that they will not.
      */
     public void setOutputClusters(boolean outputClusters) {
-    	this.outputClusters = outputClusters;
+        this.outputClusters = outputClusters;
     }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/LCIOBridgeDriver.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/LCIOBridgeDriver.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/lcsim/LCIOBridgeDriver.java	Wed Mar  9 11:43:24 2016
@@ -39,9 +39,9 @@
      * @param event - The LCIO event.
      */
     public void process(EventHeader event) {
-    	// If we are still updating the display, skip this event.
-    	if(updating) { return; }
-    	
+        // If we are still updating the display, skip this event.
+        if(updating) { return; }
+        
         // Make sure that this event has calorimeter hits.
         if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
             // Get the list of calorimeter hits from the event.
@@ -55,44 +55,44 @@
             
             // If this is the correct place to update, do so.
             if(eventsProcessed >= displayInterval) {
-            	// Lock the update method for the duration of the update.
-            	updating = true;
-            	
-            	// Clear the event display.
-            	eventDisplay.resetDisplay();
-            	
-            	// Add all of the hits.
-            	for(CalorimeterHit hit : hits) {
-            		// Get the hit's location and energy.
-            		int ix = hit.getIdentifierFieldValue("ix");
-            		int iy = hit.getIdentifierFieldValue("iy");
-            		double energy = hit.getRawEnergy();
-            		
-            		// Add the hit energy to the event display.
-            		eventDisplay.addHit(new EcalHit(ix, iy, energy));
-            	}
-            	
-            	// Add all the clusters.
-            	for(org.lcsim.event.Cluster cluster : clusters) {
-            		// Get the seed hit.
-            		CalorimeterHit seed = cluster.getCalorimeterHits().get(0);
-            		int ix = seed.getIdentifierFieldValue("ix");
-            		int iy = seed.getIdentifierFieldValue("iy");
-            		double energy = seed.getRawEnergy(); // FIXME: Should this be getCorrectedEnergy() instead? --JM
-            		
-            		// Add the cluster center to the event display.
-            		Cluster cc = new Cluster(ix, iy, energy);
-            		eventDisplay.addCluster(cc);
-            	}
-            	
-            	// Update the display.
-            	eventDisplay.updateDisplay();
-            	
-            	// Reset the number of events we've seen since the last update.
-            	eventsProcessed = 0;
-            	
-            	// Unlock the update method so that more events can be processed.
-            	updating = false;
+                // Lock the update method for the duration of the update.
+                updating = true;
+                
+                // Clear the event display.
+                eventDisplay.resetDisplay();
+                
+                // Add all of the hits.
+                for(CalorimeterHit hit : hits) {
+                    // Get the hit's location and energy.
+                    int ix = hit.getIdentifierFieldValue("ix");
+                    int iy = hit.getIdentifierFieldValue("iy");
+                    double energy = hit.getRawEnergy();
+                    
+                    // Add the hit energy to the event display.
+                    eventDisplay.addHit(new EcalHit(ix, iy, energy));
+                }
+                
+                // Add all the clusters.
+                for(org.lcsim.event.Cluster cluster : clusters) {
+                    // Get the seed hit.
+                    CalorimeterHit seed = cluster.getCalorimeterHits().get(0);
+                    int ix = seed.getIdentifierFieldValue("ix");
+                    int iy = seed.getIdentifierFieldValue("iy");
+                    double energy = seed.getRawEnergy(); // FIXME: Should this be getCorrectedEnergy() instead? --JM
+                    
+                    // Add the cluster center to the event display.
+                    Cluster cc = new Cluster(ix, iy, energy);
+                    eventDisplay.addCluster(cc);
+                }
+                
+                // Update the display.
+                eventDisplay.updateDisplay();
+                
+                // Reset the number of events we've seen since the last update.
+                eventsProcessed = 0;
+                
+                // Unlock the update method so that more events can be processed.
+                updating = false;
             }
         }
     }
@@ -119,14 +119,14 @@
      * a new event is displayed.
      */
     public void setDisplayInterval(String displayInterval) {
-    	// Convert the argument to an integer.
-    	int disp = Integer.parseInt(displayInterval);
-    	
-    	// If it is negative, make it zero.
-    	if(disp < 0) { disp = 0; }
-    	
-    	// Set the display interval.
-    	this.displayInterval = disp;
+        // Convert the argument to an integer.
+        int disp = Integer.parseInt(displayInterval);
+        
+        // If it is negative, make it zero.
+        if(disp < 0) { disp = 0; }
+        
+        // Set the display interval.
+        this.displayInterval = disp;
     }
     
     /**

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java	Wed Mar  9 11:43:24 2016
@@ -97,9 +97,9 @@
         filterPanel.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-            	// Suppress panel redrawing until the highlights are set.
-            	ecalPanel.setSuppressRedraw(true);
-            	
+                // Suppress panel redrawing until the highlights are set.
+                ecalPanel.setSuppressRedraw(true);
+                
                 // Clear the panel highlighting.
                 ecalPanel.clearHighlight();
                 

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java	Wed Mar  9 11:43:24 2016
@@ -178,9 +178,9 @@
             // be displayed.
             Double hitTime = crystalTimeMap.get(crystal);
             if(hitTime != null) {
-            	setStatusField(fieldNames[HIT_TIME], Double.toString(hitTime));
+                setStatusField(fieldNames[HIT_TIME], Double.toString(hitTime));
             } else {
-            	setStatusField(fieldNames[HIT_TIME], ResizableFieldPanel.NULL_VALUE);
+                setStatusField(fieldNames[HIT_TIME], ResizableFieldPanel.NULL_VALUE);
             }
         }
         // Otherwise, clear the field values.
@@ -257,7 +257,7 @@
         // Load hit time map.
         crystalTimeMap.clear();
         for(EcalHit hit : em.getHits()) {
-        	crystalTimeMap.put(new Point(toPanelX(hit.getX()), toPanelY(hit.getY())), hit.getTime());
+            crystalTimeMap.put(new Point(toPanelX(hit.getX()), toPanelY(hit.getY())), hit.getTime());
         }
         
         // Display it.

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PDataEventViewer.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PDataEventViewer.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PDataEventViewer.java	Wed Mar  9 11:43:24 2016
@@ -98,9 +98,9 @@
         filterPanel.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-            	// Suppress panel redrawing until the highlights are set.
-            	ecalPanel.setSuppressRedraw(true);
-            	
+                // Suppress panel redrawing until the highlights are set.
+                ecalPanel.setSuppressRedraw(true);
+                
                 // Clear the panel highlighting.
                 ecalPanel.clearHighlight();
                 

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/Viewer.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/Viewer.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/Viewer.java	Wed Mar  9 11:43:24 2016
@@ -638,7 +638,7 @@
         
         JFileChooser chooser = new JFileChooser();
         if(chooser.showSaveDialog(this) == JFileChooser.CANCEL_OPTION) {
-        	return;
+            return;
         }
         
         // Parse the file name and make sure that it ends in .PNG.
@@ -646,9 +646,9 @@
         int index = filepath.lastIndexOf('.');
         if(index == -1) { filepath = filepath + ".png"; }
         else {
-        	if(filepath.substring(index + 1).compareTo("png") != 0) {
-        		filepath = filepath.substring(0, index) + ".png";
-        	}
+            if(filepath.substring(index + 1).compareTo("png") != 0) {
+                filepath = filepath.substring(0, index) + ".png";
+            }
         }
         
         // Get the lowest available file name.

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/BooleanMap.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/BooleanMap.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/BooleanMap.java	Wed Mar  9 11:43:24 2016
@@ -10,208 +10,208 @@
  * @author Kyle McCarty
  */
 public final class BooleanMap implements ColorMap<Double> {
-	// The color to display for values which pass the boolean check.
-	private Color activeColor = new Color(255, 50, 50);
-	// The color to display for values that fail the boolean check.
-	private Color inactiveColor = Color.WHITE;
-	// The critical value against which the boolean check is performed.
-	private double value = 0.0;
-	// The type of this boolean scale.
-	private final BooleanType boolType;
-	
-	/**
-	 * <b>BooleanMap</b><br/><br/>
-	 * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue)</code><br/><br/>
-	 * Defines a <code>ColorScale</code> which maps values to colors
-	 * based on a boolean comparison.
-	 * @param type - The type of boolean comparison to perform.
-	 * @param comparisonValue - The value against which the comparison
-	 * should be made.
-	 */
-	public BooleanMap(BooleanType type, double comparisonValue) {
-		// Make sure the comparison type is not null.
-		if(type == null) { throw new IllegalArgumentException("Boolean comparison type can not be null."); }
-		
-		// Define the critical value and the boolean type.
-		value = comparisonValue;
-		boolType = type;
-	}
-	
-	/**
-	 * <b>BooleanMap</b><br/><br/>
-	 * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue,
-	 * 			Color activeColor)</code><br/><br/>
-	 * Defines a <code>ColorScale</code> which maps values to colors
-	 * based on a boolean comparison.
-	 * @param type - The type of boolean comparison to perform.
-	 * @param comparisonValue - The value against which the comparison
-	 * should be made.
-	 * @param activeColor - The color in which values that pass the
-	 * comparison should be displayed.
-	 */
-	public BooleanMap(BooleanType type, double comparisonValue, Color activeColor) {
-		// Set the critical value and the boolean type.
-		this(type, comparisonValue);
-		
-		// Set the active color.
-		this.activeColor = activeColor;
-	}
-	
-	/**
-	 * <b>BooleanMap</b><br/><br/>
-	 * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue,
-	 * 			Color activeColor, Color inactiveColor)</code><br/><br/>
-	 * Defines a <code>ColorScale</code> which maps values to colors
-	 * based on a boolean comparison.
-	 * @param type - The type of boolean comparison to perform.
-	 * @param comparisonValue - The value against which the comparison
-	 * should be made.
-	 * @param activeColor - The color in which values that pass the
-	 * comparison should be displayed.
-	 * @param inactiveColor - The color in which values that fail the
-	 * comparison should be displayed.
-	 */
-	public BooleanMap(BooleanType type, double comparisonValue, Color activeColor, Color inactiveColor) {
-		// Set the critical value and the boolean type.
-		this(type, comparisonValue);
-		
-		// Set the active and inactive colors.
-		this.activeColor = activeColor;
-		this.inactiveColor = inactiveColor;
-	}
-	
-	public Color getColor(Double value) {
-		// If the argument is null, treat it is zero.
-		if(value == null) { value = 0.0; }
-		
-		// If it passes the boolean comparison, return the active color.
-		if(passes(value)) { return activeColor; }
-		
-		// Otherwise, return the inactive color.
-		else { return inactiveColor; }
-	}
-	
-	/**
-	 * <b>getActiveColor</b><br/><br/>
-	 * <code>public Color <b>getActiveColor</b>()</code><br/><br/>
-	 * Gets the color used by the scale for values which pass the
-	 * boolean comparison.
-	 * @return Returns the color as a <code>Color</code> object.
-	 */
-	public Color getActiveColor() { return activeColor; }
-	
-	/**
-	 * <b>getBooleanType</b><br/><br/>
-	 * <code>public BooleanType <b>getBooleanType</b>()</code><br/><br/>
-	 * Indicates what type of boolean comparison is performed by this
-	 * scale.
-	 * @return Returns the type of comparison as a <code>BooleanType
-	 * </code> enumerable.
-	 */
-	public BooleanType getBooleanType() { return boolType; }
-	
-	/**
-	 * <b>getComparisonValue</b><br/><br/>
-	 * <code>public double <b>getComparisonValue</b>()</code><br/><br/>
-	 * Gets the value against which the boolean comparisons are
-	 * performed.
-	 * @return Returns the value which is compared against.
-	 */
-	public double getComparisonValue() { return value; }
-	
-	/**
-	 * <b>getInactiveColor</b><br/><br/>
-	 * <code>public Color <b>getInactiveColor</b>()</code><br/><br/>
-	 * Gets the color used by the scale for values which fail the
-	 * boolean comparison.
-	 * @return Returns the color as a <code>Color</code> object.
-	 */
-	public Color getInactiveColor() { return inactiveColor; }
-	
-	/**
-	 * <b>setComparisonValue</b><br/><br/>
-	 * <code>public void <b>setComparisonValue</b>(double value)</code><br/><br/>
-	 * Sets the value against which the boolean comparison is performed.
-	 * @param value - The value to compare against.
-	 */
-	public void setComparisonValue(double value) { this.value = value; }
-	
-	/**
-	 * <b>passes</b><br/><br/>
-	 * <code>private boolean <b>passes</b>(double d)</code><br/><br/>
-	 * Determines whether a given external value passes the boolean
-	 * check or not.
-	 * @param d - The external value to compare.
-	 * @return Returns <code>true</code> if the value passes the boolean
-	 * check and <code>false</code> if it does not.
-	 */
-	private boolean passes(double d) {
-		// Perform the appropriate comparison. Note that the default
-		// case is included to satisfy the compiler -- it should not
-		// ever actually be used.
-		switch(boolType) {
-			case EQUAL_TO:
-				return d == value;
-			case NOT_EQUAL_TO:
-				return d != value;
-			case GREATER_THAN:
-				return d > value;
-			case LESS_THAN:
-				return d < value;
-			case GREATER_THAN_OR_EQUAL_TO:
-				return d >= value;
-			case LESS_THAN_OR_EQUAL_TO:
-				return d<= value;
-			default:
-				return false;
-		}
-	}
-	
-	/**
-	 * Enumerable <code>BooleanType</code> defines the type of boolean
-	 * comparison that is to be performed by the scale.
-	 */
-	public enum BooleanType {
-		/**
-		 * <b>EQUAL_TO</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] == [Comparison Value]</code>
-		 */
-		EQUAL_TO,
-		
-		/**
-		 * <b>NOT_EQUAL_TO</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] != [Comparison Value]</code>
-		 */
-		NOT_EQUAL_TO,
-		
-		/**
-		 * <b>GREATER_THAN</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] > [Comparison Value]</code>
-		 */
-		GREATER_THAN,
-		
-		/**
-		 * <b>LESS_THAN</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] < [Comparison Value]</code>
-		 */
-		LESS_THAN,
-		
-		/**
-		 * <b>GREATER_THAN_OR_EQUAL_TO</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] >= [Comparison Value]</code>
-		 */
-		GREATER_THAN_OR_EQUAL_TO,
-		
-		/**
-		 * <b>LESS_THAN_OR_EQUAL_TO</b><br/><br/>
-		 * Performs the boolean check:<br/><br/>
-		 * <code>[External Value] <= [Comparison Value]</code>
-		 */
-		LESS_THAN_OR_EQUAL_TO
-	};
+    // The color to display for values which pass the boolean check.
+    private Color activeColor = new Color(255, 50, 50);
+    // The color to display for values that fail the boolean check.
+    private Color inactiveColor = Color.WHITE;
+    // The critical value against which the boolean check is performed.
+    private double value = 0.0;
+    // The type of this boolean scale.
+    private final BooleanType boolType;
+    
+    /**
+     * <b>BooleanMap</b><br/><br/>
+     * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue)</code><br/><br/>
+     * Defines a <code>ColorScale</code> which maps values to colors
+     * based on a boolean comparison.
+     * @param type - The type of boolean comparison to perform.
+     * @param comparisonValue - The value against which the comparison
+     * should be made.
+     */
+    public BooleanMap(BooleanType type, double comparisonValue) {
+        // Make sure the comparison type is not null.
+        if(type == null) { throw new IllegalArgumentException("Boolean comparison type can not be null."); }
+        
+        // Define the critical value and the boolean type.
+        value = comparisonValue;
+        boolType = type;
+    }
+    
+    /**
+     * <b>BooleanMap</b><br/><br/>
+     * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue,
+     *          Color activeColor)</code><br/><br/>
+     * Defines a <code>ColorScale</code> which maps values to colors
+     * based on a boolean comparison.
+     * @param type - The type of boolean comparison to perform.
+     * @param comparisonValue - The value against which the comparison
+     * should be made.
+     * @param activeColor - The color in which values that pass the
+     * comparison should be displayed.
+     */
+    public BooleanMap(BooleanType type, double comparisonValue, Color activeColor) {
+        // Set the critical value and the boolean type.
+        this(type, comparisonValue);
+        
+        // Set the active color.
+        this.activeColor = activeColor;
+    }
+    
+    /**
+     * <b>BooleanMap</b><br/><br/>
+     * <code>public <b>BooleanMap</b>(BooleanType type, double comparisonValue,
+     *          Color activeColor, Color inactiveColor)</code><br/><br/>
+     * Defines a <code>ColorScale</code> which maps values to colors
+     * based on a boolean comparison.
+     * @param type - The type of boolean comparison to perform.
+     * @param comparisonValue - The value against which the comparison
+     * should be made.
+     * @param activeColor - The color in which values that pass the
+     * comparison should be displayed.
+     * @param inactiveColor - The color in which values that fail the
+     * comparison should be displayed.
+     */
+    public BooleanMap(BooleanType type, double comparisonValue, Color activeColor, Color inactiveColor) {
+        // Set the critical value and the boolean type.
+        this(type, comparisonValue);
+        
+        // Set the active and inactive colors.
+        this.activeColor = activeColor;
+        this.inactiveColor = inactiveColor;
+    }
+    
+    public Color getColor(Double value) {
+        // If the argument is null, treat it is zero.
+        if(value == null) { value = 0.0; }
+        
+        // If it passes the boolean comparison, return the active color.
+        if(passes(value)) { return activeColor; }
+        
+        // Otherwise, return the inactive color.
+        else { return inactiveColor; }
+    }
+    
+    /**
+     * <b>getActiveColor</b><br/><br/>
+     * <code>public Color <b>getActiveColor</b>()</code><br/><br/>
+     * Gets the color used by the scale for values which pass the
+     * boolean comparison.
+     * @return Returns the color as a <code>Color</code> object.
+     */
+    public Color getActiveColor() { return activeColor; }
+    
+    /**
+     * <b>getBooleanType</b><br/><br/>
+     * <code>public BooleanType <b>getBooleanType</b>()</code><br/><br/>
+     * Indicates what type of boolean comparison is performed by this
+     * scale.
+     * @return Returns the type of comparison as a <code>BooleanType
+     * </code> enumerable.
+     */
+    public BooleanType getBooleanType() { return boolType; }
+    
+    /**
+     * <b>getComparisonValue</b><br/><br/>
+     * <code>public double <b>getComparisonValue</b>()</code><br/><br/>
+     * Gets the value against which the boolean comparisons are
+     * performed.
+     * @return Returns the value which is compared against.
+     */
+    public double getComparisonValue() { return value; }
+    
+    /**
+     * <b>getInactiveColor</b><br/><br/>
+     * <code>public Color <b>getInactiveColor</b>()</code><br/><br/>
+     * Gets the color used by the scale for values which fail the
+     * boolean comparison.
+     * @return Returns the color as a <code>Color</code> object.
+     */
+    public Color getInactiveColor() { return inactiveColor; }
+    
+    /**
+     * <b>setComparisonValue</b><br/><br/>
+     * <code>public void <b>setComparisonValue</b>(double value)</code><br/><br/>
+     * Sets the value against which the boolean comparison is performed.
+     * @param value - The value to compare against.
+     */
+    public void setComparisonValue(double value) { this.value = value; }
+    
+    /**
+     * <b>passes</b><br/><br/>
+     * <code>private boolean <b>passes</b>(double d)</code><br/><br/>
+     * Determines whether a given external value passes the boolean
+     * check or not.
+     * @param d - The external value to compare.
+     * @return Returns <code>true</code> if the value passes the boolean
+     * check and <code>false</code> if it does not.
+     */
+    private boolean passes(double d) {
+        // Perform the appropriate comparison. Note that the default
+        // case is included to satisfy the compiler -- it should not
+        // ever actually be used.
+        switch(boolType) {
+            case EQUAL_TO:
+                return d == value;
+            case NOT_EQUAL_TO:
+                return d != value;
+            case GREATER_THAN:
+                return d > value;
+            case LESS_THAN:
+                return d < value;
+            case GREATER_THAN_OR_EQUAL_TO:
+                return d >= value;
+            case LESS_THAN_OR_EQUAL_TO:
+                return d<= value;
+            default:
+                return false;
+        }
+    }
+    
+    /**
+     * Enumerable <code>BooleanType</code> defines the type of boolean
+     * comparison that is to be performed by the scale.
+     */
+    public enum BooleanType {
+        /**
+         * <b>EQUAL_TO</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] == [Comparison Value]</code>
+         */
+        EQUAL_TO,
+        
+        /**
+         * <b>NOT_EQUAL_TO</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] != [Comparison Value]</code>
+         */
+        NOT_EQUAL_TO,
+        
+        /**
+         * <b>GREATER_THAN</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] > [Comparison Value]</code>
+         */
+        GREATER_THAN,
+        
+        /**
+         * <b>LESS_THAN</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] < [Comparison Value]</code>
+         */
+        LESS_THAN,
+        
+        /**
+         * <b>GREATER_THAN_OR_EQUAL_TO</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] >= [Comparison Value]</code>
+         */
+        GREATER_THAN_OR_EQUAL_TO,
+        
+        /**
+         * <b>LESS_THAN_OR_EQUAL_TO</b><br/><br/>
+         * Performs the boolean check:<br/><br/>
+         * <code>[External Value] <= [Comparison Value]</code>
+         */
+        LESS_THAN_OR_EQUAL_TO
+    };
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/ColorScale.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/ColorScale.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/ColorScale.java	Wed Mar  9 11:43:24 2016
@@ -47,8 +47,8 @@
      * value, if scaling is logarithmic.
      */
     public double getScaledMaximum() {
-    	if(linear) { return max; }
-    	else { return lMax; }
+        if(linear) { return max; }
+        else { return lMax; }
     }
     
     /**
@@ -61,8 +61,8 @@
      * value, if scaling is logarithmic.
      */
     public double getScaledMinimum() {
-    	if(linear) { return min; }
-    	else { return lMin; }
+        if(linear) { return min; }
+        else { return lMin; }
     }
     
     /**

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalEvent.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalEvent.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalEvent.java	Wed Mar  9 11:43:24 2016
@@ -14,41 +14,41 @@
  * @author Kyle McCarty
  */
 public class CrystalEvent extends AWTEvent {
-	private static final long serialVersionUID = 77198267255387212L;
-	// Stores the location of the triggering crystal.
-	private final Point crystal;
-	// The AWTEvent id for this event.
-	private static final int AWT_ID = AWTEvent.RESERVED_ID_MAX + 10;
-	
-	/**
-	 * <b>CrystalEvent</b><br/><br/>
-	 * <code>public <b>CrystalEvent</b>(Viewer parent, Point triggerCrystal)</code><br/><br/>
-	 * Creates a crystal event for the indicated crystal and triggering
-	 * component.
-	 * @param source - The triggering component.
-	 * @param triggerCrystal - The crystal associated with the event.
-	 * @throws IllegalArgumentException Occurs if the associated crystal
-	 * is <code>null</code>.
-	 */
-	public CrystalEvent(Viewer source, Point triggerCrystal) throws IllegalArgumentException {
-		// Run the superclass constructor.
-		super(source, AWT_ID);
-		
-		// Make sure that the trigger crystal is not null.
-		if(triggerCrystal == null) {
-			throw new IllegalArgumentException("Crystal events can not occur with respect to non-exstant crystals.");
-		}
-		
-		// Define the event parameters.
-		crystal = triggerCrystal;
-	}
-	
-	/**
-	 * <b>getCrystalID</b><br/><br/>
-	 * <code>public Point <b>getCrystalID</b>()</code><br/><br/>
-	 * Indicates the panel indices at which the crystal is located.
-	 * @return Returns the crystal's panel indices as a <code>Point
-	 * </code> object.
-	 */
-	public Point getCrystalID() { return crystal; }
+    private static final long serialVersionUID = 77198267255387212L;
+    // Stores the location of the triggering crystal.
+    private final Point crystal;
+    // The AWTEvent id for this event.
+    private static final int AWT_ID = AWTEvent.RESERVED_ID_MAX + 10;
+    
+    /**
+     * <b>CrystalEvent</b><br/><br/>
+     * <code>public <b>CrystalEvent</b>(Viewer parent, Point triggerCrystal)</code><br/><br/>
+     * Creates a crystal event for the indicated crystal and triggering
+     * component.
+     * @param source - The triggering component.
+     * @param triggerCrystal - The crystal associated with the event.
+     * @throws IllegalArgumentException Occurs if the associated crystal
+     * is <code>null</code>.
+     */
+    public CrystalEvent(Viewer source, Point triggerCrystal) throws IllegalArgumentException {
+        // Run the superclass constructor.
+        super(source, AWT_ID);
+        
+        // Make sure that the trigger crystal is not null.
+        if(triggerCrystal == null) {
+            throw new IllegalArgumentException("Crystal events can not occur with respect to non-exstant crystals.");
+        }
+        
+        // Define the event parameters.
+        crystal = triggerCrystal;
+    }
+    
+    /**
+     * <b>getCrystalID</b><br/><br/>
+     * <code>public Point <b>getCrystalID</b>()</code><br/><br/>
+     * Indicates the panel indices at which the crystal is located.
+     * @return Returns the crystal's panel indices as a <code>Point
+     * </code> object.
+     */
+    public Point getCrystalID() { return crystal; }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalListener.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalListener.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/CrystalListener.java	Wed Mar  9 11:43:24 2016
@@ -11,27 +11,27 @@
  * @author Kyle McCarty
  */
 public interface CrystalListener extends EventListener {
-	/**
-	 * <b>crystalActivated</b><br/><br/>
-	 * <code>public void <b>crystalActivated</b>(CrystalEvent e)</code><br/><br/>
-	 * Invoked when a crystal becomes highlighted.
-	 * @param e - An object describing the event.
-	 */
-	public void crystalActivated(CrystalEvent e);
-	
-	/**
-	 * <b>crystalDeactivated</b><br/><br/>
-	 * <code>public void <b>crystalDeactivated</b>(CrystalEvent e)</code><br/><br/>
-	 * Invoked when a crystal ceases to be highlighted.
-	 * @param e - An object describing the event.
-	 */
-	public void crystalDeactivated(CrystalEvent e);
-	
-	/**
-	 * <b>crystalClicked</b><br/><br/>
-	 * <code>public void <b>crystalClicked</b>(CrystalEvent e)</code><br/><br/>
-	 * Invoked when a crystal is clicked
-	 * @param e - An object describing the event.
-	 */
-	public void crystalClicked(CrystalEvent e);
+    /**
+     * <b>crystalActivated</b><br/><br/>
+     * <code>public void <b>crystalActivated</b>(CrystalEvent e)</code><br/><br/>
+     * Invoked when a crystal becomes highlighted.
+     * @param e - An object describing the event.
+     */
+    public void crystalActivated(CrystalEvent e);
+    
+    /**
+     * <b>crystalDeactivated</b><br/><br/>
+     * <code>public void <b>crystalDeactivated</b>(CrystalEvent e)</code><br/><br/>
+     * Invoked when a crystal ceases to be highlighted.
+     * @param e - An object describing the event.
+     */
+    public void crystalDeactivated(CrystalEvent e);
+    
+    /**
+     * <b>crystalClicked</b><br/><br/>
+     * <code>public void <b>crystalClicked</b>(CrystalEvent e)</code><br/><br/>
+     * Invoked when a crystal is clicked
+     * @param e - An object describing the event.
+     */
+    public void crystalClicked(CrystalEvent e);
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/DatabaseCheck.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/DatabaseCheck.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/DatabaseCheck.java	Wed Mar  9 11:43:24 2016
@@ -17,122 +17,122 @@
 import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
 
 public class DatabaseCheck {
-	private static final Set<Integer> idFailSet = new HashSet<Integer>();
-	private static final Set<Point> pointFailSet = new HashSet<Point>();
-	
-	public static void main(String[] args) throws ConditionsNotFoundException, IOException {
-		// Check that an appropriate file has been given.
-		String filepath = null;
-		if(args.length == 1) {
-			filepath = args[0];
-		}
-		
-		// If no file path was defined, throw an error.
-		if(filepath == null) {
-			throw new FileNotFoundException("No CSV mapping file defined.");
-		}
-		
-		// Initialize the local database.
-		EcalWiringManager manager = new EcalWiringManager(filepath);
-		
-		// Initialize the database.
-		int runNumber = 2000;
-		String detectorName = "HPS-Proposal2014-v7-2pt2";
-		DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-		conditionsManager.setDetector(detectorName, runNumber);
-		
-		// Get ECAL conditions.
-		EcalConditions ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions(); 
-		
-		// Get the list of EcalChannel objects.
-		EcalChannelCollection channels = ecalConditions.getChannelCollection();
-		EcalLedCollection leds = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
-		
-		// Map the LED objects to their channels.
-		Map<Integer, EcalLed> ledMap = new HashMap<Integer, EcalLed>();
+    private static final Set<Integer> idFailSet = new HashSet<Integer>();
+    private static final Set<Point> pointFailSet = new HashSet<Point>();
+    
+    public static void main(String[] args) throws ConditionsNotFoundException, IOException {
+        // Check that an appropriate file has been given.
+        String filepath = null;
+        if(args.length == 1) {
+            filepath = args[0];
+        }
+        
+        // If no file path was defined, throw an error.
+        if(filepath == null) {
+            throw new FileNotFoundException("No CSV mapping file defined.");
+        }
+        
+        // Initialize the local database.
+        EcalWiringManager manager = new EcalWiringManager(filepath);
+        
+        // Initialize the database.
+        int runNumber = 2000;
+        String detectorName = "HPS-Proposal2014-v7-2pt2";
+        DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+        conditionsManager.setDetector(detectorName, runNumber);
+        
+        // Get ECAL conditions.
+        EcalConditions ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions(); 
+        
+        // Get the list of EcalChannel objects.
+        EcalChannelCollection channels = ecalConditions.getChannelCollection();
+        EcalLedCollection leds = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
+        
+        // Map the LED objects to their channels.
+        Map<Integer, EcalLed> ledMap = new HashMap<Integer, EcalLed>();
         for (EcalLed led : leds) {
-        	ledMap.put(led.getEcalChannelId(), led);
+            ledMap.put(led.getEcalChannelId(), led);
         }
-		
-		// Perform the comparison test.
-		for(EcalChannel channel : channels) {
-			// Get the crystal point information.
-			Point crystal = new Point(channel.getX(), channel.getY());
-			
-			// Get the data from manager.
-			CrystalDataSet data = manager.getCrystalData(crystal);
-			
-			// Get the appropriate LED collection.
-			EcalLed led = ledMap.get(channel.getChannelId());
-			
-			// Perform the comparison.
-			System.out.printf("Checking Mappings for Crystal (%3d, %3d):%n", crystal.x, crystal.y);
-			System.out.printf("\tChannel ID      :: %d%n", channel.getChannelId());
-			
-			System.out.printf("\tChannel     [ %3d ] vs [ %3d ] ... ", channel.getChannel(), data.getFADCChannel());
-			if(channel.getChannel() == data.getFADCChannel()) {
-				System.out.printf("[ Success ]%n");
-			} else {
-				System.out.printf("[ Failure ]%n");
-				idFailSet.add(channel.getChannelId());
-				pointFailSet.add(crystal);
-			}
-			
-			int crate = data.getMotherboard().isTop() ? 1 : 2;
-			System.out.printf("\tCrate       [ %3d ] vs [ %3d ] ... ", channel.getCrate(), crate);
-			if(channel.getCrate() == crate) {
-				System.out.printf("[ Success ]%n");
-			} else {
-				System.out.printf("[ Failure ]%n");
-				idFailSet.add(channel.getChannelId());
-				pointFailSet.add(crystal);
-			}
-			
-			System.out.printf("\tSlot        [ %3d ] vs [ %3d ] ... ", channel.getSlot(), data.getFADCSlot());
-			if(channel.getSlot() == data.getFADCSlot()) {
-				System.out.printf("[ Success ]%n");
-			} else {
-				System.out.printf("[ Failure ]%n");
-				idFailSet.add(channel.getChannelId());
-				pointFailSet.add(crystal);
-			}
-			
-			System.out.printf("\tLED Channel [ %3d ] vs [ %3d ] ... ", led.getLedNumber(), data.getLEDChannel());
-			if(led.getLedNumber() == data.getLEDChannel()) {
-				System.out.printf("[ Success ]%n");
-			} else {
-				System.out.printf("[ Failure ]%n");
-				idFailSet.add(channel.getChannelId());
-				pointFailSet.add(crystal);
-			}
-			
-			System.out.printf("\tLED Crate   [ %3d ] vs [ %3d ] ... ", led.getCrateNumber(), crate);
-			if(led.getCrateNumber() == crate) {
-				System.out.printf("[ Success ]%n");
-			} else {
-				System.out.printf("[ Failure ]%n");
-				idFailSet.add(channel.getChannelId());
-				pointFailSet.add(crystal);
-			}
-			
-			System.out.println();
-			System.out.println();
-		}
-		
-		// Print out the failing crystals.
-		System.out.println("Crystals that Failed:");
-		for(Point fail : pointFailSet) {
-			System.out.printf("\tCrystal (%3d, %3d)%n", fail.x, fail.y);
-		}
-		if(pointFailSet.isEmpty()) {
-			System.out.println("\tNone!");
-		}
-		
-		// Indicate the database connection settings.
-		System.out.println("\n");
-		System.out.printf("Detector           :: %s%n", detectorName);
-		System.out.printf("Run Number         :: %d%n", runNumber);
-		System.out.printf("Channel Collection :: %d%n", channels.getCollectionId());
-		System.out.printf("LED Collection     :: %d%n", leds.getCollectionId());
-	}
+        
+        // Perform the comparison test.
+        for(EcalChannel channel : channels) {
+            // Get the crystal point information.
+            Point crystal = new Point(channel.getX(), channel.getY());
+            
+            // Get the data from manager.
+            CrystalDataSet data = manager.getCrystalData(crystal);
+            
+            // Get the appropriate LED collection.
+            EcalLed led = ledMap.get(channel.getChannelId());
+            
+            // Perform the comparison.
+            System.out.printf("Checking Mappings for Crystal (%3d, %3d):%n", crystal.x, crystal.y);
+            System.out.printf("\tChannel ID      :: %d%n", channel.getChannelId());
+            
+            System.out.printf("\tChannel     [ %3d ] vs [ %3d ] ... ", channel.getChannel(), data.getFADCChannel());
+            if(channel.getChannel() == data.getFADCChannel()) {
+                System.out.printf("[ Success ]%n");
+            } else {
+                System.out.printf("[ Failure ]%n");
+                idFailSet.add(channel.getChannelId());
+                pointFailSet.add(crystal);
+            }
+            
+            int crate = data.getMotherboard().isTop() ? 1 : 2;
+            System.out.printf("\tCrate       [ %3d ] vs [ %3d ] ... ", channel.getCrate(), crate);
+            if(channel.getCrate() == crate) {
+                System.out.printf("[ Success ]%n");
+            } else {
+                System.out.printf("[ Failure ]%n");
+                idFailSet.add(channel.getChannelId());
+                pointFailSet.add(crystal);
+            }
+            
+            System.out.printf("\tSlot        [ %3d ] vs [ %3d ] ... ", channel.getSlot(), data.getFADCSlot());
+            if(channel.getSlot() == data.getFADCSlot()) {
+                System.out.printf("[ Success ]%n");
+            } else {
+                System.out.printf("[ Failure ]%n");
+                idFailSet.add(channel.getChannelId());
+                pointFailSet.add(crystal);
+            }
+            
+            System.out.printf("\tLED Channel [ %3d ] vs [ %3d ] ... ", led.getLedNumber(), data.getLEDChannel());
+            if(led.getLedNumber() == data.getLEDChannel()) {
+                System.out.printf("[ Success ]%n");
+            } else {
+                System.out.printf("[ Failure ]%n");
+                idFailSet.add(channel.getChannelId());
+                pointFailSet.add(crystal);
+            }
+            
+            System.out.printf("\tLED Crate   [ %3d ] vs [ %3d ] ... ", led.getCrateNumber(), crate);
+            if(led.getCrateNumber() == crate) {
+                System.out.printf("[ Success ]%n");
+            } else {
+                System.out.printf("[ Failure ]%n");
+                idFailSet.add(channel.getChannelId());
+                pointFailSet.add(crystal);
+            }
+            
+            System.out.println();
+            System.out.println();
+        }
+        
+        // Print out the failing crystals.
+        System.out.println("Crystals that Failed:");
+        for(Point fail : pointFailSet) {
+            System.out.printf("\tCrystal (%3d, %3d)%n", fail.x, fail.y);
+        }
+        if(pointFailSet.isEmpty()) {
+            System.out.println("\tNone!");
+        }
+        
+        // Indicate the database connection settings.
+        System.out.println("\n");
+        System.out.printf("Detector           :: %s%n", detectorName);
+        System.out.printf("Run Number         :: %d%n", runNumber);
+        System.out.printf("Channel Collection :: %d%n", channels.getCollectionId());
+        System.out.printf("LED Collection     :: %d%n", leds.getCollectionId());
+    }
 }

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/GradientScale.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/GradientScale.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/GradientScale.java	Wed Mar  9 11:43:24 2016
@@ -21,9 +21,9 @@
     private int[] drgb = { 255, 255, 255 };
     
     public Color getColor(Double value) {
-    	// If the argument is null, treat it as zero.
-    	if(value == null) { value = 0.0; }
-    	
+        // If the argument is null, treat it as zero.
+        if(value == null) { value = 0.0; }
+        
         // If the value is less than the minimum, return the cold color.
         if (value < min) { return coldColor; }
         

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/MultiGradientScale.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/MultiGradientScale.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/util/MultiGradientScale.java	Wed Mar  9 11:43:24 2016
@@ -29,9 +29,9 @@
     }
     
     public Color getColor(Double value) {
-    	// If the value is null, treat it as zero.
-    	if(value == null) { value = 0.0; }
-    	
+        // If the value is null, treat it as zero.
+        if(value == null) { value = 0.0; }
+        
         // Get the number of colors and scales.
         int colors = colorList.size();
         int scales = scaleList.size();
@@ -48,7 +48,7 @@
         else { sValue = Math.log10(scale * value); }
         
         if(value < 1 && (Double.isNaN(sValue) || Double.isInfinite(sValue))) {
-        	return scaleList.get(0).getColor(0.0);
+            return scaleList.get(0).getColor(0.0);
         }
         
         // Otherwise, determine which scale should get the value.

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ClockSingleton.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ClockSingleton.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ClockSingleton.java	Wed Mar  9 11:43:24 2016
@@ -13,35 +13,35 @@
  */
 public class ClockSingleton {
 
-	public static final ClockSingleton _instance = new ClockSingleton();
-	private int clock;
-	//time between events (bunch spacing)
-	private double dt = 2.0;
+    public static final ClockSingleton _instance = new ClockSingleton();
+    private int clock;
+    //time between events (bunch spacing)
+    private double dt = 2.0;
 
-	private ClockSingleton() {
-	}
+    private ClockSingleton() {
+    }
 
-	public static void init() {
-		_instance.clock = 0;
-	}
+    public static void init() {
+        _instance.clock = 0;
+    }
 
-	public static int getClock() {
-		return _instance.clock;
-	}
+    public static int getClock() {
+        return _instance.clock;
+    }
 
-	public static double getTime() {
-		return _instance.dt * _instance.clock;
-	}
+    public static double getTime() {
+        return _instance.dt * _instance.clock;
+    }
 
-	public static double getDt() {
-		return _instance.dt;
-	}
+    public static double getDt() {
+        return _instance.dt;
+    }
 
-	public static void setDt(double dt) {
-		_instance.dt = dt;
-	}
+    public static void setDt(double dt) {
+        _instance.dt = dt;
+    }
 
-	public static void step() {
-		_instance.clock++;
-	}
+    public static void step() {
+        _instance.clock++;
+    }
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java	Wed Mar  9 11:43:24 2016
@@ -383,7 +383,7 @@
                     }
                 } else {
                     if (pedestalSubtractedValue < triggerThreshold || triggerPathHitTimes.get(cellID) + delay0 == readoutCounter) {
-//					System.out.printf("sum = %f\n",sum);
+//                  System.out.printf("sum = %f\n",sum);
                         triggerPathDelayQueue.add(new BaseRawCalorimeterHit(cellID,
                                 (int) Math.round((sum + pedestalSubtractedValue) / scaleFactor),
                                 64 * triggerPathHitTimes.get(cellID)));
@@ -460,15 +460,15 @@
         short[] adcValues = new short[readoutWindow];
         for (int i = 0; i < readoutWindow; i++) {
             adcValues[i] = (short) pipeline.getValue(readoutLatency - i - 1);
-//			if (adcValues[i] != 0) {
-//				System.out.println("getWindow: " + adcValues[i] + " at i = " + i);
-//			}
+//          if (adcValues[i] != 0) {
+//              System.out.println("getWindow: " + adcValues[i] + " at i = " + i);
+//          }
         }
         return adcValues;
     }
 
     protected List<RawTrackerHit> readWindow() {
-//		System.out.println("Reading FADC data");
+//      System.out.println("Reading FADC data");
         List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
         for (Long cellID : digitalPipelines.keySet()) {
             short[] adcValues = getWindow(cellID);
@@ -488,7 +488,7 @@
     }
 
     protected List<RawTrackerHit> readPulses() {
-//		System.out.println("Reading FADC data");
+//      System.out.println("Reading FADC data");
         List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
         for (Long cellID : digitalPipelines.keySet()) {
             short[] window = getWindow(cellID);
@@ -522,7 +522,7 @@
     }
 
     protected List<RawCalorimeterHit> readIntegrals() {
-//		System.out.println("Reading FADC data");
+//      System.out.println("Reading FADC data");
         List<RawCalorimeterHit> hits = new ArrayList<RawCalorimeterHit>();
         for (Long cellID : digitalPipelines.keySet()) {
             short[] window = getWindow(cellID);

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCPrimaryTriggerDriver.java	Wed Mar  9 11:43:24 2016
@@ -34,7 +34,7 @@
     private int pairCoincidence = 2;                              // Maximum allowed time difference between clusters. (4 ns clock-cycles)
     private int backgroundLevel = -1;                             // Automatically sets the cuts to achieve a predetermined background rate.
     private TriggerModule triggerModule = new TriggerModule(1.0, 0.050,
-    		6.600, 0.010, 6.600, 0.000, 13.200, 6.600, 0.0, 360, 0.0055);
+            6.600, 0.010, 6.600, 0.000, 13.200, 6.600, 0.0, 360, 0.0055);
     
     // ==================================================================
     // ==== Driver Internal Variables ===================================
@@ -77,55 +77,55 @@
      */
     @Override
     public void startOfData() {
-    	// Define plot type names.
-    	String[] plotType = new String[PLOT_COUNT];
-    	plotType[NO_CUTS] = "";
-    	plotType[ALL_CUTS] = " (Passed All Cuts)";
-    	plotType[OVER_1HIT] = " (More than 1 Hit)";
-    	plotType[OVER_2HIT] = " (More than 2 Hits)";
-    	plotType[SINGLES_CUTS] = " (Passed Single Cuts)";
-    	
-    	// Define plot type directories.
-    	String[] plotDir = new String[PLOT_COUNT];
-    	plotDir[NO_CUTS] = "NoCuts/";
-    	plotDir[ALL_CUTS] = "PassedAll/";
-    	plotDir[OVER_1HIT] = "2PlusHits/";
-    	plotDir[OVER_2HIT] = "3PlusHits/";
-    	plotDir[SINGLES_CUTS] = "PassedSingles/";
-    	
-    	// Instantiate the singles plot arrays.
-    	clusterSeedEnergy = new IHistogram1D[PLOT_COUNT];
-    	clusterHitCount = new IHistogram1D[PLOT_COUNT];
-    	clusterTotalEnergy = new IHistogram1D[PLOT_COUNT];
-    	clusterDistribution = new IHistogram2D[PLOT_COUNT];
-    	
-    	// Instantiate the pair plot arrays. Note that the pair cuts
-    	// only ever see clusters that pass the singles cuts, so the
-    	// "passed singles cuts" plots are meaningless. Thusly, the
-    	// pair plots have one fewer plot than the singles.
-    	pairEnergySum = new IHistogram1D[PLOT_COUNT - 1];
-    	pairEnergyDifference = new IHistogram1D[PLOT_COUNT - 1];
-    	pairCoplanarity = new IHistogram1D[PLOT_COUNT - 1];
-    	pairEnergySlope = new IHistogram1D[PLOT_COUNT - 1];
-    	pairEnergySum2DDistribution = new IHistogram2D[PLOT_COUNT - 1];
-    	
-    	// Instantiate the plots.
-    	for(int i = 0; i < PLOT_COUNT; i++) {
-    		System.out.println(plotDir[i] + "Cluster Seed Energy" + plotType[i]);
-    		clusterSeedEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Seed Energy" + plotType[i], 176, 0.0, 2.2);
-    		clusterHitCount[i] = aida.histogram1D(plotDir[i] + "Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
-    		clusterTotalEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Total Energy" + plotType[i], 176, 0.0, 2.2);
-    		clusterDistribution[i] = aida.histogram2D(plotDir[i] + "Cluster Seed" + plotType[i], 46, -23, 23, 11, -5.5, 5.5);
-    		
-    		if(i != PLOT_COUNT - 1) {
-    			pairEnergySum[i] = aida.histogram1D(plotDir[i] + "Pair Energy Sum" + plotType[i], 176, 0.0, 4.4);
-    			pairEnergyDifference[i] = aida.histogram1D(plotDir[i] + "Pair Energy Difference" + plotType[i], 176, 0.0, 2.2);
-    			pairCoplanarity[i] = aida.histogram1D(plotDir[i] + "Pair Coplanarity" + plotType[i], 180, 0.0, 180.0);
-    			pairEnergySlope[i] = aida.histogram1D(plotDir[i] + "Pair Energy Slope" + plotType[i], 200, 0.0, 4.0);
-    			pairEnergySum2DDistribution[i] = aida.histogram2D(plotDir[i] + "Pair Energy Sum 2D" + plotType[i], 176, 0.0, 4.4, 176, 0.0, 4.4);
-    		}
-    	}
-    	
+        // Define plot type names.
+        String[] plotType = new String[PLOT_COUNT];
+        plotType[NO_CUTS] = "";
+        plotType[ALL_CUTS] = " (Passed All Cuts)";
+        plotType[OVER_1HIT] = " (More than 1 Hit)";
+        plotType[OVER_2HIT] = " (More than 2 Hits)";
+        plotType[SINGLES_CUTS] = " (Passed Single Cuts)";
+        
+        // Define plot type directories.
+        String[] plotDir = new String[PLOT_COUNT];
+        plotDir[NO_CUTS] = "NoCuts/";
+        plotDir[ALL_CUTS] = "PassedAll/";
+        plotDir[OVER_1HIT] = "2PlusHits/";
+        plotDir[OVER_2HIT] = "3PlusHits/";
+        plotDir[SINGLES_CUTS] = "PassedSingles/";
+        
+        // Instantiate the singles plot arrays.
+        clusterSeedEnergy = new IHistogram1D[PLOT_COUNT];
+        clusterHitCount = new IHistogram1D[PLOT_COUNT];
+        clusterTotalEnergy = new IHistogram1D[PLOT_COUNT];
+        clusterDistribution = new IHistogram2D[PLOT_COUNT];
+        
+        // Instantiate the pair plot arrays. Note that the pair cuts
+        // only ever see clusters that pass the singles cuts, so the
+        // "passed singles cuts" plots are meaningless. Thusly, the
+        // pair plots have one fewer plot than the singles.
+        pairEnergySum = new IHistogram1D[PLOT_COUNT - 1];
+        pairEnergyDifference = new IHistogram1D[PLOT_COUNT - 1];
+        pairCoplanarity = new IHistogram1D[PLOT_COUNT - 1];
+        pairEnergySlope = new IHistogram1D[PLOT_COUNT - 1];
+        pairEnergySum2DDistribution = new IHistogram2D[PLOT_COUNT - 1];
+        
+        // Instantiate the plots.
+        for(int i = 0; i < PLOT_COUNT; i++) {
+            System.out.println(plotDir[i] + "Cluster Seed Energy" + plotType[i]);
+            clusterSeedEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Seed Energy" + plotType[i], 176, 0.0, 2.2);
+            clusterHitCount[i] = aida.histogram1D(plotDir[i] + "Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
+            clusterTotalEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Total Energy" + plotType[i], 176, 0.0, 2.2);
+            clusterDistribution[i] = aida.histogram2D(plotDir[i] + "Cluster Seed" + plotType[i], 46, -23, 23, 11, -5.5, 5.5);
+            
+            if(i != PLOT_COUNT - 1) {
+                pairEnergySum[i] = aida.histogram1D(plotDir[i] + "Pair Energy Sum" + plotType[i], 176, 0.0, 4.4);
+                pairEnergyDifference[i] = aida.histogram1D(plotDir[i] + "Pair Energy Difference" + plotType[i], 176, 0.0, 2.2);
+                pairCoplanarity[i] = aida.histogram1D(plotDir[i] + "Pair Coplanarity" + plotType[i], 180, 0.0, 180.0);
+                pairEnergySlope[i] = aida.histogram1D(plotDir[i] + "Pair Energy Slope" + plotType[i], 200, 0.0, 4.0);
+                pairEnergySum2DDistribution[i] = aida.histogram2D(plotDir[i] + "Pair Energy Sum 2D" + plotType[i], 176, 0.0, 4.4, 176, 0.0, 4.4);
+            }
+        }
+        
         // Make sure that a valid cluster collection name has been
         // defined. If it has not, throw an exception.
         if (clusterCollectionName == null) {
@@ -239,15 +239,15 @@
                 
                 // Fill the hit count plots for N > 1.
                 if(hitCount > 1) {
-                	// Populate the plots.
+                    // Populate the plots.
                     clusterSeedEnergy[OVER_1HIT].fill(seedEnergy);
                     clusterTotalEnergy[OVER_1HIT].fill(clusterEnergy);
                     clusterHitCount[OVER_1HIT].fill(hitCount);
                     clusterDistribution[OVER_1HIT].fill(ix, iy);
-                	
+                    
                     // Fill the hit count plots for N > 2.
                     if(hitCount > 2) {
-                    	// Populate the plots.
+                        // Populate the plots.
                         clusterSeedEnergy[OVER_2HIT].fill(seedEnergy);
                         clusterTotalEnergy[OVER_2HIT].fill(clusterEnergy);
                         clusterHitCount[OVER_2HIT].fill(hitCount);
@@ -260,14 +260,14 @@
                 // VERBOSE :: Print the seed energy comparison check.
                 if(verbose) {
                     System.out.printf("\tSeed Energy Cut    :: %.3f < %.3f < %.3f --> %b%n",
-                    		triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW), seedEnergy,
-                    		triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH),
-                    		triggerModule.clusterSeedEnergyCut(cluster));
+                            triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW), seedEnergy,
+                            triggerModule.getCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH),
+                            triggerModule.clusterSeedEnergyCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
                 if(!triggerModule.clusterSeedEnergyCut(cluster)) {
-                	continue clusterLoop;
+                    continue clusterLoop;
                 }
                 
                 // Otherwise, note that it passed the cut.
@@ -278,13 +278,13 @@
                 // VERBOSE :: Print the hit count comparison check.
                 if(verbose) {
                     System.out.printf("\tHit Count Cut      :: %d >= %.0f --> %b%n",
-                    		hitCount, triggerModule.getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW),
-                    		triggerModule.clusterHitCountCut(cluster));
+                            hitCount, triggerModule.getCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW),
+                            triggerModule.clusterHitCountCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
                 if(!triggerModule.clusterHitCountCut(cluster)) {
-                	continue clusterLoop;
+                    continue clusterLoop;
                 }
                 
                 // Otherwise, note that it passed the cut.
@@ -295,14 +295,14 @@
                 // VERBOSE :: Print the cluster energy comparison check.
                 if(verbose) {
                     System.out.printf("\tCluster Energy Cut :: %.3f < %.3f < %.3f --> %b%n",
-                    		triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), clusterEnergy,
-                    		triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH),
-                    		triggerModule.clusterTotalEnergyCut(cluster));
+                            triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW), clusterEnergy,
+                            triggerModule.getCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH),
+                            triggerModule.clusterTotalEnergyCut(cluster));
                 }
                 
                 // If the cluster fails the cut, skip to the next cluster.
                 if(!triggerModule.clusterTotalEnergyCut(cluster)) {
-                	continue clusterLoop;
+                    continue clusterLoop;
                 }
                 
                 // Otherwise, note that it passed the cut.
@@ -544,63 +544,63 @@
         
         // Some cut values are almost always the same thing. Set those
         // here and only overwrite if necessary.
-    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.125);
-    	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    1.300);
-    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.200);
-    	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.700);
-    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.500);
-    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        2.000);
-    	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 1.200);
-    	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
-    	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       2);
+        triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.125);
+        triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    1.300);
+        triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.200);
+        triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.700);
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.500);
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        2.000);
+        triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 1.200);
+        triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
+        triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       2);
         
         // Set the variable values.
         if(backgroundLevel == 1) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         1.000);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.2);
-        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         1.000);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.2);
+            triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
         } else if(backgroundLevel == 2) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
-        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
+            triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       20);
         } else if(backgroundLevel == 3) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.0);
         } else if(backgroundLevel == 4) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
         } else if(backgroundLevel == 5) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.8);
         } else if(backgroundLevel == 6) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
         } else if(backgroundLevel == 7) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.6);
         } else if(backgroundLevel == 8) {
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 9) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 10) {
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.4);
         } else if(backgroundLevel == 0) {
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.100);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.100);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        1.900);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 2.200);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.1);
-        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       35);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.100);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.100);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   1.500);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        1.900);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 2.200);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       1.1);
+            triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       35);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
         } else if(backgroundLevel == -1) {
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.050);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.010);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   6.600);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        13.200);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 6.600);
-        	triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.0);
-        	triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       360);
-        	triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW,     0.050);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_HIGH,    6.600);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.010);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   6.600);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.000);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        13.200);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 6.600);
+            triggerModule.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.0);
+            triggerModule.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       360);
+            triggerModule.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
         }
     }
     
@@ -636,16 +636,16 @@
             
             // Fill the hit count plots for N > 1.
             if(clusterPair[0].getCalorimeterHits().size() > 1 && clusterPair[1].getCalorimeterHits().size() > 1) {
-            	// Populate the plots.
+                // Populate the plots.
                 pairEnergySum[OVER_1HIT].fill(energySum);
                 pairEnergyDifference[OVER_1HIT].fill(energyDifference);
                 pairEnergySlope[OVER_1HIT].fill(energySlope);
                 pairCoplanarity[OVER_1HIT].fill(coplanarity);
                 pairEnergySum2DDistribution[OVER_1HIT].fill(clusterPair[0].getEnergy(), clusterPair[1].getEnergy());
-            	
+                
                 // Fill the hit count plots for N > 2.
                 if(clusterPair[0].getCalorimeterHits().size() > 2 && clusterPair[1].getCalorimeterHits().size() > 2) {
-                	// Populate the plots.
+                    // Populate the plots.
                     pairEnergySum[OVER_2HIT].fill(energySum);
                     pairEnergyDifference[OVER_2HIT].fill(energyDifference);
                     pairEnergySlope[OVER_2HIT].fill(energySlope);
@@ -658,7 +658,7 @@
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
             if(!triggerModule.pairEnergySumCut(clusterPair)) {
-            	continue pairLoop;
+                continue pairLoop;
             }
             
             // Otherwise, note that it passed the cut.
@@ -668,7 +668,7 @@
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
             if(!triggerModule.pairEnergyDifferenceCut(clusterPair)) {
-            	continue pairLoop;
+                continue pairLoop;
             }
             
             // Otherwise, note that it passed the cut.
@@ -678,7 +678,7 @@
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
             if(!triggerModule.pairEnergySlopeCut(clusterPair)) {
-            	continue pairLoop;
+                continue pairLoop;
             }
             
             // Otherwise, note that it passed the cut.
@@ -688,7 +688,7 @@
             // =============================================================
             // If the cluster fails the cut, skip to the next pair.
             if(!triggerModule.pairCoplanarityCut(clusterPair)) {
-            	continue pairLoop;
+                continue pairLoop;
             }
             
             // Otherwise, note that it passed the cut.
@@ -774,6 +774,6 @@
      * @param cuts - The cut string.
      */
     public void setCuts(String cuts) {
-    	triggerModule.setCutValues(false, cuts);
+        triggerModule.setCutValues(false, cuts);
     }
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerVariableDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerVariableDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerVariableDriver.java	Wed Mar  9 11:43:24 2016
@@ -63,14 +63,14 @@
 
             //System.out.printf("%d ecal clusters in event\n", clusters.size());
             //System.out.printf("%s: %d clusters\n",this.getClass().getSimpleName(),clusters.size());
-        	//for(Cluster cl : clusters) {
-        	//	System.out.printf("%s: cl E %f x %f y %f \n",this.getClass().getSimpleName(),cl.getEnergy(),cl.getPosition()[0],cl.getPosition()[1]);
-        	//}
-        	List<Cluster> unique_clusters = this.getUniqueClusters(clusters);
-        	//System.out.printf("%s: %d unique clusters\n",this.getClass().getSimpleName(),unique_clusters.size());
-        	//for(Cluster cl : unique_clusters) {
-        	//	System.out.printf("%s: cl E %f x %f y %f \n",this.getClass().getSimpleName(),cl.getEnergy(),cl.getPosition()[0],cl.getPosition()[1]);
-        	//}
+            //for(Cluster cl : clusters) {
+            //  System.out.printf("%s: cl E %f x %f y %f \n",this.getClass().getSimpleName(),cl.getEnergy(),cl.getPosition()[0],cl.getPosition()[1]);
+            //}
+            List<Cluster> unique_clusters = this.getUniqueClusters(clusters);
+            //System.out.printf("%s: %d unique clusters\n",this.getClass().getSimpleName(),unique_clusters.size());
+            //for(Cluster cl : unique_clusters) {
+            //  System.out.printf("%s: cl E %f x %f y %f \n",this.getClass().getSimpleName(),cl.getEnergy(),cl.getPosition()[0],cl.getPosition()[1]);
+            //}
 
             updateClusterQueues(unique_clusters);
             List<Cluster[]> clusterPairs = getClusterPairsTopBot();
@@ -122,47 +122,47 @@
     
     
     private List<Cluster> getUniqueClusters(List<Cluster> clusters) {
-    	List<Cluster> unique = new ArrayList<Cluster>();
-    	for(Cluster loop_cl : clusters) {
-			ClusterCmp loop_clCmp = new ClusterCmp(loop_cl);
-    		boolean found = false;
-			for(Cluster cl : unique) {
-    			if( loop_clCmp.compareTo(cl) == 0 ) {
-    				found = true;
-    			}
-    		}
-			if( !found ) {
-				unique.add(loop_cl);
-			}
-    	}
-    	return unique;
+        List<Cluster> unique = new ArrayList<Cluster>();
+        for(Cluster loop_cl : clusters) {
+            ClusterCmp loop_clCmp = new ClusterCmp(loop_cl);
+            boolean found = false;
+            for(Cluster cl : unique) {
+                if( loop_clCmp.compareTo(cl) == 0 ) {
+                    found = true;
+                }
+            }
+            if( !found ) {
+                unique.add(loop_cl);
+            }
+        }
+        return unique;
     }
 
 
     private static class ClusterCmp implements Comparable<Cluster> {
-    	private Cluster _cluster;
-		public ClusterCmp(Cluster cl) {
-			set_cluster(cl);
-		}
-		@Override
-		public int compareTo(Cluster cl) {
-				if(cl.getEnergy()==get_cluster().getEnergy() && cl.getPosition()[0]==get_cluster().getPosition()[0] && cl.getPosition()[1]==get_cluster().getPosition()[1] ) {
-					return 0;
-				} else {
-					if( cl.getEnergy() > get_cluster().getEnergy()) {
-						return 1;
-					} else {
-						return -1;
-					}
-				}
-		}
-		public Cluster get_cluster() {
-			return _cluster;
-		}
-		public void set_cluster(Cluster _cluster) {
-			this._cluster = _cluster;
-		}
-    	
+        private Cluster _cluster;
+        public ClusterCmp(Cluster cl) {
+            set_cluster(cl);
+        }
+        @Override
+        public int compareTo(Cluster cl) {
+                if(cl.getEnergy()==get_cluster().getEnergy() && cl.getPosition()[0]==get_cluster().getPosition()[0] && cl.getPosition()[1]==get_cluster().getPosition()[1] ) {
+                    return 0;
+                } else {
+                    if( cl.getEnergy() > get_cluster().getEnergy()) {
+                        return 1;
+                    } else {
+                        return -1;
+                    }
+                }
+        }
+        public Cluster get_cluster() {
+            return _cluster;
+        }
+        public void set_cluster(Cluster _cluster) {
+            this._cluster = _cluster;
+        }
+        
     }
     
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/MollerTriggerDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/MollerTriggerDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/MollerTriggerDriver.java	Wed Mar  9 11:43:24 2016
@@ -56,8 +56,8 @@
     
     @Override
     public void process(EventHeader event) {
-    	// Run the superclass process event.
-    	super.process(event);
+        // Run the superclass process event.
+        super.process(event);
     }
     
     @Override
@@ -87,29 +87,29 @@
         aMomentumAngle = aida.histogram2D("Trigger Plots :: Particle Momentum Distribution (t = 0, Passed All Cuts)", 500, -0.01, 0.06, 500, -0.04, 0.04);
         
         // Add the allowed seed crystal positions to the seed set.
-		if(useVersionOne) {
-	        // Add the allowed seed crystal positions to the seed set.
-	        // y = +/- 1, x = -11 -> -15
-	        for(int ix = -15; ix <= -11; ix++) {
-	            allowedSeedSet.add(new Point(ix, 1));
-	            allowedSeedSet.add(new Point(ix, -1));
-	        } // y = +/- 2, x = -9 -> -15
-	        for(int ix = -15; ix <= -9; ix++) {
-	            allowedSeedSet.add(new Point(ix, 2));
-	            allowedSeedSet.add(new Point(ix, -2));
-	        }
-		}
-		else {
-	        // y = +/- 1, x = -11 -> -13
-	        for(int ix = -13; ix <= -11; ix++) {
-	            allowedSeedSet.add(new Point(ix, 1));
-	            allowedSeedSet.add(new Point(ix, -1));
-	        } // y = +/- 2, x = -10 -> -14
-	        for(int ix = -14; ix <= -10; ix++) {
-	            allowedSeedSet.add(new Point(ix, 2));
-	            allowedSeedSet.add(new Point(ix, -2));
-	        }
-		}
+        if(useVersionOne) {
+            // Add the allowed seed crystal positions to the seed set.
+            // y = +/- 1, x = -11 -> -15
+            for(int ix = -15; ix <= -11; ix++) {
+                allowedSeedSet.add(new Point(ix, 1));
+                allowedSeedSet.add(new Point(ix, -1));
+            } // y = +/- 2, x = -9 -> -15
+            for(int ix = -15; ix <= -9; ix++) {
+                allowedSeedSet.add(new Point(ix, 2));
+                allowedSeedSet.add(new Point(ix, -2));
+            }
+        }
+        else {
+            // y = +/- 1, x = -11 -> -13
+            for(int ix = -13; ix <= -11; ix++) {
+                allowedSeedSet.add(new Point(ix, 1));
+                allowedSeedSet.add(new Point(ix, -1));
+            } // y = +/- 2, x = -10 -> -14
+            for(int ix = -14; ix <= -10; ix++) {
+                allowedSeedSet.add(new Point(ix, 2));
+                allowedSeedSet.add(new Point(ix, -2));
+            }
+        }
     }
     
     @Override
@@ -201,31 +201,31 @@
             // Require that the cluster pass each of the cuts in
             // order to qualify for a trigger.
             if(totalEnergyCut && seedEnergyCut && hitCountCut && positionCut) {
-            	// Increment the number of events that have passed
-            	// the cuts.
-            	passedEvents++;
-            	
-            	// If the number of passed events exceeds the prescaling
-            	// threshold, throw a trigger.
-            	if(passedEvents >= prescale) {
-            		// Reset the number of passed events.
-            		passedEvents = 0;
-            		
-	                // Add the clusters to the cut histograms.
-	                aClusterHitCount.fill(cluster.getCalorimeterHits().size());
-	                aClusterTotalEnergy.fill(cluster.getEnergy());
-	                aClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
-	                aClusterDistribution.fill(ix > 0 ? ix - 1 : ix, iy, 1);
-	                
-	                // Increment the trigger count.
-	                triggers++;
-	                
-	                // VERBOSE :: Indicate that a trigger occurred.
-	                if(verbose) { System.out.printf("\tTriggered!%n%n"); }
-	                
-	                // Return a trigger.
-	                return true;
-            	}
+                // Increment the number of events that have passed
+                // the cuts.
+                passedEvents++;
+                
+                // If the number of passed events exceeds the prescaling
+                // threshold, throw a trigger.
+                if(passedEvents >= prescale) {
+                    // Reset the number of passed events.
+                    passedEvents = 0;
+                    
+                    // Add the clusters to the cut histograms.
+                    aClusterHitCount.fill(cluster.getCalorimeterHits().size());
+                    aClusterTotalEnergy.fill(cluster.getEnergy());
+                    aClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
+                    aClusterDistribution.fill(ix > 0 ? ix - 1 : ix, iy, 1);
+                    
+                    // Increment the trigger count.
+                    triggers++;
+                    
+                    // VERBOSE :: Indicate that a trigger occurred.
+                    if(verbose) { System.out.printf("\tTriggered!%n%n"); }
+                    
+                    // Return a trigger.
+                    return true;
+                }
             }
         }
         
@@ -371,7 +371,7 @@
      * will be thrown.
      */
     public void setPrescale(int prescale) {
-    	this.prescale = prescale;
+        this.prescale = prescale;
     }
     
     /**
@@ -383,7 +383,7 @@
     public void setVerbose(boolean verbose) {
         this.verbose = verbose;
     }
-	
+    
     /**
      * Toggles whether the more inclusive acceptance region version 1
      * is used, or the slightly smaller and more exclusive acceptance
@@ -392,9 +392,9 @@
      * 1 of the acceptance region should be used and <code>false</code>
      * that version 2 should be used.
      */
-	public void setUseVersionOne(boolean useVersionOne) {
-		this.useVersionOne = useVersionOne;
-	}
+    public void setUseVersionOne(boolean useVersionOne) {
+        this.useVersionOne = useVersionOne;
+    }
     
     // ==================================================================
     // ==== AIDA Plots ==================================================

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/OccupancyAnalysisDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/OccupancyAnalysisDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/OccupancyAnalysisDriver.java	Wed Mar  9 11:43:24 2016
@@ -12,19 +12,19 @@
 import org.lcsim.util.aida.AIDA;
 
 public class OccupancyAnalysisDriver extends Driver {
-	// Internal variables.
-	private double scalingFactor = 0.05;
-	private double seedThreshold = 0.050;
-	private double beamRatio = 1.92 / 2.2;
-	private double clusterThreshold = 0.200;
+    // Internal variables.
+    private double scalingFactor = 0.05;
+    private double seedThreshold = 0.050;
+    private double beamRatio = 1.92 / 2.2;
+    private double clusterThreshold = 0.200;
     private AIDA aida = AIDA.defaultInstance();
-	private boolean ignoreBeamGapRows = false;
-	
+    private boolean ignoreBeamGapRows = false;
+    
     // LCIO Collection Names
     private String clusterCollectionName = "EcalClusters";
     private String hitCollectionName = "EcalCorrectedHits";
     
-	// Trigger plots.
+    // Trigger plots.
     IHistogram2D occupancyDistribution;
     IHistogram2D[] clusterDistribution = new IHistogram2D[2];
     IHistogram1D[] clusterHitDistribution = new IHistogram1D[2];
@@ -32,129 +32,129 @@
     IHistogram1D[] clusterEnergyDistribution = new IHistogram1D[2];
     
     public void setIgnoreBeamGapRows(boolean ignoreBeamGapRows) {
-    	this.ignoreBeamGapRows = ignoreBeamGapRows;
+        this.ignoreBeamGapRows = ignoreBeamGapRows;
     }
     
     public void setBeamRatio(double beamRatio) {
-    	this.beamRatio = beamRatio;
+        this.beamRatio = beamRatio;
     }
     
     public void setScalingFactor(double scalingFactor) {
-    	this.scalingFactor = scalingFactor;
+        this.scalingFactor = scalingFactor;
     }
     
     public void setSeedThreshold(double seedThreshold) {
-    	this.seedThreshold = seedThreshold;
+        this.seedThreshold = seedThreshold;
     }
     
     public void setClusterThreshold(double clusterThreshold) {
-    	this.clusterThreshold = clusterThreshold;
+        this.clusterThreshold = clusterThreshold;
     }
     
     public void setClusterCollectionName(String clusterCollectionName) {
-    	this.clusterCollectionName = clusterCollectionName;
+        this.clusterCollectionName = clusterCollectionName;
     }
     
     public void setHitCollectionName(String hitCollectionName) {
-    	this.hitCollectionName = hitCollectionName;
+        this.hitCollectionName = hitCollectionName;
     }
     
     @Override
     public void process(EventHeader event) {
-    	// If clusters are present, process them.
-    	if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-    		// Get the list of clusters.
-    		List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-    		
-    		// Use the clusters to populate the cluster plots.
-    		for(Cluster cluster : clusterList) {
-    			// Get the ix and iy values for the cluster.
-    			int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-    			int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-    			
-    			// If we want to ignore the beam gap rows, make sure
-    			// that iy exceeds two.
-    			if(!ignoreBeamGapRows || (Math.abs(iy) > 2)) {
-	        		// If the cluster passes the seed threshold, place it in
-	        		// the level 1 plots.
-	    			if(cluster.getCalorimeterHits().get(0).getCorrectedEnergy() >= seedThreshold) {
-	    				clusterDistribution[0].fill(ix, iy, scalingFactor);
-	    				clusterHitDistribution[0].fill(cluster.getCalorimeterHits().size(), scalingFactor);
-	    				clusterEnergyDistribution[0].fill(cluster.getEnergy() * beamRatio, scalingFactor);
-	    			}
-	    			
-	    			// If the cluster energy passes the cluster threshold,
-	    			// populate the level 2 plots.
-	    			if(cluster.getEnergy() >= clusterThreshold) {
-	    				clusterDistribution[1].fill(ix, iy, scalingFactor);
-	    				clusterHitDistribution[1].fill(cluster.getCalorimeterHits().size(), scalingFactor);
-	    				clusterEnergyDistribution[1].fill(cluster.getEnergy() * beamRatio, scalingFactor);
-	    			}
-    			}
-    		}
-    	}
-    	
-    	// If the event has hits, process them.
-    	if(event.hasCollection(CalorimeterHit.class, hitCollectionName)) {
-    		// Get the list of hits.
-    		List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, hitCollectionName);
-    		
-    		// Track the energy in the top and bottom of the calorimeter.
-    		double[] energy = { 0.0, 0.0 };
-    		
-    		// Iterate over the hits.
-    		for(CalorimeterHit hit : hitList) {
-    			// Get the ix and iy values.
-    			int ix = hit.getIdentifierFieldValue("ix");
-    			int iy = hit.getIdentifierFieldValue("iy");
-    			
-    			// If we want to ignore beam gap rows, ensure that iy
-    			// is greater than 2.
-    			if(!ignoreBeamGapRows || Math.abs(iy) > 2) {
-	    			// Add the energy to the appropriate energy tracking
-	    			// variable for the calorimeter halves.
-	    			if(iy > 0) { energy[0] += hit.getCorrectedEnergy() * beamRatio; }
-	    			else { energy[1] += hit.getCorrectedEnergy() * beamRatio; }
-	    			
-	    			// Populate the occupancy distribution.
-	    			occupancyDistribution.fill(ix, iy, scalingFactor);
-    			}
-    		}
-			
-			// Populate the total calorimeter energy plot.
-			totalEnergyDistribution[0].fill(energy[0], scalingFactor);
-			totalEnergyDistribution[1].fill(energy[1], scalingFactor);
-    	}
+        // If clusters are present, process them.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the list of clusters.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Use the clusters to populate the cluster plots.
+            for(Cluster cluster : clusterList) {
+                // Get the ix and iy values for the cluster.
+                int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+                
+                // If we want to ignore the beam gap rows, make sure
+                // that iy exceeds two.
+                if(!ignoreBeamGapRows || (Math.abs(iy) > 2)) {
+                    // If the cluster passes the seed threshold, place it in
+                    // the level 1 plots.
+                    if(cluster.getCalorimeterHits().get(0).getCorrectedEnergy() >= seedThreshold) {
+                        clusterDistribution[0].fill(ix, iy, scalingFactor);
+                        clusterHitDistribution[0].fill(cluster.getCalorimeterHits().size(), scalingFactor);
+                        clusterEnergyDistribution[0].fill(cluster.getEnergy() * beamRatio, scalingFactor);
+                    }
+                    
+                    // If the cluster energy passes the cluster threshold,
+                    // populate the level 2 plots.
+                    if(cluster.getEnergy() >= clusterThreshold) {
+                        clusterDistribution[1].fill(ix, iy, scalingFactor);
+                        clusterHitDistribution[1].fill(cluster.getCalorimeterHits().size(), scalingFactor);
+                        clusterEnergyDistribution[1].fill(cluster.getEnergy() * beamRatio, scalingFactor);
+                    }
+                }
+            }
+        }
+        
+        // If the event has hits, process them.
+        if(event.hasCollection(CalorimeterHit.class, hitCollectionName)) {
+            // Get the list of hits.
+            List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, hitCollectionName);
+            
+            // Track the energy in the top and bottom of the calorimeter.
+            double[] energy = { 0.0, 0.0 };
+            
+            // Iterate over the hits.
+            for(CalorimeterHit hit : hitList) {
+                // Get the ix and iy values.
+                int ix = hit.getIdentifierFieldValue("ix");
+                int iy = hit.getIdentifierFieldValue("iy");
+                
+                // If we want to ignore beam gap rows, ensure that iy
+                // is greater than 2.
+                if(!ignoreBeamGapRows || Math.abs(iy) > 2) {
+                    // Add the energy to the appropriate energy tracking
+                    // variable for the calorimeter halves.
+                    if(iy > 0) { energy[0] += hit.getCorrectedEnergy() * beamRatio; }
+                    else { energy[1] += hit.getCorrectedEnergy() * beamRatio; }
+                    
+                    // Populate the occupancy distribution.
+                    occupancyDistribution.fill(ix, iy, scalingFactor);
+                }
+            }
+            
+            // Populate the total calorimeter energy plot.
+            totalEnergyDistribution[0].fill(energy[0], scalingFactor);
+            totalEnergyDistribution[1].fill(energy[1], scalingFactor);
+        }
     }
     
     @Override
     public void startOfData() {
-    	// Define the cluster distribution plots.
-    	String[] clusterDistName = { String.format("Comp Plots :: Cluster Seed Distribution [Seed Threshold %.3f GeV]", seedThreshold),
-    			String.format("Comp Plots :: Cluster Seed Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
+        // Define the cluster distribution plots.
+        String[] clusterDistName = { String.format("Comp Plots :: Cluster Seed Distribution [Seed Threshold %.3f GeV]", seedThreshold),
+                String.format("Comp Plots :: Cluster Seed Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
         clusterDistribution[0] = aida.histogram2D(clusterDistName[0], 46, -23, 23, 11, -5.5, 5.5);
         clusterDistribution[1] = aida.histogram2D(clusterDistName[1], 46, -23, 23, 11, -5.5, 5.5);
         
-    	// Define the occupancy distribution plots.
-    	String occupancyDistName = String.format("Comp Plots :: Crystal Occupancy");
-    	occupancyDistribution = aida.histogram2D(occupancyDistName, 46, -23, 23, 11, -5.5, 5.5);
-    	
+        // Define the occupancy distribution plots.
+        String occupancyDistName = String.format("Comp Plots :: Crystal Occupancy");
+        occupancyDistribution = aida.histogram2D(occupancyDistName, 46, -23, 23, 11, -5.5, 5.5);
+        
         // Define the cluster hit count distribution.
-    	String[] clusterHitDistName = { String.format("Comp Plots :: Cluster Hit Count Distribution [Seed Threshold %.3f GeV]", seedThreshold),
-    			String.format("Comp Plots :: Cluster Hit Count Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
-    	clusterHitDistribution[0] = aida.histogram1D(clusterHitDistName[0], 9, 1, 10);
-    	clusterHitDistribution[1] = aida.histogram1D(clusterHitDistName[1], 9, 1, 10);
-    	
+        String[] clusterHitDistName = { String.format("Comp Plots :: Cluster Hit Count Distribution [Seed Threshold %.3f GeV]", seedThreshold),
+                String.format("Comp Plots :: Cluster Hit Count Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
+        clusterHitDistribution[0] = aida.histogram1D(clusterHitDistName[0], 9, 1, 10);
+        clusterHitDistribution[1] = aida.histogram1D(clusterHitDistName[1], 9, 1, 10);
+        
         // Define the cluster total energy distribution.
-    	String[] clusterEnergyDistName = { String.format("Comp Plots :: Cluster Total Energy Distribution [Seed Threshold %.3f GeV]", seedThreshold),
-    			String.format("Comp Plots :: Cluster Total Energy Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
-    	clusterEnergyDistribution[0] = aida.histogram1D(clusterEnergyDistName[0], 176, 0.0, 2.2);
-    	clusterEnergyDistribution[1] = aida.histogram1D(clusterEnergyDistName[1], 176, 0.0, 2.2);
-    	
+        String[] clusterEnergyDistName = { String.format("Comp Plots :: Cluster Total Energy Distribution [Seed Threshold %.3f GeV]", seedThreshold),
+                String.format("Comp Plots :: Cluster Total Energy Distribution [Cluster Threshold %.3f GeV]", clusterThreshold) };
+        clusterEnergyDistribution[0] = aida.histogram1D(clusterEnergyDistName[0], 176, 0.0, 2.2);
+        clusterEnergyDistribution[1] = aida.histogram1D(clusterEnergyDistName[1], 176, 0.0, 2.2);
+        
         // Define the calorimeter total energy distribution.
-    	String[] totalEnergyDistName = { String.format("Comp Plots :: Calorimeter Event Energy Distribution [Top]"),
-    			String.format("Comp Plots :: Calorimeter Event Energy Distribution [Bottom]") };
-    	totalEnergyDistribution[0] = aida.histogram1D(totalEnergyDistName[0], 500, 0.0, 10.0);
-    	totalEnergyDistribution[1] = aida.histogram1D(totalEnergyDistName[1], 500, 0.0, 10.0);
+        String[] totalEnergyDistName = { String.format("Comp Plots :: Calorimeter Event Energy Distribution [Top]"),
+                String.format("Comp Plots :: Calorimeter Event Energy Distribution [Bottom]") };
+        totalEnergyDistribution[0] = aida.histogram1D(totalEnergyDistName[0], 500, 0.0, 10.0);
+        totalEnergyDistribution[1] = aida.histogram1D(totalEnergyDistName[1], 500, 0.0, 10.0);
     }
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ReadoutTrigger.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ReadoutTrigger.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/ReadoutTrigger.java	Wed Mar  9 11:43:24 2016
@@ -22,16 +22,16 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ReadoutTrigger extends Driver {
-	// Define settable parameters.
-	private double energySlopeParamF = 0.0055;
-	private String clusterCollectionName = "EcalClusters";
-	
-	// Define internal variables.
-	private TriggerModule trigger = new TriggerModule();
-	
-	// Define output plots.
-	private static final int NO_CUTS  = 0;
-	private static final int ALL_CUTS = 1;
+    // Define settable parameters.
+    private double energySlopeParamF = 0.0055;
+    private String clusterCollectionName = "EcalClusters";
+    
+    // Define internal variables.
+    private TriggerModule trigger = new TriggerModule();
+    
+    // Define output plots.
+    private static final int NO_CUTS  = 0;
+    private static final int ALL_CUTS = 1;
     private AIDA aida = AIDA.defaultInstance();
     private IHistogram1D[] clusterSeedEnergy;
     private IHistogram1D[] clusterHitCount;
@@ -46,267 +46,267 @@
     private IHistogram2D[] clusterDistribution;
     private IHistogram2D[] pairEnergySum2D;
     private IHistogram2D[] pairEnergySlope2D;
-	
+    
     /**
      * Instantiates cluster plots.
      */
     @Override
     public void startOfData() {
-    	// Define plot type names.
-    	String[] plotType = new String[2];
-    	plotType[NO_CUTS] = "";
-    	plotType[ALL_CUTS] = " (Passed All Cuts)";
-    	
-    	// Define plot type directories.
-    	String[] plotDir = new String[2];
-    	plotDir[NO_CUTS] = "NoCuts/";
-    	plotDir[ALL_CUTS] = "PassedAll/";
-    	
-    	// Instantiate the plots.
-    	for(int i = 0; i < 2; i++) {
-    		System.out.println(plotDir[i] + "Cluster Seed Energy" + plotType[i]);
-    		clusterSeedEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Seed Energy" + plotType[i], 88, 0.0, 1.1);
-    		clusterSeedEnergy[i].annotation().addItem("xAxisLabel", "Seed Energy (GeV)");
-    		clusterSeedEnergy[i].annotation().addItem("yAxisLabel", "Count");
-    		
-    		clusterHitCount[i] = aida.histogram1D(plotDir[i] + "Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
-    		clusterHitCount[i].annotation().addItem("xAxisLabel", "Hit Count");
-    		clusterHitCount[i].annotation().addItem("yAxisLabel", "Count");
-    		
-    		clusterTotalEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Total Energy" + plotType[i], 88, 0.0, 1.1);
-    		clusterTotalEnergy[i].annotation().addItem("xAxisLabel", "Cluster Energy (GeV)");
-    		clusterTotalEnergy[i].annotation().addItem("yAxisLabel", "Count");
-    		
-    		clusterTime[i] = aida.histogram1D(plotDir[i] + "Cluster Time" + plotType[i], 100, 0.0, 400);
-    		clusterTime[i].annotation().addItem("xAxisLabel", "Cluster Time (ns)");
-    		clusterTime[i].annotation().addItem("yAxisLabel", "Count");
-		
-			pairEnergySum[i] = aida.histogram1D(plotDir[i] + "Pair Energy Sum" + plotType[i], 88, 0.0, 2.2);
-			pairEnergySum[i].annotation().addItem("xAxisLabel", "Energy Sum (GeV)");
-			pairEnergySum[i].annotation().addItem("yAxisLabel", "Count");
-    		
-			pairEnergyDifference[i] = aida.histogram1D(plotDir[i] + "Pair Energy Difference" + plotType[i], 88, 0.0, 1.1);
-			pairEnergyDifference[i].annotation().addItem("xAxisLabel", "Energy Difference (GeV)");
-			pairEnergyDifference[i].annotation().addItem("yAxisLabel", "Count");
-    		
-			pairCoplanarity[i] = aida.histogram1D(plotDir[i] + "Pair Coplanarity" + plotType[i], 180, 0.0, 180.0);
-			pairCoplanarity[i].annotation().addItem("xAxisLabel", "Coplanarity Angle (Degrees)");
-			pairCoplanarity[i].annotation().addItem("yAxisLabel", "Count");
-    		
-			pairEnergySlope[i] = aida.histogram1D(plotDir[i] + "Pair Energy Slope" + plotType[i], 200, 0.0, 4.0);
-			pairEnergySlope[i].annotation().addItem("xAxisLabel", "Energy Slope (GeV)");
-			pairEnergySlope[i].annotation().addItem("yAxisLabel", "Count");
-    		
-			pairTime[i] = aida.histogram1D(plotDir[i] + "Pair Time" + plotType[i], 100, 0.0, 400);
-			pairTime[i].annotation().addItem("xAxisLabel", "Cluster Time (ns)");
-			pairTime[i].annotation().addItem("yAxisLabel", "Count");
-    		
-			pairCoincidence[i] = aida.histogram1D(plotDir[i] + "Pair Coincidence" + plotType[i], 8, 0.0, 32);
-			pairCoincidence[i].annotation().addItem("xAxisLabel", "Coincidence Time (ns)");
-			pairCoincidence[i].annotation().addItem("yAxisLabel", "Count");
-    		
-    		clusterDistribution[i] = aida.histogram2D(plotDir[i] + "Cluster Seed Distribution" + plotType[i], 46, -23, 23, 11, -5.5, 5.5);
-    		clusterDistribution[i].annotation().addItem("xAxisLabel", "x-Index");
-    		clusterDistribution[i].annotation().addItem("yAxisLabel", "y-Index");
-    		
-    		pairEnergySum2D[i] = aida.histogram2D(plotDir[i] + "Pair Energy Sum 2D" + plotType[i], 88, 0.0, 2.2, 88, 0.0, 2.2);
-    		pairEnergySum2D[i].annotation().addItem("xAxisLabel", "E1");
-    		pairEnergySum2D[i].annotation().addItem("yAxisLabel", "E2");
-    		
-    		pairEnergySlope2D[i] = aida.histogram2D(plotDir[i] + "Pair Energy Slope 2D" + plotType[i], 88, 0.0, 1.1, 200, 0.0, 400);
-    		pairEnergySlope2D[i].annotation().addItem("xAxisLabel", "E1");
-    		pairEnergySlope2D[i].annotation().addItem("yAxisLabel", "E2");
-    	}
+        // Define plot type names.
+        String[] plotType = new String[2];
+        plotType[NO_CUTS] = "";
+        plotType[ALL_CUTS] = " (Passed All Cuts)";
+        
+        // Define plot type directories.
+        String[] plotDir = new String[2];
+        plotDir[NO_CUTS] = "NoCuts/";
+        plotDir[ALL_CUTS] = "PassedAll/";
+        
+        // Instantiate the plots.
+        for(int i = 0; i < 2; i++) {
+            System.out.println(plotDir[i] + "Cluster Seed Energy" + plotType[i]);
+            clusterSeedEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Seed Energy" + plotType[i], 88, 0.0, 1.1);
+            clusterSeedEnergy[i].annotation().addItem("xAxisLabel", "Seed Energy (GeV)");
+            clusterSeedEnergy[i].annotation().addItem("yAxisLabel", "Count");
+            
+            clusterHitCount[i] = aida.histogram1D(plotDir[i] + "Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
+            clusterHitCount[i].annotation().addItem("xAxisLabel", "Hit Count");
+            clusterHitCount[i].annotation().addItem("yAxisLabel", "Count");
+            
+            clusterTotalEnergy[i] = aida.histogram1D(plotDir[i] + "Cluster Total Energy" + plotType[i], 88, 0.0, 1.1);
+            clusterTotalEnergy[i].annotation().addItem("xAxisLabel", "Cluster Energy (GeV)");
+            clusterTotalEnergy[i].annotation().addItem("yAxisLabel", "Count");
+            
+            clusterTime[i] = aida.histogram1D(plotDir[i] + "Cluster Time" + plotType[i], 100, 0.0, 400);
+            clusterTime[i].annotation().addItem("xAxisLabel", "Cluster Time (ns)");
+            clusterTime[i].annotation().addItem("yAxisLabel", "Count");
+        
+            pairEnergySum[i] = aida.histogram1D(plotDir[i] + "Pair Energy Sum" + plotType[i], 88, 0.0, 2.2);
+            pairEnergySum[i].annotation().addItem("xAxisLabel", "Energy Sum (GeV)");
+            pairEnergySum[i].annotation().addItem("yAxisLabel", "Count");
+            
+            pairEnergyDifference[i] = aida.histogram1D(plotDir[i] + "Pair Energy Difference" + plotType[i], 88, 0.0, 1.1);
+            pairEnergyDifference[i].annotation().addItem("xAxisLabel", "Energy Difference (GeV)");
+            pairEnergyDifference[i].annotation().addItem("yAxisLabel", "Count");
+            
+            pairCoplanarity[i] = aida.histogram1D(plotDir[i] + "Pair Coplanarity" + plotType[i], 180, 0.0, 180.0);
+            pairCoplanarity[i].annotation().addItem("xAxisLabel", "Coplanarity Angle (Degrees)");
+            pairCoplanarity[i].annotation().addItem("yAxisLabel", "Count");
+            
+            pairEnergySlope[i] = aida.histogram1D(plotDir[i] + "Pair Energy Slope" + plotType[i], 200, 0.0, 4.0);
+            pairEnergySlope[i].annotation().addItem("xAxisLabel", "Energy Slope (GeV)");
+            pairEnergySlope[i].annotation().addItem("yAxisLabel", "Count");
+            
+            pairTime[i] = aida.histogram1D(plotDir[i] + "Pair Time" + plotType[i], 100, 0.0, 400);
+            pairTime[i].annotation().addItem("xAxisLabel", "Cluster Time (ns)");
+            pairTime[i].annotation().addItem("yAxisLabel", "Count");
+            
+            pairCoincidence[i] = aida.histogram1D(plotDir[i] + "Pair Coincidence" + plotType[i], 8, 0.0, 32);
+            pairCoincidence[i].annotation().addItem("xAxisLabel", "Coincidence Time (ns)");
+            pairCoincidence[i].annotation().addItem("yAxisLabel", "Count");
+            
+            clusterDistribution[i] = aida.histogram2D(plotDir[i] + "Cluster Seed Distribution" + plotType[i], 46, -23, 23, 11, -5.5, 5.5);
+            clusterDistribution[i].annotation().addItem("xAxisLabel", "x-Index");
+            clusterDistribution[i].annotation().addItem("yAxisLabel", "y-Index");
+            
+            pairEnergySum2D[i] = aida.histogram2D(plotDir[i] + "Pair Energy Sum 2D" + plotType[i], 88, 0.0, 2.2, 88, 0.0, 2.2);
+            pairEnergySum2D[i].annotation().addItem("xAxisLabel", "E1");
+            pairEnergySum2D[i].annotation().addItem("yAxisLabel", "E2");
+            
+            pairEnergySlope2D[i] = aida.histogram2D(plotDir[i] + "Pair Energy Slope 2D" + plotType[i], 88, 0.0, 1.1, 200, 0.0, 400);
+            pairEnergySlope2D[i].annotation().addItem("xAxisLabel", "E1");
+            pairEnergySlope2D[i].annotation().addItem("yAxisLabel", "E2");
+        }
     }
     
     /**
      * Produces both uncut and cut distributions from clusters.
      */
-	@Override
-	public void process(EventHeader event) {
-		// Check for a collection of clusters.
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Get the list of clusters.
-			List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
-			
-			// Track which clusters have already been plotted.
-			Set<Cluster> plottedClustersUncut = new HashSet<Cluster>(clusters.size());
-			Set<Cluster> plottedClustersCut = new HashSet<Cluster>(clusters.size());
-			
-			// Populate a list of cluster pairs.
-			List<Cluster[]> pairs = getClusterPairs(clusters);
-			
-			// Process all cluster pairs.
-			pairLoop:
-			for(Cluster[] pair : pairs) {
-				// Get the x and y indices for each cluster in the pair.
-				int[] ix = { pair[0].getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
-						pair[1].getCalorimeterHits().get(0).getIdentifierFieldValue("ix") };
-				int[] iy = { pair[0].getCalorimeterHits().get(0).getIdentifierFieldValue("iy"),
-						pair[1].getCalorimeterHits().get(0).getIdentifierFieldValue("iy") };
-				
-				// Iterate over the clusters in the pair and plot the
-				// cluster singles distributions.
-				for(int clusterIndex = 0; clusterIndex < 2; clusterIndex++) {
-					// Only plot cluster singles distributions for
-					// clusters if they have not already been plotted.
-					// Note that this is needed because the same cluster
-					// can appear across multiple pairs.
-					if(!plottedClustersUncut.contains(pair[clusterIndex])) {
-						clusterSeedEnergy[NO_CUTS].fill(TriggerModule.getValueClusterSeedEnergy(pair[clusterIndex]));
-						clusterTotalEnergy[NO_CUTS].fill(TriggerModule.getValueClusterTotalEnergy(pair[clusterIndex]));
-						clusterHitCount[NO_CUTS].fill(TriggerModule.getValueClusterHitCount(pair[clusterIndex]));
-						clusterDistribution[NO_CUTS].fill(ix[clusterIndex], iy[clusterIndex]);
-						clusterTime[NO_CUTS].fill(pair[clusterIndex].getCalorimeterHits().get(0).getTime());
-						plottedClustersUncut.add(pair[clusterIndex]);
-					}
-				}
-				
-				// Plot the cluster pair distributions.
-				pairEnergySum[NO_CUTS].fill(TriggerModule.getValueEnergySum(pair));
-				pairEnergyDifference[NO_CUTS].fill(TriggerModule.getValueEnergyDifference(pair));
-				pairEnergySlope[NO_CUTS].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
-				pairCoplanarity[NO_CUTS].fill(TriggerModule.getValueCoplanarity(pair));
-				pairTime[NO_CUTS].fill(pair[1].getCalorimeterHits().get(0).getTime());
-				pairCoincidence[NO_CUTS].fill(TriggerModule.getValueTimeCoincidence(pair));
-				pairEnergySum2D[NO_CUTS].fill(pair[0].getEnergy(), pair[1].getEnergy());
-				if(pair[0].getEnergy() < pair[1].getEnergy()) {
-					pairEnergySlope2D[NO_CUTS].fill(pair[0].getEnergy(), TriggerModule.getClusterDistance(pair[0]));
-				} else {
-					pairEnergySlope2D[NO_CUTS].fill(pair[1].getEnergy(), TriggerModule.getClusterDistance(pair[1]));
-				}
-				
-				// Perform the cluster singles cuts.
-				if(!(trigger.clusterHitCountCut(pair[0]) && trigger.clusterHitCountCut(pair[1]))) {
-					continue pairLoop;
-				} if(!(trigger.clusterTotalEnergyCut(pair[0]) && trigger.clusterTotalEnergyCut(pair[1]))) {
-					continue pairLoop;
-				} if(!(trigger.clusterSeedEnergyCut(pair[0]) && trigger.clusterSeedEnergyCut(pair[1]))) {
-					continue pairLoop;
-				}
-				
-				// Perform the cluster pair cuts.
-				if(!trigger.pairCoplanarityCut(pair)) {
-					continue pairLoop;
-				} if(!trigger.pairEnergyDifferenceCut(pair)) {
-					continue pairLoop;
-				} if(!trigger.pairEnergySlopeCut(pair)) {
-					continue pairLoop;
-				} if(!trigger.pairEnergySumCut(pair)) {
-					continue pairLoop;
-				}
-				
-				// Iterate over the clusters in the pair and plot the
-				// cluster singles distributions.
-				for(int clusterIndex = 0; clusterIndex < 2; clusterIndex++) {
-					// Only plot cluster singles distributions for
-					// clusters if they have not already been plotted.
-					// Note that this is needed because the same cluster
-					// can appear across multiple pairs.
-					if(!plottedClustersCut.contains(pair[clusterIndex])) {
-						clusterSeedEnergy[ALL_CUTS].fill(TriggerModule.getValueClusterSeedEnergy(pair[clusterIndex]));
-						clusterTotalEnergy[ALL_CUTS].fill(TriggerModule.getValueClusterTotalEnergy(pair[clusterIndex]));
-						clusterHitCount[ALL_CUTS].fill(TriggerModule.getValueClusterHitCount(pair[clusterIndex]));
-						clusterDistribution[ALL_CUTS].fill(ix[clusterIndex], iy[clusterIndex]);
-						clusterTime[ALL_CUTS].fill(pair[clusterIndex].getCalorimeterHits().get(0).getTime());
-						plottedClustersCut.add(pair[clusterIndex]);
-					}
-				}
-				
-				// Plot the cluster pair distributions.
-				pairEnergySum[ALL_CUTS].fill(TriggerModule.getValueEnergySum(pair));
-				pairEnergyDifference[ALL_CUTS].fill(TriggerModule.getValueEnergyDifference(pair));
-				pairEnergySlope[ALL_CUTS].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
-				pairCoplanarity[ALL_CUTS].fill(TriggerModule.getValueCoplanarity(pair));
-				pairTime[ALL_CUTS].fill(pair[1].getCalorimeterHits().get(0).getTime());
-				pairCoincidence[ALL_CUTS].fill(TriggerModule.getValueTimeCoincidence(pair));
-				pairEnergySum2D[ALL_CUTS].fill(pair[0].getEnergy(), pair[1].getEnergy());
-				if(pair[0].getEnergy() < pair[1].getEnergy()) {
-					pairEnergySlope2D[ALL_CUTS].fill(pair[0].getEnergy(), TriggerModule.getClusterDistance(pair[0]));
-				} else {
-					pairEnergySlope2D[ALL_CUTS].fill(pair[1].getEnergy(), TriggerModule.getClusterDistance(pair[1]));
-				}
-				
-			}
-		}
-	}
-	
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
-	
-	public void setEnergySlopeParamF(double energySlopeParamF) {
-		this.energySlopeParamF = energySlopeParamF;
-		trigger.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, energySlopeParamF);
-	}
-	
-	public void setSeedEnergyLow(double value) {
-		trigger.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, value);
-	}
-	
-	public void setClusterEnergyLow(double value) {
-		trigger.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, value);
-	}
-	
-	public void setClusterEnergyHigh(double value) {
-		trigger.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, value);
-	}
-	
-	public void setHitCountLow(double value) {
-		trigger.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, value);
-	}
-	
-	public void setEnergySumLow(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, value);
-	}
-	
-	public void setEnergySumHigh(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, value);
-	}
-	
-	public void setEnergyDifferenceHigh(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, value);
-	}
-	
-	public void setEnergySlopeLow(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, value);
-	}
-	
-	public void setCoplanarityHigh(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, value);
-	}
-	
-	public void setTimeCoincidence(double value) {
-		trigger.setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, value);
-	}
-	
-	/**
-	 * Creates all top/bottom pairs from the event data.
-	 * @param clusters - A list of clusters from which to form pairs.
-	 * @return Returns a <code>List</code> collection that contains
-	 * <code>Cluster</code> arrays of size two.
-	 */
-	private List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
-		// Separate the clusters into top nad bottom clusters.
-		List<Cluster> topList = new ArrayList<Cluster>();
-		List<Cluster> botList = new ArrayList<Cluster>();
-		for(Cluster cluster : clusters) {
-			if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
-				topList.add(cluster);
-			} else {
-				botList.add(cluster);
-			}
-		}
-		
-		// Create all possible top/bottom cluster pairs.
-		List<Cluster[]> pairList = new ArrayList<Cluster[]>();
-		for(Cluster topCluster : topList) {
-			for(Cluster botCluster : botList) {
-				pairList.add(new Cluster[] { topCluster, botCluster });
-			}
-		}
-		
-		// Return the pairs.
-		return pairList;
-	}
+    @Override
+    public void process(EventHeader event) {
+        // Check for a collection of clusters.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the list of clusters.
+            List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
+            
+            // Track which clusters have already been plotted.
+            Set<Cluster> plottedClustersUncut = new HashSet<Cluster>(clusters.size());
+            Set<Cluster> plottedClustersCut = new HashSet<Cluster>(clusters.size());
+            
+            // Populate a list of cluster pairs.
+            List<Cluster[]> pairs = getClusterPairs(clusters);
+            
+            // Process all cluster pairs.
+            pairLoop:
+            for(Cluster[] pair : pairs) {
+                // Get the x and y indices for each cluster in the pair.
+                int[] ix = { pair[0].getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
+                        pair[1].getCalorimeterHits().get(0).getIdentifierFieldValue("ix") };
+                int[] iy = { pair[0].getCalorimeterHits().get(0).getIdentifierFieldValue("iy"),
+                        pair[1].getCalorimeterHits().get(0).getIdentifierFieldValue("iy") };
+                
+                // Iterate over the clusters in the pair and plot the
+                // cluster singles distributions.
+                for(int clusterIndex = 0; clusterIndex < 2; clusterIndex++) {
+                    // Only plot cluster singles distributions for
+                    // clusters if they have not already been plotted.
+                    // Note that this is needed because the same cluster
+                    // can appear across multiple pairs.
+                    if(!plottedClustersUncut.contains(pair[clusterIndex])) {
+                        clusterSeedEnergy[NO_CUTS].fill(TriggerModule.getValueClusterSeedEnergy(pair[clusterIndex]));
+                        clusterTotalEnergy[NO_CUTS].fill(TriggerModule.getValueClusterTotalEnergy(pair[clusterIndex]));
+                        clusterHitCount[NO_CUTS].fill(TriggerModule.getValueClusterHitCount(pair[clusterIndex]));
+                        clusterDistribution[NO_CUTS].fill(ix[clusterIndex], iy[clusterIndex]);
+                        clusterTime[NO_CUTS].fill(pair[clusterIndex].getCalorimeterHits().get(0).getTime());
+                        plottedClustersUncut.add(pair[clusterIndex]);
+                    }
+                }
+                
+                // Plot the cluster pair distributions.
+                pairEnergySum[NO_CUTS].fill(TriggerModule.getValueEnergySum(pair));
+                pairEnergyDifference[NO_CUTS].fill(TriggerModule.getValueEnergyDifference(pair));
+                pairEnergySlope[NO_CUTS].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
+                pairCoplanarity[NO_CUTS].fill(TriggerModule.getValueCoplanarity(pair));
+                pairTime[NO_CUTS].fill(pair[1].getCalorimeterHits().get(0).getTime());
+                pairCoincidence[NO_CUTS].fill(TriggerModule.getValueTimeCoincidence(pair));
+                pairEnergySum2D[NO_CUTS].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                if(pair[0].getEnergy() < pair[1].getEnergy()) {
+                    pairEnergySlope2D[NO_CUTS].fill(pair[0].getEnergy(), TriggerModule.getClusterDistance(pair[0]));
+                } else {
+                    pairEnergySlope2D[NO_CUTS].fill(pair[1].getEnergy(), TriggerModule.getClusterDistance(pair[1]));
+                }
+                
+                // Perform the cluster singles cuts.
+                if(!(trigger.clusterHitCountCut(pair[0]) && trigger.clusterHitCountCut(pair[1]))) {
+                    continue pairLoop;
+                } if(!(trigger.clusterTotalEnergyCut(pair[0]) && trigger.clusterTotalEnergyCut(pair[1]))) {
+                    continue pairLoop;
+                } if(!(trigger.clusterSeedEnergyCut(pair[0]) && trigger.clusterSeedEnergyCut(pair[1]))) {
+                    continue pairLoop;
+                }
+                
+                // Perform the cluster pair cuts.
+                if(!trigger.pairCoplanarityCut(pair)) {
+                    continue pairLoop;
+                } if(!trigger.pairEnergyDifferenceCut(pair)) {
+                    continue pairLoop;
+                } if(!trigger.pairEnergySlopeCut(pair)) {
+                    continue pairLoop;
+                } if(!trigger.pairEnergySumCut(pair)) {
+                    continue pairLoop;
+                }
+                
+                // Iterate over the clusters in the pair and plot the
+                // cluster singles distributions.
+                for(int clusterIndex = 0; clusterIndex < 2; clusterIndex++) {
+                    // Only plot cluster singles distributions for
+                    // clusters if they have not already been plotted.
+                    // Note that this is needed because the same cluster
+                    // can appear across multiple pairs.
+                    if(!plottedClustersCut.contains(pair[clusterIndex])) {
+                        clusterSeedEnergy[ALL_CUTS].fill(TriggerModule.getValueClusterSeedEnergy(pair[clusterIndex]));
+                        clusterTotalEnergy[ALL_CUTS].fill(TriggerModule.getValueClusterTotalEnergy(pair[clusterIndex]));
+                        clusterHitCount[ALL_CUTS].fill(TriggerModule.getValueClusterHitCount(pair[clusterIndex]));
+                        clusterDistribution[ALL_CUTS].fill(ix[clusterIndex], iy[clusterIndex]);
+                        clusterTime[ALL_CUTS].fill(pair[clusterIndex].getCalorimeterHits().get(0).getTime());
+                        plottedClustersCut.add(pair[clusterIndex]);
+                    }
+                }
+                
+                // Plot the cluster pair distributions.
+                pairEnergySum[ALL_CUTS].fill(TriggerModule.getValueEnergySum(pair));
+                pairEnergyDifference[ALL_CUTS].fill(TriggerModule.getValueEnergyDifference(pair));
+                pairEnergySlope[ALL_CUTS].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
+                pairCoplanarity[ALL_CUTS].fill(TriggerModule.getValueCoplanarity(pair));
+                pairTime[ALL_CUTS].fill(pair[1].getCalorimeterHits().get(0).getTime());
+                pairCoincidence[ALL_CUTS].fill(TriggerModule.getValueTimeCoincidence(pair));
+                pairEnergySum2D[ALL_CUTS].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                if(pair[0].getEnergy() < pair[1].getEnergy()) {
+                    pairEnergySlope2D[ALL_CUTS].fill(pair[0].getEnergy(), TriggerModule.getClusterDistance(pair[0]));
+                } else {
+                    pairEnergySlope2D[ALL_CUTS].fill(pair[1].getEnergy(), TriggerModule.getClusterDistance(pair[1]));
+                }
+                
+            }
+        }
+    }
+    
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    public void setEnergySlopeParamF(double energySlopeParamF) {
+        this.energySlopeParamF = energySlopeParamF;
+        trigger.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F, energySlopeParamF);
+    }
+    
+    public void setSeedEnergyLow(double value) {
+        trigger.setCutValue(TriggerModule.CLUSTER_SEED_ENERGY_LOW, value);
+    }
+    
+    public void setClusterEnergyLow(double value) {
+        trigger.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW, value);
+    }
+    
+    public void setClusterEnergyHigh(double value) {
+        trigger.setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH, value);
+    }
+    
+    public void setHitCountLow(double value) {
+        trigger.setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW, value);
+    }
+    
+    public void setEnergySumLow(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW, value);
+    }
+    
+    public void setEnergySumHigh(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH, value);
+    }
+    
+    public void setEnergyDifferenceHigh(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, value);
+    }
+    
+    public void setEnergySlopeLow(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW, value);
+    }
+    
+    public void setCoplanarityHigh(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH, value);
+    }
+    
+    public void setTimeCoincidence(double value) {
+        trigger.setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE, value);
+    }
+    
+    /**
+     * Creates all top/bottom pairs from the event data.
+     * @param clusters - A list of clusters from which to form pairs.
+     * @return Returns a <code>List</code> collection that contains
+     * <code>Cluster</code> arrays of size two.
+     */
+    private List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
+        // Separate the clusters into top nad bottom clusters.
+        List<Cluster> topList = new ArrayList<Cluster>();
+        List<Cluster> botList = new ArrayList<Cluster>();
+        for(Cluster cluster : clusters) {
+            if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
+                topList.add(cluster);
+            } else {
+                botList.add(cluster);
+            }
+        }
+        
+        // Create all possible top/bottom cluster pairs.
+        List<Cluster[]> pairList = new ArrayList<Cluster[]>();
+        for(Cluster topCluster : topList) {
+            for(Cluster botCluster : botList) {
+                pairList.add(new Cluster[] { topCluster, botCluster });
+            }
+        }
+        
+        // Return the pairs.
+        return pairList;
+    }
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/RingBuffer.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/RingBuffer.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/RingBuffer.java	Wed Mar  9 11:43:24 2016
@@ -8,46 +8,46 @@
  */
 public class RingBuffer {
 
-	protected double[] array;
-	protected int ptr;
+    protected double[] array;
+    protected int ptr;
 
-	public RingBuffer(int size) {
-		array = new double[size]; //initialized to 0
-		ptr = 0;
-	}
+    public RingBuffer(int size) {
+        array = new double[size]; //initialized to 0
+        ptr = 0;
+    }
 
-	/**
-	 * 
-	 * @return value stored at current cell
-	 */
-	public double currentValue() {
-		return array[ptr];
-	}
+    /**
+     * 
+     * @return value stored at current cell
+     */
+    public double currentValue() {
+        return array[ptr];
+    }
 
-	//return content of specified cell (pos=0 for current cell)
-	public double getValue(int pos) {
-		return array[((ptr + pos) % array.length + array.length) % array.length];
-	}
+    //return content of specified cell (pos=0 for current cell)
+    public double getValue(int pos) {
+        return array[((ptr + pos) % array.length + array.length) % array.length];
+    }
 
-	/**
-	 * Clear value at current cell and step to the next one
-	 */
-	public void step() {
-		array[ptr] = 0;
-		ptr++;
-		if (ptr == array.length) {
-			ptr = 0;
-		}
-	}
+    /**
+     * Clear value at current cell and step to the next one
+     */
+    public void step() {
+        array[ptr] = 0;
+        ptr++;
+        if (ptr == array.length) {
+            ptr = 0;
+        }
+    }
 
-	/**
-	 * Add given value to specified cell
-	 * @param pos Target position relative to current cell (pos=0 for current cell)
-	 * @param val 
-	 */
-	public void addToCell(int pos, double val) {
-		array[(ptr + pos) % array.length] += val;
-	}
+    /**
+     * Add given value to specified cell
+     * @param pos Target position relative to current cell (pos=0 for current cell)
+     * @param val 
+     */
+    public void addToCell(int pos, double val) {
+        array[(ptr + pos) % array.length] += val;
+    }
 
     public int getLength() {
         return array.length;

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TimeEvolutionEcalReadoutDriver.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TimeEvolutionEcalReadoutDriver.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TimeEvolutionEcalReadoutDriver.java	Wed Mar  9 11:43:24 2016
@@ -23,7 +23,7 @@
     double t0 = 18.0;
     
     public TimeEvolutionEcalReadoutDriver() {
-		hitClass = CalorimeterHit.class;
+        hitClass = CalorimeterHit.class;
     }
 
     public void setT0(double t0) {
@@ -39,8 +39,8 @@
     protected void readHits(List<CalorimeterHit> hits) {
         for (Long cellID : eDepMap.keySet()) {
             RingBuffer eDepBuffer = eDepMap.get(cellID);
-            if (eDepBuffer.currentValue() > threshold) {            	            	            	
-            	hits.add(CalorimeterHitUtilities.create(eDepBuffer.currentValue(), readoutTime(), cellID, hitType));
+            if (eDepBuffer.currentValue() > threshold) {                                                
+                hits.add(CalorimeterHitUtilities.create(eDepBuffer.currentValue(), readoutTime(), cellID, hitType));
             }
             eDepBuffer.step();
         }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalCalibrationsDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalCalibrationsDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalCalibrationsDriver.java	Wed Mar  9 11:43:24 2016
@@ -222,9 +222,9 @@
             // Create a new calibration object and add it to the collection, using mean for pedestal
             // and sigma for noise.
             try {
-            	calibrations.add(new EcalCalibration(channelId, mean, sigma));
+                calibrations.add(new EcalCalibration(channelId, mean, sigma));
             } catch (ConditionsObjectException e) {
-            	throw new RuntimeException("Error adding new calibration object.", e);
+                throw new RuntimeException("Error adding new calibration object.", e);
             }
         } 
         

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalConverterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalConverterDriver.java	Wed Mar  9 11:43:24 2016
@@ -17,8 +17,8 @@
  * @version $Id: EcalConverterDriver.java,v 1.1 2013/02/25 22:39:24 meeg Exp $
  */
 public class EcalConverterDriver extends Driver {
-	
-	Detector detector = null;
+    
+    Detector detector = null;
 
     String rawCollectionName;
     String ecalReadoutName = "EcalHits";
@@ -59,7 +59,7 @@
     
     @Override
     public void detectorChanged(Detector detector) {
-    	this.detector = detector;
+        this.detector = detector;
     }
 
     @Override
@@ -87,8 +87,8 @@
     }
 
     private CalorimeterHit HitDtoA(RawCalorimeterHit hit) {
-    	double energy = DtoA(hit.getAmplitude(), hit.getCellID());
-    	return CalorimeterHitUtilities.create(energy, period * hit.getTimeStamp() + dt, hit.getCellID());
+        double energy = DtoA(hit.getAmplitude(), hit.getCellID());
+        return CalorimeterHitUtilities.create(energy, period * hit.getTimeStamp() + dt, hit.getCellID());
     }
 
 //    private RawCalorimeterHit HitAtoD(CalorimeterHit hit) {

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java	Wed Mar  9 11:43:24 2016
@@ -29,11 +29,11 @@
  * @author Holly Szumila <[log in to unmask]>
  */
 public class EcalEdepToTriggerConverterDriver extends Driver {
-	
+    
     private EcalConditions ecalConditions = null;
     
     private static final boolean isBadChannelLoaded = true;
-	
+    
     private final String ecalReadoutName = "EcalHits";
     private String inputCollection = "EcalHits";
     private String readoutCollection = "EcalCalHits";
@@ -94,7 +94,7 @@
 
     @Override
     public void detectorChanged(Detector detector) {
-    	
+        
         // ECAL combined conditions object.
         ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
                 
@@ -104,7 +104,7 @@
     public boolean isBadCrystal(CalorimeterHit hit) {
         // Get the channel data.
         EcalChannelConstants channelData = findChannel(hit.getCellID());
-    	
+        
         return isBadChannelLoaded ? channelData.isBadChannel() : false;
     }
 
@@ -165,8 +165,8 @@
 //        System.out.format("trigger: %f %f\n", amplitude, triggerIntegral);
 
         int truncatedIntegral = (int) Math.floor(triggerIntegral / truncateScale);
-        if (truncatedIntegral > 0) {        	
-        	return CalorimeterHitUtilities.create(truncatedIntegral, hit.getTime(), hit.getCellID());
+        if (truncatedIntegral > 0) {            
+            return CalorimeterHitUtilities.create(truncatedIntegral, hit.getTime(), hit.getCellID());
         }
         return null;
     }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverter.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverter.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverter.java	Wed Mar  9 11:43:24 2016
@@ -27,28 +27,28 @@
     private int nPeak = 3;
     
     public EcalOnlineRawConverter() {
-    	// Track changes in the DAQ configuration.
-    	ConfigurationManager.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// Get the FADC configuration.
-				config = ConfigurationManager.getInstance().getFADCConfig();
-				// Get the number of peaks.
-				if(config.getMode() == 1) nPeak = Integer.MAX_VALUE;
-				else                      nPeak = config.getMaxPulses();
-				// Print the FADC configuration.
-				System.out.println();
-				System.out.println();
-				System.out.printf("NSA            :: %d ns%n", config.getNSA());
-				System.out.printf("NSB            :: %d ns%n", config.getNSB());
-				System.out.printf("Window Samples :: %d clock-cycles%n", config.getWindowWidth());
-				System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
-				System.out.println("======================================================================");
-				System.out.println("=== FADC Pulse-Processing Settings ===================================");
-				System.out.println("======================================================================");
-				config.printConfig(System.out);
-			}
-    	});
+        // Track changes in the DAQ configuration.
+        ConfigurationManager.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // Get the FADC configuration.
+                config = ConfigurationManager.getInstance().getFADCConfig();
+                // Get the number of peaks.
+                if(config.getMode() == 1) nPeak = Integer.MAX_VALUE;
+                else                      nPeak = config.getMaxPulses();
+                // Print the FADC configuration.
+                System.out.println();
+                System.out.println();
+                System.out.printf("NSA            :: %d ns%n", config.getNSA());
+                System.out.printf("NSB            :: %d ns%n", config.getNSB());
+                System.out.printf("Window Samples :: %d clock-cycles%n", config.getWindowWidth());
+                System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
+                System.out.println("======================================================================");
+                System.out.println("=== FADC Pulse-Processing Settings ===================================");
+                System.out.println("======================================================================");
+                config.printConfig(System.out);
+            }
+        });
     }
 
     /**
@@ -137,10 +137,10 @@
                 // search for next threshold crossing begins at end of this pulse:
                 if (ConfigurationManager.getInstance().getFADCConfig().getMode() == 1) {
                     // special case, emulating SSP:
-                	ii += 8;
+                    ii += 8;
                 } else {
                     // "normal" case, emulating FADC250:
-                	ii += config.getNSA()/nsPerSample - 1;
+                    ii += config.getNSA()/nsPerSample - 1;
                 }
 
                 // firmware limit on # of peaks:

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java	Wed Mar  9 11:43:24 2016
@@ -85,12 +85,12 @@
 
     @Override
     public void process(EventHeader event) {
-    	// Do not process the event if the DAQ configuration should be
-    	// used for value, but is not initialized.
-    	if(!ConfigurationManager.isInitialized()) {
-    		return;
-    	}
-    	
+        // Do not process the event if the DAQ configuration should be
+        // used for value, but is not initialized.
+        if(!ConfigurationManager.isInitialized()) {
+            return;
+        }
+        
         double timeOffset = 0.0;
         int flags = 0;
         flags += 1 << LCIOConstants.RCHBIT_TIME; //store hit time
@@ -102,12 +102,12 @@
          * This is for FADC Mode-1 data:    
          */
         if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) {
-        	List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName);
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName);
 
-        	for (RawTrackerHit hit : hits) {
-        		newHits.addAll(converter.HitDtoA(event,hit));
-        	}
-        	event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
+            for (RawTrackerHit hit : hits) {
+                newHits.addAll(converter.HitDtoA(event,hit));
+            }
+            event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
         }
 
         /*
@@ -115,26 +115,26 @@
          */
         if (event.hasCollection(RawCalorimeterHit.class, rawCollectionName)) { 
 
-        	/*
-        	 * This is for FADC Mode-7 data:
-        	 */
-        	if (event.hasCollection(LCRelation.class, extraDataRelationsName)) { // extra information available from mode 7 readout
-        		List<LCRelation> extraDataRelations = event.get(LCRelation.class, extraDataRelationsName);
-        		for (LCRelation rel : extraDataRelations) {
-        			RawCalorimeterHit hit = (RawCalorimeterHit) rel.getFrom();
-        			GenericObject extraData = (GenericObject) rel.getTo();
-        			newHits.add(converter.HitDtoA(event,hit, extraData, timeOffset));
-        		}
-        	} else {
-        		/*
-        		 * This is for FADC Mode-3 data:
-        		 */
-        		List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName);
-        		for (RawCalorimeterHit hit : hits) {
-        			newHits.add(converter.HitDtoA(event, hit, timeOffset));
-        		}
-        	}
-        	event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
+            /*
+             * This is for FADC Mode-7 data:
+             */
+            if (event.hasCollection(LCRelation.class, extraDataRelationsName)) { // extra information available from mode 7 readout
+                List<LCRelation> extraDataRelations = event.get(LCRelation.class, extraDataRelationsName);
+                for (LCRelation rel : extraDataRelations) {
+                    RawCalorimeterHit hit = (RawCalorimeterHit) rel.getFrom();
+                    GenericObject extraData = (GenericObject) rel.getTo();
+                    newHits.add(converter.HitDtoA(event,hit, extraData, timeOffset));
+                }
+            } else {
+                /*
+                 * This is for FADC Mode-3 data:
+                 */
+                List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName);
+                for (RawCalorimeterHit hit : hits) {
+                    newHits.add(converter.HitDtoA(event, hit, timeOffset));
+                }
+            }
+            event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
         }
     }
 

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPedestalCalculator.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPedestalCalculator.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalPedestalCalculator.java	Wed Mar  9 11:43:24 2016
@@ -114,11 +114,11 @@
             }
         }
         if (uploadToDB) {
-        	try {
-        		uploadToDB();
-        	} catch (DatabaseObjectException | ConditionsObjectException | SQLException e) {
-        		throw new RuntimeException("Error uploading to database.", e);
-        	}
+            try {
+                uploadToDB();
+            } catch (DatabaseObjectException | ConditionsObjectException | SQLException e) {
+                throw new RuntimeException("Error uploading to database.", e);
+            }
         } else {
             System.out.println("!!!!!!!!!!!!!!!!!!!!!!! Not Writing Database !!!!!!!!!!!!!!!!!!!!!!!!!!");
         }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java	Wed Mar  9 11:43:24 2016
@@ -41,9 +41,9 @@
  */
 public class EcalRawConverter {
 
-	/**
-	 * If true, time walk correction is performed. 
-	 */
+    /**
+     * If true, time walk correction is performed. 
+     */
     private boolean useTimeWalkCorrection = true;
     
     /**
@@ -149,42 +149,42 @@
      * for trigger emulation.
      */
     public EcalRawConverter() {
-    	// Track changes in the DAQ configuration.
-    	ConfigurationManager.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// If the DAQ configuration should be used, load the
-				// relevant settings into the driver.
-				if(useDAQConfig) {
-					// Get the FADC configuration.
-					config = ConfigurationManager.getInstance().getFADCConfig();
-					
-					// Load the settings.
-					NSB = config.getNSB();
-					NSA = config.getNSA();
-					windowSamples = config.getWindowWidth() / 4;
-					
-					// Get the number of peaks.
-					if(config.getMode() == 1) {
-						nPeak = Integer.MAX_VALUE;
-					} else {
-						nPeak = config.getMaxPulses();
-					}
-					
-					// Print the FADC configuration.
-					System.out.println();
-					System.out.println();
-					System.out.printf("NSA            :: %d ns%n", NSA);
-					System.out.printf("NSB            :: %d ns%n", NSB);
-					System.out.printf("Window Samples :: %d clock-cycles%n", windowSamples);
-					System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
-					System.out.println("======================================================================");
-					System.out.println("=== FADC Pulse-Processing Settings ===================================");
-					System.out.println("======================================================================");
-					config.printConfig(System.out);
-				}
-			}
-    	});
+        // Track changes in the DAQ configuration.
+        ConfigurationManager.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // If the DAQ configuration should be used, load the
+                // relevant settings into the driver.
+                if(useDAQConfig) {
+                    // Get the FADC configuration.
+                    config = ConfigurationManager.getInstance().getFADCConfig();
+                    
+                    // Load the settings.
+                    NSB = config.getNSB();
+                    NSA = config.getNSA();
+                    windowSamples = config.getWindowWidth() / 4;
+                    
+                    // Get the number of peaks.
+                    if(config.getMode() == 1) {
+                        nPeak = Integer.MAX_VALUE;
+                    } else {
+                        nPeak = config.getMaxPulses();
+                    }
+                    
+                    // Print the FADC configuration.
+                    System.out.println();
+                    System.out.println();
+                    System.out.printf("NSA            :: %d ns%n", NSA);
+                    System.out.printf("NSB            :: %d ns%n", NSB);
+                    System.out.printf("Window Samples :: %d clock-cycles%n", windowSamples);
+                    System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
+                    System.out.println("======================================================================");
+                    System.out.println("=== FADC Pulse-Processing Settings ===================================");
+                    System.out.println("======================================================================");
+                    config.printConfig(System.out);
+                }
+            }
+        });
     }
     
  
@@ -313,7 +313,7 @@
      * for trigger emulation.
      */
     public void setUseDAQConfig(boolean state) {
-    	useDAQConfig = state;
+        useDAQConfig = state;
     }
     
 
@@ -325,10 +325,10 @@
         EcalChannelConstants channelData = findChannel(hit.getCellID());
         double pedestal;
         if(useDAQConfig) {
-    		//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
-    		pedestal = config.getPedestal(hit.getCellID());
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
+            pedestal = config.getPedestal(hit.getCellID());
         } else {
-        	pedestal = channelData.getCalibration().getPedestal();
+            pedestal = channelData.getCalibration().getPedestal();
         }
         
         int sum = 0;
@@ -356,10 +356,10 @@
      * Choose whether to use static pedestal from database or running pedestal from mode-7.
      */
     public double getSingleSamplePedestal(EventHeader event,long cellID) {
-    	if(useDAQConfig) {
-    		//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(cellID);
-    		return config.getPedestal(cellID);
-    	}
+        if(useDAQConfig) {
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(cellID);
+            return config.getPedestal(cellID);
+        }
         if (useRunningPedestal && event!=null) {
             if (event.hasItem("EcalRunningPedestals")) {
                 Map<EcalChannel, Double> runningPedMap = (Map<EcalChannel, Double>) event.get("EcalRunningPedestals");
@@ -536,12 +536,12 @@
         // threshold is pedestal plus threshold configuration parameter:
         final int absoluteThreshold;
         if(useDAQConfig) {
-        	//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
-        	//int leadingEdgeThreshold = ConfigurationManager.getInstance().getFADCConfig().getThreshold(channel.getChannelId());
-        	int leadingEdgeThreshold = config.getThreshold(cellID);
-        	absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
+            //int leadingEdgeThreshold = ConfigurationManager.getInstance().getFADCConfig().getThreshold(channel.getChannelId());
+            int leadingEdgeThreshold = config.getThreshold(cellID);
+            absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
         } else {
-        	absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
+            absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
         }
         
         ArrayList <Integer> thresholdCrossings = new ArrayList<Integer>();
@@ -562,10 +562,10 @@
                 // search for next threshold crossing begins at end of this pulse:
                 if(useDAQConfig && ConfigurationManager.getInstance().getFADCConfig().getMode() == 1) {
                     // special case, emulating SSP:
-                	ii += 8;
+                    ii += 8;
                 } else {
                     // "normal" case, emulating FADC250:
-                	ii += NSA/nsPerSample - 1;
+                    ii += NSA/nsPerSample - 1;
                 }
 
                 // firmware limit on # of peaks:
@@ -674,8 +674,8 @@
         EcalChannelConstants channelData = findChannel(cellID);
         
         if(useDAQConfig) {
-        	//float gain = ConfigurationManager.getInstance().getFADCConfig().getGain(ecalConditions.getChannelCollection().findGeometric(cellID));
-        	return config.getGain(cellID) * adcSum * EcalUtils.MeV;
+            //float gain = ConfigurationManager.getInstance().getFADCConfig().getGain(ecalConditions.getChannelCollection().findGeometric(cellID));
+            return config.getGain(cellID) * adcSum * EcalUtils.MeV;
         }  else if(use2014Gain) {
             if (constantGain) {
                 return adcSum * EcalUtils.gainFactor * EcalUtils.ecalReadoutPeriod;

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java	Wed Mar  9 11:43:24 2016
@@ -380,8 +380,8 @@
      * conditions database.
      */
     public void setUseDAQConfig(boolean state) {
-    	useDAQConfig = state;
-    	converter.setUseDAQConfig(state);
+        useDAQConfig = state;
+        converter.setUseDAQConfig(state);
     }
 
     @Override
@@ -437,12 +437,12 @@
 
     @Override
     public void process(EventHeader event) {
-    	// Do not process the event if the DAQ configuration should be
-    	// used for value, but is not initialized.
-    	if(useDAQConfig && !ConfigurationManager.isInitialized()) {
-    		return;
-    	}
-    	
+        // Do not process the event if the DAQ configuration should be
+        // used for value, but is not initialized.
+        if(useDAQConfig && !ConfigurationManager.isInitialized()) {
+            return;
+        }
+        
         final int SYSTEM_TRIGGER = 0;
 //        final int SYSTEM_TRACKER = 1;
         final int SYSTEM_ECAL = 2;

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTimeWalk.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTimeWalk.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTimeWalk.java	Wed Mar  9 11:43:24 2016
@@ -39,11 +39,11 @@
      * Time walk parameters for pulse fitting
      */
     private static final double[] par = {
-    	0.9509,
-    	-33.21,
-    	0.2614,
-    	-0.9128,
-    	0.6251
+        0.9509,
+        -33.21,
+        0.2614,
+        -0.9128,
+        0.6251
    };
     
     /**
@@ -53,9 +53,9 @@
      * @return corrected time (ns)
      */
     public static final double correctTimeWalkPulseFitting(double time, double energy) {
-    	final double polyA = par[0] + par[1]*energy;
-    	final double polyB = par[2] + par[3] * energy + par[4] * Math.pow(energy, 2);
-    	return time - (Math.exp(polyA) + polyB);
+        final double polyA = par[0] + par[1]*energy;
+        final double polyB = par[2] + par[3] * energy + par[4] * Math.pow(energy, 2);
+        return time - (Math.exp(polyA) + polyB);
     }
     
     

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java	Wed Mar  9 11:43:24 2016
@@ -26,15 +26,15 @@
  */
 
 public class IterateGainFactorDriver extends Driver {
-	
-	private EcalConditions ecalConditions  = null;
-		
-	/**
+    
+    private EcalConditions ecalConditions  = null;
+        
+    /**
      * Set the input collection name (source).
      *
      * @param inputCollectionName the input collection name
      */
-	private String inputCollectionName = "EcalCalHits";
+    private String inputCollectionName = "EcalCalHits";
     public void setInputCollectionName(final String inputCollectionName) {
         this.inputCollectionName = inputCollectionName;
     }
@@ -116,14 +116,14 @@
      * @return the output hit collection with gain corrected energies
      */
     public List<CalorimeterHit> iterateHits(final List<CalorimeterHit> hits) {
-    	ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>();
+        ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>();
         for (final CalorimeterHit hit : hits) {
-        	double time = hit.getTime();        	
-        	long cellID = hit.getCellID();
-        	double energy = hit.getCorrectedEnergy()*gainFileGains.get(findChannelId(cellID));
-        	CalorimeterHit newHit = CalorimeterHitUtilities.create(energy, time, cellID);
-        	newHits.add(newHit);	
-        	
+            double time = hit.getTime();            
+            long cellID = hit.getCellID();
+            double energy = hit.getCorrectedEnergy()*gainFileGains.get(findChannelId(cellID));
+            CalorimeterHit newHit = CalorimeterHitUtilities.create(energy, time, cellID);
+            newHits.add(newHit);    
+            
         }
         return newHits;
     }
@@ -134,26 +134,26 @@
      */
     @Override
     public void process(final EventHeader event) {
-    	readGainFile();
-    	
-    	        // Check if output collection already exists in event which is an error.
+        readGainFile();
+        
+                // Check if output collection already exists in event which is an error.
         if (event.hasItem(outputCollectionName)) {
             throw new RuntimeException("collection " + outputCollectionName + " already exists in event");
         }
 
         // Get the input collection.
         if (event.hasCollection(CalorimeterHit.class,inputCollectionName)){
-        	final List<CalorimeterHit> inputHitCollection = event.get(CalorimeterHit.class, inputCollectionName);
+            final List<CalorimeterHit> inputHitCollection = event.get(CalorimeterHit.class, inputCollectionName);
 
-        	// Iterate the gain correction coefficient on each hit.
-        	final List<CalorimeterHit> outputHitCollection = this.iterateHits(inputHitCollection);
-        	
+            // Iterate the gain correction coefficient on each hit.
+            final List<CalorimeterHit> outputHitCollection = this.iterateHits(inputHitCollection);
+            
             int flags = 0;
             flags += 1 << LCIOConstants.RCHBIT_TIME; //store hit time
             flags += 1 << LCIOConstants.RCHBIT_LONG; //store hit position; this flag has no effect for RawCalorimeterHits
-        	
-        	// Put the collection into the event.
-        	event.put(outputCollectionName, outputHitCollection, CalorimeterHit.class, flags, ecalReadoutName);
+            
+            // Put the collection into the event.
+            event.put(outputCollectionName, outputHitCollection, CalorimeterHit.class, flags, ecalReadoutName);
         }
     }
    

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterEnergyCorrection.java	Wed Mar  9 11:43:24 2016
@@ -19,9 +19,9 @@
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public final class ClusterEnergyCorrection {
-	
-	// Variables for electron energy corrections.
-	static final double par0_em = -0.017;
+    
+    // Variables for electron energy corrections.
+    static final double par0_em = -0.017;
     static final double par1_em[] = {35,-0.06738,-0.0005613,16.42,0.3431,-2.021,74.85,-0.3626};
     static final double par2_em[] = {35, 0.933, 0.003234, 18.06, 0.24, 8.586, 75.08, -0.39};
 
@@ -84,55 +84,55 @@
     
     private static double computeCorrectedEnergy(HPSEcal3 ecal, int pdg, double rawEnergy, double xpos, double ypos) {
         //distance to beam gap edge
-    	double r;
-    	//Get these values from the Ecal geometry:
-    	HPSEcalDetectorElement detElement = (HPSEcalDetectorElement) ecal.getDetectorElement();
+        double r;
+        //Get these values from the Ecal geometry:
+        HPSEcalDetectorElement detElement = (HPSEcalDetectorElement) ecal.getDetectorElement();
 //        double BEAMGAPTOP = 22.3;//ecal.getNode().getChild("layout").getAttribute("beamgapTop").getDoubleValue();//mm
         double BEAMGAPTOP=20.0;
-		try {
-			BEAMGAPTOP = ecal.getNode().getChild("layout").getAttribute("beamgapTop").getDoubleValue();
-		} catch (DataConversionException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}//mm
+        try {
+            BEAMGAPTOP = ecal.getNode().getChild("layout").getAttribute("beamgapTop").getDoubleValue();
+        } catch (DataConversionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }//mm
         double BEAMGAPBOT=-20.0;
-		try {
-			BEAMGAPBOT = -ecal.getNode().getChild("layout").getAttribute("beamgapBottom").getDoubleValue();
-		} catch (DataConversionException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}//mm
+        try {
+            BEAMGAPBOT = -ecal.getNode().getChild("layout").getAttribute("beamgapBottom").getDoubleValue();
+        } catch (DataConversionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }//mm
         double BEAMGAPTOPC = BEAMGAPTOP + 13.0;//mm
         double BEAMGAPBOTC = BEAMGAPBOT - 13.0;//mm
-    	// x-coordinates of crystals on either side of row 1 cut out
+        // x-coordinates of crystals on either side of row 1 cut out
         EcalCrystal crystalM = detElement.getCrystal(-11, 1);
         Hep3Vector posM = crystalM.getPositionFront();
         EcalCrystal crystalP = detElement.getCrystal(-1, 1);
         Hep3Vector posP = crystalP.getPositionFront();
                
-    	if ((xpos<posM.x())||(xpos>posP.x())){
-        	if (ypos>0){
-        		r = Math.abs(ypos-BEAMGAPTOP);}    		
-        	else{
-        		r = Math.abs(ypos-BEAMGAPBOT);}
+        if ((xpos<posM.x())||(xpos>posP.x())){
+            if (ypos>0){
+                r = Math.abs(ypos-BEAMGAPTOP);}         
+            else{
+                r = Math.abs(ypos-BEAMGAPBOT);}
         }
-    	// crystals above row 1 cut out
+        // crystals above row 1 cut out
         else {
-        	if (ypos>0){
-        		if (ypos>(par1_em[0]+BEAMGAPTOP)){
-            		r = Math.abs(ypos-BEAMGAPTOP);}
-        		else{
-            		r = Math.abs(ypos-BEAMGAPTOPC);}
-        	}
-        	else {
-        		if (ypos>(-par1_em[0]+BEAMGAPBOT)){
-        			r = Math.abs(ypos-BEAMGAPBOTC);}
-        		else {
-        			r = Math.abs(ypos-BEAMGAPBOT);}
-        	}
+            if (ypos>0){
+                if (ypos>(par1_em[0]+BEAMGAPTOP)){
+                    r = Math.abs(ypos-BEAMGAPTOP);}
+                else{
+                    r = Math.abs(ypos-BEAMGAPTOPC);}
+            }
+            else {
+                if (ypos>(-par1_em[0]+BEAMGAPBOT)){
+                    r = Math.abs(ypos-BEAMGAPBOTC);}
+                else {
+                    r = Math.abs(ypos-BEAMGAPBOT);}
+            }
         }
-    	   	
-    	switch(pdg) {
+            
+        switch(pdg) {
             case 11: 
                 // electron             
                 return computeCorrectedEnergy(r, rawEnergy, par0_em, par1_em, par2_em);
@@ -158,8 +158,8 @@
      */   
     private static double computeCorrectedEnergy(double y, double rawEnergy, double varA, double varB[], double varC[]){
         int ii = y<varB[0] ? 2 : 5;
-    	double corrEnergy = rawEnergy / (varA / rawEnergy + (varB[1]-varB[ii]*Math.exp(-(y-varB[ii+1])*varB[ii+2])) / (Math.sqrt(rawEnergy)) + 
-    			(varC[1]-varC[ii]*Math.exp(-(y-varC[ii+1])*varC[ii+2])));
+        double corrEnergy = rawEnergy / (varA / rawEnergy + (varB[1]-varB[ii]*Math.exp(-(y-varB[ii+1])*varB[ii+2])) / (Math.sqrt(rawEnergy)) + 
+                (varC[1]-varC[ii]*Math.exp(-(y-varC[ii+1])*varC[ii+2])));
         return corrEnergy;
     }                   
 }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterPositionCorrection.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterPositionCorrection.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterPositionCorrection.java	Wed Mar  9 11:43:24 2016
@@ -95,6 +95,6 @@
     */    
     private static double positionCorrection(double xCl, double rawEnergy, double varA1, double varA2, double varB1, double varB2, double varB3) {
         //return ((xCl - (varB1 * rawEnergy + varB2 / Math.sqrt(rawEnergy) + varB3))/(varA1 / Math.sqrt(rawEnergy) + varA2 + 1));
-    	return ((xCl - (varB1 * rawEnergy + varB2 / Math.sqrt(rawEnergy) + varB3))/(varA1 / Math.sqrt(rawEnergy) + varA2 + 1));
+        return ((xCl - (varB1 * rawEnergy + varB2 / Math.sqrt(rawEnergy) + varB3))/(varA1 / Math.sqrt(rawEnergy) + varA2 + 1));
     }
 }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterDriver.java	Wed Mar  9 11:43:24 2016
@@ -22,8 +22,8 @@
  * @see GTPClusterer
  */
 public class GTPClusterDriver extends ClusterDriver {
-	/** An instance of the clustering algorithm object for producing
-	 * cluster objects. */
+    /** An instance of the clustering algorithm object for producing
+     * cluster objects. */
     private final GTPClusterer gtp;
     
     /**
@@ -112,11 +112,11 @@
      */
     @Override
     public void setWriteClusterCollection(boolean state) {
-    	// Set the flag as appropriate with the superclass.
-    	super.setWriteClusterCollection(state);
-    	
-    	// Also tell the clusterer whether it should persist its hit
-    	// collection or not.
-    	gtp.setWriteHitCollection(state);
+        // Set the flag as appropriate with the superclass.
+        super.setWriteClusterCollection(state);
+        
+        // Also tell the clusterer whether it should persist its hit
+        // collection or not.
+        gtp.setWriteHitCollection(state);
     }
 }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterer.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterer.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPClusterer.java	Wed Mar  9 11:43:24 2016
@@ -146,24 +146,24 @@
         // stored in LCIO format properly, it needs to separately store
         // its clusters' hits in a collection.
         if(writeHitCollection) {
-        	// Create a set to store the hits so that each one may be
-        	// stored only once.
-	        Set<CalorimeterHit> hitSet = new HashSet<CalorimeterHit>();
-	        
-	        // Loop over all clusters and add their hits to the set.
-	        for(Cluster cluster : clusterList) {
-	        	for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
-	        		hitSet.add(hit);
-	        	}
-	        }
-	        
-	        // Convert the set into a List object so that it can be stored
-	        // in LCIO.
-	        List<CalorimeterHit> clusterHits = new ArrayList<CalorimeterHit>(hitSet.size());
-	        clusterHits.addAll(hitSet);
-	        
-	        // Place the list of hits into the event stream.
-	        event.put("GTPHits", hits, CalorimeterHit.class, 0);
+            // Create a set to store the hits so that each one may be
+            // stored only once.
+            Set<CalorimeterHit> hitSet = new HashSet<CalorimeterHit>();
+            
+            // Loop over all clusters and add their hits to the set.
+            for(Cluster cluster : clusterList) {
+                for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
+                    hitSet.add(hit);
+                }
+            }
+            
+            // Convert the set into a List object so that it can be stored
+            // in LCIO.
+            List<CalorimeterHit> clusterHits = new ArrayList<CalorimeterHit>(hitSet.size());
+            clusterHits.addAll(hitSet);
+            
+            // Place the list of hits into the event stream.
+            event.put("GTPHits", hits, CalorimeterHit.class, 0);
         }
         
         // Return the clusters.
@@ -260,7 +260,7 @@
      * should not.
      */
     void setVerbose(boolean verbose) {
-    	this.verbose = verbose;
+        this.verbose = verbose;
     }
     
     /**
@@ -271,7 +271,7 @@
      * persisted and <code>false</code> that they will not.
      */
     void setWriteHitCollection(boolean state) {
-    	writeHitCollection = state;
+        writeHitCollection = state;
     }
     
 /**
@@ -291,7 +291,7 @@
     
     // VERBOSE :: Print the cluster window.
     if(verbose) {
-    	// Print the event header.
+        // Print the event header.
         System.out.printf("%n%nEvent:%n");
         
         // Calculate some constants.
@@ -304,9 +304,9 @@
             CalorimeterHit hit = null;
             
             for(Entry<Long, CalorimeterHit> entry : bufferMap.entrySet()) {
-            	hit = entry.getValue();
-            	System.out.printf("\t(%3d, %3d) --> %.4f (%.4f)%n", hit.getIdentifierFieldValue("ix"),
-            			hit.getIdentifierFieldValue("iy"), hit.getCorrectedEnergy(), hit.getRawEnergy());
+                hit = entry.getValue();
+                System.out.printf("\t(%3d, %3d) --> %.4f (%.4f)%n", hit.getIdentifierFieldValue("ix"),
+                        hit.getIdentifierFieldValue("iy"), hit.getCorrectedEnergy(), hit.getRawEnergy());
             }
             
             bufferNum++;
@@ -327,8 +327,8 @@
         // VERBOSE :: Print the current cluster.
         if(verbose) {
             System.out.printf("Cluster Check:%n");
-        	System.out.printf("\t(%3d, %3d) --> %.4f%n", currentHit.getIdentifierFieldValue("ix"),
-        			currentHit.getIdentifierFieldValue("iy"), currentHit.getCorrectedEnergy());
+            System.out.printf("\t(%3d, %3d) --> %.4f%n", currentHit.getIdentifierFieldValue("ix"),
+                    currentHit.getIdentifierFieldValue("iy"), currentHit.getCorrectedEnergy());
         }
         
         // Store the energy of the current hit.
@@ -337,11 +337,11 @@
         // If the hit energy is lower than the minimum threshold,
         // then we immediately reject this hit as a possible cluster.
         if (currentEnergy < seedEnergyThreshold) {
-        	// VERBOSE :: Note the reason the potential seed was
-        	//            rejected.
-        	if(verbose) { System.out.printf("\tREJECT :: Does not exceed seed threshold %.4f.%n", seedEnergyThreshold); }
-        	
-        	// Skip to the next potential seed.
+            // VERBOSE :: Note the reason the potential seed was
+            //            rejected.
+            if(verbose) { System.out.printf("\tREJECT :: Does not exceed seed threshold %.4f.%n", seedEnergyThreshold); }
+            
+            // Skip to the next potential seed.
             continue seedLoop;
         }
         
@@ -368,16 +368,16 @@
                 // is larger than then original hit. If it is, we may
                 // stop the comparison because this is not a cluster.
                 if (bufferHitEnergy > currentEnergy) {
-                	// VERBOSE :: Output the reason the potential
-                	//            seed was rejected along with the
-                	//            hit that caused it.
-                	if(verbose) {
-                    	System.out.printf("\tREJECT :: Buffer hit surpasses hit energy.");
-                    	System.out.printf("\tBUFFER HIT :: (%3d, %3d) --> %.4f%n", bufferHit.getIdentifierFieldValue("ix"),
-                    			bufferHit.getIdentifierFieldValue("iy"), bufferHit.getCorrectedEnergy(), bufferHit.getRawEnergy());
-                	}
-                	
-                	// Skip to the next potential seed.
+                    // VERBOSE :: Output the reason the potential
+                    //            seed was rejected along with the
+                    //            hit that caused it.
+                    if(verbose) {
+                        System.out.printf("\tREJECT :: Buffer hit surpasses hit energy.");
+                        System.out.printf("\tBUFFER HIT :: (%3d, %3d) --> %.4f%n", bufferHit.getIdentifierFieldValue("ix"),
+                                bufferHit.getIdentifierFieldValue("iy"), bufferHit.getCorrectedEnergy(), bufferHit.getRawEnergy());
+                    }
+                    
+                    // Skip to the next potential seed.
                     continue seedLoop;
                 }
                 
@@ -403,16 +403,16 @@
                     // If it is, we may stop the comparison because this
                     // is not a cluster.
                     if (neighborHitEnergy > currentEnergy) {
-                    	// VERBOSE :: Output the reason the potential
-                    	//            seed was rejected along with the
-                    	//            hit that caused it.
-                    	if(verbose) {
-                        	System.out.printf("\tREJECT :: Buffer hit surpasses hit energy.%n");
-                        	System.out.printf("\tBUFFER HIT :: (%3d, %3d) --> %.4f%n", neighborHit.getIdentifierFieldValue("ix"),
-                        			neighborHit.getIdentifierFieldValue("iy"), neighborHit.getCorrectedEnergy(), neighborHit.getRawEnergy());
-                    	}
-                    	
-                    	// Skip to the next potential seed.
+                        // VERBOSE :: Output the reason the potential
+                        //            seed was rejected along with the
+                        //            hit that caused it.
+                        if(verbose) {
+                            System.out.printf("\tREJECT :: Buffer hit surpasses hit energy.%n");
+                            System.out.printf("\tBUFFER HIT :: (%3d, %3d) --> %.4f%n", neighborHit.getIdentifierFieldValue("ix"),
+                                    neighborHit.getIdentifierFieldValue("iy"), neighborHit.getCorrectedEnergy(), neighborHit.getRawEnergy());
+                        }
+                        
+                        // Skip to the next potential seed.
                         continue seedLoop;
                     }
                     
@@ -436,10 +436,10 @@
         if(verbose) {
             System.out.printf("Cluster added.%n");
             System.out.printf("\t(%3d, %3d) --> %.4f GeV --> %d hits%n", cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
-            		cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"), cluster.getEnergy(), cluster.getCalorimeterHits().size());
+                    cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"), cluster.getEnergy(), cluster.getCalorimeterHits().size());
             for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
-            	System.out.printf("\t\tCLUSTER HIT :: (%3d, %3d) --> %.4f%n", hit.getIdentifierFieldValue("ix"),
-            			hit.getIdentifierFieldValue("iy"), hit.getCorrectedEnergy(), hit.getRawEnergy());
+                System.out.printf("\t\tCLUSTER HIT :: (%3d, %3d) --> %.4f%n", hit.getIdentifierFieldValue("ix"),
+                        hit.getIdentifierFieldValue("iy"), hit.getCorrectedEnergy(), hit.getRawEnergy());
             }
         }
     }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	Wed Mar  9 11:43:24 2016
@@ -39,8 +39,8 @@
  * @see org.hps.record.daqconfig.DAQConfigDriver
  */
 public class GTPOnlineClusterDriver extends ClusterDriver {
-	/** An instance of the clustering algorithm object for producing
-	 * cluster objects. */
+    /** An instance of the clustering algorithm object for producing
+     * cluster objects. */
     private final GTPOnlineClusterer gtp;
     /** Indicates whether the <code>ConfigurationManager</code> object
      * should be used for clustering settings or not. */
@@ -53,29 +53,29 @@
      * @see GTPOnlineClusterer
      */
     public GTPOnlineClusterDriver() {
-    	// Instantiate the clusterer.
+        // Instantiate the clusterer.
         clusterer = ClustererFactory.create("GTPOnlineClusterer");
         gtp = (GTPOnlineClusterer) clusterer;
         
         // Track the DAQ configuration status.
         ConfigurationManager.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// If DAQ configuration settings should be used, then
-				// update the clusterer.
-				if(useDAQConfig) {
-					// Get the GTP settings.
-					GTPConfig config = ConfigurationManager.getInstance().getGTPConfig();
-					
-					// Send the DAQ configuration settings to the clusterer.
-					gtp.setSeedLowThreshold(config.getSeedEnergyCutConfig().getLowerBound());
-					gtp.setWindowAfter(config.getTimeWindowAfter());
-					gtp.setWindowBefore(config.getTimeWindowBefore());
-					
-					// Print the updated settings.
-					logSettings();
-				}
-			}
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // If DAQ configuration settings should be used, then
+                // update the clusterer.
+                if(useDAQConfig) {
+                    // Get the GTP settings.
+                    GTPConfig config = ConfigurationManager.getInstance().getGTPConfig();
+                    
+                    // Send the DAQ configuration settings to the clusterer.
+                    gtp.setSeedLowThreshold(config.getSeedEnergyCutConfig().getLowerBound());
+                    gtp.setWindowAfter(config.getTimeWindowAfter());
+                    gtp.setWindowBefore(config.getTimeWindowBefore());
+                    
+                    // Print the updated settings.
+                    logSettings();
+                }
+            }
         });
     }
     
@@ -90,11 +90,11 @@
      */
     @Override
     public void process(EventHeader event) {
-    	// Only process an event if either the DAQ configuration is not
-    	// in use or if it has been initialized.
-    	if((useDAQConfig && ConfigurationManager.isInitialized()) || !useDAQConfig) {
-    		super.process(event);
-    	}
+        // Only process an event if either the DAQ configuration is not
+        // in use or if it has been initialized.
+        if((useDAQConfig && ConfigurationManager.isInitialized()) || !useDAQConfig) {
+            super.process(event);
+        }
     }
     
     /**
@@ -103,8 +103,8 @@
      */
     @Override
     public void startOfData() {
-    	// VERBOSE :: Output the driver settings.
-    	if(gtp.isVerbose()) { logSettings(); }
+        // VERBOSE :: Output the driver settings.
+        if(gtp.isVerbose()) { logSettings(); }
     }
     
     /**
@@ -168,23 +168,23 @@
      * @see org.hps.record.daqconfig.DAQConfigDriver
      */
     public void setUseDAQConfig(boolean state) {
-    	useDAQConfig = state;
+        useDAQConfig = state;
     }
     
     /**
      * Outputs the current GTP settings to the terminal.
      */
     private void logSettings() {
-		// Print the cluster driver header.
-		System.out.println();
-		System.out.println();
-		System.out.println("======================================================================");
-		System.out.println("=== GTP Readout Clusterer Settings ===================================");
-		System.out.println("======================================================================");
-		
-		// Output the driver settings.
-		System.out.printf("Seed Energy Threshold :: %.3f GeV%n", gtp.getSeedLowThreshold());
-		System.out.printf("Time Window (Before)  :: %.0f ns%n", gtp.getWindowBefore());
-		System.out.printf("Time Window (After)   :: %.0f ns%n", gtp.getWindowAfter());
+        // Print the cluster driver header.
+        System.out.println();
+        System.out.println();
+        System.out.println("======================================================================");
+        System.out.println("=== GTP Readout Clusterer Settings ===================================");
+        System.out.println("======================================================================");
+        
+        // Output the driver settings.
+        System.out.printf("Seed Energy Threshold :: %.3f GeV%n", gtp.getSeedLowThreshold());
+        System.out.printf("Time Window (Before)  :: %.0f ns%n", gtp.getWindowBefore());
+        System.out.printf("Time Window (After)   :: %.0f ns%n", gtp.getWindowAfter());
     }
 }

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java	Wed Mar  9 11:43:24 2016
@@ -69,10 +69,10 @@
  * @see GTPClusterer
  */
 public class GTPOnlineClusterer extends AbstractClusterer {
-	/**
-	 * The length of the temporal window for inclusing clusters that
-	 * occur before the seed hit.
-	 */
+    /**
+     * The length of the temporal window for inclusing clusters that
+     * occur before the seed hit.
+     */
     private double timeBefore = 4;
     
     /**
@@ -128,29 +128,29 @@
      */
     @Override
     public List<Cluster> createClusters(EventHeader event, List<CalorimeterHit> hitList) {
-    	// VERBOSE :: Print the driver header.
-    	if(verbose) {
-    		System.out.println();
-    		System.out.println();
-    		System.out.println("======================================================================");
-    		System.out.println("=== GTP Readout Clusterer ============================================");
-    		System.out.println("======================================================================");
-    		
-    		// Sort the hits by x-index and then by y-index.
-        	Collections.sort(hitList, new Comparator<CalorimeterHit>() {
-				@Override
-				public int compare(CalorimeterHit firstHit, CalorimeterHit secondHit) {
-					int[] ix = { firstHit.getIdentifierFieldValue("ix"), secondHit.getIdentifierFieldValue("ix") };
-					if(ix[0] != ix[1]) { return Integer.compare(ix[0], ix[1]); }
-					else {
-						int iy[] = { firstHit.getIdentifierFieldValue("iy"), secondHit.getIdentifierFieldValue("iy") };
-						return Integer.compare(iy[0], iy[1]);
-					}
-				}
-        	});
-        	
-        	// Print the hit collection.
-        	System.out.println("Event Hit Collection:");
+        // VERBOSE :: Print the driver header.
+        if(verbose) {
+            System.out.println();
+            System.out.println();
+            System.out.println("======================================================================");
+            System.out.println("=== GTP Readout Clusterer ============================================");
+            System.out.println("======================================================================");
+            
+            // Sort the hits by x-index and then by y-index.
+            Collections.sort(hitList, new Comparator<CalorimeterHit>() {
+                @Override
+                public int compare(CalorimeterHit firstHit, CalorimeterHit secondHit) {
+                    int[] ix = { firstHit.getIdentifierFieldValue("ix"), secondHit.getIdentifierFieldValue("ix") };
+                    if(ix[0] != ix[1]) { return Integer.compare(ix[0], ix[1]); }
+                    else {
+                        int iy[] = { firstHit.getIdentifierFieldValue("iy"), secondHit.getIdentifierFieldValue("iy") };
+                        return Integer.compare(iy[0], iy[1]);
+                    }
+                }
+            });
+            
+            // Print the hit collection.
+            System.out.println("Event Hit Collection:");
             for(CalorimeterHit hit : hitList) {
                 int ix = hit.getIdentifierFieldValue("ix");
                 int iy = hit.getIdentifierFieldValue("iy");
@@ -161,7 +161,7 @@
             }
             System.out.println();
         }
-    	
+        
         // Track the valid clusters.
         List<Cluster> clusterList = new ArrayList<Cluster>();
         
@@ -183,10 +183,10 @@
         // Iterate over each hit and see if it qualifies as a seed hit.
         seedLoop:
             for(CalorimeterHit seed : hitList) {
-            	// Put the hit energy into the hit energy distribution.
-            	hitEnergy.fill(seed.getCorrectedEnergy());
-            	hitDistribution.fill(seed.getIdentifierFieldValue("ix"), seed.getIdentifierFieldValue("iy"));
-            	
+                // Put the hit energy into the hit energy distribution.
+                hitEnergy.fill(seed.getCorrectedEnergy());
+                hitDistribution.fill(seed.getIdentifierFieldValue("ix"), seed.getIdentifierFieldValue("iy"));
+                
                 // Check whether the potential seed passes the seed
                 // energy cut.
                 if(seed.getCorrectedEnergy() < seedThreshold) {
@@ -204,16 +204,16 @@
                 // energies.
                 hitLoop:
                 for(CalorimeterHit hit : hitList) {
-                	// Negative energy hits are never valid. Skip them.
-                	if(hit.getCorrectedEnergy() < 0) {
-                		continue hitLoop;
-                	}
-                	
-                	// Do not compare the potential seed hit to itself.
-                	if(hit == seed) {
-                		continue hitLoop;
-                	}
-                	
+                    // Negative energy hits are never valid. Skip them.
+                    if(hit.getCorrectedEnergy() < 0) {
+                        continue hitLoop;
+                    }
+                    
+                    // Do not compare the potential seed hit to itself.
+                    if(hit == seed) {
+                        continue hitLoop;
+                    }
+                    
                     // Check if the hit is within the spatiotemporal
                     // clustering window.
                     if(withinTimeVerificationWindow(seed, hit) && withinSpatialWindow(seed, hit)) {
@@ -246,25 +246,25 @@
                 clusterTotalEnergy.fill(protoCluster.getEnergy());
                 clusterHitCount.fill(protoCluster.getCalorimeterHits().size());
                 clusterDistribution.fill(protoCluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
-                		protoCluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
+                        protoCluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
                 
                 // Determine how much energy in the cluster is negative
                 // and how is positive.
                 double nenergy = 0.0;
                 double penergy = 0.0;
                 for(CalorimeterHit hit : protoCluster.getCalorimeterHits()) {
-                	if(hit.getCorrectedEnergy() > 0) { penergy += hit.getCorrectedEnergy(); }
-                	else { nenergy += hit.getCorrectedEnergy(); }
+                    if(hit.getCorrectedEnergy() > 0) { penergy += hit.getCorrectedEnergy(); }
+                    else { nenergy += hit.getCorrectedEnergy(); }
                 }
                 energyDistribution.fill(Math.abs(nenergy) / (penergy + Math.abs(nenergy)));
             }
         
         // VERBOSE :: Print out all the clusters in the event.
         if(verbose) {
-        	// Print the clusters.
-        	System.out.println("Event Cluster Collection:");
+            // Print the clusters.
+            System.out.println("Event Cluster Collection:");
             for(Cluster cluster : clusterList) {
-            	// Output basic cluster positional and energy data.
+                // Output basic cluster positional and energy data.
                 CalorimeterHit seedHit = cluster.getCalorimeterHits().get(0);
                 int ix = seedHit.getIdentifierFieldValue("ix");
                 int iy = seedHit.getIdentifierFieldValue("iy");
@@ -281,7 +281,7 @@
                     System.out.printf("\t\tCompHit --> %.3f GeV at (%3d, %3d) and at t = %.2f%n", henergy, hix, hiy, htime);
                 }
             }
-        	System.out.println();
+            System.out.println();
         }
         
         // VERBOSE :: Print a new line.
@@ -366,11 +366,11 @@
      * the seed hit in clock cycles.
      */
     void setWindowBefore(int cyclesBefore) {
-    	// The cluster window can not be negative.
-    	if(cyclesBefore < 0) { cyclesBefore = 0; }
-    	
-    	// Convert the window to nanoseconds and set the two time
-    	// windows appropriately.
+        // The cluster window can not be negative.
+        if(cyclesBefore < 0) { cyclesBefore = 0; }
+        
+        // Convert the window to nanoseconds and set the two time
+        // windows appropriately.
         timeBefore = cyclesBefore * 4;
         timeWindow = Math.max(timeBefore, timeAfter);
     }
@@ -384,11 +384,11 @@
      * the seed hit in clock cycles.
      */
     void setWindowAfter(int cyclesAfter) {
-    	// The cluster window can not be negative.
-    	if(cyclesAfter < 0) { cyclesAfter = 0; }
-    	
-    	// Convert the window to nanoseconds and set the two time
-    	// windows appropriately.
+        // The cluster window can not be negative.
+        if(cyclesAfter < 0) { cyclesAfter = 0; }
+        
+        // Convert the window to nanoseconds and set the two time
+        // windows appropriately.
         timeAfter = cyclesAfter * 4;
         timeWindow = Math.max(timeBefore, timeAfter);
     }
@@ -494,9 +494,9 @@
             // considered to be adjacent to ix = -1 rather than the
             // expected ix = 0. (ix = 0 does not exist.)
             else {
-            	// ix = -1 is adjacent to ix = 1 and vice versa.
+                // ix = -1 is adjacent to ix = 1 and vice versa.
                 if((six == -1 && hix == 1) || (six == 1 && hix == -1)) {
-                	return true;
+                    return true;
                 }
                 
                 // Any other combination that reaches this point is not

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterer.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterer.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterer.java	Wed Mar  9 11:43:24 2016
@@ -289,7 +289,7 @@
                 // If the neighboring crystal exists and is not already
                 // in a cluster, add it to the list of neighboring hits.
                 if (secondaryNeighborHit != null && !hitToSeed.containsKey(secondaryNeighborHit)
-                		&& hitList.contains(secondaryNeighborHit)) {
+                        && hitList.contains(secondaryNeighborHit)) {
                     secondaryNeighborHits.add(secondaryNeighborHit);
                 }
             }
@@ -325,7 +325,7 @@
                 // If it exists, add it to the neighboring hit list.
 
                 if (clusteredNeighborHit != null && hitToSeed.get(clusteredNeighborHit) != null
-                		&& hitList.contains(clusteredNeighborHit)) {
+                        && hitList.contains(clusteredNeighborHit)) {
                     clusteredNeighborHits.add(clusteredNeighborHit);
                 }
             }
@@ -383,32 +383,32 @@
             
             // Consider time cut-is this hit in same time window as seed?
             if (useTimeCut){
-            	if(Math.abs(ihit.getTime() - iseed.getTime()) < timeWindow)
-            	{	
-            		icluster.addHit(ihit);
-            	}
+                if(Math.abs(ihit.getTime() - iseed.getTime()) < timeWindow)
+                {   
+                    icluster.addHit(ihit);
+                }
             } // end of using time cut
             else {icluster.addHit(ihit);}           
         }
 
         // Add common hits
         for (Map.Entry<CalorimeterHit, List<CalorimeterHit>> commHit : commonHits.entrySet()) {
-        	// Check that the common hit is in both time windows to their clusters
-        	CalorimeterHit seedA = commHit.getValue().get(0);
+            // Check that the common hit is in both time windows to their clusters
+            CalorimeterHit seedA = commHit.getValue().get(0);
             CalorimeterHit seedB = commHit.getValue().get(1);
-        	
+            
             boolean inTimeWithA = false;
             boolean inTimeWithB = false;
-        	// In time window with seedA?
+            // In time window with seedA?
             if (Math.abs(commHit.getKey().getTime() - seedA.getTime()) < timeWindow){
-            	inTimeWithA = true;
+                inTimeWithA = true;
             }
             
             // In time window with seedB?
             if (Math.abs(commHit.getKey().getTime() - seedB.getTime()) < timeWindow){
-            	inTimeWithB = true;
-            }
-                    	
+                inTimeWithB = true;
+            }
+                        
             double eclusterA = seedToCluster.get(seedA).getEnergy();
             double eclusterB = seedToCluster.get(seedB).getEnergy();
             double fractionA = eclusterA / (eclusterA + eclusterB);
@@ -420,25 +420,25 @@
             BaseCluster clusterB = seedToCluster.get(seedB);
 
             if (useTimeCut){
-            	// Do this if the hit is in both cluster's windows
-            	if (inTimeWithA && inTimeWithB){
-            		clusterA.addHit(commHit.getKey(), hitcontributionA);
-            		clusterB.addHit(commHit.getKey(), hitcontributionB);
-            	}
+                // Do this if the hit is in both cluster's windows
+                if (inTimeWithA && inTimeWithB){
+                    clusterA.addHit(commHit.getKey(), hitcontributionA);
+                    clusterB.addHit(commHit.getKey(), hitcontributionB);
+                }
             
-            	//If the hit is only in 1 cluster's window, add the full contribution
-            	else if(inTimeWithA ^ inTimeWithB){
-            		if(inTimeWithA){
-            			clusterA.addHit(commHit.getKey());
-            		}
-            		else{
-            			clusterB.addHit(commHit.getKey());
-            		}
-            	}
+                //If the hit is only in 1 cluster's window, add the full contribution
+                else if(inTimeWithA ^ inTimeWithB){
+                    if(inTimeWithA){
+                        clusterA.addHit(commHit.getKey());
+                    }
+                    else{
+                        clusterB.addHit(commHit.getKey());
+                    }
+                }
             } // end of using time cut
             else{
-            	clusterA.addHit(commHit.getKey(), hitcontributionA);
-        		clusterB.addHit(commHit.getKey(), hitcontributionB);           	
+                clusterA.addHit(commHit.getKey(), hitcontributionA);
+                clusterB.addHit(commHit.getKey(), hitcontributionB);            
             }
             
         }

Modified: java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java	Wed Mar  9 11:43:24 2016
@@ -41,7 +41,7 @@
     public void readEvioEvent(EvioEvent evioEvent) {
     }
 
-	@Override
-	public void conditionsChanged(ConditionsEvent conditionsEvent) {
-	}	
+    @Override
+    public void conditionsChanged(ConditionsEvent conditionsEvent) {
+    }   
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EcalHitWriter.java	Wed Mar  9 11:43:24 2016
@@ -212,10 +212,10 @@
         Map<Integer, List<Long>> slotMap = new HashMap<Integer, List<Long>>();
         for (Long id : hitMap.keySet()) {
             dec.setID(id);
-//			System.out.println(dec.getIDDescription());
-//			System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
+//          System.out.println(dec.getIDDescription());
+//          System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
 //            Long daqID = EcalConditions.physicalToDaqID(id);
-//			System.out.printf("physicalID %d, daqID %d\n", id, daqID);
+//          System.out.printf("physicalID %d, daqID %d\n", id, daqID);
             int slot = getSlot(id);
             if (slotMap.get(slot) == null) {
                 slotMap.put(slot, new ArrayList<Long>());
@@ -231,7 +231,7 @@
         for (int slot : slotMap.keySet()) {
             data.addUchar((byte) slot); // slot #
             data.addUint(0); // trigger #
-            data.addUlong(0); // timestamp    		
+            data.addUlong(0); // timestamp          
             List<Long> hitIDs = slotMap.get(slot);
             int nhits = hitIDs.size();
             data.addN(nhits); // number of channels
@@ -285,10 +285,10 @@
         Map<Integer, List<Long>> slotMap = new HashMap<Integer, List<Long>>();
         for (Long id : hitMap.keySet()) {
             dec.setID(id);
-//			System.out.println(dec.getIDDescription());
-//			System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
+//          System.out.println(dec.getIDDescription());
+//          System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
 //            Long daqID = EcalConditions.physicalToDaqID(id);
-//			System.out.printf("physicalID %d, daqID %d\n", id, daqID);
+//          System.out.printf("physicalID %d, daqID %d\n", id, daqID);
             int slot = getSlot(id);
             if (slotMap.get(slot) == null) {
                 slotMap.put(slot, new ArrayList<Long>());
@@ -304,7 +304,7 @@
         for (int slot : slotMap.keySet()) {
             data.addUchar((byte) slot); // slot #
             data.addUint(0); // trigger #
-            data.addUlong(0); // timestamp    		
+            data.addUlong(0); // timestamp          
             List<Long> hitIDs = slotMap.get(slot);
             int nhits = hitIDs.size();
             data.addN(nhits); // number of channels
@@ -358,10 +358,10 @@
         Map<Integer, List<Long>> slotMap = new HashMap<Integer, List<Long>>();
         for (Long id : hitMap.keySet()) {
             dec.setID(id);
-//			System.out.println(dec.getIDDescription());
-//			System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
+//          System.out.println(dec.getIDDescription());
+//          System.out.printf("ix = %d, iy = %d\n", dec.getValue("ix"), dec.getValue("iy"));
 //            Long daqID = EcalConditions.physicalToDaqID(id);
-//			System.out.printf("physicalID %d, daqID %d\n", id, daqID);
+//          System.out.printf("physicalID %d, daqID %d\n", id, daqID);
             int slot = getSlot(id);
             if (slotMap.get(slot) == null) {
                 slotMap.put(slot, new ArrayList<Long>());
@@ -380,7 +380,7 @@
 //            EvioBank slotBank = new EvioBank(EventConstants.ECAL_WINDOW_BANK_TAG, DataType.COMPOSITE, slot);
             data.addUchar((byte) slot); // slot #
             data.addUint(0); // trigger #
-            data.addUlong(0); // timestamp    		
+            data.addUlong(0); // timestamp          
             List<Long> hitIDs = slotMap.get(slot);
             int nhits = hitIDs.size();
             data.addN(nhits); // number of channels

Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java	Wed Mar  9 11:43:24 2016
@@ -5,45 +5,45 @@
 import org.lcsim.event.EventHeader;
 
 /**
- *	Abstract class containing shared methods used by EVIO readers.
+ *  Abstract class containing shared methods used by EVIO readers.
  *
- *	@author Sho Uemura <[log in to unmask]>
+ *  @author Sho Uemura <[log in to unmask]>
  */
 public abstract class EvioReader {
 
-	// Debug flag
-	protected boolean debug = false;
-	
-	// Name of the hit collection that will be created
-	protected String hitCollectionName = null;
+    // Debug flag
+    protected boolean debug = false;
+    
+    // Name of the hit collection that will be created
+    protected String hitCollectionName = null;
 
-	/**
-	 *	Make a LCIO hit collection (e.g. {@link RawTrackerHit}, 
-	 * 	{@link CalorimeterHit} from raw EVIO data.
-	 * 
-	 * 	@param event : The EVIO event to read the raw data from
-	 * 	@param lcsimEvent : The LCSim event to write the collections to
-	 * 	@return True if the appropriate EVIO bank is found, false otherwise	
-	 * @throws Exception 
-	 * 
-	 */
-	abstract boolean makeHits(EvioEvent event, EventHeader lcsimEvent) throws Exception;
+    /**
+     *  Make a LCIO hit collection (e.g. {@link RawTrackerHit}, 
+     *  {@link CalorimeterHit} from raw EVIO data.
+     * 
+     *  @param event : The EVIO event to read the raw data from
+     *  @param lcsimEvent : The LCSim event to write the collections to
+     *  @return True if the appropriate EVIO bank is found, false otherwise 
+     * @throws Exception 
+     * 
+     */
+    abstract boolean makeHits(EvioEvent event, EventHeader lcsimEvent) throws Exception;
 
-	/**
-	 *	Set the hit collection name.
-	 * 
-	 * 	@param hitCollectionName : Name of the hit collection
-	 */
-	public void setHitCollectionName(String hitCollectionName) {
-		this.hitCollectionName = hitCollectionName;
-	}
+    /**
+     *  Set the hit collection name.
+     * 
+     *  @param hitCollectionName : Name of the hit collection
+     */
+    public void setHitCollectionName(String hitCollectionName) {
+        this.hitCollectionName = hitCollectionName;
+    }
 
-	/**
-	 *	Enable/disable debug output.
-	 * 
-	 * 	@param debug : Set to true to enable, false to disable.
-	 */
-	public void setDebug(boolean debug) {
-		this.debug = debug;
-	}
+    /**
+     *  Enable/disable debug output.
+     * 
+     *  @param debug : Set to true to enable, false to disable.
+     */
+    public void setDebug(boolean debug) {
+        this.debug = debug;
+    }
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/RfFitFunction.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/RfFitFunction.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/RfFitFunction.java	Wed Mar  9 11:43:24 2016
@@ -7,29 +7,29 @@
  * Straight line fit
  */
 public class RfFitFunction extends AbstractIFunction {
-	protected double intercept=0;
-	protected double slope=0;
-	public RfFitFunction() {
-		this("");
-	}
-	public RfFitFunction(String title) {
-		super();
-		this.variableNames=new String[]{"time"};
-		this.parameterNames=new String[]{"intercept","slope"};
+    protected double intercept=0;
+    protected double slope=0;
+    public RfFitFunction() {
+        this("");
+    }
+    public RfFitFunction(String title) {
+        super();
+        this.variableNames=new String[]{"time"};
+        this.parameterNames=new String[]{"intercept","slope"};
 
-		init(title);
-	}
-	public double value(double [] v) {
-		return  intercept + (v[0])*slope;
-	}
-	public void setParameters(double[] pars) throws IllegalArgumentException {
-		super.setParameters(pars);
-		intercept=pars[0];
-		slope=pars[1];
-	}
-	public void setParameter(String key,double value) throws IllegalArgumentException{
-		super.setParameter(key,value);
-		if      (key.equals("intercept")) intercept=value;
-		else if (key.equals("slope"))    slope=value;
-	}
+        init(title);
+    }
+    public double value(double [] v) {
+        return  intercept + (v[0])*slope;
+    }
+    public void setParameters(double[] pars) throws IllegalArgumentException {
+        super.setParameters(pars);
+        intercept=pars[0];
+        slope=pars[1];
+    }
+    public void setParameter(String key,double value) throws IllegalArgumentException{
+        super.setParameter(key,value);
+        if      (key.equals("intercept")) intercept=value;
+        else if (key.equals("slope"))    slope=value;
+    }
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/RfHit.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/RfHit.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/RfHit.java	Wed Mar  9 11:43:24 2016
@@ -6,13 +6,13 @@
  * class to store RF times after extracting from waveform.
  */
 public class RfHit implements GenericObject {
-	private double[] times;
-	public RfHit(double[] times) { this.times=times; }
-	public int getNInt()    { return 0; }
-	public int getNFloat()  { return 0; }
-	public int getNDouble() { return times.length; }
-	public double getDoubleVal(int ii) { return times[ii]; }
-	public float  getFloatVal (int ii) { return 0; }
-	public int    getIntVal   (int ii) { return 0; }
-	public boolean isFixedSize() { return false; }
+    private double[] times;
+    public RfHit(double[] times) { this.times=times; }
+    public int getNInt()    { return 0; }
+    public int getNFloat()  { return 0; }
+    public int getNDouble() { return times.length; }
+    public double getDoubleVal(int ii) { return times[ii]; }
+    public float  getFloatVal (int ii) { return 0; }
+    public int    getIntVal   (int ii) { return 0; }
+    public boolean isFixedSize() { return false; }
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java	Wed Mar  9 11:43:24 2016
@@ -21,96 +21,96 @@
  */
 public class TestRunReconToEvio extends Driver {
 
-	EventWriter writer;
-	String rawCalorimeterHitCollectionName = "EcalDigitizedHits";
-	String evioOutputFile = "TestRunData.evio";
-	EventBuilder builder = null;
-	private int eventsWritten = 0;
-	EcalHitWriter ecalWriter = null;
-	SVTHitWriter svtWriter = null;
-	
-	Detector detector = null;
+    EventWriter writer;
+    String rawCalorimeterHitCollectionName = "EcalDigitizedHits";
+    String evioOutputFile = "TestRunData.evio";
+    EventBuilder builder = null;
+    private int eventsWritten = 0;
+    EcalHitWriter ecalWriter = null;
+    SVTHitWriter svtWriter = null;
+    
+    Detector detector = null;
 
-	public TestRunReconToEvio() {
-	}
-	
+    public TestRunReconToEvio() {
+    }
+    
     @Override
-    public void detectorChanged(Detector detector) {    	
-    	// set the detector
+    public void detectorChanged(Detector detector) {        
+        // set the detector
         this.detector = detector;
     }
 
-	public void setEvioOutputFile(String evioOutputFile) {
-		this.evioOutputFile = evioOutputFile;
-	}
+    public void setEvioOutputFile(String evioOutputFile) {
+        this.evioOutputFile = evioOutputFile;
+    }
 
-	public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
-		this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
-		if (ecalWriter != null) {
-			ecalWriter.setHitCollectionName(rawCalorimeterHitCollectionName);
-		}
-	}
+    public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
+        this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
+        if (ecalWriter != null) {
+            ecalWriter.setHitCollectionName(rawCalorimeterHitCollectionName);
+        }
+    }
 
-	protected void startOfData() {
-		try {
-			writer = new EventWriter(evioOutputFile);
-		} catch (EvioException e) {
-			throw new RuntimeException(e);
-		}
+    protected void startOfData() {
+        try {
+            writer = new EventWriter(evioOutputFile);
+        } catch (EvioException e) {
+            throw new RuntimeException(e);
+        }
 
-		ecalWriter = new EcalHitWriter();
-		ecalWriter.setDetector(detector);
-		ecalWriter.setHitCollectionName(rawCalorimeterHitCollectionName);
+        ecalWriter = new EcalHitWriter();
+        ecalWriter.setDetector(detector);
+        ecalWriter.setHitCollectionName(rawCalorimeterHitCollectionName);
 
-		svtWriter = new SVTHitWriter();
-	}
+        svtWriter = new SVTHitWriter();
+    }
 
-	protected void endOfData() {
-		System.out.println(this.getClass().getSimpleName() + " - wrote " + eventsWritten + " EVIO events in job.");
-		writer.close();		
-	}
+    protected void endOfData() {
+        System.out.println(this.getClass().getSimpleName() + " - wrote " + eventsWritten + " EVIO events in job.");
+        writer.close();     
+    }
 
-	protected void process(EventHeader event) {
+    protected void process(EventHeader event) {
 
-		if (!svtWriter.hasData(event)) {
-			return;
-		}
+        if (!svtWriter.hasData(event)) {
+            return;
+        }
 
-		// Make a new EVIO event.
-		builder = new EventBuilder(0, DataType.BANK, event.getEventNumber());
+        // Make a new EVIO event.
+        builder = new EventBuilder(0, DataType.BANK, event.getEventNumber());
 
-		// Write SVTData.
-		svtWriter.writeData(event, builder);
+        // Write SVTData.
+        svtWriter.writeData(event, builder);
 
-		// Write RawCalorimeterHit collection.
-		ecalWriter.writeData(event, builder);
-//		writeRawCalorimeterHits(event);
+        // Write RawCalorimeterHit collection.
+        ecalWriter.writeData(event, builder);
+//      writeRawCalorimeterHits(event);
 
-		// Write this EVIO event.
-		writeEvioEvent();
-	}
+        // Write this EVIO event.
+        writeEvioEvent();
+    }
 
-	private void writeEvioEvent() {
-		EvioBank eventIDBank = new EvioBank(EvioEventConstants.EVENTID_BANK_TAG, DataType.UINT32, 0);
-		int[] eventID = new int[3];
-		eventID[0] = eventsWritten;
-		eventID[1] = 0; //trigger type
-		eventID[2] = 0; //status
+    private void writeEvioEvent() {
+        EvioBank eventIDBank = new EvioBank(EvioEventConstants.EVENTID_BANK_TAG, DataType.UINT32, 0);
+        int[] eventID = new int[3];
+        eventID[0] = eventsWritten;
+        eventID[1] = 0; //trigger type
+        eventID[2] = 0; //status
 
-		try {
-			eventIDBank.appendIntData(eventID);
-			builder.addChild(builder.getEvent(), eventIDBank);
-		} catch (EvioException e) {
-			throw new RuntimeException(e);
-		}
-		builder.setAllHeaderLengths();
-		try {
-			writer.writeEvent(builder.getEvent());
-			++eventsWritten;
-		} catch (EvioException e) {
-			throw new RuntimeException(e);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
+        try {
+            eventIDBank.appendIntData(eventID);
+            builder.addChild(builder.getEvent(), eventIDBank);
+        } catch (EvioException e) {
+            throw new RuntimeException(e);
+        }
+        builder.setAllHeaderLengths();
+        try {
+            writer.writeEvent(builder.getEvent());
+            ++eventsWritten;
+        } catch (EvioException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }

Modified: java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java
 =============================================================================
--- java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java	(original)
+++ java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java	Wed Mar  9 11:43:24 2016
@@ -24,60 +24,60 @@
  */
 public class LCSimEngRunEventBuilderTest extends TestCase {
 
-	public void testLCSimEngRunEventBuilder() throws Exception {
-	    
-		// Setup database conditions.
-		DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-		conditionsManager.setXmlConfig("/org/hps/conditions/config/conditions_dev.xml");
-		conditionsManager.setDetector("HPS-Proposal2014-v8-6pt6", 2000);
+    public void testLCSimEngRunEventBuilder() throws Exception {
+        
+        // Setup database conditions.
+        DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+        conditionsManager.setXmlConfig("/org/hps/conditions/config/conditions_dev.xml");
+        conditionsManager.setDetector("HPS-Proposal2014-v8-6pt6", 2000);
 
-		// Configure LCIO writer.
-		new TestOutputFile(getClass().getSimpleName()).mkdirs();
-		File lcioFile = new TestOutputFile(getClass().getSimpleName() + File.separator + getClass().getSimpleName() + "_output.slcio");
-		LCIOWriter writer;
-		try {
-			writer = new LCIOWriter(lcioFile);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
+        // Configure LCIO writer.
+        new TestOutputFile(getClass().getSimpleName()).mkdirs();
+        File lcioFile = new TestOutputFile(getClass().getSimpleName() + File.separator + getClass().getSimpleName() + "_output.slcio");
+        LCIOWriter writer;
+        try {
+            writer = new LCIOWriter(lcioFile);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
 
-		// Create event builder.
-		LCSimEventBuilder builder = new LCSimEngRunEventBuilder();
-		conditionsManager.addConditionsListener(builder);
-		//builder.setDetectorName("HPS-Proposal2014-v8-6pt6");
-		conditionsManager.setDetector("HPS-Proposal2014-v8-6pt6", 2744);
+        // Create event builder.
+        LCSimEventBuilder builder = new LCSimEngRunEventBuilder();
+        conditionsManager.addConditionsListener(builder);
+        //builder.setDetectorName("HPS-Proposal2014-v8-6pt6");
+        conditionsManager.setDetector("HPS-Proposal2014-v8-6pt6", 2744);
 
-		// Get remote test file.
-		FileCache cache = new FileCache();
-		File evioFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/LCSimEngRunEventBuilderTest/hps_002744.evio.0"));
+        // Get remote test file.
+        FileCache cache = new FileCache();
+        File evioFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/LCSimEngRunEventBuilderTest/hps_002744.evio.0"));
 
-		// Open the EVIO reader.
-		System.out.println("Opening file " + evioFile);
-		EvioReader reader = null;
-		try {
-			reader = new EvioReader(evioFile);
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
+        // Open the EVIO reader.
+        System.out.println("Opening file " + evioFile);
+        EvioReader reader = null;
+        try {
+            reader = new EvioReader(evioFile);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
 
-		// Run the event builder on the EVIO.
-		EvioEvent evioEvent = null;
-		while ((evioEvent = reader.nextEvent()) != null) {
-			reader.parseEvent(evioEvent);
-			builder.readEvioEvent(evioEvent);
-			if (EvioEventUtilities.isPhysicsEvent(evioEvent)) {
-				try {
-					EventHeader lcsimEvent = builder.makeLCSimEvent(evioEvent);
-					System.out.println("created LCSim event #" + lcsimEvent.getEventNumber());
-					writer.write(lcsimEvent);
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-			}
-		}
+        // Run the event builder on the EVIO.
+        EvioEvent evioEvent = null;
+        while ((evioEvent = reader.nextEvent()) != null) {
+            reader.parseEvent(evioEvent);
+            builder.readEvioEvent(evioEvent);
+            if (EvioEventUtilities.isPhysicsEvent(evioEvent)) {
+                try {
+                    EventHeader lcsimEvent = builder.makeLCSimEvent(evioEvent);
+                    System.out.println("created LCSim event #" + lcsimEvent.getEventNumber());
+                    writer.write(lcsimEvent);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
 
-		// Close the LCIO writer.
-		writer.flush();
-		writer.close();
-	}
+        // Close the LCIO writer.
+        writer.flush();
+        writer.close();
+    }
 }

Modified: java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java
 =============================================================================
--- java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java	(original)
+++ java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java	Wed Mar  9 11:43:24 2016
@@ -15,60 +15,60 @@
 import org.hps.record.evio.EvioEventUtilities;
 
 /**
- * 	Integration test to check the conversion of test run EVIO to LCIO 
+ *  Integration test to check the conversion of test run EVIO to LCIO 
  * 
- * 	@author Omar Moreno <[log in to unmask]>
- *	@date November 20, 2014
+ *  @author Omar Moreno <[log in to unmask]>
+ *  @date November 20, 2014
  */
 public class LCSimTestRunEventBuilderTest extends TestCase {
 
-	//-----------------//
-	//--- Constants ---//
-	//-----------------//
-	private static final String DB_CONFIGURATION
-		= "/org/hps/conditions/config/conditions_database_testrun_2012.xml";
-	
-	public void testLCSimTestRunEventBuilder() throws Exception { 
-	
-		// Configure the conditions system to retrieve test run conditions fo run 1351.
-		DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-		conditionsManager.setXmlConfig(DB_CONFIGURATION);
-		
-		// Create the test run event builder
-		LCSimTestRunEventBuilder builder = new LCSimTestRunEventBuilder();
-		conditionsManager.addConditionsListener(builder);
+    //-----------------//
+    //--- Constants ---//
+    //-----------------//
+    private static final String DB_CONFIGURATION
+        = "/org/hps/conditions/config/conditions_database_testrun_2012.xml";
+    
+    public void testLCSimTestRunEventBuilder() throws Exception { 
+    
+        // Configure the conditions system to retrieve test run conditions fo run 1351.
+        DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+        conditionsManager.setXmlConfig(DB_CONFIGURATION);
+        
+        // Create the test run event builder
+        LCSimTestRunEventBuilder builder = new LCSimTestRunEventBuilder();
+        conditionsManager.addConditionsListener(builder);
 
-		conditionsManager.setDetector("HPS-TestRun-v5", 1351);
+        conditionsManager.setDetector("HPS-TestRun-v5", 1351);
 
-		// Retrieve the remote test file.  The file currently being contains a
-		// subset of events from run 1351
-		FileCache cache = new FileCache();
-		File evioFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/hps1351_test.evio"));
-	
-		// Instantiate the EVIO reader and open the test file.  If the file
-		// can't be found, throw a runtime exception
-		EvioReader reader = null;
-		try {
-			reader = new EvioReader(evioFile);
-		} catch (Exception e) {
-			throw new RuntimeException(
-					"[ " + this.getClass().getSimpleName() + " ]: EVIO file couldn't be opened.");
-		}
-		
-		// Loop through all EVIO events in the file and process them using the
-		// event builder.  If the event is a physics event, process the event
-		// using the subdetector readers.
-		EvioEvent evioEvent = null;
-		while ((evioEvent = reader.nextEvent()) != null) {
-			reader.parseEvent(evioEvent);
-			builder.readEvioEvent(evioEvent);
-			if (EvioEventUtilities.isPhysicsEvent(evioEvent)) {
-				EventHeader lcsimEvent = builder.makeLCSimEvent(evioEvent);
-				System.out.println("[ " + this.getClass().getSimpleName() + " ]: Created event number " + lcsimEvent.getEventNumber());
-			}
-		}
-		
-		// Close the EVIO reader
-		reader.close();
-	}
+        // Retrieve the remote test file.  The file currently being contains a
+        // subset of events from run 1351
+        FileCache cache = new FileCache();
+        File evioFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/hps1351_test.evio"));
+    
+        // Instantiate the EVIO reader and open the test file.  If the file
+        // can't be found, throw a runtime exception
+        EvioReader reader = null;
+        try {
+            reader = new EvioReader(evioFile);
+        } catch (Exception e) {
+            throw new RuntimeException(
+                    "[ " + this.getClass().getSimpleName() + " ]: EVIO file couldn't be opened.");
+        }
+        
+        // Loop through all EVIO events in the file and process them using the
+        // event builder.  If the event is a physics event, process the event
+        // using the subdetector readers.
+        EvioEvent evioEvent = null;
+        while ((evioEvent = reader.nextEvent()) != null) {
+            reader.parseEvent(evioEvent);
+            builder.readEvioEvent(evioEvent);
+            if (EvioEventUtilities.isPhysicsEvent(evioEvent)) {
+                EventHeader lcsimEvent = builder.makeLCSimEvent(evioEvent);
+                System.out.println("[ " + this.getClass().getSimpleName() + " ]: Created event number " + lcsimEvent.getEventNumber());
+            }
+        }
+        
+        // Close the EVIO reader
+        reader.close();
+    }
 }

Modified: java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java
 =============================================================================
--- java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java	(original)
+++ java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java	Wed Mar  9 11:43:24 2016
@@ -25,47 +25,47 @@
     // Initialize the logger
     protected static Logger LOGGER = Logger.getLogger(SvtEvioReaderTest.class.getPackage().getName());
     
-	public void testSvtEvioReaderTest() throws Exception { 
+    public void testSvtEvioReaderTest() throws Exception { 
 
-		// Get the EVIO file that will be used to test the reader
-		FileCache fileCache = new FileCache(); 
-		File evioFile = fileCache.getCachedFile(
-				new URL("http://www.lcsim.org/test/hps-java/svt_evio_reader_test.evio")); 
+        // Get the EVIO file that will be used to test the reader
+        FileCache fileCache = new FileCache(); 
+        File evioFile = fileCache.getCachedFile(
+                new URL("http://www.lcsim.org/test/hps-java/svt_evio_reader_test.evio")); 
 
-		LOGGER.info("Opening file " + evioFile); 
+        LOGGER.info("Opening file " + evioFile); 
 
-		// Instantiate the EVIO reader and open the file
-		EvioReader evioReader = new EvioReader(evioFile); 
-	
-		// Instantiate the SVT EVIO reader
-		SvtEvioReader svtReader = new SvtEvioReader(); 
+        // Instantiate the EVIO reader and open the file
+        EvioReader evioReader = new EvioReader(evioFile); 
+    
+        // Instantiate the SVT EVIO reader
+        SvtEvioReader svtReader = new SvtEvioReader(); 
 
-		// Setup the database conditions 
-		DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-		conditionsManager.setDetector("HPS-Proposal2014-v9-2pt2", 2000); 
+        // Setup the database conditions 
+        DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+        conditionsManager.setDetector("HPS-Proposal2014-v9-2pt2", 2000); 
 
-		// Instantiate the event builder
-		LCSimEventBuilder eventBuilder = new LCSimEngRunEventBuilder(); 
+        // Instantiate the event builder
+        LCSimEventBuilder eventBuilder = new LCSimEngRunEventBuilder(); 
 
-		// Check that the file contains the expected number of events
-		int eventCount = evioReader.getEventCount(); 
-		LOGGER.info("File " + evioFile + " contains " + eventCount + " events."); 
+        // Check that the file contains the expected number of events
+        int eventCount = evioReader.getEventCount(); 
+        LOGGER.info("File " + evioFile + " contains " + eventCount + " events."); 
 
 
-		// Loop through the EVIO events and process them.
-		EvioEvent evioEvent = null; 
-		while ((evioEvent = evioReader.nextEvent()) != null) { 
-			evioReader.parseEvent(evioEvent); 	
+        // Loop through the EVIO events and process them.
+        EvioEvent evioEvent = null; 
+        while ((evioEvent = evioReader.nextEvent()) != null) { 
+            evioReader.parseEvent(evioEvent);   
 
-			// Only process physics events
-			if (!EvioEventUtilities.isPhysicsEvent(evioEvent)) continue;
-			LOGGER.info("Found physics event."); 	
-	
-			EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent); 
-			LOGGER.info("Created LCSim event # " + lcsimEvent.getEventNumber()); 	
+            // Only process physics events
+            if (!EvioEventUtilities.isPhysicsEvent(evioEvent)) continue;
+            LOGGER.info("Found physics event.");    
+    
+            EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent); 
+            LOGGER.info("Created LCSim event # " + lcsimEvent.getEventNumber());    
 
-			// Process the event using the SVT evio reader
-			svtReader.processEvent(evioEvent, lcsimEvent);  
-		}
-	}
+            // Process the event using the SVT evio reader
+            svtReader.processEvent(evioEvent, lcsimEvent);  
+        }
+    }
 }

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java	Wed Mar  9 11:43:24 2016
@@ -26,14 +26,14 @@
     // Collection Names
     static final String rawTrackerHitCollectionName = "SVTRawTrackerHits";
     
-	public void testSimpleSvtReadout() throws Exception { 
-				
-		File inputFile = new TestDataUtility().getTestData("ReadoutToLcioTest.slcio");
-			        
+    public void testSimpleSvtReadout() throws Exception { 
+                
+        File inputFile = new TestDataUtility().getTestData("ReadoutToLcioTest.slcio");
+                    
         outputDir.mkdirs();
         if(!outputDir.exists()){ 
-        	this.printDebug("Failed to create directory " + outputDir.getPath());
-        	throw new RuntimeException("Failed to create output directory.");
+            this.printDebug("Failed to create directory " + outputDir.getPath());
+            throw new RuntimeException("Failed to create output directory.");
         }
         
         FinalCheckDriver checker = new FinalCheckDriver();
@@ -54,25 +54,25 @@
         this.printDebug("");
         this.printDebug("===============================");
         
-	}
-	
-	class FinalCheckDriver extends Driver { 
-	
-		private int totalRawTrackerHits = 0; 
-		
-		public void process(EventHeader event){
-			if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) return;
-			List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
-		
-			totalRawTrackerHits += rawHits.size();
-		}
-		
-		public int getTotalNumberOfRawTrackerHits(){
-			return totalRawTrackerHits;
-		}
-	}
-	
-	private void printDebug(String message){
-		System.out.println("[ SimpleSvtReadoutTest ]: " + message);
-	}
+    }
+    
+    class FinalCheckDriver extends Driver { 
+    
+        private int totalRawTrackerHits = 0; 
+        
+        public void process(EventHeader event){
+            if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) return;
+            List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+        
+            totalRawTrackerHits += rawHits.size();
+        }
+        
+        public int getTotalNumberOfRawTrackerHits(){
+            return totalRawTrackerHits;
+        }
+    }
+    
+    private void printDebug(String message){
+        System.out.println("[ SimpleSvtReadoutTest ]: " + message);
+    }
 }

Modified: java/trunk/integration-tests/src/test/resources/org/hps/ecalreadoutsim/EcalReadoutSimTest.lcsim
 =============================================================================
--- java/trunk/integration-tests/src/test/resources/org/hps/ecalreadoutsim/EcalReadoutSimTest.lcsim	(original)
+++ java/trunk/integration-tests/src/test/resources/org/hps/ecalreadoutsim/EcalReadoutSimTest.lcsim	Wed Mar  9 11:43:24 2016
@@ -32,7 +32,7 @@
         <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
             <outputFile>${outputFile}.slcio</outputFile>
         </driver>
-			
+            
         <driver name="EcalReadout" type="org.hps.readout.ecal.FADCEcalReadoutDriver">
             <coincidenceWindow>1</coincidenceWindow>
             <ecalName>Ecal</ecalName>
@@ -50,7 +50,7 @@
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>true</use2014Gain>
 <!--            <debug>true</debug>-->
-        </driver>	
+        </driver>   
 
         <driver name="EcalClusterer" type="org.hps.recon.ecal.GTPEcalClusterer">
             <ecalName>Ecal</ecalName>
@@ -63,7 +63,7 @@
             <deadTime>10</deadTime>
             <pairCoincidence>2</pairCoincidence>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout">
             <addNoise>false</addNoise>
         </driver>
@@ -74,4 +74,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/integration-tests/src/test/resources/org/hps/steering/test/Dummy.lcsim
 =============================================================================
--- java/trunk/integration-tests/src/test/resources/org/hps/steering/test/Dummy.lcsim	(original)
+++ java/trunk/integration-tests/src/test/resources/org/hps/steering/test/Dummy.lcsim	Wed Mar  9 11:43:24 2016
@@ -10,4 +10,4 @@
         <driver name="DummyDriver" type="org.hps.test.util.DummyDriver"/>
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/integration-tests/src/test/resources/org/hps/steering/test/EcalReadoutSimTest.lcsim
 =============================================================================
--- java/trunk/integration-tests/src/test/resources/org/hps/steering/test/EcalReadoutSimTest.lcsim	(original)
+++ java/trunk/integration-tests/src/test/resources/org/hps/steering/test/EcalReadoutSimTest.lcsim	Wed Mar  9 11:43:24 2016
@@ -28,7 +28,7 @@
         <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
             <outputFile>${outputFile}.slcio</outputFile>
         </driver>
-			
+            
         <driver name="EcalReadout" type="org.hps.readout.ecal.FADCEcalReadoutDriver">
             <coincidenceWindow>1</coincidenceWindow>
             <ecalName>Ecal</ecalName>
@@ -46,7 +46,7 @@
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>true</use2014Gain>
 <!--            <debug>true</debug>-->
-        </driver>	
+        </driver>   
 
         <driver name="EcalClusterer" type="org.hps.recon.ecal.GTPEcalClusterer">
             <ecalName>Ecal</ecalName>
@@ -59,7 +59,7 @@
             <deadTime>10</deadTime>
             <pairCoincidence>2</pairCoincidence>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout">
             <addNoise>false</addNoise>
         </driver>
@@ -70,4 +70,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -17,52 +17,52 @@
  */
 public class SVTCellIDPrintDriver extends Driver {
 
-	String rawTrackerHitCollectionName = "SVTData";
-	String outputFileName;
-	PrintWriter outputStream = null;
+    String rawTrackerHitCollectionName = "SVTData";
+    String outputFileName;
+    PrintWriter outputStream = null;
 
-	public SVTCellIDPrintDriver() {
-	}
+    public SVTCellIDPrintDriver() {
+    }
 
-	public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
-		this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
-	}
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	public void startOfData() {
-		if (rawTrackerHitCollectionName == null) {
-			throw new RuntimeException("The parameter ecalCollectionName was not set!");
-		}
+    public void startOfData() {
+        if (rawTrackerHitCollectionName == null) {
+            throw new RuntimeException("The parameter ecalCollectionName was not set!");
+        }
 
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(SVTData.class, rawTrackerHitCollectionName)) {
-			List<SVTData> hits = event.get(SVTData.class, rawTrackerHitCollectionName);
-			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (SVTData hit : hits) {
-				outputStream.printf("FPGA=%d\thybrid=%d\tchannel=%d\n", hit.getFPGAAddress(), hit.getHybridNumber(), hit.getChannelNumber());
-			}
-		}
-		if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
-			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
-			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (RawTrackerHit hit : hits) {
-				outputStream.printf("name=%s\tside=%d\tstrip=%d\n", hit.getDetectorElement().getName(), hit.getIdentifierFieldValue("side"), hit.getIdentifierFieldValue("strip"));
-			}
-		}
-	}
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(SVTData.class, rawTrackerHitCollectionName)) {
+            List<SVTData> hits = event.get(SVTData.class, rawTrackerHitCollectionName);
+            //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+            for (SVTData hit : hits) {
+                outputStream.printf("FPGA=%d\thybrid=%d\tchannel=%d\n", hit.getFPGAAddress(), hit.getHybridNumber(), hit.getChannelNumber());
+            }
+        }
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+            //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+            for (RawTrackerHit hit : hits) {
+                outputStream.printf("name=%s\tside=%d\tstrip=%d\n", hit.getDetectorElement().getName(), hit.getIdentifierFieldValue("side"), hit.getIdentifierFieldValue("strip"));
+            }
+        }
+    }
 }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java	Wed Mar  9 11:43:24 2016
@@ -32,7 +32,7 @@
  */
 public class SVTHitRecoCorrelations extends Driver {
 
-	//private List<AIDAFrame> plotterFrame = new ArrayList<AIDAFrame>();
+    //private List<AIDAFrame> plotterFrame = new ArrayList<AIDAFrame>();
     private List<IPlotter> plotters = new ArrayList<IPlotter>();
     private AIDA aida = AIDA.defaultInstance();                  
     private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
@@ -225,7 +225,7 @@
         */
         
         //for(int i=0;i<2;++i) {
-       	//plotterFrame.get(i).pack();
+        //plotterFrame.get(i).pack();
         //    plotterFrame.get(i).setVisible(true);
         //}
     }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	Wed Mar  9 11:43:24 2016
@@ -38,7 +38,7 @@
  */
 public class SVTHitReconstructionPlots extends Driver {
 
-	//private AIDAFrame plotterFrame;
+    //private AIDAFrame plotterFrame;
     private AIDA aida = AIDA.defaultInstance();
     private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
     private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SvtTimingInPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SvtTimingInPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SvtTimingInPlots.java	Wed Mar  9 11:43:24 2016
@@ -244,51 +244,51 @@
         isEcalTopCluster = false;
         List<SSPCluster> clusters = null;
         SSPData sspData = null;
-		/*if(event.hasCollection(GenericObject.class, triggerBankCollectionName)) {
-		
-		    // Get the list of trigger banks from the event
-			List<GenericObject> triggerBanks = event.get(GenericObject.class, triggerBankCollectionName);
-
-			System.out.println("Total trigger banks: " + triggerBanks.size());
-			
-			// Loop through the collection of banks and get the SSP and TI banks.
-			for (GenericObject triggerBank : triggerBanks) { 
-			    
-			    // If the bank contains TI data, process it
-			    if (AbstractIntData.getTag(triggerBank) == TIData.BANK_TAG) { 
-			        
-			        TIData tiData = new TIData(triggerBank);
-			      
-			        // Check if the trigger is singles
-			        if (tiData.isSingle0Trigger() || tiData.isSingle1Trigger()) { 
-			            isSingleClusterTrigger = true;
-			        } 
-			        
-			    } else if (AbstractIntData.getTag(triggerBank) == SSPData.BANK_TAG) { 
-			       
-			        sspData = new SSPData(triggerBank);
-			        
-			        clusters = sspData.getClusters();
-			        
-			        for (SSPCluster cluster : clusters) { 
-			            if (cluster.getYIndex() > 0) { 
-			                isEcalTopCluster = true;
-			            }
-			        }
-			    }
-			}
-
-			if (isSingleClusterTrigger) {
-			    System.out.println("Total number of singles triggers: " + sspData.getSinglesTriggers().size());
-			    for (SSPSinglesTrigger trigger : sspData.getSinglesTriggers()) { 
-			        System.out.println("Trigger: " + trigger.toString());
-			    }
-			    System.out.println("Total number of SSP clusters: " + clusters.size());
-			    for (SSPCluster cluster : clusters) { 
-			        System.out.println("X: " + cluster.getXIndex() + " Y: " + cluster.getYIndex() + " time: " + cluster.getTime());
-			    }
-			}
-		}*/	
+        /*if(event.hasCollection(GenericObject.class, triggerBankCollectionName)) {
+        
+            // Get the list of trigger banks from the event
+            List<GenericObject> triggerBanks = event.get(GenericObject.class, triggerBankCollectionName);
+
+            System.out.println("Total trigger banks: " + triggerBanks.size());
+            
+            // Loop through the collection of banks and get the SSP and TI banks.
+            for (GenericObject triggerBank : triggerBanks) { 
+                
+                // If the bank contains TI data, process it
+                if (AbstractIntData.getTag(triggerBank) == TIData.BANK_TAG) { 
+                    
+                    TIData tiData = new TIData(triggerBank);
+                  
+                    // Check if the trigger is singles
+                    if (tiData.isSingle0Trigger() || tiData.isSingle1Trigger()) { 
+                        isSingleClusterTrigger = true;
+                    } 
+                    
+                } else if (AbstractIntData.getTag(triggerBank) == SSPData.BANK_TAG) { 
+                   
+                    sspData = new SSPData(triggerBank);
+                    
+                    clusters = sspData.getClusters();
+                    
+                    for (SSPCluster cluster : clusters) { 
+                        if (cluster.getYIndex() > 0) { 
+                            isEcalTopCluster = true;
+                        }
+                    }
+                }
+            }
+
+            if (isSingleClusterTrigger) {
+                System.out.println("Total number of singles triggers: " + sspData.getSinglesTriggers().size());
+                for (SSPSinglesTrigger trigger : sspData.getSinglesTriggers()) { 
+                    System.out.println("Trigger: " + trigger.toString());
+                }
+                System.out.println("Total number of SSP clusters: " + clusters.size());
+                for (SSPCluster cluster : clusters) { 
+                    System.out.println("X: " + cluster.getXIndex() + " Y: " + cluster.getYIndex() + " time: " + cluster.getTime());
+                }
+            }
+        }*/ 
         
         // Obtain all relations between an SVT raw hit and its corresponding
         // fit parameters.  The fit parameters are obtained from the fit to

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/BasicMonitoringPlotsDriver.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/BasicMonitoringPlotsDriver.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/BasicMonitoringPlotsDriver.java	Wed Mar  9 11:43:24 2016
@@ -18,83 +18,83 @@
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class BasicMonitoringPlotsDriver extends Driver {
-	
-	private String calHitsCollectionName = "EcalCalHits"; 
-	private String rawHitsCollectionName = "EcalReadoutHits";
-	private String clustersCollectionName = "EcalClusters";
-	
-	private IHistogram1D calHitEnergyH1D;
-	private IHistogram1D clusterEnergyH1D;
-	private IHistogram1D rawHitAmplitudeH1D;
-	private IHistogram2D calHitEnergyMapH2D;
-	
-	public BasicMonitoringPlotsDriver() {		
-	}
-	
-	public void startOfData() {		
-		
-		IAnalysisFactory.create().createHistogramFactory(null);
-		IPlotterFactory plotFactory = IAnalysisFactory.create().createPlotterFactory("ECAL Monitoring");
-		IHistogramFactory histogramFactory = IAnalysisFactory.create().createHistogramFactory(null);
-		
-		calHitEnergyH1D = histogramFactory.createHistogram1D(calHitsCollectionName + ": Energy", calHitsCollectionName + ": Energy", 200, 0.0, 2.0);
-		calHitEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
-		calHitEnergyH1D.annotation().addItem("yAxisLabel", "Count");
-		IPlotter plotter = plotFactory.create("CalorimeterHits");
-		plotter.createRegion();
-		plotter.style().gridStyle().setVisible(false);
-		plotter.style().dataStyle().errorBarStyle().setVisible(false);
-		plotter.region(0).plot(calHitEnergyH1D);
-		plotter.show();
-		
-		rawHitAmplitudeH1D = histogramFactory.createHistogram1D(rawHitsCollectionName + ": Amplitude", rawHitsCollectionName + ": Amplitude", 150, 0.0, 15000.0);
-		rawHitAmplitudeH1D.annotation().addItem("xAxisLabel", "ADC Value");
-		rawHitAmplitudeH1D.annotation().addItem("yAxisLabel", "Count");
-		plotter = plotFactory.create("RawCalorimeterHits");
-		plotter.createRegion();
-		plotter.style().gridStyle().setVisible(false);
-		plotter.style().dataStyle().errorBarStyle().setVisible(false);
-		plotter.region(0).plot(rawHitAmplitudeH1D);
-		plotter.show();
-		
-		clusterEnergyH1D = histogramFactory.createHistogram1D(clustersCollectionName + ": Energy", clustersCollectionName + ": Energy", 100, 0.0, 3.0);
-		clusterEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
-		clusterEnergyH1D.annotation().addItem("yAxisLabel", "Count");
-		plotter = plotFactory.create("Clusters");
-		plotter.createRegion();
-		plotter.style().gridStyle().setVisible(false);
-		plotter.style().dataStyle().errorBarStyle().setVisible(false);
-		plotter.region(0).plot(clusterEnergyH1D);
-		plotter.show();
-		
-		calHitEnergyMapH2D = histogramFactory.createHistogram2D(calHitsCollectionName + ": Energy Map", calHitsCollectionName + ": Energy Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
-		plotter = plotFactory.create("CalorimeterHit Energy Map");
-		plotter.createRegion();
-		plotter.style().setParameter("hist2DStyle", "colorMap");
-		plotter.style().gridStyle().setVisible(false);
-		plotter.region(0).plot(calHitEnergyMapH2D);
-		plotter.show();
-	}
-	
-	public void process(EventHeader event) {
-		
+    
+    private String calHitsCollectionName = "EcalCalHits"; 
+    private String rawHitsCollectionName = "EcalReadoutHits";
+    private String clustersCollectionName = "EcalClusters";
+    
+    private IHistogram1D calHitEnergyH1D;
+    private IHistogram1D clusterEnergyH1D;
+    private IHistogram1D rawHitAmplitudeH1D;
+    private IHistogram2D calHitEnergyMapH2D;
+    
+    public BasicMonitoringPlotsDriver() {       
+    }
+    
+    public void startOfData() {     
+        
+        IAnalysisFactory.create().createHistogramFactory(null);
+        IPlotterFactory plotFactory = IAnalysisFactory.create().createPlotterFactory("ECAL Monitoring");
+        IHistogramFactory histogramFactory = IAnalysisFactory.create().createHistogramFactory(null);
+        
+        calHitEnergyH1D = histogramFactory.createHistogram1D(calHitsCollectionName + ": Energy", calHitsCollectionName + ": Energy", 200, 0.0, 2.0);
+        calHitEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
+        calHitEnergyH1D.annotation().addItem("yAxisLabel", "Count");
+        IPlotter plotter = plotFactory.create("CalorimeterHits");
+        plotter.createRegion();
+        plotter.style().gridStyle().setVisible(false);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.region(0).plot(calHitEnergyH1D);
+        plotter.show();
+        
+        rawHitAmplitudeH1D = histogramFactory.createHistogram1D(rawHitsCollectionName + ": Amplitude", rawHitsCollectionName + ": Amplitude", 150, 0.0, 15000.0);
+        rawHitAmplitudeH1D.annotation().addItem("xAxisLabel", "ADC Value");
+        rawHitAmplitudeH1D.annotation().addItem("yAxisLabel", "Count");
+        plotter = plotFactory.create("RawCalorimeterHits");
+        plotter.createRegion();
+        plotter.style().gridStyle().setVisible(false);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.region(0).plot(rawHitAmplitudeH1D);
+        plotter.show();
+        
+        clusterEnergyH1D = histogramFactory.createHistogram1D(clustersCollectionName + ": Energy", clustersCollectionName + ": Energy", 100, 0.0, 3.0);
+        clusterEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
+        clusterEnergyH1D.annotation().addItem("yAxisLabel", "Count");
+        plotter = plotFactory.create("Clusters");
+        plotter.createRegion();
+        plotter.style().gridStyle().setVisible(false);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.region(0).plot(clusterEnergyH1D);
+        plotter.show();
+        
+        calHitEnergyMapH2D = histogramFactory.createHistogram2D(calHitsCollectionName + ": Energy Map", calHitsCollectionName + ": Energy Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter = plotFactory.create("CalorimeterHit Energy Map");
+        plotter.createRegion();
+        plotter.style().setParameter("hist2DStyle", "colorMap");
+        plotter.style().gridStyle().setVisible(false);
+        plotter.region(0).plot(calHitEnergyMapH2D);
+        plotter.show();
+    }
+    
+    public void process(EventHeader event) {
+        
         if (event.hasCollection(CalorimeterHit.class, calHitsCollectionName)) {
             for (CalorimeterHit hit : event.get(CalorimeterHit.class, calHitsCollectionName)) {
                 calHitEnergyH1D.fill(hit.getCorrectedEnergy());
                 calHitEnergyMapH2D.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getCorrectedEnergy());
             }
         }
-		
+        
         if (event.hasCollection(Cluster.class, clustersCollectionName)) {
             for (Cluster cluster : event.get(Cluster.class, clustersCollectionName)) {
                 clusterEnergyH1D.fill(cluster.getEnergy());
             }
         }
-		
-		if (event.hasCollection(RawCalorimeterHit.class, rawHitsCollectionName)) {
-			for (RawCalorimeterHit hit : event.get(RawCalorimeterHit.class, rawHitsCollectionName)) {
-				rawHitAmplitudeH1D.fill(hit.getAmplitude());
-			}
-		}
-	}
+        
+        if (event.hasCollection(RawCalorimeterHit.class, rawHitsCollectionName)) {
+            for (RawCalorimeterHit hit : event.get(RawCalorimeterHit.class, rawHitsCollectionName)) {
+                rawHitAmplitudeH1D.fill(hit.getAmplitude());
+            }
+        }
+    }
 }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	Wed Mar  9 11:43:24 2016
@@ -49,15 +49,15 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class EcalClusterPlots extends Driver {
-	// Internal variables.
+    // Internal variables.
     private boolean hide = false;
     private boolean logScale = false;
-	private AIDA aida = AIDA.defaultInstance();
+    private AIDA aida = AIDA.defaultInstance();
     private double maxE = 5000 * EcalUtils.MeV;
-	private IPlotter[] plotter = new IPlotter[4];
-	private String clusterCollectionName = "EcalClusters";
-	
-	// Monitoring plot variables.
+    private IPlotter[] plotter = new IPlotter[4];
+    private String clusterCollectionName = "EcalClusters";
+    
+    // Monitoring plot variables.
     private IHistogram1D clusterCountPlot;
     private IHistogram1D clusterSizePlot;
     private IHistogram1D clusterEnergyPlot;
@@ -79,7 +79,7 @@
     private static final int TAB_CLUSTER_TIME = 2;
     private static final int TAB_CLUSTER_PAIR = 3;
     private static final String[] TAB_NAMES = { "Cluster Count Plots", "Cluster Energy Plots",
-    	"Cluster Time Plots", "Cluster Pair Plots" };
+        "Cluster Time Plots", "Cluster Pair Plots" };
     
     /**
      * Resets all of the plots for the new detector.
@@ -110,10 +110,10 @@
         
         // Apply formatting that is constant across all tabs.
         for(int tabIndex = 0; tabIndex < plotter.length; tabIndex++) {
-        	plotter[tabIndex] = plotterFactory.create(TAB_NAMES[tabIndex]);
-        	plotter[tabIndex].setTitle(TAB_NAMES[tabIndex]);
-        	plotter[tabIndex].style().dataStyle().errorBarStyle().setVisible(false);
-        	plotter[tabIndex].style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
+            plotter[tabIndex] = plotterFactory.create(TAB_NAMES[tabIndex]);
+            plotter[tabIndex].setTitle(TAB_NAMES[tabIndex]);
+            plotter[tabIndex].style().dataStyle().errorBarStyle().setVisible(false);
+            plotter[tabIndex].style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
             if(logScale) { plotter[tabIndex].style().yAxisStyle().setParameter("scale", "log"); }
         }
         
@@ -145,9 +145,9 @@
         
         // If they should not be hidden, display the tabs.
         if(!hide) {
-        	for(IPlotter tab : plotter) {
-        		tab.show();
-        	}
+            for(IPlotter tab : plotter) {
+                tab.show();
+            }
         }
     }
     
@@ -157,121 +157,121 @@
      */
     @Override
     public void process(EventHeader event) {
-    	// Check whether the event has clusters or not.
-    	if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-    		// Get the list of clusters.
-    		List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-    		
-    		// Create lists to store the clusters from the top of the
-    		// calorimeter and the bottom.
-    		List<Cluster> topList = new ArrayList<Cluster>();
-    		List<Cluster> bottomList = new ArrayList<Cluster>();
-    		
-    		// Track the highest energy cluster in the event.
-    		double maxEnergy = 0.0;
-    		
-    		// Process each of the clusters.
-    		for(Cluster cluster : clusterList) {
-    			// If this cluster has a higher energy then was seen
-    			// previously, it is now the highest energy cluster.
-				if (cluster.getEnergy() > maxEnergy) {
-					maxEnergy = cluster.getEnergy();
-				}
-				
-				
-				// Get the list of calorimeter hits and its size.
-				List<CalorimeterHit> hitList = cluster.getCalorimeterHits();
-				int hitCount = hitList.size();
-				
-				// Track cluster statistics.
-				double xEnergyWeight = 0.0;
-				double yEnergyWeight = 0.0;
-				double[] hitTimes = new double[hitCount];
-				double totalHitEnergy = 0.0;
-				
-				// Iterate over the hits and extract statistics from them.
-				for(int hitIndex = 0; hitIndex < hitCount; hitIndex++) {
-					hitTimes[hitIndex] = hitList.get(hitIndex).getTime();
-					totalHitEnergy += hitList.get(hitIndex).getRawEnergy();
-					xEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("ix"));
-					yEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("iy"));
-				}
-				
-				// If the cluster energy exceeds zero, plot the cluster
-				// statistics.
-				if(cluster.getEnergy() > 0) {
-					clusterSizePlot.fill(hitCount);
-					clusterTimes.fill(StatUtils.mean(hitTimes, 0, hitCount));
-					clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(hitTimes, 0, hitCount)));
-					edgePlot.fill(xEnergyWeight / totalHitEnergy, yEnergyWeight / totalHitEnergy);
-				}
-				
-				// Fill the single cluster plots.
-				clusterEnergyPlot.fill(cluster.getEnergy());
-				
-    			// Cluster pairs are formed from all top/bottom cluster
-    			// combinations. To create these pairs, separate the
-    			// clusters into two lists based on their y-indices.
-    			if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix") > 0) {
-    				topList.add(cluster);
-    			} else {
-    				bottomList.add(cluster);
-    			}
-    		}
-    		
-    		// Populate the event plots.
-    		clusterCountPlot.fill(clusterList.size());
-    		if(maxEnergy > 0) { clusterMaxEnergyPlot.fill(maxEnergy); }
-    		
-    		// Create a list to store cluster pairs.
-    		List<Cluster[]> pairList = new ArrayList<Cluster[]>(topList.size() * bottomList.size());
-    		
-    		// Form pairs from all possible combinations of clusters
-    		// from the top and bottom lists.
-    		for(Cluster topCluster : topList) {
-    			for(Cluster bottomCluster : bottomList) {
-    				// Make a cluster pair array.
-    				Cluster[] pair = new Cluster[2];
-    				
-    				// The lower energy cluster goes in the second slot.
-    				if(topCluster.getEnergy() > bottomCluster.getEnergy()) {
-    					pair[0] = topCluster;
-    					pair[1] = bottomCluster;
-    				} else {
-    					pair[0] = bottomCluster;
-    					pair[1] = topCluster;
-    				}
-    				
-    				// Add the pair to the pair list.
-    				pairList.add(pair);
-    			}
-    		}
-    		
-    		// Iterate over each pair and calculate the pair cut values.
-    		for(Cluster[] pair : pairList) {
-    			// Get the energy slope value.
-    			double energySumValue = TriggerModule.getValueEnergySum(pair);
-    			double energyDifferenceValue = TriggerModule.getValueEnergyDifference(pair);
-    			double energySlopeValue = TriggerModule.getValueEnergySlope(pair, 0.005500);
-    			double coplanarityValue = TriggerModule.getValueCoplanarity(pair);
-    			double xMean = ((pair[0].getEnergy() * pair[0].getPosition()[0]) +
-    					(pair[1].getEnergy() * pair[1].getPosition()[0])) / energySumValue;
-    			double yMean = ((pair[0].getEnergy() * pair[0].getPosition()[1]) +
-    					(pair[1].getEnergy() * pair[1].getPosition()[1])) / energySumValue;
-    			
-    			// Populate the cluster pair plots.
-    			pairEnergySum.fill(energySumValue, 1);;
-    			pairEnergyDifference.fill(energyDifferenceValue, 1);
-    			pairEnergySlope.fill(energySlopeValue, 1);
-    			pairCoplanarity.fill(coplanarityValue, 1);
-    			pairEnergyPositionMeanX.fill(xMean);
-    			pairEnergyPositionMeanY.fill(yMean);
-    		}
-    	}
-    	
-    	// If the event does not contain clusters, update the "Event
-    	// Clusters" plot accordingly.
-    	else { clusterCountPlot.fill(0); }
+        // Check whether the event has clusters or not.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the list of clusters.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Create lists to store the clusters from the top of the
+            // calorimeter and the bottom.
+            List<Cluster> topList = new ArrayList<Cluster>();
+            List<Cluster> bottomList = new ArrayList<Cluster>();
+            
+            // Track the highest energy cluster in the event.
+            double maxEnergy = 0.0;
+            
+            // Process each of the clusters.
+            for(Cluster cluster : clusterList) {
+                // If this cluster has a higher energy then was seen
+                // previously, it is now the highest energy cluster.
+                if (cluster.getEnergy() > maxEnergy) {
+                    maxEnergy = cluster.getEnergy();
+                }
+                
+                
+                // Get the list of calorimeter hits and its size.
+                List<CalorimeterHit> hitList = cluster.getCalorimeterHits();
+                int hitCount = hitList.size();
+                
+                // Track cluster statistics.
+                double xEnergyWeight = 0.0;
+                double yEnergyWeight = 0.0;
+                double[] hitTimes = new double[hitCount];
+                double totalHitEnergy = 0.0;
+                
+                // Iterate over the hits and extract statistics from them.
+                for(int hitIndex = 0; hitIndex < hitCount; hitIndex++) {
+                    hitTimes[hitIndex] = hitList.get(hitIndex).getTime();
+                    totalHitEnergy += hitList.get(hitIndex).getRawEnergy();
+                    xEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("ix"));
+                    yEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("iy"));
+                }
+                
+                // If the cluster energy exceeds zero, plot the cluster
+                // statistics.
+                if(cluster.getEnergy() > 0) {
+                    clusterSizePlot.fill(hitCount);
+                    clusterTimes.fill(StatUtils.mean(hitTimes, 0, hitCount));
+                    clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(hitTimes, 0, hitCount)));
+                    edgePlot.fill(xEnergyWeight / totalHitEnergy, yEnergyWeight / totalHitEnergy);
+                }
+                
+                // Fill the single cluster plots.
+                clusterEnergyPlot.fill(cluster.getEnergy());
+                
+                // Cluster pairs are formed from all top/bottom cluster
+                // combinations. To create these pairs, separate the
+                // clusters into two lists based on their y-indices.
+                if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix") > 0) {
+                    topList.add(cluster);
+                } else {
+                    bottomList.add(cluster);
+                }
+            }
+            
+            // Populate the event plots.
+            clusterCountPlot.fill(clusterList.size());
+            if(maxEnergy > 0) { clusterMaxEnergyPlot.fill(maxEnergy); }
+            
+            // Create a list to store cluster pairs.
+            List<Cluster[]> pairList = new ArrayList<Cluster[]>(topList.size() * bottomList.size());
+            
+            // Form pairs from all possible combinations of clusters
+            // from the top and bottom lists.
+            for(Cluster topCluster : topList) {
+                for(Cluster bottomCluster : bottomList) {
+                    // Make a cluster pair array.
+                    Cluster[] pair = new Cluster[2];
+                    
+                    // The lower energy cluster goes in the second slot.
+                    if(topCluster.getEnergy() > bottomCluster.getEnergy()) {
+                        pair[0] = topCluster;
+                        pair[1] = bottomCluster;
+                    } else {
+                        pair[0] = bottomCluster;
+                        pair[1] = topCluster;
+                    }
+                    
+                    // Add the pair to the pair list.
+                    pairList.add(pair);
+                }
+            }
+            
+            // Iterate over each pair and calculate the pair cut values.
+            for(Cluster[] pair : pairList) {
+                // Get the energy slope value.
+                double energySumValue = TriggerModule.getValueEnergySum(pair);
+                double energyDifferenceValue = TriggerModule.getValueEnergyDifference(pair);
+                double energySlopeValue = TriggerModule.getValueEnergySlope(pair, 0.005500);
+                double coplanarityValue = TriggerModule.getValueCoplanarity(pair);
+                double xMean = ((pair[0].getEnergy() * pair[0].getPosition()[0]) +
+                        (pair[1].getEnergy() * pair[1].getPosition()[0])) / energySumValue;
+                double yMean = ((pair[0].getEnergy() * pair[0].getPosition()[1]) +
+                        (pair[1].getEnergy() * pair[1].getPosition()[1])) / energySumValue;
+                
+                // Populate the cluster pair plots.
+                pairEnergySum.fill(energySumValue, 1);;
+                pairEnergyDifference.fill(energyDifferenceValue, 1);
+                pairEnergySlope.fill(energySlopeValue, 1);
+                pairCoplanarity.fill(coplanarityValue, 1);
+                pairEnergyPositionMeanX.fill(xMean);
+                pairEnergyPositionMeanY.fill(yMean);
+            }
+        }
+        
+        // If the event does not contain clusters, update the "Event
+        // Clusters" plot accordingly.
+        else { clusterCountPlot.fill(0); }
     }
     
     /**

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplayWithRawWaveform.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplayWithRawWaveform.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplayWithRawWaveform.java	Wed Mar  9 11:43:24 2016
@@ -54,7 +54,7 @@
     // Plotter objects and variables.
     private IPlotter plotter;
     private IPlotterFactory plotterFactory;
-    private AIDA aida = AIDA.defaultInstance();	
+    private AIDA aida = AIDA.defaultInstance(); 
 
     // LCIO Collection names.
     private String inputCollection = "EcalCalHits";
@@ -69,16 +69,16 @@
     private ArrayList<IHistogram2D> channelTimeVsEnergyPlot;
 
     // Internal variables.
-    private PEventViewer viewer;								 // Single event display.
-    private int pedSamples = 10;								 // 
-    private IPlotterStyle pstyle;								 // The plotter style for all plots.
-    private long lastEventTime = 0;								 // Tracks the time at which the last event occurred.
-    private int eventRefreshRate = 1;							 // The number of seconds before an update occurs.
-    private boolean resetOnUpdate = true;						 // Clears the event display on each update.
-    private double minEch = 10 * EcalUtils.MeV;					 // The energy scale minimum.
-    private double maxEch = 3500 * EcalUtils.MeV;				 // The energy scale maximum.
-    private int[] windowRaw = new int[NUM_CHANNELS];			 // The number of samples in a waveform for each channel.
-    private boolean[] isFirstRaw = new boolean[NUM_CHANNELS];	 // Whether a waveform plot was initiated for each channel.
+    private PEventViewer viewer;                                 // Single event display.
+    private int pedSamples = 10;                                 // 
+    private IPlotterStyle pstyle;                                // The plotter style for all plots.
+    private long lastEventTime = 0;                              // Tracks the time at which the last event occurred.
+    private int eventRefreshRate = 1;                            // The number of seconds before an update occurs.
+    private boolean resetOnUpdate = true;                        // Clears the event display on each update.
+    private double minEch = 10 * EcalUtils.MeV;                  // The energy scale minimum.
+    private double maxEch = 3500 * EcalUtils.MeV;                // The energy scale maximum.
+    private int[] windowRaw = new int[NUM_CHANNELS];             // The number of samples in a waveform for each channel.
+    private boolean[] isFirstRaw = new boolean[NUM_CHANNELS];    // Whether a waveform plot was initiated for each channel.
 
     // Plot style and title variables.
     private static final String NO_TITLE = "";

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalFeeMonitor.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalFeeMonitor.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalFeeMonitor.java	Wed Mar  9 11:43:24 2016
@@ -33,80 +33,80 @@
     // this has to match the one in FEEClusterPlotter:
     private String histoNameFormat = "%3d";
     
-	private AIDA aida = AIDA.defaultInstance();	
-	private IPlotter plotter;
-	private IPlotterFactory plotterFactory;
-	private IPlotterStyle pstyle;
-	private PEventViewer viewer;
+    private AIDA aida = AIDA.defaultInstance(); 
+    private IPlotter plotter;
+    private IPlotterFactory plotterFactory;
+    private IPlotterStyle pstyle;
+    private PEventViewer viewer;
 
-	static final String[] colors={"red","black","blue","green","yellow","pink","cyan","magenta","brown"};
-	static final int nRows=3;
-	static final int nColumns=3;
-	private int theRegion=0;
-	
-	@Override
-	public void detectorChanged(Detector detector) {
-		plotterFactory = aida.analysisFactory().createPlotterFactory("ECal Fee");
-		plotter = plotterFactory.create("ECal Fee");
-		plotter.createRegions(nColumns,nRows);
-		// Plot dummmy histos, else null plotter regions later:
-		for (int ii=0; ii<nColumns*nRows; ii++) {
-  	    	plotter.region(ii).plot(aida.histogram1D("ASDF"+ii,100,11e9,11e11));
-		}
-		plotter.show();
-		
-		pstyle=plotterFactory.createPlotterStyle();
-		pstyle.xAxisStyle().labelStyle().setBold(true);
-		pstyle.yAxisStyle().labelStyle().setBold(true);
-		pstyle.xAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.yAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.xAxisStyle().lineStyle().setColor("black");
-		pstyle.yAxisStyle().lineStyle().setColor("black");
-		pstyle.xAxisStyle().lineStyle().setThickness(2);
-		pstyle.yAxisStyle().lineStyle().setThickness(2);
-		pstyle.dataStyle().errorBarStyle().setThickness(0);
-		pstyle.legendBoxStyle().setVisible(false);
-	}
-	
-	@Override
-	public void startOfData() {
-		File config = new File("ecal-mapping-config.csv");
-		if(config.exists() && config.canRead()) {
-			try { viewer = new PDataEventViewer(config.getAbsolutePath()); }
-			catch (IOException e) { viewer = new PEventViewer(); }
-		} else { viewer = new PEventViewer(); }
-		viewer.addCrystalListener(this);
-		viewer.setVisible(true);
-	}
-	
-	@Override
-	public void actionPerformed(ActionEvent ae) { }
-	
-	@Override
-	public void crystalActivated(CrystalEvent e) { }
-	
-	@Override
-	public void crystalDeactivated(CrystalEvent e) { }
+    static final String[] colors={"red","black","blue","green","yellow","pink","cyan","magenta","brown"};
+    static final int nRows=3;
+    static final int nColumns=3;
+    private int theRegion=0;
+    
+    @Override
+    public void detectorChanged(Detector detector) {
+        plotterFactory = aida.analysisFactory().createPlotterFactory("ECal Fee");
+        plotter = plotterFactory.create("ECal Fee");
+        plotter.createRegions(nColumns,nRows);
+        // Plot dummmy histos, else null plotter regions later:
+        for (int ii=0; ii<nColumns*nRows; ii++) {
+            plotter.region(ii).plot(aida.histogram1D("ASDF"+ii,100,11e9,11e11));
+        }
+        plotter.show();
+        
+        pstyle=plotterFactory.createPlotterStyle();
+        pstyle.xAxisStyle().labelStyle().setBold(true);
+        pstyle.yAxisStyle().labelStyle().setBold(true);
+        pstyle.xAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.yAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.xAxisStyle().lineStyle().setColor("black");
+        pstyle.yAxisStyle().lineStyle().setColor("black");
+        pstyle.xAxisStyle().lineStyle().setThickness(2);
+        pstyle.yAxisStyle().lineStyle().setThickness(2);
+        pstyle.dataStyle().errorBarStyle().setThickness(0);
+        pstyle.legendBoxStyle().setVisible(false);
+    }
+    
+    @Override
+    public void startOfData() {
+        File config = new File("ecal-mapping-config.csv");
+        if(config.exists() && config.canRead()) {
+            try { viewer = new PDataEventViewer(config.getAbsolutePath()); }
+            catch (IOException e) { viewer = new PEventViewer(); }
+        } else { viewer = new PEventViewer(); }
+        viewer.addCrystalListener(this);
+        viewer.setVisible(true);
+    }
+    
+    @Override
+    public void actionPerformed(ActionEvent ae) { }
+    
+    @Override
+    public void crystalActivated(CrystalEvent e) { }
+    
+    @Override
+    public void crystalDeactivated(CrystalEvent e) { }
 
-	@Override
-	public void crystalClicked(CrystalEvent e) {
-		aida.tree().cd("/");
-		Point ecalPoint = Viewer.toEcalPoint(e.getCrystalID());
-		if (ecalPoint.x == 0 || ecalPoint.y == 0) return;
-		if (EcalMonitoringUtilities.isInHole(ecalPoint.y,ecalPoint.x)) return;
-		final int cid=EcalMonitoringUtilities.getChannelIdFromRowColumn(ecalPoint.y,ecalPoint.x);
-	    IHistogram1D hist=aida.histogram1D(String.format(histoNameFormat,cid));
-	    if (hist==null) {
-	        System.err.println("Running the Driver?");
-	    } else {
-     	    hist.setTitle(String.format("(%d,%d)",ecalPoint.x,ecalPoint.y));
+    @Override
+    public void crystalClicked(CrystalEvent e) {
+        aida.tree().cd("/");
+        Point ecalPoint = Viewer.toEcalPoint(e.getCrystalID());
+        if (ecalPoint.x == 0 || ecalPoint.y == 0) return;
+        if (EcalMonitoringUtilities.isInHole(ecalPoint.y,ecalPoint.x)) return;
+        final int cid=EcalMonitoringUtilities.getChannelIdFromRowColumn(ecalPoint.y,ecalPoint.x);
+        IHistogram1D hist=aida.histogram1D(String.format(histoNameFormat,cid));
+        if (hist==null) {
+            System.err.println("Running the Driver?");
+        } else {
+            hist.setTitle(String.format("(%d,%d)",ecalPoint.x,ecalPoint.y));
             pstyle.dataStyle().lineStyle().setParameter("color", colors[theRegion%colors.length]);
-	        plotter.region(theRegion).clear();
-	        plotter.region(theRegion).plot(hist,pstyle);
-	        plotter.region(theRegion).refresh();
-	        theRegion=(theRegion+1)%(nColumns*nRows);
-	    }
-	}
-	
-	
+            plotter.region(theRegion).clear();
+            plotter.region(theRegion).plot(hist,pstyle);
+            plotter.region(theRegion).refresh();
+            theRegion=(theRegion+1)%(nColumns*nRows);
+        }
+    }
+    
+    
 }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	Wed Mar  9 11:43:24 2016
@@ -190,17 +190,17 @@
                 GenericObject triggerData = triggerList.get(0);
                
                 if (triggerData instanceof SSPData){
-                	// TODO: TOP, BOTTOM, OR, and AND triggers are test
-                	// run specific parameters and are not supported
-                	// by SSPData.
-                	orTrigTime  = 0; //((SSPData)triggerData).getOrTrig();
-                	topTrigTime = 0; //((SSPData)triggerData).getTopTrig();
-                	botTrigTime = 0; //((SSPData)triggerData).getBotTrig(); 
-
-                	
-                	orTrigTimePlot.fill(orTrigTime);
+                    // TODO: TOP, BOTTOM, OR, and AND triggers are test
+                    // run specific parameters and are not supported
+                    // by SSPData.
+                    orTrigTime  = 0; //((SSPData)triggerData).getOrTrig();
+                    topTrigTime = 0; //((SSPData)triggerData).getTopTrig();
+                    botTrigTime = 0; //((SSPData)triggerData).getBotTrig(); 
+
+                    
+                    orTrigTimePlot.fill(orTrigTime);
                     topTrigTimePlot.fill(topTrigTime);
-                	botTrigTimePlot.fill(botTrigTime);
+                    botTrigTimePlot.fill(botTrigTime);
 
                 }       
                 

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalLedSequenceMonitor.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalLedSequenceMonitor.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalLedSequenceMonitor.java	Wed Mar  9 11:43:24 2016
@@ -58,836 +58,836 @@
  */
 public class EcalLedSequenceMonitor extends Driver{
 
-	private static final int NUM_CHANNELS = 11 * 47;
-	private static final String dbTag = "led";
-	private static final String dbTableName = "ecal_led_calibrations";
-	private static final int runNumberMax = 9999;
-	private static final int nDrivers = 8;
-	private static final int nSteps = 100; //should be 56 but here is to avoid seg fault
-
-
-
-	String inputCollectionRaw = "EcalReadoutHits";
-	String inputCollection = "EcalCalHits";	
-	AIDA aida;
-
-	DatabaseConditionsManager conditionsManager;
-
-	private EcalChannelCollection ChannelCollection;	
-	private EcalLedCollection LedCollection;
-	private EcalConditions ecalConditions;
-
-	Map < Integer,Integer > LedTopMap; //chid (conditions) --> LED id
-	Map < Integer,Integer > LedBotMap; //chid (conditions) --> LED id 
-
-	Map < Integer,Integer > LedTopMapInverted; //LED id --> chid (conditions)
-	Map < Integer,Integer > LedBotMapInverted; //LED id  --> chid (conditions)
-
-	private boolean useRawEnergy=false;
-
-	String outFileName;
-
-
-	private int runNumber = 0;	
-	private int eventN    = 0;
-	private int id,row,column,chid,ledId,driverId;
-	private  int[][] expectedSequence = new int[][]{ /*A.C. it is a terrible thing to have this hard-coded here!*/
-			//first 4 are the flasher1 sequence, TOP controller 
-			{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,-1},
-			{56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111},
-			{112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,-1}, //missing 135 is ok
-			{168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223},
-			//second 4 are the flasher2 sequence, BOTTOM controller 
-			{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,-1},	
-			{56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,-1}, //missing 69 is OK
-			{112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167},	
-			{168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223},
-	};
-	private int[][] actualSequence=new int[nDrivers][nSteps];
-
-	private int[] iStep = new int[nDrivers];
-	private int[] nEvents = new int[NUM_CHANNELS];
-	private double[] mMean = new double[NUM_CHANNELS];
-	private double[] mRMS = new double[NUM_CHANNELS];
-
-	private int nEventsMin=200;
-	private int nMinChannelsWithEvents=350; 
-	private double energy,fillEnergy,fillTime;
-	private double energyCut=2; //we expect very high energy from the LEDs..
-	private double skipInitial=0.05;
-	private double skipMin=0.3;
-	private long cellID;
-
-
-
-
-	//Histograms-functions-ntuples
-	private ArrayList<ITuple> iTuple;
-
-	private IFunction  fFunction,fFunction1;
-	private IProfile1D   cProfile;
-	private IHistogram2D			hMeanCharge2D;
-	private ArrayList<IHistogram1D> hCharge;
-	private ArrayList<IHistogram2D> hChargeVsEvn;
-	private IPlotterFactory factory;
-	private IPlotter pPlotter=null;
-	private IPlotter pPlotter2=null;
-	private IPlotterStyle style ;
-	private int[] fitStatus = new int[NUM_CHANNELS];
-
-	private boolean doFullAnalysis=false;
-	private boolean isMonitoringApp=false; 
-	private boolean saveTuple=false; 
-
-	private double[] fPars;    
-	private double[] fPrevPars;
-	private double[] fParErrs;
-	private String[] fParNames; 
-
-
-	private double fEvnMinDraw=0.;
-	private double fEvnMaxDraw=80000.;
-	private double fChargeMinDraw=0.;
-	private double fChargeMaxDraw=100.;
-
-	/*Components for user interaction*/
-	private JDialog dialog;
-	private JLabel  label;
-	private JFrame frame;
-	private JPanel panel;
-	String  labelString;
-	private JButton okButtonRed,okButtonBlue,cancelButton;
-	private int m_iteration=0;
-	private LedColor m_ret=LedColor.UNKNOWN; //use UNKNONW as CANCEL button
-	static Object modalMonitor = new Object();
-
-	public void setUseRawEnergy(boolean useRawEnergy) {
-		this.useRawEnergy=useRawEnergy;
-	}
-
-	public void setEnergyCut(double energyCut) {
-		this.energyCut=energyCut;
-	}
-	public void setSkipInitial(double skipInitial) {
-		this.skipInitial=skipInitial;
-	}
-	public void setSkipMin(double skipMin) {
-		this.skipMin=skipMin;
-	}
-
-	public void setEvnMinDraw(double evnMinDraw){
-		this.fEvnMinDraw=evnMinDraw;
-	}
-	public void setEvnMaxDraw(double evnMaxDraw){
-		this.fEvnMaxDraw=evnMaxDraw;
-	}
-	public void setChargeMinDraw(double chargeMinDraw){
-		this.fChargeMinDraw=chargeMinDraw;
-	}
-	public void setChargeMaxDraw(double chargeMaxDraw){
-		this.fChargeMaxDraw=chargeMaxDraw;
-	}
-
-	public void setNEventsMin(int nEeventsMin){
-		this.nEventsMin=nEventsMin;
-	}
-
-	public void setIsMonitoringApp(boolean app){
-		this.isMonitoringApp=app;
-	}
-
-	public void setDoFullAnalysis(boolean fullAnalysis){
-		this.doFullAnalysis=fullAnalysis;
-	}
-
-	public void setSaveTuple(boolean flag){
-		this.saveTuple=flag;
-	}
-
-	@Override
-	protected void detectorChanged(Detector detector) {
-		System.out.println("LedAnalysis::Detector changed was called");
-		System.out.println(fEvnMinDraw+" "+fEvnMaxDraw);
-		for (int ii=0;ii<nDrivers;ii++){
-			iStep[ii]=0;
-			// actualSequence[ii][iStep[ii]]=-1;
-		}
-
-		// Setup conditions
-
-		conditionsManager = DatabaseConditionsManager.getInstance();
-
-		LedTopMap = new HashMap< Integer , Integer >(); //key: ecal channel ID. Value:  led id
-		LedBotMap = new HashMap< Integer , Integer >();	
-
-		LedTopMapInverted = new HashMap< Integer , Integer >(); //key: led id. Value: ecal channel id
-		LedBotMapInverted = new HashMap< Integer , Integer >(); 
-
-
-		ChannelCollection = conditionsManager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();	
-		LedCollection = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
-		ecalConditions = conditionsManager.getEcalConditions();		
-
-		for (EcalChannel channel : ChannelCollection){
-			chid = channel.getChannelId();
-			for (EcalLed Led : LedCollection) {    	
-				if (Led.getEcalChannelId()==chid){
-					if (channel.getY()>0){
-						LedTopMap.put( chid , Led.getLedNumber() );
-						LedTopMapInverted.put(  Led.getLedNumber(), chid  );
-					}
-					else if (channel.getY()<0){
-						LedBotMap.put( chid , Led.getLedNumber() );
-						LedBotMapInverted.put( Led.getLedNumber(), chid );                    
-					}
-				}
-			}
-		}
-
-
-
-		// Setup plots
-		aida = AIDA.defaultInstance();
-		aida.tree().cd("/");
-		hMeanCharge2D = aida.histogram2D("Average LED response", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
-		factory= aida.analysisFactory().createPlotterFactory("Ecal Led Sequence");
-		pPlotter= factory.create("Drivers");
-		pPlotter.createRegions(4,2);
-		if (isMonitoringApp){
-			pPlotter2=factory.create("Sequence Map");
-			pPlotter2.createRegions(1,1);
-			pPlotter2.region(0).plot(hMeanCharge2D);
-		}   
-		iTuple = new ArrayList<ITuple>(NUM_CHANNELS);   
-		hCharge = new ArrayList<IHistogram1D>(NUM_CHANNELS);
-		hChargeVsEvn = new ArrayList<IHistogram2D>(nDrivers);
-
-
-
-		//pPlotter2.region(0).plot(hMeanCharge2D);
-
-		for (int ii=0;ii<NUM_CHANNELS;ii++){
-			int row = EcalMonitoringUtilities.getRowFromHistoID(ii);
-			int column = EcalMonitoringUtilities.getColumnFromHistoID(ii);	    
-			iTuple.add(aida.analysisFactory().createTupleFactory(aida.tree()).create("nTuple"+ii,"nTuple"+ii,"int fEvn=0 , double fCharge=0.,double fTime=0.",""));
-		}
-
-		for (int ii=0;ii<nDrivers;ii++){
-			hChargeVsEvn.add(aida.histogram2D("Driver"+ii,100,fEvnMinDraw,fEvnMaxDraw,100,fChargeMinDraw,fChargeMaxDraw));
-			pPlotter.region(ii).plot( hChargeVsEvn.get(ii));
-		}
-
-		pPlotter.show();
-		if (isMonitoringApp) pPlotter2.show();
-
-	}		
-
-	@Override
-	public void process(EventHeader event) {
-		runNumber = event.getRunNumber();
-		eventN++;
-		if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
-			//List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollectionRaw);
-			List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
-			for (CalorimeterHit hit : hits) {
-
-				column = hit.getIdentifierFieldValue("ix");
-				row = hit.getIdentifierFieldValue("iy");
-				id = EcalMonitoringUtilities.getHistoIDFromRowColumn(row, column);
-				cellID=hit.getCellID();        
-				chid = ChannelCollection.findGeometric(cellID).getChannelId();
-
-				energy = hit.getCorrectedEnergy();
-
-				if (useRawEnergy){
-					fillEnergy = getRawADCSum(energy,cellID);
-				}
-				else {
-					fillEnergy = energy;
-				}
-				fillTime = hit.getTime();
-
-
-				//find the LED
-				if (row>0){
-					ledId=LedTopMap.get(chid);
-				}
-				else if (row<0){
-					ledId=LedBotMap.get(chid);
-				}
-				driverId=getDriver(ledId);
-				if (row<0) driverId+=4;
-
-
-
-				/*Skip the events under thr*/
-				if (energy<energyCut) continue;
-
-				/*First, check if this led is the one in the NEXT step. Therefore, increment by 1 the step*/
-				/*
-				 * if (iStep[driverId]==0){
-				 
-					actualSequence[driverId][iStep[driverId]]=ledId;
-					iStep[driverId]=1;                  
-				}
-				else if ((iStep[driverId]==1)&&(ledId!=actualSequence[driverId][0])){              
-					System.out.println("LedAnalysis:: increment step ("+iStep[driverId]+") for driver "+driverId+" . Led ID: "+ledId+" Column: "+column+" Row: "+row);                 
-					if (iStep[driverId]>0) drawProfiles(actualSequence[driverId][iStep[driverId]-1],driverId); 
-					actualSequence[driverId][iStep[driverId]]=ledId;
-					iStep[driverId]++;
-				}
-				else if ((iStep[driverId]>1)&&(ledId!=actualSequence[driverId][iStep[driverId]-1])&&(ledId!=actualSequence[driverId][iStep[driverId]-2])){
-					System.out.println("LedAnalysis:: increment step ("+iStep[driverId]+") for driver "+driverId+" . Led ID: "+ledId+" Column: "+column+" Row: "+row);                 
-					if (iStep[driverId]>0) drawProfiles(actualSequence[driverId][iStep[driverId]-1],driverId); 
-					actualSequence[driverId][iStep[driverId]]=ledId;
-					iStep[driverId]++;
-				}
-
-
-			    //	if (iStep[driverId]==-1) continue; 
-
-				*/
-
-				if (iStep[driverId]==-1) continue; /*Not yet data*/
-
-				/*Put this code here, since we want to always fill the ntuple*/
-				iTuple.get(id).fill(0,nEvents[id]);
-				iTuple.get(id).fill(1,fillEnergy);
-				iTuple.get(id).fill(2,fillTime);
-				iTuple.get(id).addRow();
-				nEvents[id]++;
-
-			
-
-				/*Add a debug print */
-				if (eventN % 10000==0){
-					System.out.println("Debug. Event "+eventN+" LED ID: "+ledId+" DRIVER ID: "+driverId+" ECAL ID: "+id+" ROW: "+row+" COLUMN: "+column+ "HISTO ID: "+id);
-				}
-			}
-			if (eventN % 10000==0){
-				System.out.println("\n");
-			}
-		}		
-	}
-
-	/*
-	 * The endOfData() method analises each ntuple to find the LED response.
-	 * We cannot simply fit a gaussian to the energy distribution, since there is a high-energy tail due to the LED being turned on:
-	 * When the LED turns on, it is "cold", and emits more light. Immediately, it starts to heat, and due to temperature effects the
-	 * emitted light is less. This is clearly visible if one plots the charge VS the event number: the trend is decreasing, toward a
-	 * plateau, that corresponds to the value at thermal equilibrium.
-	 * 
-	 * For (few) channels, the first charge values are close to 0, then charge grows rapidly, then it returns back to the plateau.
-	 * To handle these, I always cut the first 10% events
-	 * To properly handle this:
-	 * 
-	 * 1) First create a profile histogram, charge VS event number.
-	 * 2) Fit it with something like "A*exp(-event_number/N0)+C. The function does not need to be extra-accurate at this stage
-	 * 3) Cut the events with event_number < 5*N0.
-	 * 4) Fit the remaining events with a gaussian.
-	 */
-	@Override
-	public void endOfData() {
-		System.out.println("LedAnalysis::end of data");
-		System.out.println("LedAnalysis:: nEventsMin is: "+nEventsMin);
-
-		double e,eMin,eMax;
-		double t;
-		int n,nBins,nSkip;
-
-		int row, column;
-
-		String hName; 
-		IFunctionFactory fFactory=aida.analysisFactory().createFunctionFactory(aida.tree());
-
-		IFitResult fResult;
-		IFitter	   fFitter;
-
-		for (int id = 0; id < 11 * 47; id++) {
-
-			eMin=9999;
-			eMax=-9999;
-			row = EcalMonitoringUtilities.getRowFromHistoID(id);
-			column = EcalMonitoringUtilities.getColumnFromHistoID(id);
-			System.out.println("");
-			System.out.println("Doing channel: X= "+column+" Y= "+row+ "id= "+id);
-			System.out.println("Number of entries in analysis ntuple: "+iTuple.get(id).rows());
-			System.out.println("Number of recognized events: "+nEvents[id]);
-			/*Create the profile. Create it for all the channels, to keep sync.*/
-			nBins=nEvents[id]/100;
-			if (nBins<=0) nBins=1;
-
-			/*Clear previous*/
-
-			if (id>0){
-				aida.tree().rm("strip");
-				aida.tree().rm("fun0");
-				aida.tree().rm("fun1");
-			}
-			/*Create the profile.*/
-			cProfile=aida.profile1D("strip",nBins,-0.5,nEvents[id]*(1-skipInitial)+0.5);
-			cProfile.reset();
-			/*Create the function for the profile fit and the gaus fit*/
-			fFunction=fFactory.createFunctionFromScript("fun0",1,"A*exp(-x[0]/tau)+B","A,tau,B","",null);
-			fFunction1=fFactory.createFunctionByName("fun1","G");
-
-			if (EcalMonitoringUtilities.isInHole(row,column)==true){
-				System.out.println("Channel X= "+column+" Y= "+row+" is in hole. Skip");
-				hCharge.add(aida.histogram1D("charge_"+id,200,0.,1.)); //create here the histogram to keep sync
-				System.out.println("In hole, skip");
-				continue;
-			}
-			else if (nEvents[id]<nEventsMin) {
-				hCharge.add(aida.histogram1D("charge_"+id,200,0.,1.)); //create here the histogram to keep sync
-				System.err.println("LedAnalysis:: the channel X= "+column+" Y= "+row+" has not enough events "+nEvents[id]+" "+nEventsMin);
-
-				continue;
-			}			  
-
-			//Fill the profile*/
-			nSkip=(int)(nEvents[id]*skipInitial);
-			if (nSkip>iTuple.get(id).rows()){
-				System.out.println("Can't skip initial events?");
-				nSkip=0;
-			}
-			iTuple.get(id).start();
-			iTuple.get(id).skip(nSkip); //This is the work-around for those channels with charge starting from 0 and rapidly growing//
-			n=0;
-			iTuple.get(id).next(); 
-			while ( iTuple.get(id).next() ){
-				e=iTuple.get(id).getDouble(1);
-				if (e<eMin) eMin=e;           			  
-				if (e>eMax) eMax=e;
-				cProfile.fill(1.*n,e);
-				n++;
-			}			
-			fFitter=aida.analysisFactory().createFitFactory().createFitter("chi2","","v");
-
-			if (doFullAnalysis){ 
-				//Init function parameters
-				double[] initialPars={eMax-eMin,nEvents[id]/10.,eMin};
-				if (initialPars[0]<0) initialPars[0]=0;
-				fFunction.setParameters(initialPars);
-
-				//Do the fit      
-				System.out.println("LedAnalysis:: do profile fit "+id+" "+fFitter.engineName()+" "+fFitter.fitMethodName());
-				System.out.println("LedAnalysis:: initial parameters "+initialPars[0]+" "+initialPars[1]+" "+initialPars[2]);
-				fResult=fFitter.fit(cProfile,fFunction);
-				fPars     = fResult.fittedParameters();
-				fParErrs  = fResult.errors();
-				fParNames = fResult.fittedParameterNames();			
-				System.out.println("LedAnalysis:: Status= "+fResult.fitStatus()+" "+fResult.isValid()+" Chi2 = "+fResult.quality()+" NDF: "+fResult.ndf());
-				for(int i=0; i< fResult.fittedFunction().numberOfParameters(); i++ ){
-					System.out.println(fParNames[i]+" : "+fPars[i]+" +- "+fParErrs[i]);
-				}  
-				fFunction.setParameters(fPars);
-
-
-				//if fit failed, revert to simpler case
-				if ((fResult.isValid()==false)||Double.isNaN(fParErrs[0])||Double.isNaN(fParErrs[1])||Double.isNaN(fParErrs[2])){
-					System.out.println("LedAnalysis:: fit failed. Reverting to simpler case");
-					nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
-				}
-				else{   
-					//Now we have the tau parameter. Take ONLY the events that are with N>5*tau/
-					//As a cross-check, also verify that tau > Nevents/10, otherwise skip the first Nevents/2
-					//and emit warning
-					nSkip=(int)( fPars[1]*5);
-					if (nSkip < (nEvents[id]*skipMin)){
-						System.out.println("LedAnalysis:: Skip number too low: "+nSkip+" Increment it to "+nEvents[id]/2);
-						nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
-					}
-					if (nSkip > nEvents[id]){
-						System.out.println("LedAnalysis:: Skip number too high, reduce it");
-						nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
-					}
-				}
-			}
-			else{
-				nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
-			}
-
-			System.out.println("LedAnalysis:: gaus fit :: Going to skip "+nSkip+" out of "+nEvents[id]);
-			System.out.println("eMin is: "+eMin+" eMax is: "+eMax);
-			hCharge.add(aida.histogram1D("charge_"+id,200,eMin*0.9,eMax*1.1));
-
-
-			iTuple.get(id).start();
-			iTuple.get(id).skip(nSkip); 
-			n=0;
-			while (iTuple.get(id).next()){
-				e=iTuple.get(id).getDouble(1);
-				t=iTuple.get(id).getDouble(2);
-				hCharge.get(id).fill(e);
-				n++;
-			}			
-
-			/*Finally do the fit with the gaussian*/
-			double[] initialPars1={hCharge.get(id).maxBinHeight(),hCharge.get(id).mean(),hCharge.get(id).rms()};
-
-			System.out.println("LedAnalysis:: Gaus fit");
-			System.out.println("LedAnalysis:: initial parameters "+initialPars1[0]+" "+initialPars1[1]+" "+initialPars1[2]);
-
-			fFunction1.setParameters(initialPars1);
-			fResult=fFitter.fit(hCharge.get(id),fFunction1);
-			fPars     = fResult.fittedParameters();
-			fParErrs  = fResult.errors();
-			fParNames = fResult.fittedParameterNames();			
-			System.out.println("Status= "+fResult.fitStatus()+" "+fResult.isValid()+" Chi2 = "+fResult.quality()+" NDF: "+fResult.ndf());
-			for(int i=0; i< fResult.fittedFunction().numberOfParameters(); i++ ){
-				System.out.println(fParNames[i]+" : "+fPars[i]+" +- "+fParErrs[i]);
-			}  
-			fFunction1.setParameters(fPars);
-			mMean[id]=fPars[1];
-			mRMS[id]=fPars[2];
-
-			hMeanCharge2D.fill(column,row,mMean[id]);
-			System.out.println("\n");
-		}//End loop on channels
-
-
-
-		if ((pPlotter2!=null)&&(isMonitoringApp)){
-			style = pPlotter2.region(0).style();
-			style.setParameter("hist2DStyle", "colorMap");
-			style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-			style.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString()); 
-			pPlotter2.region(0).plot(hMeanCharge2D);
-			pPlotter2.region(0).refresh();
-		}
-		else{
-			IPlotterStyle pstyle =  aida.analysisFactory().createPlotterFactory().createPlotterStyle();
-			pPlotter2 = null;
-			pPlotter2 =  aida.analysisFactory().createPlotterFactory().create();
-			pstyle.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-			pstyle.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
-			pstyle.setParameter("hist2DStyle", "colorMap");
-			if (pPlotter2!=null){
-				pPlotter2.createRegion().plot(hMeanCharge2D,pstyle);
-				pPlotter2.show();
-			}
-		}
-
-		if (isMonitoringApp){
-			askUploadToDBDialog();
-			synchronized (modalMonitor) {
-				try{
-					modalMonitor.wait(60000); //wait 1 minute for user interaction.
-				}
-				catch(InterruptedException excp){
-					System.out.println("Got exception: "+excp);
-				}
-			}
-			if ((m_ret!=LedColor.UNKNOWN)){
-				if (m_ret==LedColor.BLUE)    System.out.println("OK, upload to DB BLUE");
-				else System.out.println("OK, upload to DB RED");
-				try {
-					uploadToDB(m_ret);
-				} catch (SQLException | DatabaseObjectException | ConditionsObjectException error) {
-					throw new RuntimeException("Error uploading to the database ", error);
-				}
-
-				System.out.println("Save an Elog too");
-				uploadToElog();
-			}
-			else{
-				System.out.println("Cancel pressed. Nothing to do");
-			}
-		}
-
-		/*Write a file with the LED values*/
-		try {
-			if (useRawEnergy){
-				outFileName=runNumber+".raw.txt";
-			}
-			else{
-				outFileName=runNumber+".energy.txt";
-			}
-			PrintWriter writer = new PrintWriter(outFileName, "UTF-8");
-
-			for (int cid = 1; cid <= 442; cid++) {/*This is a loop over the channel ID, as in the conditions system*/
-				EcalChannel cc = findChannel(cid);
-				column = cc.getX(); //This is the column
-				row = cc.getY(); //This is the row
-				id=EcalMonitoringUtilities.getHistoIDFromRowColumn(row,column);
-				row = EcalMonitoringUtilities.getRowFromHistoID(id);
-				column = EcalMonitoringUtilities.getColumnFromHistoID(id);
-				if (EcalMonitoringUtilities.isInHole(row, column)) continue;
-				if ((row == 0) || (column == 0)) continue;
-
-				writer.print(cid+" "+column+" "+row+" "+" "+ mMean[id]+" "+mRMS[id]+"\r\n");
-
-			}
-			writer.close();
-
-		} 
-		catch (FileNotFoundException fnfe) {
-
-			System.out.println(fnfe.getMessage());
-
-		}
-
-		catch (IOException ioe) {
-
-			System.out.println(ioe.getMessage());
-
-		}
-
-
-		System.out.println("EcalLedSequenceMonitor endOfData clear histograms"); 
-		for(int ii = 0; ii < NUM_CHANNELS; ii++) {   	
-			row=EcalMonitoringUtilities.getRowFromHistoID(ii);
-			column = EcalMonitoringUtilities.getColumnFromHistoID(ii);      	  
-			hName="charge_"+ii;	 
-			try{
-				aida.tree().rm(hName);
-			}
-			catch(IllegalArgumentException ee){
-				System.out.println("Got exception "+ee);
-			}
-
-			if (!saveTuple||(isMonitoringApp)){
-				hName="nTuple"+ii;
-				try{
-					aida.tree().rm(hName);
-				}
-				catch(IllegalArgumentException ee){
-					System.out.println("Got exception "+ee);
-				}
-			}
-		}
-		System.out.println("EcalLedSequenceMonitor endOfData clear histograms done");   
-		System.out.println("endOfData end");
-		System.out.println("The program is not stucked. It is writing the output AIDA file, this takes time!");
-	}/*End endOfData*/
-
-
-	/**
-	 * This function returns the driver number (from 0 to 3) given the LED id.
-	 * @param led
-	 * @return
-	 */
-	public int getDriver(int led){
-		int ret=-1;	
-		if ((led>=2)&&(led<56)) ret=0;
-		else if ((led>=56)&&(led<112)) ret=1;
-		else if ((led>=112)&&(led<168)) ret=2;
-		else if ((led>=168)&&(led<224)) ret=3;
-		return ret;
-	}
-
-	/**
-	 * Very simple method to retrieve the pedestal-subtracted raw Energy.
-	 * If the gain changes (because we do a re-calibration), I do not want to include this in the LED analysis
-	 * @param energy
-	 * @param cellID
-	 * @return
-	 */
-	public double getRawADCSum(double energy,long cellID){
-		EcalChannelConstants channelData = ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
-		double RawSum=energy / EcalUtils.GeV;
-		double gain=channelData.getGain().getGain();
-		double ret=RawSum/gain;
-		//  System.out.println("A:C "+RawSum+" "+ret);
-		return ret;
-	}
-
-	private void uploadToDB(LedColor color) throws DatabaseObjectException, ConditionsObjectException, SQLException {
-		int x,y,id;
-		double mean,rms;
-		System.out.println(String.format("Uploading new led data to the database, runMin=%d, runMax=%d, tag=%s ....",
-				runNumber,runNumberMax,dbTag));
-
-		conditionsManager = DatabaseConditionsManager.getInstance();
-		EcalLedCalibrationCollection led_calibrations =  new EcalLedCalibrationCollection();
-		led_calibrations.setConnection(conditionsManager.getConnection());
-
-		TableMetaData tableMetaData = conditionsManager.findTableMetaData(dbTableName);
-		led_calibrations.setTableMetaData(tableMetaData);
-
-		for (int cid = 1; cid <= 442; cid++) {/*This is a loop over the channel ID, as in the conditions system*/
-			EcalChannel cc = findChannel(cid);
-			x = cc.getX(); //This is the column
-			y = cc.getY(); //This is the row
-			id=EcalMonitoringUtilities.getHistoIDFromRowColumn(y,x);
-			mean=mMean[id];
-			rms=mRMS[id];
-			led_calibrations.add(new EcalLedCalibration(cid,mean,rms,color));
-		}
-
-		int collectionId = -1;
-
-		try {
-			collectionId = conditionsManager.getCollectionId(led_calibrations, "loaded by EcalLedSequenceMonitor");
-		} catch (Exception e) {
-			System.out.println("Got exception on uploadToDB "+ e);
-			throw new RuntimeException(e);
-		}
-		System.err.println("CollectionID:  "+collectionId);
-		led_calibrations.insert();
-		ConditionsRecord conditionsRecord = new ConditionsRecord(
-				led_calibrations.getCollectionId(), runNumber, runNumberMax, dbTableName, dbTableName, 
-				"Generated by LedAnalysis from Run #"+runNumber, dbTag);
-		conditionsRecord.setConnection(conditionsManager.getConnection());
-		tableMetaData = conditionsManager.findTableMetaData("conditions");
-		conditionsRecord.setTableMetaData(tableMetaData);
-		conditionsRecord.insert();
-
-		System.out.println("Upload to DB done");
-	}
-
-	private void uploadToElog(){
-		String path,exe,command,imgpath;
-		path="/home/hpsrun/LedSequenceData";
-		exe=path+"/doElog.csh";
-		imgpath=path+"/screenshots/"+runNumber+".png";
-
-		File f=new File(path);
-		if (!f.exists()){
-			System.err.println("LedMonitoringSequence:: wrong path");
-			return;
-		}
-		if (pPlotter2==null){
-			System.err.println("LedMonitoringSquence:: no plotter");
-			return;
-		}
-		try{
-			pPlotter2.writeToFile(imgpath);
-		}
-		catch(Exception e){
-			System.err.println("Exception "+e);
-		}
-		File f1=new File(exe);
-		if (!f1.exists()){
-			System.err.println("LedMonitoringSequence:: no script!");
-			return;
-		}   
-		command=exe+" "+imgpath;
-		try{
-			System.out.println("LedMonitoringSequence:: try this command: "+command);
-			Runtime.getRuntime().exec(command);
-		}
-		catch(Exception e){
-			System.err.println("Exception "+e);
-		}
-	}
-
-
-	private void drawProfiles(int ledID,int driverID){
-
-		int m_column,m_row,m_ledID,m_chID,m_ID,m_driverID;
-
-		m_ledID = ledID;
-		m_driverID = driverID;
-		m_chID = 0;
-
-
-		if (m_driverID<=3) m_chID = LedTopMapInverted.get(ledID);
-		else m_chID = LedBotMapInverted.get(ledID);
-
-		m_column=findChannel(m_chID).getX();
-		m_row=findChannel(m_chID).getY();
-		m_ID=EcalMonitoringUtilities.getHistoIDFromRowColumn(m_row, m_column);
-		/* 
+    private static final int NUM_CHANNELS = 11 * 47;
+    private static final String dbTag = "led";
+    private static final String dbTableName = "ecal_led_calibrations";
+    private static final int runNumberMax = 9999;
+    private static final int nDrivers = 8;
+    private static final int nSteps = 100; //should be 56 but here is to avoid seg fault
+
+
+
+    String inputCollectionRaw = "EcalReadoutHits";
+    String inputCollection = "EcalCalHits"; 
+    AIDA aida;
+
+    DatabaseConditionsManager conditionsManager;
+
+    private EcalChannelCollection ChannelCollection;    
+    private EcalLedCollection LedCollection;
+    private EcalConditions ecalConditions;
+
+    Map < Integer,Integer > LedTopMap; //chid (conditions) --> LED id
+    Map < Integer,Integer > LedBotMap; //chid (conditions) --> LED id 
+
+    Map < Integer,Integer > LedTopMapInverted; //LED id --> chid (conditions)
+    Map < Integer,Integer > LedBotMapInverted; //LED id  --> chid (conditions)
+
+    private boolean useRawEnergy=false;
+
+    String outFileName;
+
+
+    private int runNumber = 0;  
+    private int eventN    = 0;
+    private int id,row,column,chid,ledId,driverId;
+    private  int[][] expectedSequence = new int[][]{ /*A.C. it is a terrible thing to have this hard-coded here!*/
+            //first 4 are the flasher1 sequence, TOP controller 
+            {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,-1},
+            {56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111},
+            {112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,-1}, //missing 135 is ok
+            {168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223},
+            //second 4 are the flasher2 sequence, BOTTOM controller 
+            {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,-1},  
+            {56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,-1}, //missing 69 is OK
+            {112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167},  
+            {168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223},
+    };
+    private int[][] actualSequence=new int[nDrivers][nSteps];
+
+    private int[] iStep = new int[nDrivers];
+    private int[] nEvents = new int[NUM_CHANNELS];
+    private double[] mMean = new double[NUM_CHANNELS];
+    private double[] mRMS = new double[NUM_CHANNELS];
+
+    private int nEventsMin=200;
+    private int nMinChannelsWithEvents=350; 
+    private double energy,fillEnergy,fillTime;
+    private double energyCut=2; //we expect very high energy from the LEDs..
+    private double skipInitial=0.05;
+    private double skipMin=0.3;
+    private long cellID;
+
+
+
+
+    //Histograms-functions-ntuples
+    private ArrayList<ITuple> iTuple;
+
+    private IFunction  fFunction,fFunction1;
+    private IProfile1D   cProfile;
+    private IHistogram2D            hMeanCharge2D;
+    private ArrayList<IHistogram1D> hCharge;
+    private ArrayList<IHistogram2D> hChargeVsEvn;
+    private IPlotterFactory factory;
+    private IPlotter pPlotter=null;
+    private IPlotter pPlotter2=null;
+    private IPlotterStyle style ;
+    private int[] fitStatus = new int[NUM_CHANNELS];
+
+    private boolean doFullAnalysis=false;
+    private boolean isMonitoringApp=false; 
+    private boolean saveTuple=false; 
+
+    private double[] fPars;    
+    private double[] fPrevPars;
+    private double[] fParErrs;
+    private String[] fParNames; 
+
+
+    private double fEvnMinDraw=0.;
+    private double fEvnMaxDraw=80000.;
+    private double fChargeMinDraw=0.;
+    private double fChargeMaxDraw=100.;
+
+    /*Components for user interaction*/
+    private JDialog dialog;
+    private JLabel  label;
+    private JFrame frame;
+    private JPanel panel;
+    String  labelString;
+    private JButton okButtonRed,okButtonBlue,cancelButton;
+    private int m_iteration=0;
+    private LedColor m_ret=LedColor.UNKNOWN; //use UNKNONW as CANCEL button
+    static Object modalMonitor = new Object();
+
+    public void setUseRawEnergy(boolean useRawEnergy) {
+        this.useRawEnergy=useRawEnergy;
+    }
+
+    public void setEnergyCut(double energyCut) {
+        this.energyCut=energyCut;
+    }
+    public void setSkipInitial(double skipInitial) {
+        this.skipInitial=skipInitial;
+    }
+    public void setSkipMin(double skipMin) {
+        this.skipMin=skipMin;
+    }
+
+    public void setEvnMinDraw(double evnMinDraw){
+        this.fEvnMinDraw=evnMinDraw;
+    }
+    public void setEvnMaxDraw(double evnMaxDraw){
+        this.fEvnMaxDraw=evnMaxDraw;
+    }
+    public void setChargeMinDraw(double chargeMinDraw){
+        this.fChargeMinDraw=chargeMinDraw;
+    }
+    public void setChargeMaxDraw(double chargeMaxDraw){
+        this.fChargeMaxDraw=chargeMaxDraw;
+    }
+
+    public void setNEventsMin(int nEeventsMin){
+        this.nEventsMin=nEventsMin;
+    }
+
+    public void setIsMonitoringApp(boolean app){
+        this.isMonitoringApp=app;
+    }
+
+    public void setDoFullAnalysis(boolean fullAnalysis){
+        this.doFullAnalysis=fullAnalysis;
+    }
+
+    public void setSaveTuple(boolean flag){
+        this.saveTuple=flag;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+        System.out.println("LedAnalysis::Detector changed was called");
+        System.out.println(fEvnMinDraw+" "+fEvnMaxDraw);
+        for (int ii=0;ii<nDrivers;ii++){
+            iStep[ii]=0;
+            // actualSequence[ii][iStep[ii]]=-1;
+        }
+
+        // Setup conditions
+
+        conditionsManager = DatabaseConditionsManager.getInstance();
+
+        LedTopMap = new HashMap< Integer , Integer >(); //key: ecal channel ID. Value:  led id
+        LedBotMap = new HashMap< Integer , Integer >(); 
+
+        LedTopMapInverted = new HashMap< Integer , Integer >(); //key: led id. Value: ecal channel id
+        LedBotMapInverted = new HashMap< Integer , Integer >(); 
+
+
+        ChannelCollection = conditionsManager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();    
+        LedCollection = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
+        ecalConditions = conditionsManager.getEcalConditions();     
+
+        for (EcalChannel channel : ChannelCollection){
+            chid = channel.getChannelId();
+            for (EcalLed Led : LedCollection) {     
+                if (Led.getEcalChannelId()==chid){
+                    if (channel.getY()>0){
+                        LedTopMap.put( chid , Led.getLedNumber() );
+                        LedTopMapInverted.put(  Led.getLedNumber(), chid  );
+                    }
+                    else if (channel.getY()<0){
+                        LedBotMap.put( chid , Led.getLedNumber() );
+                        LedBotMapInverted.put( Led.getLedNumber(), chid );                    
+                    }
+                }
+            }
+        }
+
+
+
+        // Setup plots
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        hMeanCharge2D = aida.histogram2D("Average LED response", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        factory= aida.analysisFactory().createPlotterFactory("Ecal Led Sequence");
+        pPlotter= factory.create("Drivers");
+        pPlotter.createRegions(4,2);
+        if (isMonitoringApp){
+            pPlotter2=factory.create("Sequence Map");
+            pPlotter2.createRegions(1,1);
+            pPlotter2.region(0).plot(hMeanCharge2D);
+        }   
+        iTuple = new ArrayList<ITuple>(NUM_CHANNELS);   
+        hCharge = new ArrayList<IHistogram1D>(NUM_CHANNELS);
+        hChargeVsEvn = new ArrayList<IHistogram2D>(nDrivers);
+
+
+
+        //pPlotter2.region(0).plot(hMeanCharge2D);
+
+        for (int ii=0;ii<NUM_CHANNELS;ii++){
+            int row = EcalMonitoringUtilities.getRowFromHistoID(ii);
+            int column = EcalMonitoringUtilities.getColumnFromHistoID(ii);      
+            iTuple.add(aida.analysisFactory().createTupleFactory(aida.tree()).create("nTuple"+ii,"nTuple"+ii,"int fEvn=0 , double fCharge=0.,double fTime=0.",""));
+        }
+
+        for (int ii=0;ii<nDrivers;ii++){
+            hChargeVsEvn.add(aida.histogram2D("Driver"+ii,100,fEvnMinDraw,fEvnMaxDraw,100,fChargeMinDraw,fChargeMaxDraw));
+            pPlotter.region(ii).plot( hChargeVsEvn.get(ii));
+        }
+
+        pPlotter.show();
+        if (isMonitoringApp) pPlotter2.show();
+
+    }       
+
+    @Override
+    public void process(EventHeader event) {
+        runNumber = event.getRunNumber();
+        eventN++;
+        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+            //List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollectionRaw);
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+            for (CalorimeterHit hit : hits) {
+
+                column = hit.getIdentifierFieldValue("ix");
+                row = hit.getIdentifierFieldValue("iy");
+                id = EcalMonitoringUtilities.getHistoIDFromRowColumn(row, column);
+                cellID=hit.getCellID();        
+                chid = ChannelCollection.findGeometric(cellID).getChannelId();
+
+                energy = hit.getCorrectedEnergy();
+
+                if (useRawEnergy){
+                    fillEnergy = getRawADCSum(energy,cellID);
+                }
+                else {
+                    fillEnergy = energy;
+                }
+                fillTime = hit.getTime();
+
+
+                //find the LED
+                if (row>0){
+                    ledId=LedTopMap.get(chid);
+                }
+                else if (row<0){
+                    ledId=LedBotMap.get(chid);
+                }
+                driverId=getDriver(ledId);
+                if (row<0) driverId+=4;
+
+
+
+                /*Skip the events under thr*/
+                if (energy<energyCut) continue;
+
+                /*First, check if this led is the one in the NEXT step. Therefore, increment by 1 the step*/
+                /*
+                 * if (iStep[driverId]==0){
+                 
+                    actualSequence[driverId][iStep[driverId]]=ledId;
+                    iStep[driverId]=1;                  
+                }
+                else if ((iStep[driverId]==1)&&(ledId!=actualSequence[driverId][0])){              
+                    System.out.println("LedAnalysis:: increment step ("+iStep[driverId]+") for driver "+driverId+" . Led ID: "+ledId+" Column: "+column+" Row: "+row);                 
+                    if (iStep[driverId]>0) drawProfiles(actualSequence[driverId][iStep[driverId]-1],driverId); 
+                    actualSequence[driverId][iStep[driverId]]=ledId;
+                    iStep[driverId]++;
+                }
+                else if ((iStep[driverId]>1)&&(ledId!=actualSequence[driverId][iStep[driverId]-1])&&(ledId!=actualSequence[driverId][iStep[driverId]-2])){
+                    System.out.println("LedAnalysis:: increment step ("+iStep[driverId]+") for driver "+driverId+" . Led ID: "+ledId+" Column: "+column+" Row: "+row);                 
+                    if (iStep[driverId]>0) drawProfiles(actualSequence[driverId][iStep[driverId]-1],driverId); 
+                    actualSequence[driverId][iStep[driverId]]=ledId;
+                    iStep[driverId]++;
+                }
+
+
+                //  if (iStep[driverId]==-1) continue; 
+
+                */
+
+                if (iStep[driverId]==-1) continue; /*Not yet data*/
+
+                /*Put this code here, since we want to always fill the ntuple*/
+                iTuple.get(id).fill(0,nEvents[id]);
+                iTuple.get(id).fill(1,fillEnergy);
+                iTuple.get(id).fill(2,fillTime);
+                iTuple.get(id).addRow();
+                nEvents[id]++;
+
+            
+
+                /*Add a debug print */
+                if (eventN % 10000==0){
+                    System.out.println("Debug. Event "+eventN+" LED ID: "+ledId+" DRIVER ID: "+driverId+" ECAL ID: "+id+" ROW: "+row+" COLUMN: "+column+ "HISTO ID: "+id);
+                }
+            }
+            if (eventN % 10000==0){
+                System.out.println("\n");
+            }
+        }       
+    }
+
+    /*
+     * The endOfData() method analises each ntuple to find the LED response.
+     * We cannot simply fit a gaussian to the energy distribution, since there is a high-energy tail due to the LED being turned on:
+     * When the LED turns on, it is "cold", and emits more light. Immediately, it starts to heat, and due to temperature effects the
+     * emitted light is less. This is clearly visible if one plots the charge VS the event number: the trend is decreasing, toward a
+     * plateau, that corresponds to the value at thermal equilibrium.
+     * 
+     * For (few) channels, the first charge values are close to 0, then charge grows rapidly, then it returns back to the plateau.
+     * To handle these, I always cut the first 10% events
+     * To properly handle this:
+     * 
+     * 1) First create a profile histogram, charge VS event number.
+     * 2) Fit it with something like "A*exp(-event_number/N0)+C. The function does not need to be extra-accurate at this stage
+     * 3) Cut the events with event_number < 5*N0.
+     * 4) Fit the remaining events with a gaussian.
+     */
+    @Override
+    public void endOfData() {
+        System.out.println("LedAnalysis::end of data");
+        System.out.println("LedAnalysis:: nEventsMin is: "+nEventsMin);
+
+        double e,eMin,eMax;
+        double t;
+        int n,nBins,nSkip;
+
+        int row, column;
+
+        String hName; 
+        IFunctionFactory fFactory=aida.analysisFactory().createFunctionFactory(aida.tree());
+
+        IFitResult fResult;
+        IFitter    fFitter;
+
+        for (int id = 0; id < 11 * 47; id++) {
+
+            eMin=9999;
+            eMax=-9999;
+            row = EcalMonitoringUtilities.getRowFromHistoID(id);
+            column = EcalMonitoringUtilities.getColumnFromHistoID(id);
+            System.out.println("");
+            System.out.println("Doing channel: X= "+column+" Y= "+row+ "id= "+id);
+            System.out.println("Number of entries in analysis ntuple: "+iTuple.get(id).rows());
+            System.out.println("Number of recognized events: "+nEvents[id]);
+            /*Create the profile. Create it for all the channels, to keep sync.*/
+            nBins=nEvents[id]/100;
+            if (nBins<=0) nBins=1;
+
+            /*Clear previous*/
+
+            if (id>0){
+                aida.tree().rm("strip");
+                aida.tree().rm("fun0");
+                aida.tree().rm("fun1");
+            }
+            /*Create the profile.*/
+            cProfile=aida.profile1D("strip",nBins,-0.5,nEvents[id]*(1-skipInitial)+0.5);
+            cProfile.reset();
+            /*Create the function for the profile fit and the gaus fit*/
+            fFunction=fFactory.createFunctionFromScript("fun0",1,"A*exp(-x[0]/tau)+B","A,tau,B","",null);
+            fFunction1=fFactory.createFunctionByName("fun1","G");
+
+            if (EcalMonitoringUtilities.isInHole(row,column)==true){
+                System.out.println("Channel X= "+column+" Y= "+row+" is in hole. Skip");
+                hCharge.add(aida.histogram1D("charge_"+id,200,0.,1.)); //create here the histogram to keep sync
+                System.out.println("In hole, skip");
+                continue;
+            }
+            else if (nEvents[id]<nEventsMin) {
+                hCharge.add(aida.histogram1D("charge_"+id,200,0.,1.)); //create here the histogram to keep sync
+                System.err.println("LedAnalysis:: the channel X= "+column+" Y= "+row+" has not enough events "+nEvents[id]+" "+nEventsMin);
+
+                continue;
+            }             
+
+            //Fill the profile*/
+            nSkip=(int)(nEvents[id]*skipInitial);
+            if (nSkip>iTuple.get(id).rows()){
+                System.out.println("Can't skip initial events?");
+                nSkip=0;
+            }
+            iTuple.get(id).start();
+            iTuple.get(id).skip(nSkip); //This is the work-around for those channels with charge starting from 0 and rapidly growing//
+            n=0;
+            iTuple.get(id).next(); 
+            while ( iTuple.get(id).next() ){
+                e=iTuple.get(id).getDouble(1);
+                if (e<eMin) eMin=e;                       
+                if (e>eMax) eMax=e;
+                cProfile.fill(1.*n,e);
+                n++;
+            }           
+            fFitter=aida.analysisFactory().createFitFactory().createFitter("chi2","","v");
+
+            if (doFullAnalysis){ 
+                //Init function parameters
+                double[] initialPars={eMax-eMin,nEvents[id]/10.,eMin};
+                if (initialPars[0]<0) initialPars[0]=0;
+                fFunction.setParameters(initialPars);
+
+                //Do the fit      
+                System.out.println("LedAnalysis:: do profile fit "+id+" "+fFitter.engineName()+" "+fFitter.fitMethodName());
+                System.out.println("LedAnalysis:: initial parameters "+initialPars[0]+" "+initialPars[1]+" "+initialPars[2]);
+                fResult=fFitter.fit(cProfile,fFunction);
+                fPars     = fResult.fittedParameters();
+                fParErrs  = fResult.errors();
+                fParNames = fResult.fittedParameterNames();         
+                System.out.println("LedAnalysis:: Status= "+fResult.fitStatus()+" "+fResult.isValid()+" Chi2 = "+fResult.quality()+" NDF: "+fResult.ndf());
+                for(int i=0; i< fResult.fittedFunction().numberOfParameters(); i++ ){
+                    System.out.println(fParNames[i]+" : "+fPars[i]+" +- "+fParErrs[i]);
+                }  
+                fFunction.setParameters(fPars);
+
+
+                //if fit failed, revert to simpler case
+                if ((fResult.isValid()==false)||Double.isNaN(fParErrs[0])||Double.isNaN(fParErrs[1])||Double.isNaN(fParErrs[2])){
+                    System.out.println("LedAnalysis:: fit failed. Reverting to simpler case");
+                    nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
+                }
+                else{   
+                    //Now we have the tau parameter. Take ONLY the events that are with N>5*tau/
+                    //As a cross-check, also verify that tau > Nevents/10, otherwise skip the first Nevents/2
+                    //and emit warning
+                    nSkip=(int)( fPars[1]*5);
+                    if (nSkip < (nEvents[id]*skipMin)){
+                        System.out.println("LedAnalysis:: Skip number too low: "+nSkip+" Increment it to "+nEvents[id]/2);
+                        nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
+                    }
+                    if (nSkip > nEvents[id]){
+                        System.out.println("LedAnalysis:: Skip number too high, reduce it");
+                        nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
+                    }
+                }
+            }
+            else{
+                nSkip=(int)(nEvents[id]*(skipMin+skipInitial));
+            }
+
+            System.out.println("LedAnalysis:: gaus fit :: Going to skip "+nSkip+" out of "+nEvents[id]);
+            System.out.println("eMin is: "+eMin+" eMax is: "+eMax);
+            hCharge.add(aida.histogram1D("charge_"+id,200,eMin*0.9,eMax*1.1));
+
+
+            iTuple.get(id).start();
+            iTuple.get(id).skip(nSkip); 
+            n=0;
+            while (iTuple.get(id).next()){
+                e=iTuple.get(id).getDouble(1);
+                t=iTuple.get(id).getDouble(2);
+                hCharge.get(id).fill(e);
+                n++;
+            }           
+
+            /*Finally do the fit with the gaussian*/
+            double[] initialPars1={hCharge.get(id).maxBinHeight(),hCharge.get(id).mean(),hCharge.get(id).rms()};
+
+            System.out.println("LedAnalysis:: Gaus fit");
+            System.out.println("LedAnalysis:: initial parameters "+initialPars1[0]+" "+initialPars1[1]+" "+initialPars1[2]);
+
+            fFunction1.setParameters(initialPars1);
+            fResult=fFitter.fit(hCharge.get(id),fFunction1);
+            fPars     = fResult.fittedParameters();
+            fParErrs  = fResult.errors();
+            fParNames = fResult.fittedParameterNames();         
+            System.out.println("Status= "+fResult.fitStatus()+" "+fResult.isValid()+" Chi2 = "+fResult.quality()+" NDF: "+fResult.ndf());
+            for(int i=0; i< fResult.fittedFunction().numberOfParameters(); i++ ){
+                System.out.println(fParNames[i]+" : "+fPars[i]+" +- "+fParErrs[i]);
+            }  
+            fFunction1.setParameters(fPars);
+            mMean[id]=fPars[1];
+            mRMS[id]=fPars[2];
+
+            hMeanCharge2D.fill(column,row,mMean[id]);
+            System.out.println("\n");
+        }//End loop on channels
+
+
+
+        if ((pPlotter2!=null)&&(isMonitoringApp)){
+            style = pPlotter2.region(0).style();
+            style.setParameter("hist2DStyle", "colorMap");
+            style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            style.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString()); 
+            pPlotter2.region(0).plot(hMeanCharge2D);
+            pPlotter2.region(0).refresh();
+        }
+        else{
+            IPlotterStyle pstyle =  aida.analysisFactory().createPlotterFactory().createPlotterStyle();
+            pPlotter2 = null;
+            pPlotter2 =  aida.analysisFactory().createPlotterFactory().create();
+            pstyle.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            pstyle.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
+            pstyle.setParameter("hist2DStyle", "colorMap");
+            if (pPlotter2!=null){
+                pPlotter2.createRegion().plot(hMeanCharge2D,pstyle);
+                pPlotter2.show();
+            }
+        }
+
+        if (isMonitoringApp){
+            askUploadToDBDialog();
+            synchronized (modalMonitor) {
+                try{
+                    modalMonitor.wait(60000); //wait 1 minute for user interaction.
+                }
+                catch(InterruptedException excp){
+                    System.out.println("Got exception: "+excp);
+                }
+            }
+            if ((m_ret!=LedColor.UNKNOWN)){
+                if (m_ret==LedColor.BLUE)    System.out.println("OK, upload to DB BLUE");
+                else System.out.println("OK, upload to DB RED");
+                try {
+                    uploadToDB(m_ret);
+                } catch (SQLException | DatabaseObjectException | ConditionsObjectException error) {
+                    throw new RuntimeException("Error uploading to the database ", error);
+                }
+
+                System.out.println("Save an Elog too");
+                uploadToElog();
+            }
+            else{
+                System.out.println("Cancel pressed. Nothing to do");
+            }
+        }
+
+        /*Write a file with the LED values*/
+        try {
+            if (useRawEnergy){
+                outFileName=runNumber+".raw.txt";
+            }
+            else{
+                outFileName=runNumber+".energy.txt";
+            }
+            PrintWriter writer = new PrintWriter(outFileName, "UTF-8");
+
+            for (int cid = 1; cid <= 442; cid++) {/*This is a loop over the channel ID, as in the conditions system*/
+                EcalChannel cc = findChannel(cid);
+                column = cc.getX(); //This is the column
+                row = cc.getY(); //This is the row
+                id=EcalMonitoringUtilities.getHistoIDFromRowColumn(row,column);
+                row = EcalMonitoringUtilities.getRowFromHistoID(id);
+                column = EcalMonitoringUtilities.getColumnFromHistoID(id);
+                if (EcalMonitoringUtilities.isInHole(row, column)) continue;
+                if ((row == 0) || (column == 0)) continue;
+
+                writer.print(cid+" "+column+" "+row+" "+" "+ mMean[id]+" "+mRMS[id]+"\r\n");
+
+            }
+            writer.close();
+
+        } 
+        catch (FileNotFoundException fnfe) {
+
+            System.out.println(fnfe.getMessage());
+
+        }
+
+        catch (IOException ioe) {
+
+            System.out.println(ioe.getMessage());
+
+        }
+
+
+        System.out.println("EcalLedSequenceMonitor endOfData clear histograms"); 
+        for(int ii = 0; ii < NUM_CHANNELS; ii++) {      
+            row=EcalMonitoringUtilities.getRowFromHistoID(ii);
+            column = EcalMonitoringUtilities.getColumnFromHistoID(ii);            
+            hName="charge_"+ii;  
+            try{
+                aida.tree().rm(hName);
+            }
+            catch(IllegalArgumentException ee){
+                System.out.println("Got exception "+ee);
+            }
+
+            if (!saveTuple||(isMonitoringApp)){
+                hName="nTuple"+ii;
+                try{
+                    aida.tree().rm(hName);
+                }
+                catch(IllegalArgumentException ee){
+                    System.out.println("Got exception "+ee);
+                }
+            }
+        }
+        System.out.println("EcalLedSequenceMonitor endOfData clear histograms done");   
+        System.out.println("endOfData end");
+        System.out.println("The program is not stucked. It is writing the output AIDA file, this takes time!");
+    }/*End endOfData*/
+
+
+    /**
+     * This function returns the driver number (from 0 to 3) given the LED id.
+     * @param led
+     * @return
+     */
+    public int getDriver(int led){
+        int ret=-1; 
+        if ((led>=2)&&(led<56)) ret=0;
+        else if ((led>=56)&&(led<112)) ret=1;
+        else if ((led>=112)&&(led<168)) ret=2;
+        else if ((led>=168)&&(led<224)) ret=3;
+        return ret;
+    }
+
+    /**
+     * Very simple method to retrieve the pedestal-subtracted raw Energy.
+     * If the gain changes (because we do a re-calibration), I do not want to include this in the LED analysis
+     * @param energy
+     * @param cellID
+     * @return
+     */
+    public double getRawADCSum(double energy,long cellID){
+        EcalChannelConstants channelData = ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
+        double RawSum=energy / EcalUtils.GeV;
+        double gain=channelData.getGain().getGain();
+        double ret=RawSum/gain;
+        //  System.out.println("A:C "+RawSum+" "+ret);
+        return ret;
+    }
+
+    private void uploadToDB(LedColor color) throws DatabaseObjectException, ConditionsObjectException, SQLException {
+        int x,y,id;
+        double mean,rms;
+        System.out.println(String.format("Uploading new led data to the database, runMin=%d, runMax=%d, tag=%s ....",
+                runNumber,runNumberMax,dbTag));
+
+        conditionsManager = DatabaseConditionsManager.getInstance();
+        EcalLedCalibrationCollection led_calibrations =  new EcalLedCalibrationCollection();
+        led_calibrations.setConnection(conditionsManager.getConnection());
+
+        TableMetaData tableMetaData = conditionsManager.findTableMetaData(dbTableName);
+        led_calibrations.setTableMetaData(tableMetaData);
+
+        for (int cid = 1; cid <= 442; cid++) {/*This is a loop over the channel ID, as in the conditions system*/
+            EcalChannel cc = findChannel(cid);
+            x = cc.getX(); //This is the column
+            y = cc.getY(); //This is the row
+            id=EcalMonitoringUtilities.getHistoIDFromRowColumn(y,x);
+            mean=mMean[id];
+            rms=mRMS[id];
+            led_calibrations.add(new EcalLedCalibration(cid,mean,rms,color));
+        }
+
+        int collectionId = -1;
+
+        try {
+            collectionId = conditionsManager.getCollectionId(led_calibrations, "loaded by EcalLedSequenceMonitor");
+        } catch (Exception e) {
+            System.out.println("Got exception on uploadToDB "+ e);
+            throw new RuntimeException(e);
+        }
+        System.err.println("CollectionID:  "+collectionId);
+        led_calibrations.insert();
+        ConditionsRecord conditionsRecord = new ConditionsRecord(
+                led_calibrations.getCollectionId(), runNumber, runNumberMax, dbTableName, dbTableName, 
+                "Generated by LedAnalysis from Run #"+runNumber, dbTag);
+        conditionsRecord.setConnection(conditionsManager.getConnection());
+        tableMetaData = conditionsManager.findTableMetaData("conditions");
+        conditionsRecord.setTableMetaData(tableMetaData);
+        conditionsRecord.insert();
+
+        System.out.println("Upload to DB done");
+    }
+
+    private void uploadToElog(){
+        String path,exe,command,imgpath;
+        path="/home/hpsrun/LedSequenceData";
+        exe=path+"/doElog.csh";
+        imgpath=path+"/screenshots/"+runNumber+".png";
+
+        File f=new File(path);
+        if (!f.exists()){
+            System.err.println("LedMonitoringSequence:: wrong path");
+            return;
+        }
+        if (pPlotter2==null){
+            System.err.println("LedMonitoringSquence:: no plotter");
+            return;
+        }
+        try{
+            pPlotter2.writeToFile(imgpath);
+        }
+        catch(Exception e){
+            System.err.println("Exception "+e);
+        }
+        File f1=new File(exe);
+        if (!f1.exists()){
+            System.err.println("LedMonitoringSequence:: no script!");
+            return;
+        }   
+        command=exe+" "+imgpath;
+        try{
+            System.out.println("LedMonitoringSequence:: try this command: "+command);
+            Runtime.getRuntime().exec(command);
+        }
+        catch(Exception e){
+            System.err.println("Exception "+e);
+        }
+    }
+
+
+    private void drawProfiles(int ledID,int driverID){
+
+        int m_column,m_row,m_ledID,m_chID,m_ID,m_driverID;
+
+        m_ledID = ledID;
+        m_driverID = driverID;
+        m_chID = 0;
+
+
+        if (m_driverID<=3) m_chID = LedTopMapInverted.get(ledID);
+        else m_chID = LedBotMapInverted.get(ledID);
+
+        m_column=findChannel(m_chID).getX();
+        m_row=findChannel(m_chID).getY();
+        m_ID=EcalMonitoringUtilities.getHistoIDFromRowColumn(m_row, m_column);
+        /* 
         System.out.println("Going to draw LED id "+m_ledID+" X= "+m_column+" Y= "+m_row+" driver: "+m_driverID);
         System.out.println("Ch_ID: "+m_chID);
         System.out.println("Histo ID:"+m_ID);
         System.out.println("Events: "+iTuple.get(m_ID).rows());
-		 */      
-		hChargeVsEvn.get(m_driverID).reset();
-		hChargeVsEvn.get(m_driverID).setTitle("Driver_"+m_driverID+" Led_"+ledID);
-		IEvaluator evaluatorX = aida.analysisFactory().createTupleFactory(aida.analysisFactory().createTreeFactory().create()).createEvaluator("fEvn");
-		IEvaluator evaluatorY = aida.analysisFactory().createTupleFactory(aida.analysisFactory().createTreeFactory().create()).createEvaluator("fCharge");  
-
-		iTuple.get(m_ID).project(hChargeVsEvn.get(m_driverID),evaluatorX,evaluatorY);
-
-		pPlotter.region(m_driverID).clear();  
-		pPlotter.region(m_driverID).plot(hChargeVsEvn.get(m_driverID));
-		pPlotter.region(m_driverID).refresh();
-
-	}
-
-	private EcalChannel findChannel(int channel_id) {
-		return ecalConditions.getChannelCollection().findChannel(channel_id);
-	}
-
-
-	private void askUploadToDBDialog(){
-		m_ret=LedColor.UNKNOWN;
-
-		okButtonRed = new JButton("Yes, red");
-		okButtonBlue = new JButton("Yes, blue");
-		cancelButton = new JButton("Cancel");
-		labelString = "<html> Update conditions to DB <br> for run: <br> "+runNumber+" - "+runNumberMax+" <br> ???? <br> "
-				+ "Use the monitoring app to look at the map<br>"
-				+ "(Tab LED sequence)<br>"
-				+"Reply in 60 seconds<br>"+"</html>";   
-		label = new JLabel( labelString);
-
-		frame  = new JFrame("Upload to DB?");
-		frame.setSize(500,250);
-		panel = new JPanel();
-		frame.add(panel);
-
-
-		// dialog = new JDialog((JFrame)null, "User selection");
-		// dialog.setSize(200,200);
-		// dialog.setLayout(new FlowLayout());
-		// dialog.add(label);
-		// dialog.add(cancelButton);
-		// dialog.add(okButton);
-		// dialog.setVisible(true);
-		//dialog.pack();
-		panel.add(label);
-		panel.add(cancelButton);
-		panel.add(okButtonBlue);
-		panel.add(okButtonRed);
-
-
-		frame.setVisible(true);
-		okButtonBlue.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent event)
-			{
-				m_ret=LedColor.BLUE;
-				frame.dispose();    
-				synchronized(modalMonitor)
-				{
-					System.out.println("Blue pressed");
-					modalMonitor.notify();
-				}
-			}
-		}
-				);
-		okButtonRed.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent event)
-			{
-				m_ret=LedColor.RED;
-				frame.dispose();    
-				synchronized(modalMonitor)
-				{
-					System.out.println("Red pressed");
-					modalMonitor.notify();
-				}
-			}
-		}
-				);
-
-		cancelButton.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent event)
-			{
-				m_ret=LedColor.UNKNOWN;
-				frame.dispose();   
-				synchronized(modalMonitor)
-				{
-					System.out.println("Cancel pressed");
-					modalMonitor.notify();
-				}
-			}
-		}
-				);
-
-		System.out.println("askUploadDB done");
-	}
+         */      
+        hChargeVsEvn.get(m_driverID).reset();
+        hChargeVsEvn.get(m_driverID).setTitle("Driver_"+m_driverID+" Led_"+ledID);
+        IEvaluator evaluatorX = aida.analysisFactory().createTupleFactory(aida.analysisFactory().createTreeFactory().create()).createEvaluator("fEvn");
+        IEvaluator evaluatorY = aida.analysisFactory().createTupleFactory(aida.analysisFactory().createTreeFactory().create()).createEvaluator("fCharge");  
+
+        iTuple.get(m_ID).project(hChargeVsEvn.get(m_driverID),evaluatorX,evaluatorY);
+
+        pPlotter.region(m_driverID).clear();  
+        pPlotter.region(m_driverID).plot(hChargeVsEvn.get(m_driverID));
+        pPlotter.region(m_driverID).refresh();
+
+    }
+
+    private EcalChannel findChannel(int channel_id) {
+        return ecalConditions.getChannelCollection().findChannel(channel_id);
+    }
+
+
+    private void askUploadToDBDialog(){
+        m_ret=LedColor.UNKNOWN;
+
+        okButtonRed = new JButton("Yes, red");
+        okButtonBlue = new JButton("Yes, blue");
+        cancelButton = new JButton("Cancel");
+        labelString = "<html> Update conditions to DB <br> for run: <br> "+runNumber+" - "+runNumberMax+" <br> ???? <br> "
+                + "Use the monitoring app to look at the map<br>"
+                + "(Tab LED sequence)<br>"
+                +"Reply in 60 seconds<br>"+"</html>";   
+        label = new JLabel( labelString);
+
+        frame  = new JFrame("Upload to DB?");
+        frame.setSize(500,250);
+        panel = new JPanel();
+        frame.add(panel);
+
+
+        // dialog = new JDialog((JFrame)null, "User selection");
+        // dialog.setSize(200,200);
+        // dialog.setLayout(new FlowLayout());
+        // dialog.add(label);
+        // dialog.add(cancelButton);
+        // dialog.add(okButton);
+        // dialog.setVisible(true);
+        //dialog.pack();
+        panel.add(label);
+        panel.add(cancelButton);
+        panel.add(okButtonBlue);
+        panel.add(okButtonRed);
+
+
+        frame.setVisible(true);
+        okButtonBlue.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent event)
+            {
+                m_ret=LedColor.BLUE;
+                frame.dispose();    
+                synchronized(modalMonitor)
+                {
+                    System.out.println("Blue pressed");
+                    modalMonitor.notify();
+                }
+            }
+        }
+                );
+        okButtonRed.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent event)
+            {
+                m_ret=LedColor.RED;
+                frame.dispose();    
+                synchronized(modalMonitor)
+                {
+                    System.out.println("Red pressed");
+                    modalMonitor.notify();
+                }
+            }
+        }
+                );
+
+        cancelButton.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent event)
+            {
+                m_ret=LedColor.UNKNOWN;
+                frame.dispose();   
+                synchronized(modalMonitor)
+                {
+                    System.out.println("Cancel pressed");
+                    modalMonitor.notify();
+                }
+            }
+        }
+                );
+
+        System.out.println("askUploadDB done");
+    }
 
 }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java	Wed Mar  9 11:43:24 2016
@@ -33,80 +33,80 @@
     // this has to match the one in EcalPedstalCalculator:
     private String histoNameFormat = "Ecal/Pedestals/Mode7/ped%03d";
     
-	private AIDA aida = AIDA.defaultInstance();	
-	private IPlotter plotter;
-	private IPlotterFactory plotterFactory;
-	private IPlotterStyle pstyle;
-	private PEventViewer viewer;
+    private AIDA aida = AIDA.defaultInstance(); 
+    private IPlotter plotter;
+    private IPlotterFactory plotterFactory;
+    private IPlotterStyle pstyle;
+    private PEventViewer viewer;
 
-	static final String[] colors={"red","black","blue","green","yellow","pink","cyan","magenta","brown"};
-	static final int nRows=3;
-	static final int nColumns=3;
-	private int theRegion=0;
-	
-	@Override
-	public void detectorChanged(Detector detector) {
-		plotterFactory = aida.analysisFactory().createPlotterFactory("ECal Peds");
-		plotter = plotterFactory.create("ECal Peds");
-		plotter.createRegions(nColumns,nRows);
-		// Plot dummmy histos, else null plotter regions later:
-		for (int ii=0; ii<nColumns*nRows; ii++) {
-  	    	plotter.region(ii).plot(aida.histogram1D("ASDF"+ii,100,11e9,11e11));
-		}
-		plotter.show();
-		
-		pstyle=plotterFactory.createPlotterStyle();
-		pstyle.xAxisStyle().labelStyle().setBold(true);
-		pstyle.yAxisStyle().labelStyle().setBold(true);
-		pstyle.xAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.yAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.xAxisStyle().lineStyle().setColor("black");
-		pstyle.yAxisStyle().lineStyle().setColor("black");
-		pstyle.xAxisStyle().lineStyle().setThickness(2);
-		pstyle.yAxisStyle().lineStyle().setThickness(2);
-		pstyle.dataStyle().errorBarStyle().setThickness(0);
-		pstyle.legendBoxStyle().setVisible(false);
-	}
-	
-	@Override
-	public void startOfData() {
-		File config = new File("ecal-mapping-config.csv");
-		if(config.exists() && config.canRead()) {
-			try { viewer = new PDataEventViewer(config.getAbsolutePath()); }
-			catch (IOException e) { viewer = new PEventViewer(); }
-		} else { viewer = new PEventViewer(); }
-		viewer.addCrystalListener(this);
-		viewer.setVisible(true);
-	}
-	
-	@Override
-	public void actionPerformed(ActionEvent ae) { }
-	
-	@Override
-	public void crystalActivated(CrystalEvent e) { }
-	
-	@Override
-	public void crystalDeactivated(CrystalEvent e) { }
+    static final String[] colors={"red","black","blue","green","yellow","pink","cyan","magenta","brown"};
+    static final int nRows=3;
+    static final int nColumns=3;
+    private int theRegion=0;
+    
+    @Override
+    public void detectorChanged(Detector detector) {
+        plotterFactory = aida.analysisFactory().createPlotterFactory("ECal Peds");
+        plotter = plotterFactory.create("ECal Peds");
+        plotter.createRegions(nColumns,nRows);
+        // Plot dummmy histos, else null plotter regions later:
+        for (int ii=0; ii<nColumns*nRows; ii++) {
+            plotter.region(ii).plot(aida.histogram1D("ASDF"+ii,100,11e9,11e11));
+        }
+        plotter.show();
+        
+        pstyle=plotterFactory.createPlotterStyle();
+        pstyle.xAxisStyle().labelStyle().setBold(true);
+        pstyle.yAxisStyle().labelStyle().setBold(true);
+        pstyle.xAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.yAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.xAxisStyle().lineStyle().setColor("black");
+        pstyle.yAxisStyle().lineStyle().setColor("black");
+        pstyle.xAxisStyle().lineStyle().setThickness(2);
+        pstyle.yAxisStyle().lineStyle().setThickness(2);
+        pstyle.dataStyle().errorBarStyle().setThickness(0);
+        pstyle.legendBoxStyle().setVisible(false);
+    }
+    
+    @Override
+    public void startOfData() {
+        File config = new File("ecal-mapping-config.csv");
+        if(config.exists() && config.canRead()) {
+            try { viewer = new PDataEventViewer(config.getAbsolutePath()); }
+            catch (IOException e) { viewer = new PEventViewer(); }
+        } else { viewer = new PEventViewer(); }
+        viewer.addCrystalListener(this);
+        viewer.setVisible(true);
+    }
+    
+    @Override
+    public void actionPerformed(ActionEvent ae) { }
+    
+    @Override
+    public void crystalActivated(CrystalEvent e) { }
+    
+    @Override
+    public void crystalDeactivated(CrystalEvent e) { }
 
-	@Override
-	public void crystalClicked(CrystalEvent e) {
-		aida.tree().cd("/");
-		Point ecalPoint = Viewer.toEcalPoint(e.getCrystalID());
-		if (ecalPoint.x == 0 || ecalPoint.y == 0) return;
-		if (EcalMonitoringUtilities.isInHole(ecalPoint.y,ecalPoint.x)) return;
-		final int cid=EcalMonitoringUtilities.getChannelIdFromRowColumn(ecalPoint.y,ecalPoint.x);
-	    IHistogram1D hist=aida.histogram1D(String.format(histoNameFormat,cid));
-	    if (hist==null) {
-	        System.err.println("Running the Driver?");
-	    } else {
-     	    hist.setTitle(String.format("(%d,%d)",ecalPoint.x,ecalPoint.y));
+    @Override
+    public void crystalClicked(CrystalEvent e) {
+        aida.tree().cd("/");
+        Point ecalPoint = Viewer.toEcalPoint(e.getCrystalID());
+        if (ecalPoint.x == 0 || ecalPoint.y == 0) return;
+        if (EcalMonitoringUtilities.isInHole(ecalPoint.y,ecalPoint.x)) return;
+        final int cid=EcalMonitoringUtilities.getChannelIdFromRowColumn(ecalPoint.y,ecalPoint.x);
+        IHistogram1D hist=aida.histogram1D(String.format(histoNameFormat,cid));
+        if (hist==null) {
+            System.err.println("Running the Driver?");
+        } else {
+            hist.setTitle(String.format("(%d,%d)",ecalPoint.x,ecalPoint.y));
             pstyle.dataStyle().lineStyle().setParameter("color", colors[theRegion%colors.length]);
-	        plotter.region(theRegion).clear();
-	        plotter.region(theRegion).plot(hist,pstyle);
-	        plotter.region(theRegion).refresh();
-	        theRegion=(theRegion+1)%(nColumns*nRows);
-	    }
-	}
-	
-	
+            plotter.region(theRegion).clear();
+            plotter.region(theRegion).plot(hist,pstyle);
+            plotter.region(theRegion).refresh();
+            theRegion=(theRegion+1)%(nColumns*nRows);
+        }
+    }
+    
+    
 }

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	Wed Mar  9 11:43:24 2016
@@ -93,7 +93,7 @@
     }
 
     private void setupPlots() {
-    	System.out.println("ECAL WINDOW PLOTS START");
+        System.out.println("ECAL WINDOW PLOTS START");
         //if (plotterFrame != null) {
         //    plotterFrame.dispose();
         //}
@@ -108,8 +108,8 @@
         IPlotterStyle pstyle = plotter.style();
         pstyle.dataStyle().errorBarStyle().setVisible(false);
         plotter.createRegions(1,1);     
-    	windowPlot1 = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : dummy", 1, -0.5, 1 - 0.5);
-    	plotter.region(0).plot(windowPlot1);
+        windowPlot1 = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : dummy", 1, -0.5, 1 - 0.5);
+        plotter.region(0).plot(windowPlot1);
         plotter.show();
     }
 
@@ -126,15 +126,15 @@
                 dec.setID(hit.getCellID());
                 int x = dec.getValue("ix");
                 int y = dec.getValue("iy");
-//				System.out.println("got hit: x= " + x + ", y= " + y);
+//              System.out.println("got hit: x= " + x + ", y= " + y);
                 if (isFirst) {
-                	System.out.println("FIRST!!!");
+                    System.out.println("FIRST!!!");
                     isFirst=false;
-                	window=hit.getADCValues().length;
-                	windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
-                	plotter.region(0).clear();
-                	plotter.region(0).plot(windowPlot);
-                	plotter.region(0).refresh();
+                    window=hit.getADCValues().length;
+                    windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
+                    plotter.region(0).clear();
+                    plotter.region(0).plot(windowPlot);
+                    plotter.region(0).refresh();
                 
                 }
                 if (testX && x != plotX) {

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -26,224 +26,224 @@
  * @see DiagnosticUpdatable
  */
 public abstract class AbstractTablePanel extends JPanel implements DiagnosticUpdatable {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	public static final int ORIENTATION_HORIZONTAL = 0;
-	public static final int ORIENTATION_VERTICAL   = 1;
-	
-	// Components.
-	private JLabel localHeader;
-	private JLabel globalHeader;
-	protected final JTable localTable;
-	protected final JTable globalTable;
-	
-	// Component parameters.
-	private boolean horizontal = true;
-	private Dimension userPrefSize = null;
-	private Dimension defaultPrefSize = new Dimension(0, 0);
-	
-	/**
-	 * Instantiates an <code>AbstractTablePanel</code>.
-	 * @param args Arguments to be used when generating the panel tables.
-	 */
-	public AbstractTablePanel(Object... args) {
-		// Initialize the tables.
-		JTable[] tables = initializeTables(args);
-		localTable = tables[0];
-		globalTable = tables[1];
-		add(globalTable);
-		add(localTable);
-		
-		// Set the panels to their null starting values.
-		updatePanel(null, null);
-		
-		// Define the panel layout.
-		setLayout(null);
-		
-		// Create header labels for the tables.
-		localHeader = new JLabel("Instantaneous Statistics");
-		localHeader.setHorizontalAlignment(JLabel.CENTER);
-		add(localHeader);
-		
-		globalHeader = new JLabel("Run Statistics");
-		globalHeader.setHorizontalAlignment(JLabel.CENTER);
-		add(globalHeader);
-		
-		// Track when the component changes size and reposition the
-		// components accordingly.
-		addComponentListener(new ComponentAdapter() {
-			@Override
-			public void componentResized(ComponentEvent e) { positionComponents(); }
-		});
-		
-		// Define the component preferred size.
-		defaultPrefSize.width = localTable.getPreferredSize().width +
-				ComponentUtils.hinternal + globalTable.getPreferredSize().width;
-		defaultPrefSize.height = localTable.getPreferredSize().height +
-				ComponentUtils.vinternal + globalTable.getPreferredSize().height;
-	}
-	
-	@Override
-	public Dimension getPreferredSize() {
-		// If there is a user-specified preferred size, return that.
-		if(userPrefSize == null) { return defaultPrefSize; }
-		
-		// Otherwise, return the default calculated preferred size.
-		else { return userPrefSize; }
-	}
-	
-	@Override
-	public void setBackground(Color bg) {
-		// Set the base component background.
-		super.setBackground(bg);
-		
-		// If the components have been initialized, pass the background
-		// color change to them as appropriate. Note that the tables
-		// will always retain the same background color.
-		if(localTable != null) {
-			// Set the header backgrounds.
-			localHeader.setBackground(bg);
-			globalHeader.setBackground(bg);
-		}
-	}
-	
-	@Override
-	public void setFont(Font font) {
-		// Set the base component font.
-		super.setFont(font);
-		
-		// If the components have been initialized, pass the font change
-		// to them as appropriate.
-		if(localTable != null) {
-			// Set the table fonts.
-			localTable.setFont(font);
-			globalTable.setFont(font);
-			
-			// Set the header fonts.
-			Font headerFont = font.deriveFont(Font.BOLD, (float) Math.ceil(font.getSize2D() * 1.3));
-			localHeader.setFont(headerFont);
-			globalHeader.setFont(headerFont);
-		}
-	}
-	
-	@Override
-	public void setForeground(Color fg) {
-		// Set the base component foreground.
-		super.setForeground(fg);
-		
-		// If the components have been initialized, pass the foreground
-		// color change to them as appropriate. Note that the tables
-		// will always retain the same foreground color.
-		if(localTable != null) {
-			// Set the header foregrounds.
-			localHeader.setForeground(fg);
-			globalHeader.setForeground(fg);
-		}
-	}
-	
-	/**
-	 * Sets the orientation of components on the panel.
-	 * @param orientation - The orientation identifier. Identifiers can
-	 * be obtained as static variables from the within the root object
-	 * <code>AbstractTable</code>.
-	 */
-	public void setOrientation(int orientation) {
-		if(orientation == ORIENTATION_HORIZONTAL) {
-			if(!horizontal) {
-				horizontal = true;
-				positionComponents();
-			}
-		} else if(orientation == ORIENTATION_VERTICAL) {
-			if(horizontal) {
-				horizontal = false;
-				positionComponents();
-			}
-		} else {
-			throw new IllegalArgumentException("Invalid orienation identifier.");
-		}
-	}
-	
-	@Override
-	public void setPreferredSize(Dimension preferredSize) {
-		userPrefSize = preferredSize;
-	}
-	
-	/**
-	 * Generates the two tables that are used by the component. This
-	 * must return an array of size two.
-	 * @param args - Any arguments that should be passed to the method
-	 * for generating tables.
-	 * @return Returns an array of size two, where the first index must
-	 * contain the local table and the second index the global table.
-	 */
-	protected abstract JTable[] initializeTables(Object... args);
-	
-	/**
-	 * Repositions the components to the correct places on the parent
-	 * <code>JPanel</code>. This should be run whenever the panel
-	 * changes size.
-	 */
-	private void positionComponents() {
-		// Do not update if the components have not been initialized.
-		if(localHeader == null) { return; }
-		
-		// If the components should be position horizontally...
-		if(horizontal) {
-			// The local components get the left half of the panel and the
-			// global components the right. Find half of the panel width,
-			// accounting for the internal spacing. This is an internal
-			// component, so it does not employ additional spacing between
-			// itself and the parent component's edges.
-			int compWidth = (getWidth() - 10) / 2;
-			
-			// If there is any width remaining, it goes to the spacing.
-			int horizontal = ComponentUtils.hinternal + (getWidth() - 10) % 2;
-			
-			// Place the header labels. These are given their preferred
-			// height. Note that this means a very small panel may cut off
-			// some of the components. First, get the preferred height of
-			// the label with the larger preferred height. These should be
-			// the same thing, but just in case...
-			int labelHeight = localHeader.getPreferredSize().height;
-			if(labelHeight < globalHeader.getPreferredSize().height) {
-				labelHeight = globalHeader.getPreferredSize().height;
-			}
-			
-			// Set the label sizes and positions.
-			localHeader.setBounds(0, 0, compWidth, labelHeight);
-			globalHeader.setLocation(ComponentUtils.getNextX(localHeader, horizontal), 0);
-			globalHeader.setSize(compWidth, labelHeight);
-			
-			// The tables go under their respective labels and should fill
-			// the remainder of the label height.
-			int tableY = ComponentUtils.getNextY(localHeader, ComponentUtils.vinternal);
-			localTable.setBounds(0, tableY, compWidth, localTable.getPreferredSize().height);
-			globalTable.setBounds(globalHeader.getX(), tableY, compWidth, globalTable.getPreferredSize().height);
-		}
-		
-		// Otherwise, position them vertically.
-		else {
-			// Place the header labels. These are given their preferred
-			// height. Note that this means a very small panel may cut off
-			// some of the components. First, get the preferred height of
-			// the label with the larger preferred height. These should be
-			// the same thing, but just in case...
-			int labelHeight = localHeader.getPreferredSize().height;
-			if(labelHeight < globalHeader.getPreferredSize().height) {
-				labelHeight = globalHeader.getPreferredSize().height;
-			}
-			
-			// The local components go first, taking up the entire upper
-			// width of the panel.
-			localHeader.setBounds(0, 0, getWidth(), labelHeight);
-			localTable.setBounds(0, ComponentUtils.getNextY(localHeader, ComponentUtils.vinternal),
-					getWidth(), localTable.getPreferredSize().height);
-			
-			// The global components go immediately below.
-			globalHeader.setBounds(0, ComponentUtils.getNextY(localTable, ComponentUtils.vinternal),
-					getWidth(), labelHeight);
-			globalTable.setBounds(0, ComponentUtils.getNextY(globalHeader, ComponentUtils.vinternal),
-					getWidth(), globalTable.getPreferredSize().height);
-		}
-	}
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    public static final int ORIENTATION_HORIZONTAL = 0;
+    public static final int ORIENTATION_VERTICAL   = 1;
+    
+    // Components.
+    private JLabel localHeader;
+    private JLabel globalHeader;
+    protected final JTable localTable;
+    protected final JTable globalTable;
+    
+    // Component parameters.
+    private boolean horizontal = true;
+    private Dimension userPrefSize = null;
+    private Dimension defaultPrefSize = new Dimension(0, 0);
+    
+    /**
+     * Instantiates an <code>AbstractTablePanel</code>.
+     * @param args Arguments to be used when generating the panel tables.
+     */
+    public AbstractTablePanel(Object... args) {
+        // Initialize the tables.
+        JTable[] tables = initializeTables(args);
+        localTable = tables[0];
+        globalTable = tables[1];
+        add(globalTable);
+        add(localTable);
+        
+        // Set the panels to their null starting values.
+        updatePanel(null, null);
+        
+        // Define the panel layout.
+        setLayout(null);
+        
+        // Create header labels for the tables.
+        localHeader = new JLabel("Instantaneous Statistics");
+        localHeader.setHorizontalAlignment(JLabel.CENTER);
+        add(localHeader);
+        
+        globalHeader = new JLabel("Run Statistics");
+        globalHeader.setHorizontalAlignment(JLabel.CENTER);
+        add(globalHeader);
+        
+        // Track when the component changes size and reposition the
+        // components accordingly.
+        addComponentListener(new ComponentAdapter() {
+            @Override
+            public void componentResized(ComponentEvent e) { positionComponents(); }
+        });
+        
+        // Define the component preferred size.
+        defaultPrefSize.width = localTable.getPreferredSize().width +
+                ComponentUtils.hinternal + globalTable.getPreferredSize().width;
+        defaultPrefSize.height = localTable.getPreferredSize().height +
+                ComponentUtils.vinternal + globalTable.getPreferredSize().height;
+    }
+    
+    @Override
+    public Dimension getPreferredSize() {
+        // If there is a user-specified preferred size, return that.
+        if(userPrefSize == null) { return defaultPrefSize; }
+        
+        // Otherwise, return the default calculated preferred size.
+        else { return userPrefSize; }
+    }
+    
+    @Override
+    public void setBackground(Color bg) {
+        // Set the base component background.
+        super.setBackground(bg);
+        
+        // If the components have been initialized, pass the background
+        // color change to them as appropriate. Note that the tables
+        // will always retain the same background color.
+        if(localTable != null) {
+            // Set the header backgrounds.
+            localHeader.setBackground(bg);
+            globalHeader.setBackground(bg);
+        }
+    }
+    
+    @Override
+    public void setFont(Font font) {
+        // Set the base component font.
+        super.setFont(font);
+        
+        // If the components have been initialized, pass the font change
+        // to them as appropriate.
+        if(localTable != null) {
+            // Set the table fonts.
+            localTable.setFont(font);
+            globalTable.setFont(font);
+            
+            // Set the header fonts.
+            Font headerFont = font.deriveFont(Font.BOLD, (float) Math.ceil(font.getSize2D() * 1.3));
+            localHeader.setFont(headerFont);
+            globalHeader.setFont(headerFont);
+        }
+    }
+    
+    @Override
+    public void setForeground(Color fg) {
+        // Set the base component foreground.
+        super.setForeground(fg);
+        
+        // If the components have been initialized, pass the foreground
+        // color change to them as appropriate. Note that the tables
+        // will always retain the same foreground color.
+        if(localTable != null) {
+            // Set the header foregrounds.
+            localHeader.setForeground(fg);
+            globalHeader.setForeground(fg);
+        }
+    }
+    
+    /**
+     * Sets the orientation of components on the panel.
+     * @param orientation - The orientation identifier. Identifiers can
+     * be obtained as static variables from the within the root object
+     * <code>AbstractTable</code>.
+     */
+    public void setOrientation(int orientation) {
+        if(orientation == ORIENTATION_HORIZONTAL) {
+            if(!horizontal) {
+                horizontal = true;
+                positionComponents();
+            }
+        } else if(orientation == ORIENTATION_VERTICAL) {
+            if(horizontal) {
+                horizontal = false;
+                positionComponents();
+            }
+        } else {
+            throw new IllegalArgumentException("Invalid orienation identifier.");
+        }
+    }
+    
+    @Override
+    public void setPreferredSize(Dimension preferredSize) {
+        userPrefSize = preferredSize;
+    }
+    
+    /**
+     * Generates the two tables that are used by the component. This
+     * must return an array of size two.
+     * @param args - Any arguments that should be passed to the method
+     * for generating tables.
+     * @return Returns an array of size two, where the first index must
+     * contain the local table and the second index the global table.
+     */
+    protected abstract JTable[] initializeTables(Object... args);
+    
+    /**
+     * Repositions the components to the correct places on the parent
+     * <code>JPanel</code>. This should be run whenever the panel
+     * changes size.
+     */
+    private void positionComponents() {
+        // Do not update if the components have not been initialized.
+        if(localHeader == null) { return; }
+        
+        // If the components should be position horizontally...
+        if(horizontal) {
+            // The local components get the left half of the panel and the
+            // global components the right. Find half of the panel width,
+            // accounting for the internal spacing. This is an internal
+            // component, so it does not employ additional spacing between
+            // itself and the parent component's edges.
+            int compWidth = (getWidth() - 10) / 2;
+            
+            // If there is any width remaining, it goes to the spacing.
+            int horizontal = ComponentUtils.hinternal + (getWidth() - 10) % 2;
+            
+            // Place the header labels. These are given their preferred
+            // height. Note that this means a very small panel may cut off
+            // some of the components. First, get the preferred height of
+            // the label with the larger preferred height. These should be
+            // the same thing, but just in case...
+            int labelHeight = localHeader.getPreferredSize().height;
+            if(labelHeight < globalHeader.getPreferredSize().height) {
+                labelHeight = globalHeader.getPreferredSize().height;
+            }
+            
+            // Set the label sizes and positions.
+            localHeader.setBounds(0, 0, compWidth, labelHeight);
+            globalHeader.setLocation(ComponentUtils.getNextX(localHeader, horizontal), 0);
+            globalHeader.setSize(compWidth, labelHeight);
+            
+            // The tables go under their respective labels and should fill
+            // the remainder of the label height.
+            int tableY = ComponentUtils.getNextY(localHeader, ComponentUtils.vinternal);
+            localTable.setBounds(0, tableY, compWidth, localTable.getPreferredSize().height);
+            globalTable.setBounds(globalHeader.getX(), tableY, compWidth, globalTable.getPreferredSize().height);
+        }
+        
+        // Otherwise, position them vertically.
+        else {
+            // Place the header labels. These are given their preferred
+            // height. Note that this means a very small panel may cut off
+            // some of the components. First, get the preferred height of
+            // the label with the larger preferred height. These should be
+            // the same thing, but just in case...
+            int labelHeight = localHeader.getPreferredSize().height;
+            if(labelHeight < globalHeader.getPreferredSize().height) {
+                labelHeight = globalHeader.getPreferredSize().height;
+            }
+            
+            // The local components go first, taking up the entire upper
+            // width of the panel.
+            localHeader.setBounds(0, 0, getWidth(), labelHeight);
+            localTable.setBounds(0, ComponentUtils.getNextY(localHeader, ComponentUtils.vinternal),
+                    getWidth(), localTable.getPreferredSize().height);
+            
+            // The global components go immediately below.
+            globalHeader.setBounds(0, ComponentUtils.getNextY(localTable, ComponentUtils.vinternal),
+                    getWidth(), labelHeight);
+            globalTable.setBounds(0, ComponentUtils.getNextY(globalHeader, ComponentUtils.vinternal),
+                    getWidth(), globalTable.getPreferredSize().height);
+        }
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -14,189 +14,189 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public abstract class AbstractTriggerTablePanel extends AbstractTwoColumnTablePanel {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	
-	// Internal variables.
-	private final int numCuts;
-	private final boolean singles;
-	
-	// Store reference index variables for local and run values.
-	private static final int GLOBAL = 0;
-	private static final int LOCAL  = 1;
-	
-	// Reference variables to the default table rows.
-	protected static final int ROW_RECON_COUNT        = 0;
-	protected static final int ROW_SSP_SIM_COUNT      = 1;
-	protected static final int ROW_SSP_BANK_COUNT     = 2;
-	protected static final int ROW_SSP_EFFICIENCY     = 3;
-	protected static final int ROW_TRIGGER_EFFICIENCY = 4;
-	protected static final int ROW_EMPTY_SPACE        = 5;
-	protected static final int ROW_CUT_FAILS_TITLE    = 6;
-	protected static final int ROW_FIRST_TRIGGER_CUT  = 7;
-	
-	/**
-	 * Instantiates an <code>AbstractTriggerTablePanel</code> with the
-	 * indicated cut names.
-	 * @param cutNames
-	 */
-	public AbstractTriggerTablePanel(String[] cutNames, boolean isSingles) {
-		// Instantiate the superclass.
-		super(makeTitle(cutNames));
-		
-		// Store the number of cuts.
-		numCuts = cutNames.length;
-		updatePanel(null, null);
-		
-		// Store whether this is a singles or pair trigger panel.
-		singles = isSingles;
-	}
-	
-	@Override
-	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
-		// If the snapshot is null, all values should be "N/A."
-		if(runSnapshot == null || localSnapshot == null) {
-			// Output cluster count data.
-			String scalerNullValue = "---";
-			setLocalRowValue(ROW_RECON_COUNT,     scalerNullValue);
-			setLocalRowValue(ROW_SSP_SIM_COUNT,   scalerNullValue);
-			setLocalRowValue(ROW_SSP_BANK_COUNT,  scalerNullValue);
-			setGlobalRowValue(ROW_RECON_COUNT,    scalerNullValue);
-			setGlobalRowValue(ROW_SSP_SIM_COUNT,  scalerNullValue);
-			setGlobalRowValue(ROW_SSP_BANK_COUNT, scalerNullValue);
-			
-			// Output the tracked statistical data.
-			String percentNullValue = "--- / --- (---%)";
-			setLocalRowValue(ROW_SSP_EFFICIENCY,      percentNullValue);
-			setLocalRowValue(ROW_TRIGGER_EFFICIENCY,  percentNullValue);
-			setGlobalRowValue(ROW_SSP_EFFICIENCY,     percentNullValue);
-			setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, percentNullValue);
-			
-			int ROW_SECOND_TRIGGER_CUT = ROW_FIRST_TRIGGER_CUT + numCuts + 2;
-			for(int cutRow = 0; cutRow < numCuts; cutRow++) {
-				setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT,   percentNullValue);
-				setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT,  percentNullValue);
-				setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT,  percentNullValue);
-				setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, percentNullValue);
-			}
-		} else {
-			// Get the local and run trigger statistics from the snapshot.
-			DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
-			stat[GLOBAL] = runSnapshot;
-			stat[LOCAL] = localSnapshot;
-			
-			// Get the appropriate trigger statistical modules.
-			TriggerStatModule[][] triggerStats = new TriggerStatModule[2][2];
-			if(singles) {
-				triggerStats[LOCAL][0] = stat[LOCAL].getSingles0Stats();
-				triggerStats[LOCAL][1] = stat[LOCAL].getSingles1Stats();
-				triggerStats[GLOBAL][0] = stat[GLOBAL].getSingles0Stats();
-				triggerStats[GLOBAL][1] = stat[GLOBAL].getSingles1Stats();
-			} else {
-				triggerStats[LOCAL][0] = stat[LOCAL].getPair0Stats();
-				triggerStats[LOCAL][1] = stat[LOCAL].getPair1Stats();
-				triggerStats[GLOBAL][0] = stat[GLOBAL].getPair0Stats();
-				triggerStats[GLOBAL][1] = stat[GLOBAL].getPair1Stats();
-			}
-			
-			// Get the total number of triggers of each type.
-			int[] sspSimTriggers = new int[2];
-			int[] sspBankTriggers = new int[2];
-			int[] reconSimTriggers = new int[2];
-			int[] sspMatchedTriggers = new int[2];
-			int[] reconMatchedTriggers = new int[2];
-			
-			for(int i = 0; i < 2; i++) {
-				sspSimTriggers[i] = triggerStats[i][0].getSSPSimulatedTriggers() + triggerStats[i][1].getSSPSimulatedTriggers();
-				sspBankTriggers[i] = triggerStats[i][0].getReportedTriggers() + triggerStats[i][1].getReportedTriggers();
-				reconSimTriggers[i] = triggerStats[i][0].getReconSimulatedTriggers() + triggerStats[i][1].getReconSimulatedTriggers();
-				sspMatchedTriggers[i] = triggerStats[i][0].getMatchedSSPSimulatedTriggers() + triggerStats[i][1].getMatchedSSPSimulatedTriggers();
-				reconMatchedTriggers[i] = triggerStats[i][0].getMatchedReconSimulatedTriggers() + triggerStats[i][1].getMatchedReconSimulatedTriggers();
-			}
-			
-			// Determine the most spaces needed to display the values.
-			// Get the largest number of digits in any of the values.
-			int mostDigits = ComponentUtils.max(reconSimTriggers[LOCAL], sspBankTriggers[LOCAL],
-					sspSimTriggers[LOCAL], reconSimTriggers[GLOBAL], sspBankTriggers[GLOBAL],
-					sspSimTriggers[GLOBAL]);
-			int spaces = ComponentUtils.getDigits(mostDigits);
-			
-			// Update the single-value counters.
-			String countFormat = "%" + spaces + "d";
-			setLocalRowValue(ROW_RECON_COUNT,     String.format(countFormat, reconSimTriggers[LOCAL]));
-			setLocalRowValue(ROW_SSP_SIM_COUNT,   String.format(countFormat, sspSimTriggers[LOCAL]));
-			setLocalRowValue(ROW_SSP_BANK_COUNT,  String.format(countFormat, sspBankTriggers[LOCAL]));
-			setGlobalRowValue(ROW_RECON_COUNT,    String.format(countFormat, reconSimTriggers[GLOBAL]));
-			setGlobalRowValue(ROW_SSP_SIM_COUNT,  String.format(countFormat, sspSimTriggers[GLOBAL]));
-			setGlobalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, sspBankTriggers[GLOBAL]));
-			
-			// Update the percentage counters.
-			String percentFormat = "%" + spaces + "d / %" + spaces + "d (%7.3f)";
-			
-			setLocalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[LOCAL],
-					sspSimTriggers[LOCAL], (100.0 * sspMatchedTriggers[LOCAL] / sspSimTriggers[LOCAL])));
-			setLocalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[LOCAL],
-					reconSimTriggers[LOCAL], (100.0 * reconMatchedTriggers[LOCAL] / reconSimTriggers[LOCAL])));
-			setGlobalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[GLOBAL],
-					sspSimTriggers[GLOBAL], (100.0 * sspMatchedTriggers[GLOBAL] / sspSimTriggers[GLOBAL])));
-			setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[GLOBAL],
-					reconSimTriggers[GLOBAL], (100.0 * reconMatchedTriggers[GLOBAL] / reconSimTriggers[GLOBAL])));
-			
-			int ROW_SECOND_TRIGGER_CUT = ROW_FIRST_TRIGGER_CUT + numCuts + 2;
-			for(int cutRow = 0; cutRow < numCuts; cutRow++) {
-				setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
-						triggerStats[LOCAL][0].getSSPCutFailures(cutRow), triggerStats[LOCAL][0].getSSPSimulatedTriggers(),
-						(100.0 * triggerStats[LOCAL][0].getSSPCutFailures(cutRow) / triggerStats[LOCAL][0].getSSPSimulatedTriggers())));
-				setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
-						triggerStats[LOCAL][1].getSSPCutFailures(cutRow), triggerStats[LOCAL][1].getSSPSimulatedTriggers(),
-						(100.0 * triggerStats[LOCAL][1].getSSPCutFailures(cutRow) / triggerStats[LOCAL][1].getSSPSimulatedTriggers())));
-				setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
-						triggerStats[GLOBAL][0].getSSPCutFailures(cutRow), triggerStats[GLOBAL][0].getSSPSimulatedTriggers(),
-						(100.0 * triggerStats[GLOBAL][0].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][0].getSSPSimulatedTriggers())));
-				setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
-						triggerStats[GLOBAL][1].getSSPCutFailures(cutRow), triggerStats[GLOBAL][1].getSSPSimulatedTriggers(),
-						(100.0 * triggerStats[GLOBAL][1].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][1].getSSPSimulatedTriggers())));
-			}
-		}
-	}
-	
-	/**
-	 * Creates the table appropriate table rows from the argument cut
-	 * names.
-	 * @param cutNames - An array containing the names of the cuts to
-	 * display.
-	 * @return Returns an array with the default table rows merged in
-	 * with the provided cut names.
-	 */
-	private static final String[] makeTitle(String[] cutNames) {
-		// Make a new array to hold all the text.
-		String[] mergedArray = new String[cutNames.length + cutNames.length + 9];
-		
-		// Define the default trigger headers.
-		mergedArray[0] = "Recon Triggers:";
-		mergedArray[1] = "SSP Sim Triggers:";
-		mergedArray[2] = "SSP Bank Triggers:";
-		mergedArray[3] = "SSP Efficiency:";
-		mergedArray[4] = "Trigger Efficiency:";
-		mergedArray[5] = "";
-		mergedArray[6] = "First Trigger Cut Failures";
-		
-		// Insert the cut names for the first trigger.
-		for(int cutIndex = 0; cutIndex < cutNames.length; cutIndex++) {
-			mergedArray[7 + cutIndex] = cutNames[cutIndex];
-		}
-		
-		// Insert the header for the second trigger cut names.
-		int startIndex = 7 + cutNames.length;
-		mergedArray[startIndex]     = "";
-		mergedArray[startIndex + 1] = "Second Trigger Cut Failures";
-		
-		// Insert the next set of cut names.
-		for(int cutIndex = 0; cutIndex < cutNames.length; cutIndex++) {
-			mergedArray[startIndex + 2 + cutIndex] = cutNames[cutIndex];
-		}
-		
-		// Return the resultant array.
-		return mergedArray;
-	}
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    
+    // Internal variables.
+    private final int numCuts;
+    private final boolean singles;
+    
+    // Store reference index variables for local and run values.
+    private static final int GLOBAL = 0;
+    private static final int LOCAL  = 1;
+    
+    // Reference variables to the default table rows.
+    protected static final int ROW_RECON_COUNT        = 0;
+    protected static final int ROW_SSP_SIM_COUNT      = 1;
+    protected static final int ROW_SSP_BANK_COUNT     = 2;
+    protected static final int ROW_SSP_EFFICIENCY     = 3;
+    protected static final int ROW_TRIGGER_EFFICIENCY = 4;
+    protected static final int ROW_EMPTY_SPACE        = 5;
+    protected static final int ROW_CUT_FAILS_TITLE    = 6;
+    protected static final int ROW_FIRST_TRIGGER_CUT  = 7;
+    
+    /**
+     * Instantiates an <code>AbstractTriggerTablePanel</code> with the
+     * indicated cut names.
+     * @param cutNames
+     */
+    public AbstractTriggerTablePanel(String[] cutNames, boolean isSingles) {
+        // Instantiate the superclass.
+        super(makeTitle(cutNames));
+        
+        // Store the number of cuts.
+        numCuts = cutNames.length;
+        updatePanel(null, null);
+        
+        // Store whether this is a singles or pair trigger panel.
+        singles = isSingles;
+    }
+    
+    @Override
+    public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
+        // If the snapshot is null, all values should be "N/A."
+        if(runSnapshot == null || localSnapshot == null) {
+            // Output cluster count data.
+            String scalerNullValue = "---";
+            setLocalRowValue(ROW_RECON_COUNT,     scalerNullValue);
+            setLocalRowValue(ROW_SSP_SIM_COUNT,   scalerNullValue);
+            setLocalRowValue(ROW_SSP_BANK_COUNT,  scalerNullValue);
+            setGlobalRowValue(ROW_RECON_COUNT,    scalerNullValue);
+            setGlobalRowValue(ROW_SSP_SIM_COUNT,  scalerNullValue);
+            setGlobalRowValue(ROW_SSP_BANK_COUNT, scalerNullValue);
+            
+            // Output the tracked statistical data.
+            String percentNullValue = "--- / --- (---%)";
+            setLocalRowValue(ROW_SSP_EFFICIENCY,      percentNullValue);
+            setLocalRowValue(ROW_TRIGGER_EFFICIENCY,  percentNullValue);
+            setGlobalRowValue(ROW_SSP_EFFICIENCY,     percentNullValue);
+            setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, percentNullValue);
+            
+            int ROW_SECOND_TRIGGER_CUT = ROW_FIRST_TRIGGER_CUT + numCuts + 2;
+            for(int cutRow = 0; cutRow < numCuts; cutRow++) {
+                setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT,   percentNullValue);
+                setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT,  percentNullValue);
+                setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT,  percentNullValue);
+                setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, percentNullValue);
+            }
+        } else {
+            // Get the local and run trigger statistics from the snapshot.
+            DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
+            stat[GLOBAL] = runSnapshot;
+            stat[LOCAL] = localSnapshot;
+            
+            // Get the appropriate trigger statistical modules.
+            TriggerStatModule[][] triggerStats = new TriggerStatModule[2][2];
+            if(singles) {
+                triggerStats[LOCAL][0] = stat[LOCAL].getSingles0Stats();
+                triggerStats[LOCAL][1] = stat[LOCAL].getSingles1Stats();
+                triggerStats[GLOBAL][0] = stat[GLOBAL].getSingles0Stats();
+                triggerStats[GLOBAL][1] = stat[GLOBAL].getSingles1Stats();
+            } else {
+                triggerStats[LOCAL][0] = stat[LOCAL].getPair0Stats();
+                triggerStats[LOCAL][1] = stat[LOCAL].getPair1Stats();
+                triggerStats[GLOBAL][0] = stat[GLOBAL].getPair0Stats();
+                triggerStats[GLOBAL][1] = stat[GLOBAL].getPair1Stats();
+            }
+            
+            // Get the total number of triggers of each type.
+            int[] sspSimTriggers = new int[2];
+            int[] sspBankTriggers = new int[2];
+            int[] reconSimTriggers = new int[2];
+            int[] sspMatchedTriggers = new int[2];
+            int[] reconMatchedTriggers = new int[2];
+            
+            for(int i = 0; i < 2; i++) {
+                sspSimTriggers[i] = triggerStats[i][0].getSSPSimulatedTriggers() + triggerStats[i][1].getSSPSimulatedTriggers();
+                sspBankTriggers[i] = triggerStats[i][0].getReportedTriggers() + triggerStats[i][1].getReportedTriggers();
+                reconSimTriggers[i] = triggerStats[i][0].getReconSimulatedTriggers() + triggerStats[i][1].getReconSimulatedTriggers();
+                sspMatchedTriggers[i] = triggerStats[i][0].getMatchedSSPSimulatedTriggers() + triggerStats[i][1].getMatchedSSPSimulatedTriggers();
+                reconMatchedTriggers[i] = triggerStats[i][0].getMatchedReconSimulatedTriggers() + triggerStats[i][1].getMatchedReconSimulatedTriggers();
+            }
+            
+            // Determine the most spaces needed to display the values.
+            // Get the largest number of digits in any of the values.
+            int mostDigits = ComponentUtils.max(reconSimTriggers[LOCAL], sspBankTriggers[LOCAL],
+                    sspSimTriggers[LOCAL], reconSimTriggers[GLOBAL], sspBankTriggers[GLOBAL],
+                    sspSimTriggers[GLOBAL]);
+            int spaces = ComponentUtils.getDigits(mostDigits);
+            
+            // Update the single-value counters.
+            String countFormat = "%" + spaces + "d";
+            setLocalRowValue(ROW_RECON_COUNT,     String.format(countFormat, reconSimTriggers[LOCAL]));
+            setLocalRowValue(ROW_SSP_SIM_COUNT,   String.format(countFormat, sspSimTriggers[LOCAL]));
+            setLocalRowValue(ROW_SSP_BANK_COUNT,  String.format(countFormat, sspBankTriggers[LOCAL]));
+            setGlobalRowValue(ROW_RECON_COUNT,    String.format(countFormat, reconSimTriggers[GLOBAL]));
+            setGlobalRowValue(ROW_SSP_SIM_COUNT,  String.format(countFormat, sspSimTriggers[GLOBAL]));
+            setGlobalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, sspBankTriggers[GLOBAL]));
+            
+            // Update the percentage counters.
+            String percentFormat = "%" + spaces + "d / %" + spaces + "d (%7.3f)";
+            
+            setLocalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[LOCAL],
+                    sspSimTriggers[LOCAL], (100.0 * sspMatchedTriggers[LOCAL] / sspSimTriggers[LOCAL])));
+            setLocalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[LOCAL],
+                    reconSimTriggers[LOCAL], (100.0 * reconMatchedTriggers[LOCAL] / reconSimTriggers[LOCAL])));
+            setGlobalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[GLOBAL],
+                    sspSimTriggers[GLOBAL], (100.0 * sspMatchedTriggers[GLOBAL] / sspSimTriggers[GLOBAL])));
+            setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[GLOBAL],
+                    reconSimTriggers[GLOBAL], (100.0 * reconMatchedTriggers[GLOBAL] / reconSimTriggers[GLOBAL])));
+            
+            int ROW_SECOND_TRIGGER_CUT = ROW_FIRST_TRIGGER_CUT + numCuts + 2;
+            for(int cutRow = 0; cutRow < numCuts; cutRow++) {
+                setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
+                        triggerStats[LOCAL][0].getSSPCutFailures(cutRow), triggerStats[LOCAL][0].getSSPSimulatedTriggers(),
+                        (100.0 * triggerStats[LOCAL][0].getSSPCutFailures(cutRow) / triggerStats[LOCAL][0].getSSPSimulatedTriggers())));
+                setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
+                        triggerStats[LOCAL][1].getSSPCutFailures(cutRow), triggerStats[LOCAL][1].getSSPSimulatedTriggers(),
+                        (100.0 * triggerStats[LOCAL][1].getSSPCutFailures(cutRow) / triggerStats[LOCAL][1].getSSPSimulatedTriggers())));
+                setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
+                        triggerStats[GLOBAL][0].getSSPCutFailures(cutRow), triggerStats[GLOBAL][0].getSSPSimulatedTriggers(),
+                        (100.0 * triggerStats[GLOBAL][0].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][0].getSSPSimulatedTriggers())));
+                setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
+                        triggerStats[GLOBAL][1].getSSPCutFailures(cutRow), triggerStats[GLOBAL][1].getSSPSimulatedTriggers(),
+                        (100.0 * triggerStats[GLOBAL][1].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][1].getSSPSimulatedTriggers())));
+            }
+        }
+    }
+    
+    /**
+     * Creates the table appropriate table rows from the argument cut
+     * names.
+     * @param cutNames - An array containing the names of the cuts to
+     * display.
+     * @return Returns an array with the default table rows merged in
+     * with the provided cut names.
+     */
+    private static final String[] makeTitle(String[] cutNames) {
+        // Make a new array to hold all the text.
+        String[] mergedArray = new String[cutNames.length + cutNames.length + 9];
+        
+        // Define the default trigger headers.
+        mergedArray[0] = "Recon Triggers:";
+        mergedArray[1] = "SSP Sim Triggers:";
+        mergedArray[2] = "SSP Bank Triggers:";
+        mergedArray[3] = "SSP Efficiency:";
+        mergedArray[4] = "Trigger Efficiency:";
+        mergedArray[5] = "";
+        mergedArray[6] = "First Trigger Cut Failures";
+        
+        // Insert the cut names for the first trigger.
+        for(int cutIndex = 0; cutIndex < cutNames.length; cutIndex++) {
+            mergedArray[7 + cutIndex] = cutNames[cutIndex];
+        }
+        
+        // Insert the header for the second trigger cut names.
+        int startIndex = 7 + cutNames.length;
+        mergedArray[startIndex]     = "";
+        mergedArray[startIndex + 1] = "Second Trigger Cut Failures";
+        
+        // Insert the next set of cut names.
+        for(int cutIndex = 0; cutIndex < cutNames.length; cutIndex++) {
+            mergedArray[startIndex + 2 + cutIndex] = cutNames[cutIndex];
+        }
+        
+        // Return the resultant array.
+        return mergedArray;
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -16,94 +16,94 @@
  * @see AbstractTablePanel
  */
 public abstract class AbstractTwoColumnTablePanel extends AbstractTablePanel {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	
-	// Table models.
-	private TableTextModel localModel;
-	private TableTextModel globalModel;
-	
-	// Table model mappings.
-	private static final int COL_TITLE = 0;
-	private static final int COL_VALUE = 1;
-	
-	/**
-	 * Instantiates an <code>AbstractTwoColumnTablePanel</code> object
-	 * with the indicated row names.
-	 * @param rowNames - The names of the rows.
-	 */
-	public AbstractTwoColumnTablePanel(String[] rowNames) {
-		super((Object[]) rowNames);
-	}
-	
-	@Override
-	protected JTable[] initializeTables(Object... args) {
-		// The arguments should be a string array.
-		if(!(args instanceof String[])) {
-			throw new IllegalArgumentException("Row names must be strings!");
-		}
-		String[] rowNames = (String[]) args;
-		
-		// Initialize the table models. They should have two columns
-		// (one for values and one for headers) and a number of rows
-		// equal to the number of row names.
-		localModel = new TableTextModel(rowNames.length, 2);
-		globalModel = new TableTextModel(rowNames.length, 2);
-		
-		// Initialize the titles.
-		for(int i = 0; i < rowNames.length; i++) {
-			localModel.setValueAt(rowNames[i], i, COL_TITLE);
-			globalModel.setValueAt(rowNames[i], i, COL_TITLE);
-		}
-		updatePanel(null, null);
-		
-		// Make a cell renderer.
-		DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
-		centerRenderer.setHorizontalAlignment(JLabel.CENTER);
-		
-		// Create JTable objects to display the data.
-		JTable localTable = new JTable(localModel);
-		localTable.setRowSelectionAllowed(false);
-		localTable.setColumnSelectionAllowed(false);
-		localTable.setCellSelectionEnabled(false);
-		localTable.setShowVerticalLines(false);
-		localTable.getColumnModel().getColumn(0).setMinWidth(200);
-		localTable.getColumnModel().getColumn(0).setMaxWidth(200);
-		localTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
-		localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
-		
-		JTable globalTable = new JTable(globalModel);
-		globalTable.setRowSelectionAllowed(false);
-		globalTable.setColumnSelectionAllowed(false);
-		globalTable.setCellSelectionEnabled(false);
-		globalTable.setShowVerticalLines(false);
-		globalTable.getColumnModel().getColumn(0).setMinWidth(200);
-		globalTable.getColumnModel().getColumn(0).setMaxWidth(200);
-		globalTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
-		globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
-		
-		// Return the two tables.
-		return new JTable[] { localTable, globalTable };
-	}
-	
-	/**
-	 * Sets the value of the indicated row for the global statistical
-	 * table.
-	 * @param rowIndex - The row.
-	 * @param value - The new value.
-	 */
-	protected void setGlobalRowValue(int rowIndex, String value) {
-		globalModel.setValueAt(value, rowIndex, COL_VALUE);
-	}
-	
-	/**
-	 * Sets the value of the indicated row for the local statistical
-	 * table.
-	 * @param rowIndex - The row.
-	 * @param value - The new value.
-	 */
-	protected void setLocalRowValue(int rowIndex, String value) {
-		localModel.setValueAt(value, rowIndex, COL_VALUE);
-	}
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    
+    // Table models.
+    private TableTextModel localModel;
+    private TableTextModel globalModel;
+    
+    // Table model mappings.
+    private static final int COL_TITLE = 0;
+    private static final int COL_VALUE = 1;
+    
+    /**
+     * Instantiates an <code>AbstractTwoColumnTablePanel</code> object
+     * with the indicated row names.
+     * @param rowNames - The names of the rows.
+     */
+    public AbstractTwoColumnTablePanel(String[] rowNames) {
+        super((Object[]) rowNames);
+    }
+    
+    @Override
+    protected JTable[] initializeTables(Object... args) {
+        // The arguments should be a string array.
+        if(!(args instanceof String[])) {
+            throw new IllegalArgumentException("Row names must be strings!");
+        }
+        String[] rowNames = (String[]) args;
+        
+        // Initialize the table models. They should have two columns
+        // (one for values and one for headers) and a number of rows
+        // equal to the number of row names.
+        localModel = new TableTextModel(rowNames.length, 2);
+        globalModel = new TableTextModel(rowNames.length, 2);
+        
+        // Initialize the titles.
+        for(int i = 0; i < rowNames.length; i++) {
+            localModel.setValueAt(rowNames[i], i, COL_TITLE);
+            globalModel.setValueAt(rowNames[i], i, COL_TITLE);
+        }
+        updatePanel(null, null);
+        
+        // Make a cell renderer.
+        DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+        centerRenderer.setHorizontalAlignment(JLabel.CENTER);
+        
+        // Create JTable objects to display the data.
+        JTable localTable = new JTable(localModel);
+        localTable.setRowSelectionAllowed(false);
+        localTable.setColumnSelectionAllowed(false);
+        localTable.setCellSelectionEnabled(false);
+        localTable.setShowVerticalLines(false);
+        localTable.getColumnModel().getColumn(0).setMinWidth(200);
+        localTable.getColumnModel().getColumn(0).setMaxWidth(200);
+        localTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
+        localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
+        
+        JTable globalTable = new JTable(globalModel);
+        globalTable.setRowSelectionAllowed(false);
+        globalTable.setColumnSelectionAllowed(false);
+        globalTable.setCellSelectionEnabled(false);
+        globalTable.setShowVerticalLines(false);
+        globalTable.getColumnModel().getColumn(0).setMinWidth(200);
+        globalTable.getColumnModel().getColumn(0).setMaxWidth(200);
+        globalTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
+        globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
+        
+        // Return the two tables.
+        return new JTable[] { localTable, globalTable };
+    }
+    
+    /**
+     * Sets the value of the indicated row for the global statistical
+     * table.
+     * @param rowIndex - The row.
+     * @param value - The new value.
+     */
+    protected void setGlobalRowValue(int rowIndex, String value) {
+        globalModel.setValueAt(value, rowIndex, COL_VALUE);
+    }
+    
+    /**
+     * Sets the value of the indicated row for the local statistical
+     * table.
+     * @param rowIndex - The row.
+     * @param value - The new value.
+     */
+    protected void setLocalRowValue(int rowIndex, String value) {
+        localModel.setValueAt(value, rowIndex, COL_VALUE);
+    }
 
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -14,99 +14,99 @@
  * @see AbstractTablePanel
  */
 public class ClusterTablePanel extends AbstractTwoColumnTablePanel {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	private static final String[] TABLE_TITLES = { "Recon Clusters", "SSP Clusters", "Matched Clusters",
-			"Failed (Position)", "Failed (Energy)", "Failed (Hit Count)" };
-	
-	// Table model mappings.
-	private static final int ROW_RECON_COUNT      = 0;
-	private static final int ROW_SSP_COUNT        = 1;
-	private static final int ROW_MATCHED          = 2;
-	private static final int ROW_FAILED_POSITION  = 3;
-	private static final int ROW_FAILED_ENERGY    = 4;
-	private static final int ROW_FAILED_HIT_COUNT = 5;
-	
-	/**
-	 * Instantiate a new <code>ClusterTablePanel</code>.
-	 */
-	public ClusterTablePanel() { super(TABLE_TITLES); }
-	
-	@Override
-	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
-		// If the snapshot is null, all values should be "N/A."
-		if(localSnapshot == null || runSnapshot == null) {
-			// Output cluster count data.
-			String scalerNullValue = "---";
-			setLocalRowValue(ROW_RECON_COUNT,  scalerNullValue);
-			setLocalRowValue(ROW_SSP_COUNT,    scalerNullValue);
-			setGlobalRowValue(ROW_RECON_COUNT, scalerNullValue);
-			setGlobalRowValue(ROW_SSP_COUNT,   scalerNullValue);
-			
-			// Output the tracked statistical data.
-			String percentNullValue = "--- / --- (---%)";
-			setLocalRowValue(ROW_MATCHED,           percentNullValue);
-			setLocalRowValue(ROW_FAILED_POSITION,   percentNullValue);
-			setLocalRowValue(ROW_FAILED_ENERGY,     percentNullValue);
-			setLocalRowValue(ROW_FAILED_HIT_COUNT,  percentNullValue);
-			setGlobalRowValue(ROW_MATCHED,          percentNullValue);
-			setGlobalRowValue(ROW_FAILED_POSITION,  percentNullValue);
-			setGlobalRowValue(ROW_FAILED_ENERGY,    percentNullValue);
-			setGlobalRowValue(ROW_FAILED_HIT_COUNT, percentNullValue);
-		}
-		
-		// Otherwise, populate the table with the diagnostic data.
-		else {
-			// Get the cluster statistical banks.
-			ClusterStatModule lstat = localSnapshot.getClusterStats();
-			ClusterStatModule rstat = runSnapshot.getClusterStats();
-			
-			// Get the largest number of digits in any of the values.
-			int mostDigits = ComponentUtils.max(lstat.getReconClusterCount(), lstat.getSSPClusterCount(), lstat.getMatches(),
-					lstat.getPositionFailures(), lstat.getEnergyFailures(), lstat.getHitCountFailures(),
-					rstat.getReconClusterCount(), rstat.getSSPClusterCount(), rstat.getMatches(),
-					rstat.getPositionFailures(), rstat.getEnergyFailures(), rstat.getHitCountFailures());
-			int spaces = ComponentUtils.getDigits(mostDigits);
-			
-			// Put the number of reconstructed and SSP clusters into
-			// the tables.
-			int[] clusterValue = {
-					lstat.getReconClusterCount(),
-					lstat.getSSPClusterCount(),
-					rstat.getReconClusterCount(),
-					rstat.getSSPClusterCount()
-			};
-			String countFormat = "%" + spaces + "d";
-			setLocalRowValue(ROW_RECON_COUNT,  String.format(countFormat, clusterValue[0]));
-			setLocalRowValue(ROW_SSP_COUNT,    String.format(countFormat, clusterValue[1]));
-			setGlobalRowValue(ROW_RECON_COUNT, String.format(countFormat, clusterValue[2]));
-			setGlobalRowValue(ROW_SSP_COUNT,   String.format(countFormat, clusterValue[3]));
-			
-			// Output the tracked statistical data.
-			int total;
-			String percentFormat = "%" + spaces + "d / %" + spaces + "d (%7.3f)";
-			int[] statValue = {
-					lstat.getMatches(),
-					lstat.getPositionFailures(),
-					lstat.getEnergyFailures(),
-					lstat.getHitCountFailures(),
-					rstat.getMatches(),
-					rstat.getPositionFailures(),
-					rstat.getEnergyFailures(),
-					rstat.getHitCountFailures()
-			};
-			
-			total = lstat.getReconClusterCount();
-			setLocalRowValue(ROW_MATCHED,          String.format(percentFormat, statValue[0], total, 100.0 * statValue[0] / total));
-			setLocalRowValue(ROW_FAILED_POSITION,  String.format(percentFormat, statValue[1], total, 100.0 * statValue[1] / total));
-			setLocalRowValue(ROW_FAILED_ENERGY,    String.format(percentFormat, statValue[2], total, 100.0 * statValue[2] / total));
-			setLocalRowValue(ROW_FAILED_HIT_COUNT, String.format(percentFormat, statValue[3], total, 100.0 * statValue[3] / total));
-			
-			total = rstat.getReconClusterCount();
-			setGlobalRowValue(ROW_MATCHED,          String.format(percentFormat, statValue[4], total, 100.0 * statValue[4] / total));
-			setGlobalRowValue(ROW_FAILED_POSITION,  String.format(percentFormat, statValue[5], total, 100.0 * statValue[5] / total));
-			setGlobalRowValue(ROW_FAILED_ENERGY,    String.format(percentFormat, statValue[6], total, 100.0 * statValue[6] / total));
-			setGlobalRowValue(ROW_FAILED_HIT_COUNT, String.format(percentFormat, statValue[7], total, 100.0 * statValue[7] / total));
-		}
-	}
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    private static final String[] TABLE_TITLES = { "Recon Clusters", "SSP Clusters", "Matched Clusters",
+            "Failed (Position)", "Failed (Energy)", "Failed (Hit Count)" };
+    
+    // Table model mappings.
+    private static final int ROW_RECON_COUNT      = 0;
+    private static final int ROW_SSP_COUNT        = 1;
+    private static final int ROW_MATCHED          = 2;
+    private static final int ROW_FAILED_POSITION  = 3;
+    private static final int ROW_FAILED_ENERGY    = 4;
+    private static final int ROW_FAILED_HIT_COUNT = 5;
+    
+    /**
+     * Instantiate a new <code>ClusterTablePanel</code>.
+     */
+    public ClusterTablePanel() { super(TABLE_TITLES); }
+    
+    @Override
+    public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
+        // If the snapshot is null, all values should be "N/A."
+        if(localSnapshot == null || runSnapshot == null) {
+            // Output cluster count data.
+            String scalerNullValue = "---";
+            setLocalRowValue(ROW_RECON_COUNT,  scalerNullValue);
+            setLocalRowValue(ROW_SSP_COUNT,    scalerNullValue);
+            setGlobalRowValue(ROW_RECON_COUNT, scalerNullValue);
+            setGlobalRowValue(ROW_SSP_COUNT,   scalerNullValue);
+            
+            // Output the tracked statistical data.
+            String percentNullValue = "--- / --- (---%)";
+            setLocalRowValue(ROW_MATCHED,           percentNullValue);
+            setLocalRowValue(ROW_FAILED_POSITION,   percentNullValue);
+            setLocalRowValue(ROW_FAILED_ENERGY,     percentNullValue);
+            setLocalRowValue(ROW_FAILED_HIT_COUNT,  percentNullValue);
+            setGlobalRowValue(ROW_MATCHED,          percentNullValue);
+            setGlobalRowValue(ROW_FAILED_POSITION,  percentNullValue);
+            setGlobalRowValue(ROW_FAILED_ENERGY,    percentNullValue);
+            setGlobalRowValue(ROW_FAILED_HIT_COUNT, percentNullValue);
+        }
+        
+        // Otherwise, populate the table with the diagnostic data.
+        else {
+            // Get the cluster statistical banks.
+            ClusterStatModule lstat = localSnapshot.getClusterStats();
+            ClusterStatModule rstat = runSnapshot.getClusterStats();
+            
+            // Get the largest number of digits in any of the values.
+            int mostDigits = ComponentUtils.max(lstat.getReconClusterCount(), lstat.getSSPClusterCount(), lstat.getMatches(),
+                    lstat.getPositionFailures(), lstat.getEnergyFailures(), lstat.getHitCountFailures(),
+                    rstat.getReconClusterCount(), rstat.getSSPClusterCount(), rstat.getMatches(),
+                    rstat.getPositionFailures(), rstat.getEnergyFailures(), rstat.getHitCountFailures());
+            int spaces = ComponentUtils.getDigits(mostDigits);
+            
+            // Put the number of reconstructed and SSP clusters into
+            // the tables.
+            int[] clusterValue = {
+                    lstat.getReconClusterCount(),
+                    lstat.getSSPClusterCount(),
+                    rstat.getReconClusterCount(),
+                    rstat.getSSPClusterCount()
+            };
+            String countFormat = "%" + spaces + "d";
+            setLocalRowValue(ROW_RECON_COUNT,  String.format(countFormat, clusterValue[0]));
+            setLocalRowValue(ROW_SSP_COUNT,    String.format(countFormat, clusterValue[1]));
+            setGlobalRowValue(ROW_RECON_COUNT, String.format(countFormat, clusterValue[2]));
+            setGlobalRowValue(ROW_SSP_COUNT,   String.format(countFormat, clusterValue[3]));
+            
+            // Output the tracked statistical data.
+            int total;
+            String percentFormat = "%" + spaces + "d / %" + spaces + "d (%7.3f)";
+            int[] statValue = {
+                    lstat.getMatches(),
+                    lstat.getPositionFailures(),
+                    lstat.getEnergyFailures(),
+                    lstat.getHitCountFailures(),
+                    rstat.getMatches(),
+                    rstat.getPositionFailures(),
+                    rstat.getEnergyFailures(),
+                    rstat.getHitCountFailures()
+            };
+            
+            total = lstat.getReconClusterCount();
+            setLocalRowValue(ROW_MATCHED,          String.format(percentFormat, statValue[0], total, 100.0 * statValue[0] / total));
+            setLocalRowValue(ROW_FAILED_POSITION,  String.format(percentFormat, statValue[1], total, 100.0 * statValue[1] / total));
+            setLocalRowValue(ROW_FAILED_ENERGY,    String.format(percentFormat, statValue[2], total, 100.0 * statValue[2] / total));
+            setLocalRowValue(ROW_FAILED_HIT_COUNT, String.format(percentFormat, statValue[3], total, 100.0 * statValue[3] / total));
+            
+            total = rstat.getReconClusterCount();
+            setGlobalRowValue(ROW_MATCHED,          String.format(percentFormat, statValue[4], total, 100.0 * statValue[4] / total));
+            setGlobalRowValue(ROW_FAILED_POSITION,  String.format(percentFormat, statValue[5], total, 100.0 * statValue[5] / total));
+            setGlobalRowValue(ROW_FAILED_ENERGY,    String.format(percentFormat, statValue[6], total, 100.0 * statValue[6] / total));
+            setGlobalRowValue(ROW_FAILED_HIT_COUNT, String.format(percentFormat, statValue[7], total, 100.0 * statValue[7] / total));
+        }
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ComponentUtils.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ComponentUtils.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ComponentUtils.java	Wed Mar  9 11:43:24 2016
@@ -11,116 +11,116 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class ComponentUtils {
-	/** The default spacing used between a horizontal edge of one
-	 * component and the horizontal edge of another. */
-	static final int hinternal = 10;
-	/** The default spacing used between a vertical edge of one
-	 * component and the vertical edge of another. */
-	static final int vinternal = 10;
-	/** The default spacing used between a horizontal edge of one
-	 * component and the edge of its parent component. */
-	static final int hexternal = 0;
-	/** The default spacing used between a vertical edge of one
-	 * component and the edge of its parent component. */
-	static final int vexternal = 0;
-	
-	/**
-	 * Gets a <code>String</code> composed of a number of instances of
-	 * character <code>c</code> equal to <code>number</code>.
-	 * @param c - The character to repeat.
-	 * @param number - The number of repetitions.
-	 * @return Returns the repeated character as a <code>String</code>.
-	 */
-	public static final String getChars(char c, int number) {
-		// Create a buffer to store the characters in.
-		StringBuffer s = new StringBuffer();
-		
-		// Add the indicated number of instances.
-		for(int i = 0; i < number; i++) {
-			s.append(c);
-		}
-		
-		// Return the string.
-		return s.toString();
-	}
-	
-	/**
-	 * Gets the number of digits in the base-10 String representation
-	 * of an integer primitive. Negative signs are not included in the
-	 * digit count.
-	 * @param value - The value of which to obtain the length.
-	 * @return Returns the number of digits in the String representation
-	 * of the argument value.
-	 */
-	public static final int getDigits(int value) {
-		return TriggerDiagnosticUtil.getDigits(value);
-	}
-	
-	/**
-	 * Gets the maximum value from a list of values.
-	 * @param values - The values to compare.
-	 * @return Returns the largest of the argument values.
-	 * @throws IllegalArgumentException Occurs if no values are given.
-	 */
-	public static final int max(int... values) throws IllegalArgumentException {
-		// Throw an error if no arguments are provided.
-		if(values == null || values.length == 0) {
-			throw new IllegalArgumentException("Can not determine maximum value from a list of 0 values.");
-		}
-		
-		// If there is only one value, return it.
-		if(values.length == 1) { return values[0]; }
-		
-		// Otherwise, get the largest value.
-		int largest = Integer.MIN_VALUE;
-		for(int value : values) {
-			if(value > largest) { largest = value; }
-		}
-		
-		// Return the result.
-		return largest;
-	}
-	
-	/**
-	 * Gets the x-coordinate immediately to the right of the given
-	 * component.
-	 * @param c - The component of which to find the edge.
-	 * @return Returns the x-coordinate as an <code>int</code> value.
-	 */
-	static final int getNextX(Component c) {
-		return getNextX(c, 0);
-	}
-	
-	/**
-	 * Gets the x-coordinate a given distance to the right edge of the
-	 * argument component.
-	 * @param c - The component of which to find the edge.
-	 * @param spacing - The additional spacing past the edge of the
-	 * component to add.
-	 * @return Returns the x-coordinate as an <code>int</code> value.
-	 */
-	static final int getNextX(Component c, int spacing) {
-		return c.getX() + c.getWidth() + spacing;
-	}
-	
-	/**
-	 * Gets the y-coordinate immediately below the given component.
-	 * @param c - The component of which to find the edge.
-	 * @return Returns the y-coordinate as an <code>int</code> value.
-	 */
-	static final int getNextY(Component c) {
-		return getNextY(c, 0);
-	}
-	
-	/**
-	 * Gets the y-coordinate a given distance below the bottom edge
-	 * of the argument component.
-	 * @param c - The component of which to find the edge.
-	 * @param spacing - The additional spacing past the edge of the
-	 * component to add.
-	 * @return Returns the y-coordinate as an <code>int</code> value.
-	 */
-	static final int getNextY(Component c, int spacing) {
-		return c.getY() + c.getHeight() + spacing;
-	}
+    /** The default spacing used between a horizontal edge of one
+     * component and the horizontal edge of another. */
+    static final int hinternal = 10;
+    /** The default spacing used between a vertical edge of one
+     * component and the vertical edge of another. */
+    static final int vinternal = 10;
+    /** The default spacing used between a horizontal edge of one
+     * component and the edge of its parent component. */
+    static final int hexternal = 0;
+    /** The default spacing used between a vertical edge of one
+     * component and the edge of its parent component. */
+    static final int vexternal = 0;
+    
+    /**
+     * Gets a <code>String</code> composed of a number of instances of
+     * character <code>c</code> equal to <code>number</code>.
+     * @param c - The character to repeat.
+     * @param number - The number of repetitions.
+     * @return Returns the repeated character as a <code>String</code>.
+     */
+    public static final String getChars(char c, int number) {
+        // Create a buffer to store the characters in.
+        StringBuffer s = new StringBuffer();
+        
+        // Add the indicated number of instances.
+        for(int i = 0; i < number; i++) {
+            s.append(c);
+        }
+        
+        // Return the string.
+        return s.toString();
+    }
+    
+    /**
+     * Gets the number of digits in the base-10 String representation
+     * of an integer primitive. Negative signs are not included in the
+     * digit count.
+     * @param value - The value of which to obtain the length.
+     * @return Returns the number of digits in the String representation
+     * of the argument value.
+     */
+    public static final int getDigits(int value) {
+        return TriggerDiagnosticUtil.getDigits(value);
+    }
+    
+    /**
+     * Gets the maximum value from a list of values.
+     * @param values - The values to compare.
+     * @return Returns the largest of the argument values.
+     * @throws IllegalArgumentException Occurs if no values are given.
+     */
+    public static final int max(int... values) throws IllegalArgumentException {
+        // Throw an error if no arguments are provided.
+        if(values == null || values.length == 0) {
+            throw new IllegalArgumentException("Can not determine maximum value from a list of 0 values.");
+        }
+        
+        // If there is only one value, return it.
+        if(values.length == 1) { return values[0]; }
+        
+        // Otherwise, get the largest value.
+        int largest = Integer.MIN_VALUE;
+        for(int value : values) {
+            if(value > largest) { largest = value; }
+        }
+        
+        // Return the result.
+        return largest;
+    }
+    
+    /**
+     * Gets the x-coordinate immediately to the right of the given
+     * component.
+     * @param c - The component of which to find the edge.
+     * @return Returns the x-coordinate as an <code>int</code> value.
+     */
+    static final int getNextX(Component c) {
+        return getNextX(c, 0);
+    }
+    
+    /**
+     * Gets the x-coordinate a given distance to the right edge of the
+     * argument component.
+     * @param c - The component of which to find the edge.
+     * @param spacing - The additional spacing past the edge of the
+     * component to add.
+     * @return Returns the x-coordinate as an <code>int</code> value.
+     */
+    static final int getNextX(Component c, int spacing) {
+        return c.getX() + c.getWidth() + spacing;
+    }
+    
+    /**
+     * Gets the y-coordinate immediately below the given component.
+     * @param c - The component of which to find the edge.
+     * @return Returns the y-coordinate as an <code>int</code> value.
+     */
+    static final int getNextY(Component c) {
+        return getNextY(c, 0);
+    }
+    
+    /**
+     * Gets the y-coordinate a given distance below the bottom edge
+     * of the argument component.
+     * @param c - The component of which to find the edge.
+     * @param spacing - The additional spacing past the edge of the
+     * component to add.
+     * @return Returns the y-coordinate as an <code>int</code> value.
+     */
+    static final int getNextY(Component c, int spacing) {
+        return c.getY() + c.getHeight() + spacing;
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java	Wed Mar  9 11:43:24 2016
@@ -12,11 +12,11 @@
  * @see DiagSnapshot
  */
 public interface DiagnosticUpdatable {
-	/**
-	 * Updates the object with information from the trigger diagnostic
-	 * snapshot in the argument.
-	 * @param snapshot - The snapshot containing information with which
-	 * to update the object.
-	 */
-	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot);
+    /**
+     * Updates the object with information from the trigger diagnostic
+     * snapshot in the argument.
+     * @param snapshot - The snapshot containing information with which
+     * to update the object.
+     */
+    public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot);
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -11,200 +11,200 @@
 import org.hps.analysis.trigger.util.ComponentUtils;
 
 public class EfficiencyTablePanel extends AbstractTablePanel implements DiagnosticUpdatable {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	
-	// Table models.
-	private TableTextModel localModel;
-	private TableTextModel globalModel;
-	
-	// Column/row reference variables.
-	private static final int ROWS = 7;
-	private static final int COLUMNS = 6;
-	/* private static final int COL_HEADER    = 0;
-	private static final int COL_SINGLES_0 = 1;
-	private static final int COL_SINGLES_1 = 2;
-	private static final int COL_PAIR_0    = 3;
-	private static final int COL_PAIR_1    = 4; */
-	private static final int COL_COUNT     = 5;
-	/* private static final int ROW_HEADER    = 0;
-	private static final int ROW_PULSER    = 1;
-	private static final int ROW_COSMIC    = 2;
-	private static final int ROW_SINGLES_0 = 3;
-	private static final int ROW_SINGLES_1 = 4;
-	private static final int ROW_PAIR_0    = 5;
-	private static final int ROW_PAIR_1    = 6; */
-	
-	// Global/local reference variables.
-	private static final int GLOBAL = 0;
-	private static final int LOCAL  = 1;
-	
-	// Trigger type reference variables.
-	private static final int TYPE_SINGLES_0 = TriggerStatModule.SINGLES_0;
-	private static final int TYPE_SINGLES_1 = TriggerStatModule.SINGLES_1;
-	private static final int TYPE_PAIR_0    = TriggerStatModule.PAIR_0;
-	private static final int TYPE_PAIR_1    = TriggerStatModule.PAIR_1;
-	
-	// Column/row header names.
-	private static final String[] COL_NAMES = {
-		"", "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Count"
-	};
-	private static final String[] ROW_NAMES = {
-		"", "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Pulser", "Cosmic"
-		//"", "Random", "Cosmic", "Singles 0", "Singles 1", "Pair 0", "Pair 1"
-	};
-	
-	/**
-	 * Instantiates a new <code>EfficiencyTablePanel</code>.
-	 */
-	public EfficiencyTablePanel() {
-		// Instantiate the superclass.
-		super();
-		
-		// Set the orientation to vertical.
-		setOrientation(ORIENTATION_VERTICAL);
-	}
-	
-	@Override
-	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
-		// If there is no snapshot, the tables should all display an
-		// empty value.
-		if(runSnapshot == null || localSnapshot == null) {
-			for(int row = 1; row < ROWS; row++) {
-				for(int col = 1; col < COLUMNS; col++) {
-					localModel.setValueAt("---", row, col);
-					globalModel.setValueAt("---", row, col);
-				}
-			}
-		}
-		
-		// Otherwise, update the table cells from the snapshot data.
-		else {
-			// Get the efficiency modules.
-			DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
-			stat[GLOBAL] = runSnapshot;
-			stat[LOCAL] = localSnapshot;
-			
-			// Get the trigger count for each trigger type for both the
-			// local and global snapshots.
-			int[][][] matched = new int[2][4][6];
-			int[][][] triggers = new int[2][4][6];
-			for(int i = 0; i < 2; i++) {
-				for(int triggerType = 0; triggerType < 6; triggerType++) {
-					// Get the total triggers seen for each type.
-					triggers[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getSSPSimulatedTriggers(triggerType);
-					triggers[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getSSPSimulatedTriggers(triggerType);
-					triggers[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getSSPSimulatedTriggers(triggerType);
-					triggers[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getSSPSimulatedTriggers(triggerType);
-					
-					// Get the total triggers matched for each type.
-					matched[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getMatchedSSPSimulatedTriggers(triggerType);
-					matched[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getMatchedSSPSimulatedTriggers(triggerType);
-					matched[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getMatchedSSPSimulatedTriggers(triggerType);
-					matched[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getMatchedSSPSimulatedTriggers(triggerType);
-				}
-			}
-			
-			// Determine the spacing needed to display the largest numerical
-			// cell value.
-			int numWidth = -1;
-			for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
-				for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
-					int rSize = ComponentUtils.getDigits(triggers[GLOBAL][seenTriggerType][tiTriggerType]);
-					int lSize = ComponentUtils.getDigits(triggers[LOCAL][seenTriggerType][tiTriggerType]);
-					numWidth = ComponentUtils.max(numWidth, rSize, lSize);
-				}
-			}
-			
-			// Generate the format string for the cells.
-			String format = "%" + numWidth + "d / %" + numWidth + "d";
-			
-			// Update the table.
-			for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
-				// Fill the row/column combinations that hold trigger
-				// statistical information.
-				for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
-					// Fill the local table cell.
-					String localText = String.format(format, matched[LOCAL][seenTriggerType][tiTriggerType],
-							triggers[LOCAL][seenTriggerType][tiTriggerType]);
-					if(triggers[LOCAL][seenTriggerType][tiTriggerType] == 0) {
-						localText = localText + " (  N/A  %)";
-					} else {
-						localText = String.format("%s (%7.3f%%)", localText,
-								(100.0 * matched[LOCAL][seenTriggerType][tiTriggerType] / triggers[LOCAL][seenTriggerType][tiTriggerType]));
-					}
-					localModel.setValueAt(localText, tiTriggerType + 1, seenTriggerType + 1);
-					
-					// Fill the global table cell.
-					String globalText = String.format(format, matched[GLOBAL][seenTriggerType][tiTriggerType],
-							triggers[GLOBAL][seenTriggerType][tiTriggerType]);
-					if(triggers[GLOBAL][seenTriggerType][tiTriggerType] == 0) {
-						globalText = globalText + " (  N/A  %)";
-					} else {
-						globalText = String.format("%s (%7.3f%%)", globalText,
-								(100.0 * matched[GLOBAL][seenTriggerType][tiTriggerType] / triggers[GLOBAL][seenTriggerType][tiTriggerType]));
-					}
-					globalModel.setValueAt(globalText, tiTriggerType + 1, seenTriggerType + 1);
-				}
-				
-				// Populate the count column.
-				localModel.setValueAt("" + stat[LOCAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
-				globalModel.setValueAt("" + stat[GLOBAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
-			}
-		}
-	}
-	
-	@Override
-	protected JTable[] initializeTables(Object... args) {
-		// Initialize the table models. There should be one row and
-		// one column for each type of trigger plus an additional one
-		// of each for headers.
-		localModel = new TableTextModel(ROWS, COLUMNS);
-		globalModel = new TableTextModel(ROWS, COLUMNS);
-		
-		// Set the column headers.
-		for(int col = 0; col < COLUMNS; col++) {
-			localModel.setValueAt(COL_NAMES[col], 0, col);
-			globalModel.setValueAt(COL_NAMES[col], 0, col);
-		}
-		
-		// Set the row headers.
-		for(int row = 0; row < ROWS; row++) {
-			localModel.setValueAt(ROW_NAMES[row], row, 0);
-			globalModel.setValueAt(ROW_NAMES[row], row, 0);
-		}
-		
-		// Make a cell renderer.
-		DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
-		centerRenderer.setHorizontalAlignment(JLabel.CENTER);
-		
-		// Create JTable objects to display the data.
-		JTable localTable = new JTable(localModel);
-		localTable.setRowSelectionAllowed(false);
-		localTable.setColumnSelectionAllowed(false);
-		localTable.setCellSelectionEnabled(false);
-		localTable.setShowVerticalLines(false);
-		localTable.getColumnModel().getColumn(0).setMaxWidth(150);
-		localTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
-		for(int col = 1; col < COLUMNS; col++) {
-			localTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
-		}
-		localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
-		
-		JTable globalTable = new JTable(globalModel);
-		globalTable.setRowSelectionAllowed(false);
-		globalTable.setColumnSelectionAllowed(false);
-		globalTable.setCellSelectionEnabled(false);
-		globalTable.setShowVerticalLines(false);
-		globalTable.getColumnModel().getColumn(0).setMaxWidth(150);
-		globalTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
-		for(int col = 1; col < COLUMNS; col++) {
-			globalTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
-		}
-		globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
-		
-		// Return the tables.
-		return new JTable[] { localTable, globalTable };
-	}
-	
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    
+    // Table models.
+    private TableTextModel localModel;
+    private TableTextModel globalModel;
+    
+    // Column/row reference variables.
+    private static final int ROWS = 7;
+    private static final int COLUMNS = 6;
+    /* private static final int COL_HEADER    = 0;
+    private static final int COL_SINGLES_0 = 1;
+    private static final int COL_SINGLES_1 = 2;
+    private static final int COL_PAIR_0    = 3;
+    private static final int COL_PAIR_1    = 4; */
+    private static final int COL_COUNT     = 5;
+    /* private static final int ROW_HEADER    = 0;
+    private static final int ROW_PULSER    = 1;
+    private static final int ROW_COSMIC    = 2;
+    private static final int ROW_SINGLES_0 = 3;
+    private static final int ROW_SINGLES_1 = 4;
+    private static final int ROW_PAIR_0    = 5;
+    private static final int ROW_PAIR_1    = 6; */
+    
+    // Global/local reference variables.
+    private static final int GLOBAL = 0;
+    private static final int LOCAL  = 1;
+    
+    // Trigger type reference variables.
+    private static final int TYPE_SINGLES_0 = TriggerStatModule.SINGLES_0;
+    private static final int TYPE_SINGLES_1 = TriggerStatModule.SINGLES_1;
+    private static final int TYPE_PAIR_0    = TriggerStatModule.PAIR_0;
+    private static final int TYPE_PAIR_1    = TriggerStatModule.PAIR_1;
+    
+    // Column/row header names.
+    private static final String[] COL_NAMES = {
+        "", "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Count"
+    };
+    private static final String[] ROW_NAMES = {
+        "", "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Pulser", "Cosmic"
+        //"", "Random", "Cosmic", "Singles 0", "Singles 1", "Pair 0", "Pair 1"
+    };
+    
+    /**
+     * Instantiates a new <code>EfficiencyTablePanel</code>.
+     */
+    public EfficiencyTablePanel() {
+        // Instantiate the superclass.
+        super();
+        
+        // Set the orientation to vertical.
+        setOrientation(ORIENTATION_VERTICAL);
+    }
+    
+    @Override
+    public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
+        // If there is no snapshot, the tables should all display an
+        // empty value.
+        if(runSnapshot == null || localSnapshot == null) {
+            for(int row = 1; row < ROWS; row++) {
+                for(int col = 1; col < COLUMNS; col++) {
+                    localModel.setValueAt("---", row, col);
+                    globalModel.setValueAt("---", row, col);
+                }
+            }
+        }
+        
+        // Otherwise, update the table cells from the snapshot data.
+        else {
+            // Get the efficiency modules.
+            DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
+            stat[GLOBAL] = runSnapshot;
+            stat[LOCAL] = localSnapshot;
+            
+            // Get the trigger count for each trigger type for both the
+            // local and global snapshots.
+            int[][][] matched = new int[2][4][6];
+            int[][][] triggers = new int[2][4][6];
+            for(int i = 0; i < 2; i++) {
+                for(int triggerType = 0; triggerType < 6; triggerType++) {
+                    // Get the total triggers seen for each type.
+                    triggers[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getSSPSimulatedTriggers(triggerType);
+                    triggers[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getSSPSimulatedTriggers(triggerType);
+                    triggers[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getSSPSimulatedTriggers(triggerType);
+                    triggers[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getSSPSimulatedTriggers(triggerType);
+                    
+                    // Get the total triggers matched for each type.
+                    matched[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getMatchedSSPSimulatedTriggers(triggerType);
+                    matched[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getMatchedSSPSimulatedTriggers(triggerType);
+                    matched[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getMatchedSSPSimulatedTriggers(triggerType);
+                    matched[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getMatchedSSPSimulatedTriggers(triggerType);
+                }
+            }
+            
+            // Determine the spacing needed to display the largest numerical
+            // cell value.
+            int numWidth = -1;
+            for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
+                for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
+                    int rSize = ComponentUtils.getDigits(triggers[GLOBAL][seenTriggerType][tiTriggerType]);
+                    int lSize = ComponentUtils.getDigits(triggers[LOCAL][seenTriggerType][tiTriggerType]);
+                    numWidth = ComponentUtils.max(numWidth, rSize, lSize);
+                }
+            }
+            
+            // Generate the format string for the cells.
+            String format = "%" + numWidth + "d / %" + numWidth + "d";
+            
+            // Update the table.
+            for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
+                // Fill the row/column combinations that hold trigger
+                // statistical information.
+                for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
+                    // Fill the local table cell.
+                    String localText = String.format(format, matched[LOCAL][seenTriggerType][tiTriggerType],
+                            triggers[LOCAL][seenTriggerType][tiTriggerType]);
+                    if(triggers[LOCAL][seenTriggerType][tiTriggerType] == 0) {
+                        localText = localText + " (  N/A  %)";
+                    } else {
+                        localText = String.format("%s (%7.3f%%)", localText,
+                                (100.0 * matched[LOCAL][seenTriggerType][tiTriggerType] / triggers[LOCAL][seenTriggerType][tiTriggerType]));
+                    }
+                    localModel.setValueAt(localText, tiTriggerType + 1, seenTriggerType + 1);
+                    
+                    // Fill the global table cell.
+                    String globalText = String.format(format, matched[GLOBAL][seenTriggerType][tiTriggerType],
+                            triggers[GLOBAL][seenTriggerType][tiTriggerType]);
+                    if(triggers[GLOBAL][seenTriggerType][tiTriggerType] == 0) {
+                        globalText = globalText + " (  N/A  %)";
+                    } else {
+                        globalText = String.format("%s (%7.3f%%)", globalText,
+                                (100.0 * matched[GLOBAL][seenTriggerType][tiTriggerType] / triggers[GLOBAL][seenTriggerType][tiTriggerType]));
+                    }
+                    globalModel.setValueAt(globalText, tiTriggerType + 1, seenTriggerType + 1);
+                }
+                
+                // Populate the count column.
+                localModel.setValueAt("" + stat[LOCAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
+                globalModel.setValueAt("" + stat[GLOBAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
+            }
+        }
+    }
+    
+    @Override
+    protected JTable[] initializeTables(Object... args) {
+        // Initialize the table models. There should be one row and
+        // one column for each type of trigger plus an additional one
+        // of each for headers.
+        localModel = new TableTextModel(ROWS, COLUMNS);
+        globalModel = new TableTextModel(ROWS, COLUMNS);
+        
+        // Set the column headers.
+        for(int col = 0; col < COLUMNS; col++) {
+            localModel.setValueAt(COL_NAMES[col], 0, col);
+            globalModel.setValueAt(COL_NAMES[col], 0, col);
+        }
+        
+        // Set the row headers.
+        for(int row = 0; row < ROWS; row++) {
+            localModel.setValueAt(ROW_NAMES[row], row, 0);
+            globalModel.setValueAt(ROW_NAMES[row], row, 0);
+        }
+        
+        // Make a cell renderer.
+        DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+        centerRenderer.setHorizontalAlignment(JLabel.CENTER);
+        
+        // Create JTable objects to display the data.
+        JTable localTable = new JTable(localModel);
+        localTable.setRowSelectionAllowed(false);
+        localTable.setColumnSelectionAllowed(false);
+        localTable.setCellSelectionEnabled(false);
+        localTable.setShowVerticalLines(false);
+        localTable.getColumnModel().getColumn(0).setMaxWidth(150);
+        localTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
+        for(int col = 1; col < COLUMNS; col++) {
+            localTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
+        }
+        localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
+        
+        JTable globalTable = new JTable(globalModel);
+        globalTable.setRowSelectionAllowed(false);
+        globalTable.setColumnSelectionAllowed(false);
+        globalTable.setCellSelectionEnabled(false);
+        globalTable.setShowVerticalLines(false);
+        globalTable.getColumnModel().getColumn(0).setMaxWidth(150);
+        globalTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
+        for(int col = 1; col < COLUMNS; col++) {
+            globalTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
+        }
+        globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
+        
+        // Return the tables.
+        return new JTable[] { localTable, globalTable };
+    }
+    
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -7,14 +7,14 @@
  * @author Kyle McCarty
  */
 public class PairTablePanel extends AbstractTriggerTablePanel {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	private static final String[] CUT_NAMES = { "    Energy Sum:",
-		"    Energy Difference:", "    Energy Slope:", "    Coplanarity:" };
-	
-	/**
-	 * Instantiates a <code>PairTablePanel</code>.
-	 */
-	public PairTablePanel() { super(CUT_NAMES, false); }
-	
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    private static final String[] CUT_NAMES = { "    Energy Sum:",
+        "    Energy Difference:", "    Energy Slope:", "    Coplanarity:" };
+    
+    /**
+     * Instantiates a <code>PairTablePanel</code>.
+     */
+    public PairTablePanel() { super(CUT_NAMES, false); }
+    
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java	Wed Mar  9 11:43:24 2016
@@ -12,291 +12,291 @@
 import org.hps.analysis.trigger.util.ComponentUtils;
 
 public class ShifterTrigPanel extends JPanel {
-	private static final Color BG_WARNING = new Color(255, 235, 20);
-	private static final Color BG_CRITICAL = new Color(230, 0, 0);
-	private static final Color FONT_WARNING = new Color(255, 157, 0);
-	private static final Color FONT_CRITICAL = new Color(117, 0, 0);
-	private static final long serialVersionUID = 1L;
-	
-	private JLabel panelTitle;
-	private JLabel[] fieldTitle;
-	private JLabel[] fieldValue;
-	
-	/**
-	 * Instantiates a new <code>ShifterTrigPanel</code> with the
-	 * indicated name.
-	 */
-	public ShifterTrigPanel(String name) {
-		// Instantiate a layout for the fields.
-		SpringLayout layout = new SpringLayout();
-		setLayout(layout);
-		
-		// Instantiate the header title.
-		panelTitle = new JLabel(name);
-		panelTitle.setVerticalAlignment(JLabel.CENTER);
-		panelTitle.setHorizontalAlignment(JLabel.CENTER);
-		add(panelTitle);
-		
-		// Instantiate the field title labels.
-		String[] titleName = { "Cluster Efficiency", "Singles 0 Logic Efficiency",
-				"Singles 0 Trigger Efficiency", "Singles 1 Logic Efficiency",
-				"Singles 1 Trigger Efficiency", "Pair 0 Logic Efficiency",
-				"Pair 0 Trigger Efficiency", "Pair 1 Logic Efficiency", "Pair 1 Trigger Efficiency" };
-		fieldTitle = new JLabel[titleName.length];
-		for(int index = 0; index < titleName.length; index++) {
-			fieldTitle[index] = new JLabel(titleName[index]);
-			fieldTitle[index].setVerticalAlignment(JLabel.CENTER);
-			fieldTitle[index].setHorizontalAlignment(JLabel.RIGHT);
-			fieldTitle[index].setOpaque(true);
-			add(fieldTitle[index]);
-		}
-		
-		// Instantiate the field value labels.
-		fieldValue = new JLabel[titleName.length];
-		for(int index = 0; index < titleName.length; index++) {
-			fieldValue[index] = new JLabel("");
-			fieldValue[index].setVerticalAlignment(JLabel.CENTER);
-			fieldValue[index].setHorizontalAlignment(JLabel.LEFT);
-			fieldValue[index].setOpaque(true);
-			add(fieldValue[index]);
-		}
-		
-		// Get the longest title.
-		int maxWidth = -1;
-		int maxIndex = -1;
-		for(int index = 0; index < titleName.length; index++) {
-			int width = fieldTitle[index].getFontMetrics(fieldTitle[index].getFont()).stringWidth(titleName[index]);
-			if(width > maxWidth) {
-				maxWidth = width;
-				maxIndex = index;
-			}
-		}
-		
-		// Define border edge and spacing variables.
-		String EAST = SpringLayout.EAST;
-		String WEST = SpringLayout.WEST;
-		String NORTH = SpringLayout.NORTH;
-		String SOUTH = SpringLayout.SOUTH;
-		int hinternal =  5;
-		int vinternal = 10;
-		int hexternal =  5;
-		int vexternal =  5;
-		
-		// Position the panel header.
-		layout.putConstraint(EAST,  panelTitle, hexternal, EAST,  this);
-		layout.putConstraint(WEST,  panelTitle, hexternal, WEST,  this);
-		layout.putConstraint(NORTH, panelTitle, vexternal, NORTH, this);
-		
-		// Position the field entries.
-		Component lastComp = panelTitle;
-		for(int index = 0; index < titleName.length; index++) {
-			// For all field titles except the largest, lock the right
-			// edge of the title to match the position of the largest
-			// title's right edge. The largest title is allowed to size
-			// itself to its preferred width.
-			if(index == maxIndex) {
-				layout.putConstraint(NORTH, fieldTitle[index], vinternal, SOUTH, lastComp);
-				layout.putConstraint(WEST,  fieldTitle[index], hexternal, WEST,  this);
-			} else {
-				layout.putConstraint(NORTH, fieldTitle[index], vinternal, SOUTH, lastComp);
-				layout.putConstraint(WEST,  fieldTitle[index], hexternal, WEST,  this);
-				layout.putConstraint(EAST,  fieldTitle[index],         0, EAST,  fieldTitle[maxIndex]);
-			}
-			
-			// Position the field value label to the right of the field
-			// title label. It should use up the remainder of the width
-			// allowed by the component.
-			layout.putConstraint(WEST,  fieldValue[index], hinternal, EAST,  fieldTitle[index]);
-			layout.putConstraint(EAST,  fieldValue[index], hexternal, EAST,  this);
-			layout.putConstraint(NORTH, fieldValue[index], vinternal, SOUTH, lastComp);
-			
-			// Update the "last component" to the current field title
-			// label.
-			lastComp = fieldTitle[index];
-		}
-		
-		// Update the fonts.
-		setFont(getFont());
-	}
-	
-	@Override
-	public void setBackground(Color bg) {
-		// Set the superclass background.
-		super.setBackground(bg);
-		
-		// Set the component backgrounds.
-		if(panelTitle != null) {
-			panelTitle.setBackground(bg);
-			for(int index = 0; index < fieldTitle.length; index++) {
-				fieldTitle[index].setBackground(bg);
-				
-				// If the field value label has a special alert color,
-				// then do not overwrite it.
-				if(!fieldValue[index].getBackground().equals(BG_WARNING)
-						&& !fieldValue[index].getBackground().equals(BG_CRITICAL)) {
-					fieldValue[index].setBackground(bg);
-				}
-			}
-		}
-	}
-	
-	@Override
-	public void setFont(Font font) {
-		// Set the superclass font.
-		super.setFont(font);
-		
-		// Set the component fonts.
-		if(panelTitle != null) {
-			panelTitle.setFont(font.deriveFont(Font.BOLD, (float) (font.getSize2D() * 1.5)));
-			for(int index = 0; index < fieldTitle.length; index++) {
-				fieldTitle[index].setFont(font.deriveFont(Font.BOLD));
-				fieldValue[index].setFont(font);
-			}
-		}
-	}
-	
-	@Override
-	public void setForeground(Color fg) {
-		// Set the superclass foreground.
-		super.setForeground(fg);
-		
-		// Set the component backgrounds.
-		if(panelTitle != null) {
-			panelTitle.setForeground(fg);
-			for(int index = 0; index < fieldTitle.length; index++) {
-				fieldTitle[index].setForeground(fg);
-				
-				// If the field value label has a special alert color,
-				// then do not overwrite it.
-				if(!fieldValue[index].getForeground().equals(FONT_WARNING)
-						&& !fieldValue[index].getForeground().equals(FONT_CRITICAL)) {
-					fieldValue[index].setBackground(fg);
-				}
-			}
-		}
-	}
-	
-	/**
-	 * Updates the panel statistical display with data from the
-	 * argument snapshot.
-	 * @param stat - The snapshot from which to derive statistical
-	 *               data.
-	 */
-	public void updatePanel(DiagnosticSnapshot stat) {
-		// If the snapshot is null, insert "null" values in the
-		// field panels,
-		if(stat == null) {
-			// Populate the fields with a "null" entry.
-			for(int index = 0; index < fieldValue.length; index++) {
-				fieldValue[index].setText("--- / --- (  N/A  %)");
-			}
-			
-			// No data exists, so no further processing is needed.
-			return;
-		}
-		
-		// Define index constants.
-		int RECON = 0;
-		int SSP = 1;
-		int TRIGGER_0 = 0;
-		int TRIGGER_1 = 1;
-		
-		// Get the tracked values from the snapshot.
-		int seenClusters = stat.getClusterStats().getReconClusterCount();
-		int[][] seenSinglesTriggers = {
-			{ stat.getSingles0Stats().getReconSimulatedTriggers(), stat.getSingles1Stats().getReconSimulatedTriggers() },
-			{ stat.getSingles0Stats().getSSPSimulatedTriggers(), stat.getSingles1Stats().getSSPSimulatedTriggers() }
-		};
-		int[][] seenPairTriggers = {
+    private static final Color BG_WARNING = new Color(255, 235, 20);
+    private static final Color BG_CRITICAL = new Color(230, 0, 0);
+    private static final Color FONT_WARNING = new Color(255, 157, 0);
+    private static final Color FONT_CRITICAL = new Color(117, 0, 0);
+    private static final long serialVersionUID = 1L;
+    
+    private JLabel panelTitle;
+    private JLabel[] fieldTitle;
+    private JLabel[] fieldValue;
+    
+    /**
+     * Instantiates a new <code>ShifterTrigPanel</code> with the
+     * indicated name.
+     */
+    public ShifterTrigPanel(String name) {
+        // Instantiate a layout for the fields.
+        SpringLayout layout = new SpringLayout();
+        setLayout(layout);
+        
+        // Instantiate the header title.
+        panelTitle = new JLabel(name);
+        panelTitle.setVerticalAlignment(JLabel.CENTER);
+        panelTitle.setHorizontalAlignment(JLabel.CENTER);
+        add(panelTitle);
+        
+        // Instantiate the field title labels.
+        String[] titleName = { "Cluster Efficiency", "Singles 0 Logic Efficiency",
+                "Singles 0 Trigger Efficiency", "Singles 1 Logic Efficiency",
+                "Singles 1 Trigger Efficiency", "Pair 0 Logic Efficiency",
+                "Pair 0 Trigger Efficiency", "Pair 1 Logic Efficiency", "Pair 1 Trigger Efficiency" };
+        fieldTitle = new JLabel[titleName.length];
+        for(int index = 0; index < titleName.length; index++) {
+            fieldTitle[index] = new JLabel(titleName[index]);
+            fieldTitle[index].setVerticalAlignment(JLabel.CENTER);
+            fieldTitle[index].setHorizontalAlignment(JLabel.RIGHT);
+            fieldTitle[index].setOpaque(true);
+            add(fieldTitle[index]);
+        }
+        
+        // Instantiate the field value labels.
+        fieldValue = new JLabel[titleName.length];
+        for(int index = 0; index < titleName.length; index++) {
+            fieldValue[index] = new JLabel("");
+            fieldValue[index].setVerticalAlignment(JLabel.CENTER);
+            fieldValue[index].setHorizontalAlignment(JLabel.LEFT);
+            fieldValue[index].setOpaque(true);
+            add(fieldValue[index]);
+        }
+        
+        // Get the longest title.
+        int maxWidth = -1;
+        int maxIndex = -1;
+        for(int index = 0; index < titleName.length; index++) {
+            int width = fieldTitle[index].getFontMetrics(fieldTitle[index].getFont()).stringWidth(titleName[index]);
+            if(width > maxWidth) {
+                maxWidth = width;
+                maxIndex = index;
+            }
+        }
+        
+        // Define border edge and spacing variables.
+        String EAST = SpringLayout.EAST;
+        String WEST = SpringLayout.WEST;
+        String NORTH = SpringLayout.NORTH;
+        String SOUTH = SpringLayout.SOUTH;
+        int hinternal =  5;
+        int vinternal = 10;
+        int hexternal =  5;
+        int vexternal =  5;
+        
+        // Position the panel header.
+        layout.putConstraint(EAST,  panelTitle, hexternal, EAST,  this);
+        layout.putConstraint(WEST,  panelTitle, hexternal, WEST,  this);
+        layout.putConstraint(NORTH, panelTitle, vexternal, NORTH, this);
+        
+        // Position the field entries.
+        Component lastComp = panelTitle;
+        for(int index = 0; index < titleName.length; index++) {
+            // For all field titles except the largest, lock the right
+            // edge of the title to match the position of the largest
+            // title's right edge. The largest title is allowed to size
+            // itself to its preferred width.
+            if(index == maxIndex) {
+                layout.putConstraint(NORTH, fieldTitle[index], vinternal, SOUTH, lastComp);
+                layout.putConstraint(WEST,  fieldTitle[index], hexternal, WEST,  this);
+            } else {
+                layout.putConstraint(NORTH, fieldTitle[index], vinternal, SOUTH, lastComp);
+                layout.putConstraint(WEST,  fieldTitle[index], hexternal, WEST,  this);
+                layout.putConstraint(EAST,  fieldTitle[index],         0, EAST,  fieldTitle[maxIndex]);
+            }
+            
+            // Position the field value label to the right of the field
+            // title label. It should use up the remainder of the width
+            // allowed by the component.
+            layout.putConstraint(WEST,  fieldValue[index], hinternal, EAST,  fieldTitle[index]);
+            layout.putConstraint(EAST,  fieldValue[index], hexternal, EAST,  this);
+            layout.putConstraint(NORTH, fieldValue[index], vinternal, SOUTH, lastComp);
+            
+            // Update the "last component" to the current field title
+            // label.
+            lastComp = fieldTitle[index];
+        }
+        
+        // Update the fonts.
+        setFont(getFont());
+    }
+    
+    @Override
+    public void setBackground(Color bg) {
+        // Set the superclass background.
+        super.setBackground(bg);
+        
+        // Set the component backgrounds.
+        if(panelTitle != null) {
+            panelTitle.setBackground(bg);
+            for(int index = 0; index < fieldTitle.length; index++) {
+                fieldTitle[index].setBackground(bg);
+                
+                // If the field value label has a special alert color,
+                // then do not overwrite it.
+                if(!fieldValue[index].getBackground().equals(BG_WARNING)
+                        && !fieldValue[index].getBackground().equals(BG_CRITICAL)) {
+                    fieldValue[index].setBackground(bg);
+                }
+            }
+        }
+    }
+    
+    @Override
+    public void setFont(Font font) {
+        // Set the superclass font.
+        super.setFont(font);
+        
+        // Set the component fonts.
+        if(panelTitle != null) {
+            panelTitle.setFont(font.deriveFont(Font.BOLD, (float) (font.getSize2D() * 1.5)));
+            for(int index = 0; index < fieldTitle.length; index++) {
+                fieldTitle[index].setFont(font.deriveFont(Font.BOLD));
+                fieldValue[index].setFont(font);
+            }
+        }
+    }
+    
+    @Override
+    public void setForeground(Color fg) {
+        // Set the superclass foreground.
+        super.setForeground(fg);
+        
+        // Set the component backgrounds.
+        if(panelTitle != null) {
+            panelTitle.setForeground(fg);
+            for(int index = 0; index < fieldTitle.length; index++) {
+                fieldTitle[index].setForeground(fg);
+                
+                // If the field value label has a special alert color,
+                // then do not overwrite it.
+                if(!fieldValue[index].getForeground().equals(FONT_WARNING)
+                        && !fieldValue[index].getForeground().equals(FONT_CRITICAL)) {
+                    fieldValue[index].setBackground(fg);
+                }
+            }
+        }
+    }
+    
+    /**
+     * Updates the panel statistical display with data from the
+     * argument snapshot.
+     * @param stat - The snapshot from which to derive statistical
+     *               data.
+     */
+    public void updatePanel(DiagnosticSnapshot stat) {
+        // If the snapshot is null, insert "null" values in the
+        // field panels,
+        if(stat == null) {
+            // Populate the fields with a "null" entry.
+            for(int index = 0; index < fieldValue.length; index++) {
+                fieldValue[index].setText("--- / --- (  N/A  %)");
+            }
+            
+            // No data exists, so no further processing is needed.
+            return;
+        }
+        
+        // Define index constants.
+        int RECON = 0;
+        int SSP = 1;
+        int TRIGGER_0 = 0;
+        int TRIGGER_1 = 1;
+        
+        // Get the tracked values from the snapshot.
+        int seenClusters = stat.getClusterStats().getReconClusterCount();
+        int[][] seenSinglesTriggers = {
+            { stat.getSingles0Stats().getReconSimulatedTriggers(), stat.getSingles1Stats().getReconSimulatedTriggers() },
+            { stat.getSingles0Stats().getSSPSimulatedTriggers(), stat.getSingles1Stats().getSSPSimulatedTriggers() }
+        };
+        int[][] seenPairTriggers = {
                         { stat.getPair0Stats().getReconSimulatedTriggers(), stat.getPair1Stats().getReconSimulatedTriggers() },
                         { stat.getPair0Stats().getSSPSimulatedTriggers(), stat.getPair1Stats().getSSPSimulatedTriggers() }
-		};
-		int matchedClusters = stat.getClusterStats().getMatches();
-		int[][] matchedSinglesTriggers = {
+        };
+        int matchedClusters = stat.getClusterStats().getMatches();
+        int[][] matchedSinglesTriggers = {
                         { stat.getSingles0Stats().getMatchedReconSimulatedTriggers(), stat.getSingles1Stats().getMatchedReconSimulatedTriggers() },
                         { stat.getSingles0Stats().getMatchedSSPSimulatedTriggers(), stat.getSingles1Stats().getMatchedSSPSimulatedTriggers() }
-		};
-		int[][] matchedPairTriggers = {
+        };
+        int[][] matchedPairTriggers = {
                         { stat.getPair0Stats().getMatchedReconSimulatedTriggers(), stat.getPair1Stats().getMatchedReconSimulatedTriggers() },
                         { stat.getPair0Stats().getMatchedSSPSimulatedTriggers(), stat.getPair1Stats().getMatchedSSPSimulatedTriggers() }
-		};
-		
-		// Get the largest digit of the tracked values. This should
-		// always be one of the "seen" values.
-		int mostDigits = ComponentUtils.max(seenClusters, seenSinglesTriggers[0][0], seenSinglesTriggers[0][1],
-				seenSinglesTriggers[1][0], seenSinglesTriggers[1][1], seenPairTriggers[0][0], seenPairTriggers[0][1],
-				seenPairTriggers[1][0], seenPairTriggers[1][1]);
-		int spaces = ComponentUtils.getDigits(mostDigits);
-		
-		// Populate the cluster field panel.
-		processEfficiency(seenClusters, matchedClusters, 0, spaces, 0.98, 0.94);
-		
-		// Populate the singles trigger field panels.
-		processEfficiency(seenSinglesTriggers[RECON][TRIGGER_0], matchedSinglesTriggers[RECON][TRIGGER_0], 1, spaces, 0.99, 0.95);
+        };
+        
+        // Get the largest digit of the tracked values. This should
+        // always be one of the "seen" values.
+        int mostDigits = ComponentUtils.max(seenClusters, seenSinglesTriggers[0][0], seenSinglesTriggers[0][1],
+                seenSinglesTriggers[1][0], seenSinglesTriggers[1][1], seenPairTriggers[0][0], seenPairTriggers[0][1],
+                seenPairTriggers[1][0], seenPairTriggers[1][1]);
+        int spaces = ComponentUtils.getDigits(mostDigits);
+        
+        // Populate the cluster field panel.
+        processEfficiency(seenClusters, matchedClusters, 0, spaces, 0.98, 0.94);
+        
+        // Populate the singles trigger field panels.
+        processEfficiency(seenSinglesTriggers[RECON][TRIGGER_0], matchedSinglesTriggers[RECON][TRIGGER_0], 1, spaces, 0.99, 0.95);
                 processEfficiency(seenSinglesTriggers[SSP][TRIGGER_0],   matchedSinglesTriggers[SSP][TRIGGER_0],   2, spaces, 0.99, 0.95);
                 processEfficiency(seenSinglesTriggers[RECON][TRIGGER_1], matchedSinglesTriggers[RECON][TRIGGER_1], 3, spaces, 0.99, 0.95);
                 processEfficiency(seenSinglesTriggers[SSP][TRIGGER_1],   matchedSinglesTriggers[SSP][TRIGGER_1],   4, spaces, 0.99, 0.95);
-		
-		// Populate the pair trigger field panels.
-		processEfficiency(seenPairTriggers[RECON][TRIGGER_0], matchedPairTriggers[RECON][TRIGGER_0], 5, spaces, 0.99, 0.95);
+        
+        // Populate the pair trigger field panels.
+        processEfficiency(seenPairTriggers[RECON][TRIGGER_0], matchedPairTriggers[RECON][TRIGGER_0], 5, spaces, 0.99, 0.95);
                 processEfficiency(seenPairTriggers[SSP][TRIGGER_0],   matchedPairTriggers[SSP][TRIGGER_0],   6, spaces, 0.99, 0.95);
                 processEfficiency(seenPairTriggers[RECON][TRIGGER_1], matchedPairTriggers[RECON][TRIGGER_1], 7, spaces, 0.99, 0.95);
                 processEfficiency(seenPairTriggers[SSP][TRIGGER_1],   matchedPairTriggers[SSP][TRIGGER_1],   8, spaces, 0.99, 0.95);
-	}
-	
-	/**
-	 * Updates the indicated field value using the indicated number
-	 * seen and matched elements. Automatically handles the special
-	 * case of zero seen elements and also updates the colors of the
-	 * field labels to the appropriate color based on the efficiency
-	 * and the thresholds for warnings.
-	 * @param seen - The number of elements seen.
-	 * @param matched - The number of elements matched.
-	 * @param fieldIndex - The index for the field that should display
-	 *                     the statistical data.
-	 * @param spaces - The number of spaces to giveto each displayed
-	 *                 value.
-	 * @param threshWarning - The threshold at which the "warning
-	 *                        color should be used.
-	 * @param threshCritical - The threshold at which the "critical"
-	 *                         color should be used.
-	 */
-	private void processEfficiency(int seen, int matched, int fieldIndex, int spaces, double threshWarning, double threshCritical) {
-		// Calculate the efficiency.
-		double efficiency = 100.0 * matched / seen;
-		
-		// Create the format string.
-		String format = "%" + spaces + "d / %";
-		
-		// If the number of values seen is zero, there is no
-		// percentage that can be calculated.
-		if(seen == 0) {
-			fieldValue[fieldIndex].setText(String.format(format + " (  N/A  %%)", seen, matched));
-		}
-		
-		// Otherwise, include the percentage.
-		else {
-			fieldValue[fieldIndex].setText(String.format(format + " (7.3f%%)", seen, matched, efficiency));
-		}
-		
-		// If the efficiency is below the critical threshold,
-		// change the field background to the critical color.
-		if(efficiency < threshCritical) {
-			fieldValue[fieldIndex].setBackground(BG_CRITICAL);
-			fieldValue[fieldIndex].setForeground(FONT_CRITICAL);
-		}
-		
-		// Otherwise, if the efficiency is below the warning
-		// level, set the field background to the warning color.
-		else if(efficiency < threshWarning) {
-			fieldValue[fieldIndex].setBackground(BG_WARNING);
-			fieldValue[fieldIndex].setForeground(FONT_WARNING);
-		}
-		
-		// Otherwise, use the default component background.
-		else {
-			fieldValue[fieldIndex].setBackground(getBackground());
-			fieldValue[fieldIndex].setForeground(getForeground());
-		}
-	}
+    }
+    
+    /**
+     * Updates the indicated field value using the indicated number
+     * seen and matched elements. Automatically handles the special
+     * case of zero seen elements and also updates the colors of the
+     * field labels to the appropriate color based on the efficiency
+     * and the thresholds for warnings.
+     * @param seen - The number of elements seen.
+     * @param matched - The number of elements matched.
+     * @param fieldIndex - The index for the field that should display
+     *                     the statistical data.
+     * @param spaces - The number of spaces to giveto each displayed
+     *                 value.
+     * @param threshWarning - The threshold at which the "warning
+     *                        color should be used.
+     * @param threshCritical - The threshold at which the "critical"
+     *                         color should be used.
+     */
+    private void processEfficiency(int seen, int matched, int fieldIndex, int spaces, double threshWarning, double threshCritical) {
+        // Calculate the efficiency.
+        double efficiency = 100.0 * matched / seen;
+        
+        // Create the format string.
+        String format = "%" + spaces + "d / %";
+        
+        // If the number of values seen is zero, there is no
+        // percentage that can be calculated.
+        if(seen == 0) {
+            fieldValue[fieldIndex].setText(String.format(format + " (  N/A  %%)", seen, matched));
+        }
+        
+        // Otherwise, include the percentage.
+        else {
+            fieldValue[fieldIndex].setText(String.format(format + " (7.3f%%)", seen, matched, efficiency));
+        }
+        
+        // If the efficiency is below the critical threshold,
+        // change the field background to the critical color.
+        if(efficiency < threshCritical) {
+            fieldValue[fieldIndex].setBackground(BG_CRITICAL);
+            fieldValue[fieldIndex].setForeground(FONT_CRITICAL);
+        }
+        
+        // Otherwise, if the efficiency is below the warning
+        // level, set the field background to the warning color.
+        else if(efficiency < threshWarning) {
+            fieldValue[fieldIndex].setBackground(BG_WARNING);
+            fieldValue[fieldIndex].setForeground(FONT_WARNING);
+        }
+        
+        // Otherwise, use the default component background.
+        else {
+            fieldValue[fieldIndex].setBackground(getBackground());
+            fieldValue[fieldIndex].setForeground(getForeground());
+        }
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java	Wed Mar  9 11:43:24 2016
@@ -12,25 +12,25 @@
  * to either yellow or red if the efficiencies drop too low.
  */
 public class ShifterTrigWindow extends JPanel implements DiagnosticUpdatable {
-	private static final long serialVersionUID = 1L;
-	private ShifterTrigPanel localPanel = new ShifterTrigPanel("Instantaneous");
-	private ShifterTrigPanel globalPanel = new ShifterTrigPanel("Run-Integrated");
-	
-	/**
-	 * Instantiates a new panel for displaying basic information
-	 * pertaining to trigger diagnostics.
-	 */
-	public ShifterTrigWindow() {
-		setLayout(new GridLayout(1, 2));
-		add(localPanel);
-		add(globalPanel);
-		updatePanel(null, null);
-	}
-	
-	@Override
-	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
-		// Update each panel with the appropriate snapshot.
-		localPanel.updatePanel(localSnapshot);
-		globalPanel.updatePanel(runSnapshot);
-	}
+    private static final long serialVersionUID = 1L;
+    private ShifterTrigPanel localPanel = new ShifterTrigPanel("Instantaneous");
+    private ShifterTrigPanel globalPanel = new ShifterTrigPanel("Run-Integrated");
+    
+    /**
+     * Instantiates a new panel for displaying basic information
+     * pertaining to trigger diagnostics.
+     */
+    public ShifterTrigWindow() {
+        setLayout(new GridLayout(1, 2));
+        add(localPanel);
+        add(globalPanel);
+        updatePanel(null, null);
+    }
+    
+    @Override
+    public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
+        // Update each panel with the appropriate snapshot.
+        localPanel.updatePanel(localSnapshot);
+        globalPanel.updatePanel(runSnapshot);
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java	Wed Mar  9 11:43:24 2016
@@ -7,14 +7,14 @@
  * @author Kyle McCarty
  */
 public class SinglesTablePanel extends AbstractTriggerTablePanel {
-	// Static variables.
-	private static final long serialVersionUID = 0L;
-	private static final String[] CUT_NAMES = { "    Cluster Energy (Low):",
-		"    Cluster Energy (High):", "    Hit Count:"  };
-	
-	/**
-	 * Instantiates a <code>SinglesTablePanel</code>.
-	 */
-	public SinglesTablePanel() { super(CUT_NAMES, true); }
-	
+    // Static variables.
+    private static final long serialVersionUID = 0L;
+    private static final String[] CUT_NAMES = { "    Cluster Energy (Low):",
+        "    Cluster Energy (High):", "    Hit Count:"  };
+    
+    /**
+     * Instantiates a <code>SinglesTablePanel</code>.
+     */
+    public SinglesTablePanel() { super(CUT_NAMES, true); }
+    
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TableTextModel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TableTextModel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TableTextModel.java	Wed Mar  9 11:43:24 2016
@@ -11,96 +11,96 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class TableTextModel extends AbstractTableModel {
-	// Serial UID.
-	private static final long serialVersionUID = 0L;
-	
-	// Stored values.
-	private final int rows, columns;
-	private final String[][] values;
-	
-	/**
-	 * Instantiates a new <code>TableTextModel</code> with the indicated
-	 * number of rows and columns.
-	 * @param rows - The number of rows.
-	 * @param columns - The number of columns.
-	 */
-	public TableTextModel(int rows, int columns) {
-		// Make sure that the arguments for rows and columns are valid.
-		if(rows < 1) {
-			throw new IllegalArgumentException("TableTextModel must have at least one row.");
-		} else 	if(columns < 1) {
-			throw new IllegalArgumentException("TableTextModel must have at least one column.");
-		}
-		
-		// Define the number of rows and columns.
-		this.rows = rows;
-		this.columns = columns;
-		
-		// Instantiate the data storage array.
-		values = new String[rows][columns];
-	}
-	
-	@Override
-	public int getRowCount() { return rows; }
-	
-	@Override
-	public int getColumnCount() { return columns; }
-	
-	@Override
-	public Object getValueAt(int rowIndex, int columnIndex) {
-		// Ensure that the value is within the allowed range.
-		validateIndex(rowIndex, columnIndex);
-		
-		// Return the value.
-		return values[rowIndex][columnIndex];
-	}
-	
-	@Override
-	public void setValueAt(Object value, int rowIndex, int columnIndex) {
-		// If the object is a string, pass it to the preferred handler.
-		// This can also be performed if the value is null.
-		if(value == null || value instanceof String) {
-			setValueAt((String) value, rowIndex, columnIndex);
-		}
-		
-		// Otherwise, cast the object to a string and use that instead.
-		else { setValueAt(value.toString(), rowIndex, columnIndex); }
-	}
-	
-	/**
-	 * Sets the text for the indicated column and row of the table.
-	 * @param value - The new text.
-	 * @param rowIndex - The row.
-	 * @param columnIndex - The column.
-	 * @throws IndexOutOfBoundsException Occurs if the row and column
-	 * are not a valid member of table model.
-	 */
-	public void setValueAt(String value, int rowIndex, int columnIndex) throws IndexOutOfBoundsException {
-		// Ensure that the value is within the allowed range.
-		validateIndex(rowIndex, columnIndex);
-		
-		// Set the value.
-		values[rowIndex][columnIndex] = value;
-		
-		// Update the table.
-		this.fireTableCellUpdated(rowIndex, columnIndex);
-	}
-	
-	/**
-	 * Checks to make sure that a given row/column pointer refers to
-	 * an extant position in the data array. In the event that the row
-	 * and column values are not valid, an <code>IndexOutOfBounds</code>
-	 * exception is thrown.
-	 * @param rowIndex - The row index.
-	 * @param columnIndex - The column index.
-	 * @throws IndexOutOfBoundsException Occurs if the row and column
-	 * are not a valid member of the data array.
-	 */
-	private void validateIndex(int rowIndex, int columnIndex) throws IndexOutOfBoundsException {
-		if(rowIndex < 0 || rowIndex >= getRowCount()) {
-			throw new IndexOutOfBoundsException(String.format("Row index %d is out of bounds.", rowIndex));
-		} else if(columnIndex < 0 || columnIndex >= getColumnCount()) {
-			throw new IndexOutOfBoundsException(String.format("Column index %d is out of bounds.", columnIndex));
-		}
-	}
+    // Serial UID.
+    private static final long serialVersionUID = 0L;
+    
+    // Stored values.
+    private final int rows, columns;
+    private final String[][] values;
+    
+    /**
+     * Instantiates a new <code>TableTextModel</code> with the indicated
+     * number of rows and columns.
+     * @param rows - The number of rows.
+     * @param columns - The number of columns.
+     */
+    public TableTextModel(int rows, int columns) {
+        // Make sure that the arguments for rows and columns are valid.
+        if(rows < 1) {
+            throw new IllegalArgumentException("TableTextModel must have at least one row.");
+        } else  if(columns < 1) {
+            throw new IllegalArgumentException("TableTextModel must have at least one column.");
+        }
+        
+        // Define the number of rows and columns.
+        this.rows = rows;
+        this.columns = columns;
+        
+        // Instantiate the data storage array.
+        values = new String[rows][columns];
+    }
+    
+    @Override
+    public int getRowCount() { return rows; }
+    
+    @Override
+    public int getColumnCount() { return columns; }
+    
+    @Override
+    public Object getValueAt(int rowIndex, int columnIndex) {
+        // Ensure that the value is within the allowed range.
+        validateIndex(rowIndex, columnIndex);
+        
+        // Return the value.
+        return values[rowIndex][columnIndex];
+    }
+    
+    @Override
+    public void setValueAt(Object value, int rowIndex, int columnIndex) {
+        // If the object is a string, pass it to the preferred handler.
+        // This can also be performed if the value is null.
+        if(value == null || value instanceof String) {
+            setValueAt((String) value, rowIndex, columnIndex);
+        }
+        
+        // Otherwise, cast the object to a string and use that instead.
+        else { setValueAt(value.toString(), rowIndex, columnIndex); }
+    }
+    
+    /**
+     * Sets the text for the indicated column and row of the table.
+     * @param value - The new text.
+     * @param rowIndex - The row.
+     * @param columnIndex - The column.
+     * @throws IndexOutOfBoundsException Occurs if the row and column
+     * are not a valid member of table model.
+     */
+    public void setValueAt(String value, int rowIndex, int columnIndex) throws IndexOutOfBoundsException {
+        // Ensure that the value is within the allowed range.
+        validateIndex(rowIndex, columnIndex);
+        
+        // Set the value.
+        values[rowIndex][columnIndex] = value;
+        
+        // Update the table.
+        this.fireTableCellUpdated(rowIndex, columnIndex);
+    }
+    
+    /**
+     * Checks to make sure that a given row/column pointer refers to
+     * an extant position in the data array. In the event that the row
+     * and column values are not valid, an <code>IndexOutOfBounds</code>
+     * exception is thrown.
+     * @param rowIndex - The row index.
+     * @param columnIndex - The column index.
+     * @throws IndexOutOfBoundsException Occurs if the row and column
+     * are not a valid member of the data array.
+     */
+    private void validateIndex(int rowIndex, int columnIndex) throws IndexOutOfBoundsException {
+        if(rowIndex < 0 || rowIndex >= getRowCount()) {
+            throw new IndexOutOfBoundsException(String.format("Row index %d is out of bounds.", rowIndex));
+        } else if(columnIndex < 0 || columnIndex >= getColumnCount()) {
+            throw new IndexOutOfBoundsException(String.format("Column index %d is out of bounds.", columnIndex));
+        }
+    }
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java	Wed Mar  9 11:43:24 2016
@@ -9,45 +9,45 @@
 import org.lcsim.util.Driver;
 
 public class TriggerDiagnosticGUIDriver extends Driver {
-	private JFrame window = new JFrame();
-	private ClusterTablePanel clusterTable = new ClusterTablePanel();
-	private SinglesTablePanel singlesTable = new SinglesTablePanel();
-	private PairTablePanel pairTable = new PairTablePanel();
-	private EfficiencyTablePanel efficiencyTable = new EfficiencyTablePanel();
-	private String diagnosticCollectionName = "DiagnosticSnapshot";
-	
-	@Override
-	public void startOfData() {
-		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-		window.setSize(500, 400);
-		//window.add(clusterTable);
-		//window.add(singlesTable);
-		//window.add(pairTable);
-		window.add(efficiencyTable);
-		window.setVisible(true);
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Updates are only performed if a diagnostic snapshot object
-		// exists. Otherwise, do nothing.
-		if(event.hasCollection(DiagnosticSnapshot.class, diagnosticCollectionName)) {
-			// Get the snapshot collection.
-			List<DiagnosticSnapshot> snapshotList = event.get(DiagnosticSnapshot.class, diagnosticCollectionName);
-			
-			// Get the snapshot. There will only ever be one.
-			DiagnosticSnapshot runSnapshot = snapshotList.get(1);
-			DiagnosticSnapshot localSnapshot = snapshotList.get(0);
-			
-			// Feed it to the table.
-			clusterTable.updatePanel(runSnapshot, localSnapshot);
-			singlesTable.updatePanel(runSnapshot, localSnapshot);
-			pairTable.updatePanel(runSnapshot, localSnapshot);
-			efficiencyTable.updatePanel(runSnapshot, localSnapshot);
-		}
-	}
-	
-	public void setDiagnosticCollectionName(String name) {
-		diagnosticCollectionName = name;
-	}
+    private JFrame window = new JFrame();
+    private ClusterTablePanel clusterTable = new ClusterTablePanel();
+    private SinglesTablePanel singlesTable = new SinglesTablePanel();
+    private PairTablePanel pairTable = new PairTablePanel();
+    private EfficiencyTablePanel efficiencyTable = new EfficiencyTablePanel();
+    private String diagnosticCollectionName = "DiagnosticSnapshot";
+    
+    @Override
+    public void startOfData() {
+        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        window.setSize(500, 400);
+        //window.add(clusterTable);
+        //window.add(singlesTable);
+        //window.add(pairTable);
+        window.add(efficiencyTable);
+        window.setVisible(true);
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Updates are only performed if a diagnostic snapshot object
+        // exists. Otherwise, do nothing.
+        if(event.hasCollection(DiagnosticSnapshot.class, diagnosticCollectionName)) {
+            // Get the snapshot collection.
+            List<DiagnosticSnapshot> snapshotList = event.get(DiagnosticSnapshot.class, diagnosticCollectionName);
+            
+            // Get the snapshot. There will only ever be one.
+            DiagnosticSnapshot runSnapshot = snapshotList.get(1);
+            DiagnosticSnapshot localSnapshot = snapshotList.get(0);
+            
+            // Feed it to the table.
+            clusterTable.updatePanel(runSnapshot, localSnapshot);
+            singlesTable.updatePanel(runSnapshot, localSnapshot);
+            pairTable.updatePanel(runSnapshot, localSnapshot);
+            efficiencyTable.updatePanel(runSnapshot, localSnapshot);
+        }
+    }
+    
+    public void setDiagnosticCollectionName(String name) {
+        diagnosticCollectionName = name;
+    }
 }

Modified: java/trunk/parent/pom.xml
 =============================================================================
--- java/trunk/parent/pom.xml	(original)
+++ java/trunk/parent/pom.xml	Wed Mar  9 11:43:24 2016
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <prerequisites>
         <maven>3.0</maven>
     </prerequisites>
@@ -43,7 +44,7 @@
             <id>srs-repo-public</id>
             <name>SRS</name>
             <url>http://srs.slac.stanford.edu/nexus/content/groups/srs-maven2-public/</url>
-        </repository>        
+        </repository>
         <repository>
             <id>lcsim-repo-public</id>
             <name>LCSim</name>
@@ -66,13 +67,13 @@
         <repository>
             <id>lcsim-repo-releases</id>
             <name>LCSim Releases</name>
-            <!--<url>http://srs.slac.stanford.edu/nexus/content/repositories/lcsim-maven2-releases/</url>-->
+            <!--<url>http://srs.slac.stanford.edu/nexus/content/repositories/lcsim-maven2-releases/</url> -->
             <url>http://scalnx-v01.slac.stanford.edu:8180/nexus/content/repositories/lcsim-maven2-releases/</url>
         </repository>
         <snapshotRepository>
             <id>lcsim-repo-snapshots</id>
             <name>LCSim Snapshots</name>
-            <!--<url>http://srs.slac.stanford.edu/nexus/content/repositories/lcsim-maven2-snapshot/</url>-->
+            <!--<url>http://srs.slac.stanford.edu/nexus/content/repositories/lcsim-maven2-snapshot/</url> -->
             <url>http://scalnx-v01.slac.stanford.edu:8180/nexus/content/repositories/lcsim-maven2-snapshot/</url>
         </snapshotRepository>
         <site>
@@ -342,12 +343,8 @@
                 <artifactId>maven-surefire-report-plugin</artifactId>
                 <version>2.17</version>
             </plugin>
-            <!--            
-            <plugin>
-                <groupId>org.kuali.maven.plugins</groupId>
-                <artifactId>graph-maven-plugin</artifactId>
-            </plugin>
-            -->
+            <!-- <plugin> <groupId>org.kuali.maven.plugins</groupId> <artifactId>graph-maven-plugin</artifactId> 
+                </plugin> -->
         </plugins>
     </reporting>
     <build>
@@ -380,7 +377,8 @@
                     <artifactId>maven-antrun-plugin</artifactId>
                     <version>1.7</version>
                 </plugin>
-                <!-- This fixes the lifecycle not covered by plugin execution error in Eclipse. -->
+                <!-- This fixes the lifecycle not covered by plugin execution 
+                    error in Eclipse. -->
                 <plugin>
                     <groupId>org.eclipse.m2e</groupId>
                     <artifactId>lifecycle-mapping</artifactId>
@@ -407,13 +405,8 @@
                         </lifecycleMappingMetadata>
                     </configuration>
                 </plugin>
-                <!--                
-                <plugin>
-                    <groupId>org.kuali.maven.plugins</groupId>
-                    <artifactId>graph-maven-plugin</artifactId>
-                    <version>1.2.3</version>
-                </plugin>
-                -->
+                <!-- <plugin> <groupId>org.kuali.maven.plugins</groupId> 
+                    <artifactId>graph-maven-plugin</artifactId> <version>1.2.3</version> </plugin> -->
             </plugins>
         </pluginManagement>
         <plugins>
@@ -433,10 +426,7 @@
                     <target>1.7</target>
                     <showWarnings>true</showWarnings>
                     <showDeprecation>true</showDeprecation>
-                    <!--                    
-                    <staleMillis>1</staleMillis>
-                    <useIncrementalCompilation>false</useIncrementalCompilation>
-                    -->
+                    <!-- <staleMillis>1</staleMillis> <useIncrementalCompilation>false</useIncrementalCompilation> -->
                 </configuration>
             </plugin>
             <plugin>
@@ -446,7 +436,7 @@
                 <configuration>
                     <argLine>-Xmx1024m</argLine>
                     <forkMode>pertest</forkMode>
-                    <systemPropertyVariables>                    
+                    <systemPropertyVariables>
                         <org.lcsim.cacheDir>${org.lcsim.cacheDir}</org.lcsim.cacheDir>
                         <java.util.logging.config.class>org.hps.logging.config.TestLoggingConfig</java.util.logging.config.class>
                     </systemPropertyVariables>
@@ -469,7 +459,8 @@
                         <configuration>
                             <target>
                                 <!-- Create the directory for test output. -->
-                                <mkdir dir="${project.build.directory}/test-output" />
+                                <mkdir
+                                    dir="${project.build.directory}/test-output" />
                             </target>
                         </configuration>
                         <goals>
@@ -486,7 +477,33 @@
             <plugin>
                 <artifactId>maven-resources-plugin</artifactId>
                 <version>2.7</version>
-            </plugin>            
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.17</version>
+                <configuration>
+                    <logViolationsToConsole>true</logViolationsToConsole>
+                    <consoleOutput>true</consoleOutput>
+                    <includeResources>true</includeResources>
+                    <includeTestResources>true</includeTestResources>
+                    <checkstyleRules>
+                        <module name="Checker">a
+                            <module name="FileTabCharacter">
+                                <property name="fileExtensions" value="java,xml,lcsim"/>
+                            </module>
+                        </module>
+                    </checkstyleRules>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <developers>
@@ -560,7 +577,7 @@
             </roles>
             <timezone>-8</timezone>
         </developer>
-	<developer>
+        <developer>
             <name>Holly Szumila-Vance</name>
             <email>[log in to unmask]</email>
             <organization>Old Dominion University</organization>

Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/CosmicPMTFilter.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/CosmicPMTFilter.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/CosmicPMTFilter.java	Wed Mar  9 11:43:24 2016
@@ -8,63 +8,63 @@
 import org.lcsim.util.aida.AIDA;
 
 public class CosmicPMTFilter extends Driver {
-	
-	// class storing raw PMT readout:
-	static final String CLASSNAME="FADCGenericHits";
+    
+    // class storing raw PMT readout:
+    static final String CLASSNAME="FADCGenericHits";
 
-	// hardware location of PMTs:
-	static final int CRATE=2; // this is hps2, crate #37 in EVIO
-	static final int SLOT=20;
-	static final int CHANNELS[]={13,14};
-	
-	// cuts on pulse integrals for cosmic signals (units ADC):
-	static final float CUTS[]={2000,4000};
+    // hardware location of PMTs:
+    static final int CRATE=2; // this is hps2, crate #37 in EVIO
+    static final int SLOT=20;
+    static final int CHANNELS[]={13,14};
+    
+    // cuts on pulse integrals for cosmic signals (units ADC):
+    static final float CUTS[]={2000,4000};
 
-	// number of samples to use at beginning of window for pedestal:
-	static final int NPEDSAMP=20;
+    // number of samples to use at beginning of window for pedestal:
+    static final int NPEDSAMP=20;
 
-	AIDA aida = AIDA.defaultInstance();
+    AIDA aida = AIDA.defaultInstance();
     
-	public void detectorChanged(Detector detector) {
-    	aida.tree().cd("/");
-    	aida.histogram2D("CosmicPMTs",400,0,10000,400,0,10000);
+    public void detectorChanged(Detector detector) {
+        aida.tree().cd("/");
+        aida.histogram2D("CosmicPMTs",400,0,10000,400,0,10000);
     }
 
-	public void process(EventHeader event) {
-	
-		// find PMT data:
-		FADCGenericHit pmt1=null,pmt2=null;
-		if (!event.hasCollection(GenericObject.class,CLASSNAME))
-		      throw new Driver.NextEventException();
-		for (GenericObject gob : event.get(GenericObject.class,CLASSNAME)) {
-			FADCGenericHit hit=(FADCGenericHit)gob;
-			if (hit.getCrate()==CRATE && hit.getSlot()==SLOT) {
-				if      (hit.getChannel()==CHANNELS[0]) pmt1=hit;
-				else if (hit.getChannel()==CHANNELS[1]) pmt2=hit;
-			}
-		}
-		if (pmt1==null || pmt2==null) throw new Driver.NextEventException();
-	
-		// calculate and histogram pulse integrals:
-		float pulse1=getPulseIntegral(pmt1);
-		float pulse2=getPulseIntegral(pmt2);
+    public void process(EventHeader event) {
+    
+        // find PMT data:
+        FADCGenericHit pmt1=null,pmt2=null;
+        if (!event.hasCollection(GenericObject.class,CLASSNAME))
+              throw new Driver.NextEventException();
+        for (GenericObject gob : event.get(GenericObject.class,CLASSNAME)) {
+            FADCGenericHit hit=(FADCGenericHit)gob;
+            if (hit.getCrate()==CRATE && hit.getSlot()==SLOT) {
+                if      (hit.getChannel()==CHANNELS[0]) pmt1=hit;
+                else if (hit.getChannel()==CHANNELS[1]) pmt2=hit;
+            }
+        }
+        if (pmt1==null || pmt2==null) throw new Driver.NextEventException();
+    
+        // calculate and histogram pulse integrals:
+        float pulse1=getPulseIntegral(pmt1);
+        float pulse2=getPulseIntegral(pmt2);
         aida.histogram2D("CosmicPMTs").fill(pulse1,pulse2);
-		
+        
         // cut on pulse integrals:
-		if (pulse1<CUTS[0] || pulse2<CUTS[1]) throw new Driver.NextEventException();
-	}
-	
-	public float getPulseIntegral(FADCGenericHit hh) {
-		float sum=0;
-		for (int samp : hh.getData()) sum+=samp;
-		return sum-getPedestal(hh)*hh.getData().length;
-	}
-	
-	public float getPedestal(FADCGenericHit hh) {
-		if (hh.getData().length<NPEDSAMP)
-			throw new java.lang.RuntimeException("Not enough samples for pedestal.");
-		float sum=0;
-		for (int isamp=0; isamp<NPEDSAMP; isamp++) sum+=hh.getData()[isamp];
-		return sum/NPEDSAMP;
-	}
+        if (pulse1<CUTS[0] || pulse2<CUTS[1]) throw new Driver.NextEventException();
+    }
+    
+    public float getPulseIntegral(FADCGenericHit hh) {
+        float sum=0;
+        for (int samp : hh.getData()) sum+=samp;
+        return sum-getPedestal(hh)*hh.getData().length;
+    }
+    
+    public float getPedestal(FADCGenericHit hh) {
+        if (hh.getData().length<NPEDSAMP)
+            throw new java.lang.RuntimeException("Not enough samples for pedestal.");
+        float sum=0;
+        for (int isamp=0; isamp<NPEDSAMP; isamp++) sum+=hh.getData()[isamp];
+        return sum/NPEDSAMP;
+    }
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalGainCalibFilter.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalGainCalibFilter.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalGainCalibFilter.java	Wed Mar  9 11:43:24 2016
@@ -7,11 +7,11 @@
 
 public class EcalGainCalibFilter extends EventReconFilter {
 
-	private double feeCut = 0.6;
-	private double molCut = 0.6;
-	private double tMin = 16.0;
-	private double tMax = 80.0;
-	private double dtMax = 12.0;
+    private double feeCut = 0.6;
+    private double molCut = 0.6;
+    private double tMin = 16.0;
+    private double tMax = 80.0;
+    private double dtMax = 12.0;
     private String clusterCollectionName = "EcalClusters";
 
     public void setFeeCut(double feeCut) { this.feeCut = feeCut; }
@@ -27,32 +27,32 @@
     @Override
     public void process(EventHeader event) 
     {
-    	incrementEventProcessed();
+        incrementEventProcessed();
         if (!event.hasCollection(Cluster.class, clusterCollectionName)) skipEvent();
         List<Cluster> cc = event.get(Cluster.class, clusterCollectionName);
         if (cc.size() < 1) skipEvent();
         boolean keepEvent = false;
         for (Cluster c1 : cc) 
         {
-        	final double t1 = ClusterUtilities.getSeedHitTime(c1);
-        	if (t1<tMin || t1>tMax) continue;
-        	if (c1.getEnergy() > feeCut)
-        	{
-        		keepEvent = true;
-        		break;
-        	}
-        	for (Cluster c2 : cc)
-        	{
-        		final double t2 = ClusterUtilities.getSeedHitTime(c2);
-        		if (c1 == c2) continue;
-        		if (t2<tMin || t2>tMax) continue;
-        		if (Math.abs(t1-t2) > dtMax) continue;
-        		if (c1.getEnergy() + c2.getEnergy() > molCut)
-        		{
-        			keepEvent = true;
-        			break;
-        		}
-        	}
+            final double t1 = ClusterUtilities.getSeedHitTime(c1);
+            if (t1<tMin || t1>tMax) continue;
+            if (c1.getEnergy() > feeCut)
+            {
+                keepEvent = true;
+                break;
+            }
+            for (Cluster c2 : cc)
+            {
+                final double t2 = ClusterUtilities.getSeedHitTime(c2);
+                if (c1 == c2) continue;
+                if (t2<tMin || t2>tMax) continue;
+                if (Math.abs(t1-t2) > dtMax) continue;
+                if (c1.getEnergy() + c2.getEnergy() > molCut)
+                {
+                    keepEvent = true;
+                    break;
+                }
+            }
         }
         if (!keepEvent) skipEvent();
         incrementEventPassed();

Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/FEEFilterDriver.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/FEEFilterDriver.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/FEEFilterDriver.java	Wed Mar  9 11:43:24 2016
@@ -45,7 +45,7 @@
       //  cc.Delete();
 
       // keep events with a cluster over 600 MeV with seed over 400 MeV (for 2015 running).
-    	// keep events with cluster over 1.2 GeV and seed over 650 MeV for 2016 running.
+        // keep events with cluster over 1.2 GeV and seed over 650 MeV for 2016 running.
       if (cc.getEnergy() > 1.2 && 
           ClusterUtilities.findSeedHit(cc).getCorrectedEnergy() > 0.65)
         return;

Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/MinimumHitsFilter.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/MinimumHitsFilter.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/MinimumHitsFilter.java	Wed Mar  9 11:43:24 2016
@@ -61,7 +61,7 @@
 
 
     private boolean isHitOnTop(RawTrackerHit hit){
-    	HpsSiSensor sensor=(HpsSiSensor) hit.getDetectorElement();
+        HpsSiSensor sensor=(HpsSiSensor) hit.getDetectorElement();
         IIdentifier id=hit.getIdentifier();
         SiTrackerIdentifierHelper _sid_helper=(SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
 

Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/PulserScalerAndEpicsFilter.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/PulserScalerAndEpicsFilter.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/PulserScalerAndEpicsFilter.java	Wed Mar  9 11:43:24 2016
@@ -25,83 +25,83 @@
 
 public class PulserScalerAndEpicsFilter extends Driver{
 
-	public void process(EventHeader event) {
+    public void process(EventHeader event) {
 
-		// only keep pulser triggers:
-		if (!event.hasCollection(GenericObject.class,"TriggerBank"))
-			throw new Driver.NextEventException();
-		boolean isPulser=false;
-		for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
-		{
-			if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
-			TIData tid = new TIData(gob);
-			if (tid.isPulserTrigger())
-			{
-				isPulser=true;
-				break;
-			}
-		}
+        // only keep pulser triggers:
+        if (!event.hasCollection(GenericObject.class,"TriggerBank"))
+            throw new Driver.NextEventException();
+        boolean isPulser=false;
+        for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
+        {
+            if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
+            TIData tid = new TIData(gob);
+            if (tid.isPulserTrigger())
+            {
+                isPulser=true;
+                break;
+            }
+        }
 
-		// don't drop any events with EPICS data or scalers data
-		// (could also do this via event tag=31)
-		final EpicsData edata = EpicsData.read(event);
-		if (edata != null) return;
-		
-		if( event.hasCollection(GenericObject.class, "ScalerData"))
-			return;
+        // don't drop any events with EPICS data or scalers data
+        // (could also do this via event tag=31)
+        final EpicsData edata = EpicsData.read(event);
+        if (edata != null) return;
+        
+        if( event.hasCollection(GenericObject.class, "ScalerData"))
+            return;
 
-		if (!isPulser) throw new Driver.NextEventException();
+        if (!isPulser) throw new Driver.NextEventException();
 
 
-	}
-	/**
-	 * standalone way to run this:
-	 * 
-	 * @param arg [0] inputFile [1] outputFile [2] run number [3] detectorName (optional, default = "HPS-EngRun2015-Nominal-v1") 
-	 * @throws IOException
-	 */
-	public static void main(String arg[]) throws IOException{
-		ConditionsDriver hack = new ConditionsDriver();
-		
-		String detectorName = "HPS-EngRun2015-Nominal-v1";
-		if(arg.length >3)
-		hack.setDetectorName(arg[3]);
-		hack.setFreeze(true);
-		hack.setRunNumber(Integer.parseInt(arg[2]));
-		hack.initialize();
-		PulserScalerAndEpicsFilter pf = new PulserScalerAndEpicsFilter();
-		LCIOWriter writer = new LCIOWriter(arg[1]);
-		File file = new File(arg[0]);
-		LCIOReader reader = new LCIOReader(file);
-		System.out.println(file.getPath());
-		int nEventsKept = 0;
-		int nEvents = 0;
-		try{
-			while(true){
-				try{
-					
-					EventHeader eh = reader.read();
-					if(eh.getEventNumber() %1000 == 0){
-						//Driver.this.
-						System.out.println("PulserFitter:");
-						System.out.println("    " + nEventsKept + " events kept");
-						System.out.println("    " + nEvents + "events read");
-					}
-					nEvents ++;
-					pf.process(eh); //might throw NextEventException
-					
-					nEventsKept++;
-					writer.write(eh);
-				}catch(Driver.NextEventException e){
+    }
+    /**
+     * standalone way to run this:
+     * 
+     * @param arg [0] inputFile [1] outputFile [2] run number [3] detectorName (optional, default = "HPS-EngRun2015-Nominal-v1") 
+     * @throws IOException
+     */
+    public static void main(String arg[]) throws IOException{
+        ConditionsDriver hack = new ConditionsDriver();
+        
+        String detectorName = "HPS-EngRun2015-Nominal-v1";
+        if(arg.length >3)
+        hack.setDetectorName(arg[3]);
+        hack.setFreeze(true);
+        hack.setRunNumber(Integer.parseInt(arg[2]));
+        hack.initialize();
+        PulserScalerAndEpicsFilter pf = new PulserScalerAndEpicsFilter();
+        LCIOWriter writer = new LCIOWriter(arg[1]);
+        File file = new File(arg[0]);
+        LCIOReader reader = new LCIOReader(file);
+        System.out.println(file.getPath());
+        int nEventsKept = 0;
+        int nEvents = 0;
+        try{
+            while(true){
+                try{
+                    
+                    EventHeader eh = reader.read();
+                    if(eh.getEventNumber() %1000 == 0){
+                        //Driver.this.
+                        System.out.println("PulserFitter:");
+                        System.out.println("    " + nEventsKept + " events kept");
+                        System.out.println("    " + nEvents + "events read");
+                    }
+                    nEvents ++;
+                    pf.process(eh); //might throw NextEventException
+                    
+                    nEventsKept++;
+                    writer.write(eh);
+                }catch(Driver.NextEventException e){
 
-				}
-			}
-		}catch(IOException e){
-			e.printStackTrace();
-			reader.close();
-		}
+                }
+            }
+        }catch(IOException e){
+            e.printStackTrace();
+            reader.close();
+        }
 
 
-		writer.close();
-	}
+        writer.close();
+    }
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java	Wed Mar  9 11:43:24 2016
@@ -188,7 +188,7 @@
      * @param nsigma
      */
     public void setNSigmaPositionMatch(double nsigma) {
-    	MAXNSIGMAPOSITIONMATCH=nsigma;
+        MAXNSIGMAPOSITIONMATCH=nsigma;
     }
     
         
@@ -255,7 +255,7 @@
         for (List<Track> tracks : trackCollections) {
        
             for (Track track : tracks) {
-            	
+                
                 // Create a reconstructed particle to represent the track.
                 ReconstructedParticle particle = new BaseReconstructedParticle();
 
@@ -304,7 +304,7 @@
 
                     // prefer using GBL tracks to correct (later) the clusters, for some consistency:
                     if (track.getType() >= 32 || !clusterToTrack.containsKey(matchedCluster)) {
-                    	  clusterToTrack.put(matchedCluster,track);
+                          clusterToTrack.put(matchedCluster,track);
                     }
                 }
 
@@ -365,7 +365,7 @@
                     ClusterUtilities.applyCorrections(ecal, cluster, ypos);
                 }
                 else {
-                    ClusterUtilities.applyCorrections(ecal, cluster);          		
+                    ClusterUtilities.applyCorrections(ecal, cluster);               
                 }
             }
         }

Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/SimpleParticleID.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/particle/SimpleParticleID.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/particle/SimpleParticleID.java	Wed Mar  9 11:43:24 2016
@@ -9,67 +9,67 @@
  *
  */
 public class SimpleParticleID implements ParticleID {
-	
-	int algorithmType = 0; 
-	int pdgID = UnknownPDG;
-	int type = 0; 
-	
-	double likelihood = 0.; 
-	// TODO: Need to define what other parameters are needed.
-	double[] parameters = new double[1]; 
+    
+    int algorithmType = 0; 
+    int pdgID = UnknownPDG;
+    int type = 0; 
+    
+    double likelihood = 0.; 
+    // TODO: Need to define what other parameters are needed.
+    double[] parameters = new double[1]; 
 
-	public SimpleParticleID(){}
-	
-	public SimpleParticleID(int pdgID, int algorithmType, int type, double likelihood){
-		this.pdgID = pdgID; 
-		this.algorithmType = algorithmType; 
-		this.type = type; 
-		this.likelihood = likelihood; 
-	}
-	
-	@Override
-	public int getAlgorithmType() {
-		return algorithmType;
-	}
+    public SimpleParticleID(){}
+    
+    public SimpleParticleID(int pdgID, int algorithmType, int type, double likelihood){
+        this.pdgID = pdgID; 
+        this.algorithmType = algorithmType; 
+        this.type = type; 
+        this.likelihood = likelihood; 
+    }
+    
+    @Override
+    public int getAlgorithmType() {
+        return algorithmType;
+    }
 
-	@Override
-	public double getLikelihood() {
-		return likelihood;
-	}
+    @Override
+    public double getLikelihood() {
+        return likelihood;
+    }
 
-	@Override
-	public int getPDG() {
-		return pdgID;
-	}
+    @Override
+    public int getPDG() {
+        return pdgID;
+    }
 
-	@Override
-	public double[] getParameters() {
-		return parameters;
-	}
+    @Override
+    public double[] getParameters() {
+        return parameters;
+    }
 
-	@Override
-	public int getType() {
-		return type;
-	}
-	
-	public void setAlgorithmType(int algorithmType){
-		this.algorithmType = algorithmType;
-	}
-	
-	public void setLikelihood(int likelihood){
-		this.likelihood = likelihood; 
-	}
-	
-	public void setPDG(int pdgID){
-		this.pdgID = pdgID; 
-	}
-	
-	public void setType(int type){
-		this.type = type; 
-	}
-	
-	public void setParameters(double[] parameters){
-		this.parameters = parameters;
-	}
+    @Override
+    public int getType() {
+        return type;
+    }
+    
+    public void setAlgorithmType(int algorithmType){
+        this.algorithmType = algorithmType;
+    }
+    
+    public void setLikelihood(int likelihood){
+        this.likelihood = likelihood; 
+    }
+    
+    public void setPDG(int pdgID){
+        this.pdgID = pdgID; 
+    }
+    
+    public void setType(int type){
+        this.type = type; 
+    }
+    
+    public void setParameters(double[] parameters){
+        this.parameters = parameters;
+    }
 
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/utils/TrackClusterMatcher.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/utils/TrackClusterMatcher.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/utils/TrackClusterMatcher.java	Wed Mar  9 11:43:24 2016
@@ -230,7 +230,7 @@
      */
     public double getDistance(Cluster cluster,Track track) {
         
-    	// Get the cluster position
+        // Get the cluster position
         Hep3Vector cPos = new BasicHep3Vector(cluster.getPosition());
         
         // Extrapolate the track to the Ecal cluster position
@@ -260,8 +260,8 @@
     public double getNSigmaPosition(Cluster cluster,ReconstructedParticle particle) {
 
         if (particle.getTracks().size()<1) return Double.MAX_VALUE;
-    	  Track track=particle.getTracks().get(0);
-    	
+          Track track=particle.getTracks().get(0);
+        
         if (this.useAnalyticExtrapolator)
             throw new RuntimeException("This is to be used with non-analytic extrapolator only.");
 
@@ -532,11 +532,11 @@
      * Class to store track-cluster matching qualities.
      */
     public class TrackClusterMatch {
-    	private double nSigmaPositionMatch=Double.MAX_VALUE;
-    	public TrackClusterMatch(ReconstructedParticle pp, Cluster cc) {
-    	    nSigmaPositionMatch = getNSigmaPosition(cc,pp);
-    	}
-    	public double getNSigmaPositionMatch() { return nSigmaPositionMatch; }
+        private double nSigmaPositionMatch=Double.MAX_VALUE;
+        public TrackClusterMatch(ReconstructedParticle pp, Cluster cc) {
+            nSigmaPositionMatch = getNSigmaPosition(cc,pp);
+        }
+        public double getNSigmaPositionMatch() { return nSigmaPositionMatch; }
     }
     
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/BaseSimpleVertexer.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/BaseSimpleVertexer.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/BaseSimpleVertexer.java	Wed Mar  9 11:43:24 2016
@@ -12,25 +12,25 @@
 public abstract class BaseSimpleVertexer implements SimpleVertexer {
 
 
-	protected boolean _debug = false;
-	protected Vertex _fitted_vertex = null;
+    protected boolean _debug = false;
+    protected Vertex _fitted_vertex = null;
 
-	public BaseSimpleVertexer() {
-	}
+    public BaseSimpleVertexer() {
+    }
 
-	@Override
-	public abstract void fitVertex();
+    @Override
+    public abstract void fitVertex();
 
-	@Override
-	public Vertex getFittedVertex() {
-		return _fitted_vertex;
-	}
-	
-	public void clear() {
-		_fitted_vertex = null;
-	}
-	
-	public abstract boolean isValid();
-	
+    @Override
+    public Vertex getFittedVertex() {
+        return _fitted_vertex;
+    }
+    
+    public void clear() {
+        _fitted_vertex = null;
+    }
+    
+    public abstract boolean isValid();
+    
 
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorVertex.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorVertex.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorVertex.java	Wed Mar  9 11:43:24 2016
@@ -14,8 +14,8 @@
 
 /**
  * 
- *	@author Mathew Thomas Graham <[log in to unmask]>
- *	@version $Id:$
+ *  @author Mathew Thomas Graham <[log in to unmask]>
+ *  @version $Id:$
  *
  */
 public class BilliorVertex implements Vertex {
@@ -74,12 +74,12 @@
      * @param particle : The ReconstructedParticle Associated with this Vertex
      */
     public void setAssociatedParticle(ReconstructedParticle particle){
-    	this._particle = particle;
+        this._particle = particle;
     }
 
     @Override
     public boolean isPrimary() {
-    	return _isPrimary; 
+        return _isPrimary; 
     }
 
     @Override
@@ -94,7 +94,7 @@
 
     @Override
     public double getProbability() {
-    	return _probability;
+        return _probability;
     }
 
     @Override
@@ -108,7 +108,7 @@
     }
 
     // TODO: These should be pulled out and accessed by their own 
-    //		 getter methods.  
+    //       getter methods.  
     @Override
     public Map<String, Double> getParameters() {
         Map<String, Double> pars = new HashMap<String, Double>();
@@ -128,6 +128,6 @@
 
     @Override
     public ReconstructedParticle getAssociatedParticle() {
-    	return _particle; 
+        return _particle; 
     }
 }

Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoLineVertexer.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoLineVertexer.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoLineVertexer.java	Wed Mar  9 11:43:24 2016
@@ -20,21 +20,21 @@
  */
 public class TwoLineVertexer extends BaseSimpleVertexer {
     protected Hep3Vector A1,A2,B1,B2;
-	
-	public TwoLineVertexer() {
-		
-	}
-	
+    
+    public TwoLineVertexer() {
+        
+    }
+    
     public void setLines(Hep3Vector PA1, Hep3Vector PA2, Hep3Vector PB1, Hep3Vector PB2) {
-    	this.A1 = PA1;
-    	this.A2 = PA2;
-    	this.B1 = PB1;
-    	this.B2 = PB2;
+        this.A1 = PA1;
+        this.A2 = PA2;
+        this.B1 = PB1;
+        this.B2 = PB2;
     }
   
     public void clear() {
-    	super.clear();
-    	setLines(null,null,null,null);
+        super.clear();
+        setLines(null,null,null,null);
     }
     
     public boolean isValid() {
@@ -44,11 +44,11 @@
     
     @Override
     public void fitVertex() {
-    	assert isValid();
-    	Hep3Vector vtxPosition = getPOCALineToLine();
-		if (vtxPosition!=null) {
-			_fitted_vertex = new BaseVertex(true, "Two Line Vertexer", 0, 0, new SymmetricMatrix(0), vtxPosition, null); 
-    	}
+        assert isValid();
+        Hep3Vector vtxPosition = getPOCALineToLine();
+        if (vtxPosition!=null) {
+            _fitted_vertex = new BaseVertex(true, "Two Line Vertexer", 0, 0, new SymmetricMatrix(0), vtxPosition, null); 
+        }
     }
     
     /**
@@ -94,57 +94,57 @@
      */
     private Hep3Vector getPOCALineToLine() {
 
-		if(_debug) System.out.printf("%s: A1=%s A2=%s B1=%s B2=%s\n", this.getClass().getSimpleName(), A1.toString(), A2.toString(), B1.toString(), B2.toString());
+        if(_debug) System.out.printf("%s: A1=%s A2=%s B1=%s B2=%s\n", this.getClass().getSimpleName(), A1.toString(), A2.toString(), B1.toString(), B2.toString());
 
-    	double ya[][] = {VecOp.mult(-1,VecOp.sub(B1, A1)).v()};
-    	BasicMatrix y = (BasicMatrix)MatrixOp.transposed(new BasicMatrix(ya));
-    	Hep3Vector dB = VecOp.sub(B2, B1);
-    	Hep3Vector dA = VecOp.sub(A2, A1);
-    	BasicMatrix X = new BasicMatrix(3,2);
-    	for(int col=0;col<2;++col) {
-    		if(col==0) {
-    			X.setElement(0, col, dB.x());
-    			X.setElement(1, col, dB.y());
-    			X.setElement(2, col, dB.z());
-    		} else {
-    			X.setElement(0, col, -1*dA.x());
-    			X.setElement(1, col, -1*dA.y());
-    			X.setElement(2, col, -1*dA.z());
-    		}
-    	}
+        double ya[][] = {VecOp.mult(-1,VecOp.sub(B1, A1)).v()};
+        BasicMatrix y = (BasicMatrix)MatrixOp.transposed(new BasicMatrix(ya));
+        Hep3Vector dB = VecOp.sub(B2, B1);
+        Hep3Vector dA = VecOp.sub(A2, A1);
+        BasicMatrix X = new BasicMatrix(3,2);
+        for(int col=0;col<2;++col) {
+            if(col==0) {
+                X.setElement(0, col, dB.x());
+                X.setElement(1, col, dB.y());
+                X.setElement(2, col, dB.z());
+            } else {
+                X.setElement(0, col, -1*dA.x());
+                X.setElement(1, col, -1*dA.y());
+                X.setElement(2, col, -1*dA.z());
+            }
+        }
 
-    	BasicMatrix X_T = (BasicMatrix)MatrixOp.transposed(X);
-    	BasicMatrix XX_T = (BasicMatrix)MatrixOp.mult(X_T, X);
-		BasicMatrix IXX_T = null;
-		try {
-			IXX_T = (BasicMatrix)MatrixOp.inverse(XX_T);
-		} 
-		catch(MatrixOp.IndeterminateMatrixException e) {
-			System.out.printf("%s: caught indeterminate exception %s\n",this.getClass().getSimpleName(),e.getMessage());
-			return null;
-		}
-    	BasicMatrix X_Ty = (BasicMatrix)MatrixOp.mult(X_T,y);
-    	BasicMatrix b = (BasicMatrix)MatrixOp.mult(IXX_T, X_Ty);
-    	double t = b.e(0, 0);
-    	double s = b.e(1, 0);
-    	Hep3Vector Bpca = VecOp.add(B1, VecOp.mult(t, dB));
-    	Hep3Vector Apca = VecOp.add(A1, VecOp.mult(s, dA));
+        BasicMatrix X_T = (BasicMatrix)MatrixOp.transposed(X);
+        BasicMatrix XX_T = (BasicMatrix)MatrixOp.mult(X_T, X);
+        BasicMatrix IXX_T = null;
+        try {
+            IXX_T = (BasicMatrix)MatrixOp.inverse(XX_T);
+        } 
+        catch(MatrixOp.IndeterminateMatrixException e) {
+            System.out.printf("%s: caught indeterminate exception %s\n",this.getClass().getSimpleName(),e.getMessage());
+            return null;
+        }
+        BasicMatrix X_Ty = (BasicMatrix)MatrixOp.mult(X_T,y);
+        BasicMatrix b = (BasicMatrix)MatrixOp.mult(IXX_T, X_Ty);
+        double t = b.e(0, 0);
+        double s = b.e(1, 0);
+        Hep3Vector Bpca = VecOp.add(B1, VecOp.mult(t, dB));
+        Hep3Vector Apca = VecOp.add(A1, VecOp.mult(s, dA));
         Hep3Vector vertex = VecOp.add(Apca, VecOp.mult(0.5, VecOp.sub(Bpca, Apca)));
-    	if(_debug) {
-    		System.out.printf("y:\n%s\n",y.toString());
-    		System.out.printf("X:\n%s\n",X.toString());
-    		System.out.printf("b:\n%s\n",b.toString());
-        	Hep3Vector ymin = VecOp.add(VecOp.mult(t, dB) , VecOp.mult(s, dA) );
-        	Hep3Vector yminprime = VecOp.add(VecOp.sub(B1, A1), ymin);
-        	System.out.printf("ymin:\n%s\n",ymin.toString());
-        	System.out.printf("yminprime:\n%s\n",yminprime.toString());
-        	System.out.printf("Apca:\n%s\n",Apca.toString());
-        	System.out.printf("Bpca:\n%s\n",Bpca.toString());
-        	System.out.printf("vertex:\n%s\n",vertex.toString());
-    	}
-    	return vertex;
-    	
-    	
+        if(_debug) {
+            System.out.printf("y:\n%s\n",y.toString());
+            System.out.printf("X:\n%s\n",X.toString());
+            System.out.printf("b:\n%s\n",b.toString());
+            Hep3Vector ymin = VecOp.add(VecOp.mult(t, dB) , VecOp.mult(s, dA) );
+            Hep3Vector yminprime = VecOp.add(VecOp.sub(B1, A1), ymin);
+            System.out.printf("ymin:\n%s\n",ymin.toString());
+            System.out.printf("yminprime:\n%s\n",yminprime.toString());
+            System.out.printf("Apca:\n%s\n",Apca.toString());
+            System.out.printf("Bpca:\n%s\n",Bpca.toString());
+            System.out.printf("vertex:\n%s\n",vertex.toString());
+        }
+        return vertex;
+        
+        
     }
 
     

Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java	Wed Mar  9 11:43:24 2016
@@ -18,7 +18,7 @@
  */
 public class TwoParticleVertexer extends TwoLineVertexer {
     
-	public TwoParticleVertexer() {
+    public TwoParticleVertexer() {
     }
     public void setParticle(MCParticle track1,MCParticle track2) {
         
@@ -34,8 +34,8 @@
         Hep3Vector PB2 = this.propAlongLine(PB1, p2, dz);
         
         if(_debug) {
-        	System.out.printf("A1 %s p1 %s B1 %s p2 %s\n", PA1.toString(), p1.toString(), PB1.toString(), p2.toString());
-        	System.out.printf("A2 %s B2 %s\n", PA2.toString(), PB2.toString());
+            System.out.printf("A1 %s p1 %s B1 %s p2 %s\n", PA1.toString(), p1.toString(), PB1.toString(), p2.toString());
+            System.out.printf("A2 %s B2 %s\n", PA2.toString(), PB2.toString());
         }
         
         //set the member variables

Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackFringeVertexer.java
 =============================================================================
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackFringeVertexer.java	(original)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackFringeVertexer.java	Wed Mar  9 11:43:24 2016
@@ -25,7 +25,7 @@
     protected HelixConverter converter = new HelixConverter(0.);
     
     public void setTracks(Track track1, Track track2, FieldMap fieldMap) {
-    	SeedTrack s1 = (SeedTrack) track1;
+        SeedTrack s1 = (SeedTrack) track1;
         HelicalTrackFit htf1 = s1.getSeedCandidate().getHelix();
         HpsHelicalTrackFit hpstrk1 = new HpsHelicalTrackFit(htf1);
         SeedTrack s2 = (SeedTrack) track2;
@@ -71,5 +71,5 @@
     }
     
     
-	
+    
 }

Modified: java/trunk/recon/src/test/java/org/hps/recon/particle/HpsReconParticleDriverTest.java
 =============================================================================
--- java/trunk/recon/src/test/java/org/hps/recon/particle/HpsReconParticleDriverTest.java	(original)
+++ java/trunk/recon/src/test/java/org/hps/recon/particle/HpsReconParticleDriverTest.java	Wed Mar  9 11:43:24 2016
@@ -26,165 +26,165 @@
  */
 public class HpsReconParticleDriverTest extends TestCase { 
 
-	private static final double B_FIELD = 0.5; // Tesla
-  	double[] trackParameters = new double[5];
- 	List<Track> tracks = new ArrayList<Track>(); 
-	List<Cluster> clusters = new ArrayList<Cluster>();
-	List<ReconstructedParticle> particleTracks; 
-	HpsReconParticleDriver particleDriver = null; 
-	
-   	public void setUp() throws Exception {
-   		
-   		System.out.println("\n#=== Creating Ideal Tracks ===#\n");
+    private static final double B_FIELD = 0.5; // Tesla
+    double[] trackParameters = new double[5];
+    List<Track> tracks = new ArrayList<Track>(); 
+    List<Cluster> clusters = new ArrayList<Cluster>();
+    List<ReconstructedParticle> particleTracks; 
+    HpsReconParticleDriver particleDriver = null; 
+    
+    public void setUp() throws Exception {
+        
+        System.out.println("\n#=== Creating Ideal Tracks ===#\n");
    
-   		// Create a pair of ideal e+e- tracks in opposite detector volumes.
-   		// The e+ track is created on the bottom half of the detector while
-   		// the e- track is created on the top half.
-   		Track electronTrack = new BaseTrack(); 
-   		trackParameters[BaseTrack.D0] = 0.41051;
-   		trackParameters[BaseTrack.OMEGA] = -2.2584e-4; 
-   		trackParameters[BaseTrack.PHI] = 6.2626; 
-   		trackParameters[BaseTrack.TANLAMBDA] = 0.046548; 
-   		trackParameters[BaseTrack.Z0] = .23732; 
-   		((BaseTrack) electronTrack).setTrackParameters(trackParameters, B_FIELD);
-   		
-   		System.out.println("\n[ Track ] Electron:  \n" + electronTrack.toString());
-   		
-   		Track positronTrack = new BaseTrack();
-   		trackParameters[BaseTrack.D0] = 0.19691;
-   		trackParameters[BaseTrack.OMEGA] = 1.005e-4; 
-   		trackParameters[BaseTrack.PHI] = 6.2447; 
-   		trackParameters[BaseTrack.TANLAMBDA] = -0.024134; 
-   		trackParameters[BaseTrack.Z0] = -0.040231; 
-   		((BaseTrack) positronTrack).setTrackParameters(trackParameters, B_FIELD);
+        // Create a pair of ideal e+e- tracks in opposite detector volumes.
+        // The e+ track is created on the bottom half of the detector while
+        // the e- track is created on the top half.
+        Track electronTrack = new BaseTrack(); 
+        trackParameters[BaseTrack.D0] = 0.41051;
+        trackParameters[BaseTrack.OMEGA] = -2.2584e-4; 
+        trackParameters[BaseTrack.PHI] = 6.2626; 
+        trackParameters[BaseTrack.TANLAMBDA] = 0.046548; 
+        trackParameters[BaseTrack.Z0] = .23732; 
+        ((BaseTrack) electronTrack).setTrackParameters(trackParameters, B_FIELD);
+        
+        System.out.println("\n[ Track ] Electron:  \n" + electronTrack.toString());
+        
+        Track positronTrack = new BaseTrack();
+        trackParameters[BaseTrack.D0] = 0.19691;
+        trackParameters[BaseTrack.OMEGA] = 1.005e-4; 
+        trackParameters[BaseTrack.PHI] = 6.2447; 
+        trackParameters[BaseTrack.TANLAMBDA] = -0.024134; 
+        trackParameters[BaseTrack.Z0] = -0.040231; 
+        ((BaseTrack) positronTrack).setTrackParameters(trackParameters, B_FIELD);
 
-   		System.out.println("\n[ Track ] Positron: \n" + positronTrack.toString());
+        System.out.println("\n[ Track ] Positron: \n" + positronTrack.toString());
 
-   		// Add the tracks to the list of tracks that will be used for test
-   		// purposes.
-   		tracks.add(electronTrack);
-   		tracks.add(positronTrack);
-   		
-   		System.out.println("\n#=== Creating Ideal Ecal Clusters ===#\n");
-   		
-   		// Create a pair of ideal clusters to match the e+e- pairs created
-   		// above.  Since the properties of a cluster cannot be modified 
-   		// directly via setter methods, first create a CalorimeterHit and
-   		// then use that to create a cluster.
-   		//Hep3Vector topHitPosition = new BasicHep3Vector(190.27, 69.729, 1422.8);
-   		//BaseCalorimeterHit topHit 
-   		//	= new BaseCalorimeterHit(.4600, .4600, 0, 0, 0, topHitPosition, 0);
-   		
-   		//System.out.println("\n[ Calorimeter Hit ] Top: \n" + topHit.toString());
-   		
-   		Cluster topCluster = new BaseCluster();
-   		//((BaseCluster) topCluster).addHit(topHit);
-   		
-   		
-   		System.out.print("\n[ Cluster ] Top: " + topCluster.toString());
-   		System.out.println(" and position= ["  + topCluster.getPosition()[0] + ", " 
-   											   + topCluster.getPosition()[1] + ", " 
-   											   + topCluster.getPosition()[2] + " ]");
-   		
-   		//Hep3Vector bottomHitPosition = new BasicHep3Vector(-148.46, -39.27, 1430.5);
-   		//BaseCalorimeterHit bottomHit 
-   		//	= new BaseCalorimeterHit(1.1420, 1.1420, 0, 0, 0, bottomHitPosition, 0);
+        // Add the tracks to the list of tracks that will be used for test
+        // purposes.
+        tracks.add(electronTrack);
+        tracks.add(positronTrack);
+        
+        System.out.println("\n#=== Creating Ideal Ecal Clusters ===#\n");
+        
+        // Create a pair of ideal clusters to match the e+e- pairs created
+        // above.  Since the properties of a cluster cannot be modified 
+        // directly via setter methods, first create a CalorimeterHit and
+        // then use that to create a cluster.
+        //Hep3Vector topHitPosition = new BasicHep3Vector(190.27, 69.729, 1422.8);
+        //BaseCalorimeterHit topHit 
+        //  = new BaseCalorimeterHit(.4600, .4600, 0, 0, 0, topHitPosition, 0);
+        
+        //System.out.println("\n[ Calorimeter Hit ] Top: \n" + topHit.toString());
+        
+        Cluster topCluster = new BaseCluster();
+        //((BaseCluster) topCluster).addHit(topHit);
+        
+        
+        System.out.print("\n[ Cluster ] Top: " + topCluster.toString());
+        System.out.println(" and position= ["  + topCluster.getPosition()[0] + ", " 
+                                               + topCluster.getPosition()[1] + ", " 
+                                               + topCluster.getPosition()[2] + " ]");
+        
+        //Hep3Vector bottomHitPosition = new BasicHep3Vector(-148.46, -39.27, 1430.5);
+        //BaseCalorimeterHit bottomHit 
+        //  = new BaseCalorimeterHit(1.1420, 1.1420, 0, 0, 0, bottomHitPosition, 0);
 
-   		//System.out.println("\n[ Calorimeter Hit ] Bottom:\n " + bottomHit.toString());
-   		
-   		Cluster bottomCluster = new BaseCluster();
-   		//((BaseCluster) bottomCluster).addHit(bottomHit);
-   		
-   		System.out.print("\n[ Cluster ] bottom: " + bottomCluster.toString());
-   		System.out.println(" and position= [ " + topCluster.getPosition()[0] + ", " 
-   											   + topCluster.getPosition()[1] + ", " 
-   											   + topCluster.getPosition()[2] + " ]");
+        //System.out.println("\n[ Calorimeter Hit ] Bottom:\n " + bottomHit.toString());
+        
+        Cluster bottomCluster = new BaseCluster();
+        //((BaseCluster) bottomCluster).addHit(bottomHit);
+        
+        System.out.print("\n[ Cluster ] bottom: " + bottomCluster.toString());
+        System.out.println(" and position= [ " + topCluster.getPosition()[0] + ", " 
+                                               + topCluster.getPosition()[1] + ", " 
+                                               + topCluster.getPosition()[2] + " ]");
 
-   		// Add the clusters to the list of clusters that will be used for test
-   		// purposes.
-   		clusters.add(topCluster);
-   		clusters.add(bottomCluster);
-   		
-   		particleDriver = new HpsReconParticleDriver();
-   		particleDriver.setDebug(true);
-   	}
-   	
-   	public void testMakeReconstructedParticles(){
-   		
-   		System.out.println("\n#=== Running makeReconstructedParticles Test ===#");
-    	
-    	
-    	// Create two ReconstructedParticles with tracks only
-    	List<Cluster> emptyClusters = new ArrayList<Cluster>(); 
-    	List<List<Track>> trackCollections = new ArrayList<List<Track>>(0);
-    	trackCollections.add(tracks);
-    	particleTracks = particleDriver.makeReconstructedParticles(emptyClusters, trackCollections);
+        // Add the clusters to the list of clusters that will be used for test
+        // purposes.
+        clusters.add(topCluster);
+        clusters.add(bottomCluster);
+        
+        particleDriver = new HpsReconParticleDriver();
+        particleDriver.setDebug(true);
+    }
     
-    	//
-    	// The list contains two Tracks which should result in two 
-    	// ReconstructedParticles.
-    	//
-    	assertTrue("More particles than expected were created.", particleTracks.size() == 2);
-    	System.out.println("\nThe number of ReconstructedParticles created: " + particleTracks.size());
+    public void testMakeReconstructedParticles(){
+        
+        System.out.println("\n#=== Running makeReconstructedParticles Test ===#");
+        
+        
+        // Create two ReconstructedParticles with tracks only
+        List<Cluster> emptyClusters = new ArrayList<Cluster>(); 
+        List<List<Track>> trackCollections = new ArrayList<List<Track>>(0);
+        trackCollections.add(tracks);
+        particleTracks = particleDriver.makeReconstructedParticles(emptyClusters, trackCollections);
     
-    	for(int particleN = 0; particleN < particleTracks.size(); particleN++){
-    	
-    		//
-    		//	Check if the RecontructedParticle track is the same as the track 
-    		//	that created it
-    		// 
-    		assertTrue("The particle track does not match the track that created it",
-    					particleTracks.get(particleN).getTracks().get(0).equals(tracks.get(particleN)));
-    	
-    	
-    		//
-    		// Check that the charge of the ReconstructedParticles was set properly
-    		//
-    		assertTrue("The charge of the ReconstructedParticle is equal to zero.", 
-    					Math.abs(particleTracks.get(particleN).getCharge()) != 0);
-    		System.out.println("The charge of ReconstructedParticle number " + particleN + ": " + particleTracks.get(particleN).getCharge());
-    	
-    	
-    		//
-    		// Check that the particle ID was set correctly
-    		//
-    		assertTrue("The particle ID of the ReconstructedParticle is equal to zero.", 
-    				   particleTracks.get(particleN).getParticleIDUsed().getPDG() != 0);
-    		System.out.println("The particle ID of ReconstructedParticle number " + particleN + ": " + particleTracks.get(particleN).getParticleIDUsed().getPDG());
-    	}
-    	
-    	//
-    	// Check that the momentum of the ReconstructedParticles was set properly 
-    	// and rotated to the detector frame.
-    	//
-    	Hep3Vector electronMomentum = new BasicHep3Vector(tracks.get(0).getTrackStates().get(0).getMomentum());
-    	electronMomentum = CoordinateTransformations.transformVectorToDetector(electronMomentum);
-    	assertTrue("The momentum of the track and ReconstructedParticle don't match! Top track p = " 
-    				+ electronMomentum.toString() + " Recon particle p = " + particleTracks.get(0).getMomentum().toString(),
-    				particleTracks.get(0).getMomentum().equals(electronMomentum));
-    	
-    	System.out.println("The momentum of the first ReconstructedParticle: " + particleTracks.get(0).getMomentum().toString());
-    	
-    	Hep3Vector positronMomentum = new BasicHep3Vector(tracks.get(1).getTrackStates().get(0).getMomentum());
-    	positronMomentum = CoordinateTransformations.transformVectorToDetector(positronMomentum);
-    	assertTrue("The momentum of track and ReconstructedParticle don't march! Bottom track p = "
-    			    + positronMomentum.toString() + " Recon particle p = " + particleTracks.get(1).getMomentum().toString(),
-    			    particleTracks.get(1).getMomentum().equals(positronMomentum));
-    	
-    	System.out.println("The momentum of the second ReconstructedParticle: " + particleTracks.get(1).getMomentum().toString());
-    	
-   	}
-   	
-   	public void testVertexParticles(){
-   	
-    	// Create two ReconstructedParticles with tracks only
-    	//List<Cluster> emptyClusters = new ArrayList<Cluster>(); 
-    	//particleTracks = particleDriver.makeReconstructedParticles(emptyClusters, tracks);
+        //
+        // The list contains two Tracks which should result in two 
+        // ReconstructedParticles.
+        //
+        assertTrue("More particles than expected were created.", particleTracks.size() == 2);
+        System.out.println("\nThe number of ReconstructedParticles created: " + particleTracks.size());
+    
+        for(int particleN = 0; particleN < particleTracks.size(); particleN++){
+        
+            //
+            //  Check if the RecontructedParticle track is the same as the track 
+            //  that created it
+            // 
+            assertTrue("The particle track does not match the track that created it",
+                        particleTracks.get(particleN).getTracks().get(0).equals(tracks.get(particleN)));
+        
+        
+            //
+            // Check that the charge of the ReconstructedParticles was set properly
+            //
+            assertTrue("The charge of the ReconstructedParticle is equal to zero.", 
+                        Math.abs(particleTracks.get(particleN).getCharge()) != 0);
+            System.out.println("The charge of ReconstructedParticle number " + particleN + ": " + particleTracks.get(particleN).getCharge());
+        
+        
+            //
+            // Check that the particle ID was set correctly
+            //
+            assertTrue("The particle ID of the ReconstructedParticle is equal to zero.", 
+                       particleTracks.get(particleN).getParticleIDUsed().getPDG() != 0);
+            System.out.println("The particle ID of ReconstructedParticle number " + particleN + ": " + particleTracks.get(particleN).getParticleIDUsed().getPDG());
+        }
+        
+        //
+        // Check that the momentum of the ReconstructedParticles was set properly 
+        // and rotated to the detector frame.
+        //
+        Hep3Vector electronMomentum = new BasicHep3Vector(tracks.get(0).getTrackStates().get(0).getMomentum());
+        electronMomentum = CoordinateTransformations.transformVectorToDetector(electronMomentum);
+        assertTrue("The momentum of the track and ReconstructedParticle don't match! Top track p = " 
+                    + electronMomentum.toString() + " Recon particle p = " + particleTracks.get(0).getMomentum().toString(),
+                    particleTracks.get(0).getMomentum().equals(electronMomentum));
+        
+        System.out.println("The momentum of the first ReconstructedParticle: " + particleTracks.get(0).getMomentum().toString());
+        
+        Hep3Vector positronMomentum = new BasicHep3Vector(tracks.get(1).getTrackStates().get(0).getMomentum());
+        positronMomentum = CoordinateTransformations.transformVectorToDetector(positronMomentum);
+        assertTrue("The momentum of track and ReconstructedParticle don't march! Bottom track p = "
+                    + positronMomentum.toString() + " Recon particle p = " + particleTracks.get(1).getMomentum().toString(),
+                    particleTracks.get(1).getMomentum().equals(positronMomentum));
+        
+        System.out.println("The momentum of the second ReconstructedParticle: " + particleTracks.get(1).getMomentum().toString());
+        
+    }
+    
+    public void testVertexParticles(){
+    
+        // Create two ReconstructedParticles with tracks only
+        //List<Cluster> emptyClusters = new ArrayList<Cluster>(); 
+        //particleTracks = particleDriver.makeReconstructedParticles(emptyClusters, tracks);
 
-    	//List<ReconstructedParticle> electrons = particleTracks.subList(0, 1);
-   		//List<ReconstructedParticle> positrons = particleTracks.subList(1, 2);
-   	
-   		//particleDriver.vertexParticles(electrons, positrons);
-   		
-   	}
+        //List<ReconstructedParticle> electrons = particleTracks.subList(0, 1);
+        //List<ReconstructedParticle> positrons = particleTracks.subList(1, 2);
+    
+        //particleDriver.vertexParticles(electrons, positrons);
+        
+    }
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/daqconfig/DAQConfigDriver.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/daqconfig/DAQConfigDriver.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/daqconfig/DAQConfigDriver.java	Wed Mar  9 11:43:24 2016
@@ -39,57 +39,57 @@
  * @see ConfigurationManager
  */
 public class DAQConfigDriver extends Driver {
-	private int runNumber = -1;
-	private String filepath = null;
-	private boolean firstEvent = true;
-	private boolean readDataFiles = false;
-	private File[] dataFiles = new File[3];
-	private int[] crateNumber = { 46, 37, 39 };
-	
-	/**
-	 * Verifies the parameter <code>filepath</code> for the data file
-	 * repository and checks that appropriate data files exist for the
-	 * requested run number if the driver is set to read from data files.
-	 * Otherwise, this does nothing.
-	 */
-	@Override
-	public void startOfData() {
-		// Check whether to use stored data files or the EvIO data stream
-		// as the source of the DAQ settings. Nothing needs to be done
-		// in the latter case.
-		if(readDataFiles) {
-			// The user must define a data file prefix and repository
-			// location for this option to be used.
-			if(filepath == null) {
-				throw new NullPointerException("DAQ settings repository filepath must be defined.");
-			} if(runNumber == -1) {
-				throw new NullPointerException("Run number must be defined.");
-			}
-			
-			// Verify that the repository actually exist.
-			File repository = new File(filepath);
-			if(!repository.exists() || !repository.isDirectory()) {
-				throw new IllegalArgumentException("Repository location \"" + filepath + "\" must be an existing directory.");
-			}
-			
-			// Define the data file objects.
-			for(int i = 0; i < dataFiles.length; i++) {
-				try {
-					dataFiles[i] = new File(repository.getCanonicalPath() + "/" + runNumber + "_" + crateNumber[i] + ".txt");
-				} catch(IOException e) {
-					throw new RuntimeException("Error resolving absolute repository filepath.");
-				}
-			}
-			
-			// Verify that the data files actually exist.
-			for(File dataFile : dataFiles) {
-				if(!dataFile.exists() || !dataFile.canRead()) {
-					throw new IllegalArgumentException("Data file \"" + dataFile.getName() + "\" does not exist or can not be read.");
-				}
-			}
-		}
-	}
-	
+    private int runNumber = -1;
+    private String filepath = null;
+    private boolean firstEvent = true;
+    private boolean readDataFiles = false;
+    private File[] dataFiles = new File[3];
+    private int[] crateNumber = { 46, 37, 39 };
+    
+    /**
+     * Verifies the parameter <code>filepath</code> for the data file
+     * repository and checks that appropriate data files exist for the
+     * requested run number if the driver is set to read from data files.
+     * Otherwise, this does nothing.
+     */
+    @Override
+    public void startOfData() {
+        // Check whether to use stored data files or the EvIO data stream
+        // as the source of the DAQ settings. Nothing needs to be done
+        // in the latter case.
+        if(readDataFiles) {
+            // The user must define a data file prefix and repository
+            // location for this option to be used.
+            if(filepath == null) {
+                throw new NullPointerException("DAQ settings repository filepath must be defined.");
+            } if(runNumber == -1) {
+                throw new NullPointerException("Run number must be defined.");
+            }
+            
+            // Verify that the repository actually exist.
+            File repository = new File(filepath);
+            if(!repository.exists() || !repository.isDirectory()) {
+                throw new IllegalArgumentException("Repository location \"" + filepath + "\" must be an existing directory.");
+            }
+            
+            // Define the data file objects.
+            for(int i = 0; i < dataFiles.length; i++) {
+                try {
+                    dataFiles[i] = new File(repository.getCanonicalPath() + "/" + runNumber + "_" + crateNumber[i] + ".txt");
+                } catch(IOException e) {
+                    throw new RuntimeException("Error resolving absolute repository filepath.");
+                }
+            }
+            
+            // Verify that the data files actually exist.
+            for(File dataFile : dataFiles) {
+                if(!dataFile.exists() || !dataFile.canRead()) {
+                    throw new IllegalArgumentException("Data file \"" + dataFile.getName() + "\" does not exist or can not be read.");
+                }
+            }
+        }
+    }
+    
     /**
      * Checks an event for the DAQ configuration banks and passes them
      * to the <code>ConfigurationManager</code> if the driver is set to
@@ -99,28 +99,28 @@
      */
     @Override
     public void process(EventHeader event) {
-    	// If this is the first event and data files are to be read,
-    	// import the data files and generate the DAQ information.
-    	if(firstEvent && readDataFiles) {
-    		// Get the data files in the form of a data array.
-    		String[][] data;
-    		try { data = getDataFileArrays(dataFiles); }
-    		catch(IOException e) {
-				throw new RuntimeException("An error occurred when processing the data files.");
-			}
-    		
-    		// Instantiate an EvIO DAQ parser and feed it the data.
-    		EvioDAQParser daqConfig = new EvioDAQParser();
-    		for(int i = 0; i < dataFiles.length; i++) {
-        		daqConfig.parse(crateNumber[i], runNumber, data[i]);
-    		}
-    		
-    		// Update the configuration manager.
-    		ConfigurationManager.updateConfiguration(daqConfig);
-    	}
-    	
+        // If this is the first event and data files are to be read,
+        // import the data files and generate the DAQ information.
+        if(firstEvent && readDataFiles) {
+            // Get the data files in the form of a data array.
+            String[][] data;
+            try { data = getDataFileArrays(dataFiles); }
+            catch(IOException e) {
+                throw new RuntimeException("An error occurred when processing the data files.");
+            }
+            
+            // Instantiate an EvIO DAQ parser and feed it the data.
+            EvioDAQParser daqConfig = new EvioDAQParser();
+            for(int i = 0; i < dataFiles.length; i++) {
+                daqConfig.parse(crateNumber[i], runNumber, data[i]);
+            }
+            
+            // Update the configuration manager.
+            ConfigurationManager.updateConfiguration(daqConfig);
+        }
+        
         // Check if a trigger configuration bank exists.
-    	if(!readDataFiles && event.hasCollection(EvioDAQParser.class, "TriggerConfig")) {
+        if(!readDataFiles && event.hasCollection(EvioDAQParser.class, "TriggerConfig")) {
             // Get the trigger configuration bank. There should only be
             // one in the list.
             List<EvioDAQParser> configList = event.get(EvioDAQParser.class, "TriggerConfig");
@@ -134,7 +134,7 @@
         // Note that it is no longer the first event.
         firstEvent = false;
     }
-	
+    
     /**
      * Converts DAQ configuration data files into an array of strings
      * where each array entry represents a line in the configuration
@@ -152,44 +152,44 @@
      * or reading the objects in the objects referred to by the files
      * pointed to in the <code>dataFiles</code> array.
      */
-	private static final String[][] getDataFileArrays(File[] dataFiles) throws IOException {
-		// Create file readers to process the data files.
-		FileReader[] fr = new FileReader[dataFiles.length];
-		BufferedReader[] reader = new BufferedReader[dataFiles.length];
-		for(int i = 0; i < dataFiles.length; i++) {
-			fr[i] = new FileReader(dataFiles[i]);
-			reader[i] = new BufferedReader(fr[i]);
-		}
-		
-		// Generate String arrays where each entry in the array is
-		// a line from the data file.
-		String[][] data = new String[dataFiles.length][0];
-		for(int i = 0; i < dataFiles.length; i++) {
-			// Create a list to hold the raw strings.
-			List<String> rawData = new ArrayList<String>();
-			
-			// Add each line from the current data file to the list
-			// as a single entry.
-			String curLine = null;
-			while((curLine = reader[i].readLine()) != null) {
-				rawData.add(curLine);
-			}
-			
-			// Convert the list into a String array.
-			data[i] = rawData.toArray(new String[rawData.size()]);
-		}
-		
-		// Return the data array.
-		return data;
-	}
-    
-	/**
-	 * Sets the run number of the DAQ configuration being processed.
-	 * This is only used when reading from data files.
-	 * @param run - The run number of the data files to be used.
-	 */
+    private static final String[][] getDataFileArrays(File[] dataFiles) throws IOException {
+        // Create file readers to process the data files.
+        FileReader[] fr = new FileReader[dataFiles.length];
+        BufferedReader[] reader = new BufferedReader[dataFiles.length];
+        for(int i = 0; i < dataFiles.length; i++) {
+            fr[i] = new FileReader(dataFiles[i]);
+            reader[i] = new BufferedReader(fr[i]);
+        }
+        
+        // Generate String arrays where each entry in the array is
+        // a line from the data file.
+        String[][] data = new String[dataFiles.length][0];
+        for(int i = 0; i < dataFiles.length; i++) {
+            // Create a list to hold the raw strings.
+            List<String> rawData = new ArrayList<String>();
+            
+            // Add each line from the current data file to the list
+            // as a single entry.
+            String curLine = null;
+            while((curLine = reader[i].readLine()) != null) {
+                rawData.add(curLine);
+            }
+            
+            // Convert the list into a String array.
+            data[i] = rawData.toArray(new String[rawData.size()]);
+        }
+        
+        // Return the data array.
+        return data;
+    }
+    
+    /**
+     * Sets the run number of the DAQ configuration being processed.
+     * This is only used when reading from data files.
+     * @param run - The run number of the data files to be used.
+     */
     public void setRunNumber(int run) {
-    	runNumber = run;
+        runNumber = run;
     }
     
     /**
@@ -198,7 +198,7 @@
      * @param filepath - The file path of the data file repository.
      */
     public void setDataFileRepository(String filepath) {
-    	this.filepath = filepath;
+        this.filepath = filepath;
     }
     
     /**
@@ -211,6 +211,6 @@
      * should be read from the EvIO stream.
      */
     public void setReadDataFiles(boolean state) {
-    	readDataFiles = state;
+        readDataFiles = state;
     }
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/daqconfig/EvioDAQParser.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/daqconfig/EvioDAQParser.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/daqconfig/EvioDAQParser.java	Wed Mar  9 11:43:24 2016
@@ -42,7 +42,7 @@
      * 
      * TODO: Restructure, clean up...
      */
-	/** The EvIO bank identification tag for DAQ configuration banks. */
+    /** The EvIO bank identification tag for DAQ configuration banks. */
     public static final int BANK_TAG = 0xE10E;
     
     // Stores the hardware codes for each trigger type.
@@ -204,7 +204,7 @@
      * Instantiates the <code>EvioDAQParser</code>.
      */
     public EvioDAQParser() {
-    	// Create a map to map crystals to their database channel object.
+        // Create a map to map crystals to their database channel object.
         ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
         for (int ii = 0; ii < 442; ii++) {
             channels.add(findChannel(ii + 1));
@@ -220,9 +220,9 @@
      * parameters.
      */
     public void parse(int crate, int runNumber, String[] configurationTables) {
-    	// Track the number of banks that have been parsed. If the
-    	// parameter values have not been populated after a certain
-    	// number of banks, there is missing information.
+        // Track the number of banks that have been parsed. If the
+        // parameter values have not been populated after a certain
+        // number of banks, there is missing information.
         nBanks++;
         
         // Create a map that maps an identifier for each configuration
@@ -256,10 +256,10 @@
      * contain the DAQ configuration parameters.
      */
     private void loadConfigMap(int crate, String[] configTables) {
-    	// Iterate over each configuration table.
+        // Iterate over each configuration table.
         for(String configTable : configTables) {
-        	// Split each table into rows and iterate over the rows.
-        	rowLoop:
+            // Split each table into rows and iterate over the rows.
+            rowLoop:
             for(String line : configTable.trim().split("\n")) {
                 // Split the first column from the row.
                 String[] cols = line.trim().split(" +", 2);
@@ -290,8 +290,8 @@
                 // This entry indicates which triggers are enabled and
                 // needs to be parsed differently than normal.
                 else if(key.startsWith("SSP_HPS_SET_IO_SRC")) {
-                	// The first "parameter value" is a hardware code
-                	// that identifies the trigger. Obtain it.
+                    // The first "parameter value" is a hardware code
+                    // that identifies the trigger. Obtain it.
                     int trig = Integer.valueOf(vals.get(1));
                     
                     // There are two trigger of each type, singles and
@@ -313,8 +313,8 @@
                 // This indicates a regular parameter that does not
                 // require any special parsing.
                 if(vals.size() > 1 && key.startsWith("SSP")) {
-                	// List the parameter by "[ROW NAME]_[KEY]" and
-                	// remove the key so that only the values remain.
+                    // List the parameter by "[ROW NAME]_[KEY]" and
+                    // remove the key so that only the values remain.
                     key += "_" + vals.remove(0);
                 }
                 
@@ -330,7 +330,7 @@
      * format of <code>[PARAMETER KEY] --> { [PARAMETER VALUES] }</code>.
      */
     public void parseConfigMap() {
-    	// Parse simple FADC data.
+        // Parse simple FADC data.
         fadcNSA    = Integer.valueOf(getConfigParameter("FADC250_NSA",      0));
         fadcNSB    = Integer.valueOf(getConfigParameter("FADC250_NSB",      0));
         fadcNPEAK  = Integer.valueOf(getConfigParameter("FADC250_NPEAK",    0));
@@ -345,12 +345,12 @@
         
         // Parse trigger data.
         for(int ii = 0; ii < 2; ii++) {
-        	// Check singles trigger cuts enabled status.
+            // Check singles trigger cuts enabled status.
             singlesNhitsEn[ii]         = getBoolConfigSSP(ii,  "SINGLES_NMIN",          1);
             singlesEnergyMinEn[ii]     = getBoolConfigSSP(ii,  "SINGLES_EMIN",          1);
             singlesEnergyMaxEn[ii]     = getBoolConfigSSP(ii,  "SINGLES_EMAX",          1);
             
-        	// Check pair trigger cuts enabled status.
+            // Check pair trigger cuts enabled status.
             pairsEnergySumMaxMinEn[ii] = getBoolConfigSSP(ii,  "PAIRS_SUMMAX_MIN",      2);
             pairsEnergyDiffEn[ii]      = getBoolConfigSSP(ii,  "PAIRS_DIFFMAX",         1);
             pairsCoplanarityEn[ii]     = getBoolConfigSSP(ii,  "PAIRS_COPLANARITY",     1);
@@ -383,7 +383,7 @@
      * used to determine if the run is a "bugged" run.
      */
     private void fixConfigMap2014Run(int runNumber) {
-    	// If this is a good run, noting should be done. Return.
+        // If this is a good run, noting should be done. Return.
         if(runNumber > 3470 || runNumber < 3100) { return; }
         
         // Populate missing GTP entries.
@@ -412,10 +412,10 @@
      * the FADC channel with which they are associated.
      */
     private void parseFADC(int crate, String key, List<String> vals) {
-    	// The FADC slot is not stored on the same line as the other
-    	// data and must be parsed and retained, as it is necessary
-    	// for handling the subsequent lines. If this line is the
-    	// FADC slot, store it.
+        // The FADC slot is not stored on the same line as the other
+        // data and must be parsed and retained, as it is necessary
+        // for handling the subsequent lines. If this line is the
+        // FADC slot, store it.
         if(key.equals("FADC250_SLOT")) {
             thisFadcSlot = Integer.valueOf(vals.get(0));
         }
@@ -449,8 +449,8 @@
      * to FADC channels 0 - 15.
      */
     private void setChannelParsFloat(int crate, int slot, Map<EcalChannel, Float> map, List<String> vals) {
-    	// Iterate over each channel and map the database channel object
-    	// to the corresponding list value.
+        // Iterate over each channel and map the database channel object
+        // to the corresponding list value.
         for(int ii = 0; ii < 16; ii++) {
             map.put(findChannel(crate, slot, ii), Float.valueOf(vals.get(ii)));
         }
@@ -468,8 +468,8 @@
      * objects representing the channel values.
      */
     private void setChannelParsInt(int crate, int slot, Map<EcalChannel, Integer> map, List<String> vals) {
-    	// Iterate over each channel and map the database channel object
-    	// to the corresponding list value.
+        // Iterate over each channel and map the database channel object
+        // to the corresponding list value.
         for(int ii = 0; ii < 16; ii++) {
             map.put(findChannel(crate, slot, ii), Integer.valueOf(vals.get(ii)));
         }
@@ -619,9 +619,9 @@
      * can not be found, an error message is passed to the logger.
      */
     public String getConfigParameter(String key, int ival) {
-    	// Check the parameter map for the requested parameter key.
+        // Check the parameter map for the requested parameter key.
         if(configMap.containsKey(key)) {
-        	// Get the list of values associated with this parameter key.
+            // Get the list of values associated with this parameter key.
             List<String> vals = configMap.get(key);
             
             // Check that the list of values contains a parameter for
@@ -639,7 +639,7 @@
         // If the key is not present...
         else {
             // If more than 2 banks have been read, the absence of a
-        	// key represents an error. Log that this has occurred.
+            // key represents an error. Log that this has occurred.
             if(nBanks > 2) {
                 Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "ConfigMap MISSING KEY:   " + key);
             }
@@ -659,13 +659,13 @@
      * if it exists, and <code>null</code> if it does not.
      */
     public EcalChannel findChannel(int crate, int fadcSlot, int fadcChan) {
-    	// Search through the database channels for a channel that
-    	// matches the the argument parameters.
+        // Search through the database channels for a channel that
+        // matches the the argument parameters.
         for (EcalChannel cc : channels) {
-        	// A channel matches the argument if the slot and channel
-        	// values are the same. Crate number must also match, but
-        	// note that EcalChannel follows a different convention
-        	// with respect to crate numbering.
+            // A channel matches the argument if the slot and channel
+            // values are the same. Crate number must also match, but
+            // note that EcalChannel follows a different convention
+            // with respect to crate numbering.
             if( ((cc.getCrate() - 1) * 2 == crate - 37) && (cc.getSlot() == fadcSlot) && (cc.getChannel() == fadcChan) ) {
                 return cc;
             }

Modified: java/trunk/record-util/src/main/java/org/hps/record/daqconfig/FADCConfig.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/daqconfig/FADCConfig.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/daqconfig/FADCConfig.java	Wed Mar  9 11:43:24 2016
@@ -130,13 +130,13 @@
      * per ADC.
      */
     public float getGain(Point ixy) {
-    	// Get the channel index.
-    	Integer index = indexChannelMap.get(ixy);
-    	
-    	// If the channel index was defined, return the pedestal.
+        // Get the channel index.
+        Integer index = indexChannelMap.get(ixy);
+        
+        // If the channel index was defined, return the pedestal.
         if(index != null) { return getGain(index); }
         else {
-        	throw new IllegalArgumentException(String.format("Crystal (%3d, %3d) does not exist.", ixy.x, ixy.y));
+            throw new IllegalArgumentException(String.format("Crystal (%3d, %3d) does not exist.", ixy.x, ixy.y));
         }
     }
     
@@ -226,13 +226,13 @@
      * of ADC.
      */
     public float getPedestal(Point ixy) {
-    	// Get the channel index.
-    	Integer index = indexChannelMap.get(ixy);
-    	
-    	// If the channel index was defined, return the pedestal.
+        // Get the channel index.
+        Integer index = indexChannelMap.get(ixy);
+        
+        // If the channel index was defined, return the pedestal.
         if(index != null) { return getPedestal(index); }
         else {
-        	throw new IllegalArgumentException(String.format("Crystal (%3d, %3d) does not exist.", ixy.x, ixy.y));
+            throw new IllegalArgumentException(String.format("Crystal (%3d, %3d) does not exist.", ixy.x, ixy.y));
         }
     }
     
@@ -307,7 +307,7 @@
     
     @Override
     public void printConfig(PrintStream ps) {
-    	// Print the basic configuration information.
+        // Print the basic configuration information.
         ps.println("FADC Configuration:");
         ps.printf("\tMode          :: %d%n", mode);
         ps.printf("\tNSA           :: %d%n", nsa);
@@ -322,23 +322,23 @@
         // Iterate over each crystal y-index.
         yLoop:
         for(int iy = -5; iy <= 5; iy++) {
-        	// iy = 0 does not exists; skip it!
-        	if(iy == 0) { continue yLoop; }
-        	
-        	// Iterate over each crystal x-index.
-        	xLoop:
-        	for(int ix = -23; ix <= 23; ix++) {
-        		// ix = 0 and the beam hole do not exist; skip these!
-        		if(ix == 0) { continue xLoop; }
-        		if((ix >= -10 && ix <= -2) && (iy == -1 || iy == 1)) {
-        			continue xLoop;
-        		}
-        		
-        		// Output the crystal indices, pedestal, and gain.
-        		int channelID = indexChannelMap.get(new Point(ix, iy));
-        		ps.printf("\t%3d\t%3d\t%8.3f\t%8.3f\t%4d%n", ix, iy,
-        				getPedestal(channelID), getGain(channelID), getThreshold(channelID));
-        	}
+            // iy = 0 does not exists; skip it!
+            if(iy == 0) { continue yLoop; }
+            
+            // Iterate over each crystal x-index.
+            xLoop:
+            for(int ix = -23; ix <= 23; ix++) {
+                // ix = 0 and the beam hole do not exist; skip these!
+                if(ix == 0) { continue xLoop; }
+                if((ix >= -10 && ix <= -2) && (iy == -1 || iy == 1)) {
+                    continue xLoop;
+                }
+                
+                // Output the crystal indices, pedestal, and gain.
+                int channelID = indexChannelMap.get(new Point(ix, iy));
+                ps.printf("\t%3d\t%3d\t%8.3f\t%8.3f\t%4d%n", ix, iy,
+                        getPedestal(channelID), getGain(channelID), getThreshold(channelID));
+            }
         }
     }
     

Modified: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPData.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPData.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPData.java	Wed Mar  9 11:43:24 2016
@@ -175,7 +175,7 @@
      * of <code>SSPCosmicTrigger</code> objects.
      */
     public List<SSPCosmicTrigger> getCosmicTriggers() {
-    	return cosmicList;
+        return cosmicList;
     }
     
     /**
@@ -184,7 +184,7 @@
      * of <code>SSPPairTrigger</code> objects.
      */
     public List<SSPPairTrigger> getPairTriggers() {
-    	return pairList;
+        return pairList;
     }
     
     /**
@@ -193,7 +193,7 @@
      * of <code>SSPSinglesTrigger</code> objects.
      */
     public List<SSPSinglesTrigger> getSinglesTriggers() {
-    	return singlesList;
+        return singlesList;
     }
     
     /**

Modified: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPNumberedTrigger.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPNumberedTrigger.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPNumberedTrigger.java	Wed Mar  9 11:43:24 2016
@@ -10,16 +10,16 @@
  * @see SSPTrigger
  */
 public abstract class SSPNumberedTrigger extends SSPTrigger {
-	/**
-	 * Instantiates the <code>SSPNumberedTrigger</code>.
+    /**
+     * Instantiates the <code>SSPNumberedTrigger</code>.
      * @param type - The type of trigger.
      * @param time - The time at which the trigger occurred in ns.
      * @param data - The trigger bit data.
-	 */
-	public SSPNumberedTrigger(int type, int time, int data) {
-		super(type, time, data);
-	}
-	
+     */
+    public SSPNumberedTrigger(int type, int time, int data) {
+        super(type, time, data);
+    }
+    
     /**
      * Indicates whether the trigger was reported by the first of the
      * singles triggers.

Modified: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPPairTrigger.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPPairTrigger.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPPairTrigger.java	Wed Mar  9 11:43:24 2016
@@ -21,12 +21,12 @@
     
     @Override
     public boolean isFirstTrigger() {
-    	return (type == SSPData.TRIG_TYPE_PAIR0);
+        return (type == SSPData.TRIG_TYPE_PAIR0);
     }
     
     @Override
     public boolean isSecondTrigger() {
-    	return (type == SSPData.TRIG_TYPE_PAIR1);
+        return (type == SSPData.TRIG_TYPE_PAIR1);
     }
     
     /**
@@ -71,9 +71,9 @@
     
     @Override
     public String toString() {
-		return String.format("Trigger %d :: %3d ns :: ESum: %d, EDiff: %d, ESlope: %d, Coplanarity: %d",
-				isFirstTrigger() ? 1 : 2, getTime(), passCutEnergySum() ? 1 : 0,
-				passCutEnergyDifference() ? 1 : 0, passCutEnergySlope() ? 1 : 0,
-				passCutCoplanarity() ? 1 : 0);
+        return String.format("Trigger %d :: %3d ns :: ESum: %d, EDiff: %d, ESlope: %d, Coplanarity: %d",
+                isFirstTrigger() ? 1 : 2, getTime(), passCutEnergySum() ? 1 : 0,
+                passCutEnergyDifference() ? 1 : 0, passCutEnergySlope() ? 1 : 0,
+                passCutCoplanarity() ? 1 : 0);
     }
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPSinglesTrigger.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPSinglesTrigger.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/SSPSinglesTrigger.java	Wed Mar  9 11:43:24 2016
@@ -27,12 +27,12 @@
     
     @Override
     public boolean isFirstTrigger() {
-    	return (type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP);
+        return (type == SSPData.TRIG_TYPE_SINGLES0_BOT) || (type == SSPData.TRIG_TYPE_SINGLES0_TOP);
     }
     
     @Override
     public boolean isSecondTrigger() {
-    	return (type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP);
+        return (type == SSPData.TRIG_TYPE_SINGLES1_BOT) || (type == SSPData.TRIG_TYPE_SINGLES1_TOP);
     }
     
     /**
@@ -67,8 +67,8 @@
     
     @Override
     public String toString() {
-		return String.format("Trigger %d :: %3d ns :: EClusterLow: %d; EClusterHigh %d; HitCount: %d",
-				isFirstTrigger() ? 1 : 2, getTime(), passCutEnergyMin() ? 1 : 0,
-				passCutEnergyMax() ? 1 : 0, passCutHitCount() ? 1 : 0);
+        return String.format("Trigger %d :: %3d ns :: EClusterLow: %d; EClusterHigh %d; HitCount: %d",
+                isFirstTrigger() ? 1 : 2, getTime(), passCutEnergyMin() ? 1 : 0,
+                passCutEnergyMax() ? 1 : 0, passCutHitCount() ? 1 : 0);
     }
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerModule.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerModule.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerModule.java	Wed Mar  9 11:43:24 2016
@@ -44,8 +44,8 @@
  * @see SSPCluster
  */
 public final class TriggerModule {
-	/** The calorimeter mid-plane, defined by the photon beam position
-	* (30.52 mrad) at the calorimeter face (z = 1393 mm). */
+    /** The calorimeter mid-plane, defined by the photon beam position
+    * (30.52 mrad) at the calorimeter face (z = 1393 mm). */
     private static final double ORIGIN_X = 1393.0 * Math.tan(0.03052);
     
     /** The value of the parameter "F" in the energy slope equation
@@ -104,23 +104,23 @@
      * above zero) will be accepted.
      */
     public TriggerModule() {
-    	// Set the cluster singles cuts to accept all values by default.
-    	cuts.put(CLUSTER_HIT_COUNT_LOW, 0.0);
-    	cuts.put(CLUSTER_SEED_ENERGY_LOW, 0.0);
-    	cuts.put(CLUSTER_SEED_ENERGY_HIGH, Double.MAX_VALUE);
-    	cuts.put(CLUSTER_TOTAL_ENERGY_LOW, 0.0);
-    	cuts.put(CLUSTER_TOTAL_ENERGY_HIGH, Double.MAX_VALUE);
-    	
-    	// Set the cluster pair cuts to accept all values by default.
-    	cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
-    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
-    	cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
-    	cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
-    	cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
-    	cuts.put(PAIR_TIME_COINCIDENCE, Double.MAX_VALUE);
-    	
-    	// Set the default value of the energy slope parameter F.
-    	cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
+        // Set the cluster singles cuts to accept all values by default.
+        cuts.put(CLUSTER_HIT_COUNT_LOW, 0.0);
+        cuts.put(CLUSTER_SEED_ENERGY_LOW, 0.0);
+        cuts.put(CLUSTER_SEED_ENERGY_HIGH, Double.MAX_VALUE);
+        cuts.put(CLUSTER_TOTAL_ENERGY_LOW, 0.0);
+        cuts.put(CLUSTER_TOTAL_ENERGY_HIGH, Double.MAX_VALUE);
+        
+        // Set the cluster pair cuts to accept all values by default.
+        cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
+        cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
+        cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
+        cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
+        cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
+        cuts.put(PAIR_TIME_COINCIDENCE, Double.MAX_VALUE);
+        
+        // Set the default value of the energy slope parameter F.
+        cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
     }
     
     /**
@@ -142,25 +142,25 @@
      * </ul>
      */
     public TriggerModule(double... cutValues) {
-    	// Set the cuts to the default values.
-    	this();
-    	
-    	// Define the cuts in the order that they correspond to the
-    	// value arguments.
-    	String[] cutID = { CLUSTER_HIT_COUNT_LOW, CLUSTER_SEED_ENERGY_LOW, CLUSTER_SEED_ENERGY_HIGH,
-    			CLUSTER_TOTAL_ENERGY_LOW, CLUSTER_TOTAL_ENERGY_HIGH, PAIR_ENERGY_SUM_LOW, PAIR_ENERGY_SUM_HIGH,
-    			PAIR_ENERGY_DIFFERENCE_HIGH, PAIR_ENERGY_SLOPE_LOW, PAIR_COPLANARITY_HIGH, PAIR_ENERGY_SLOPE_F };
-    	
-    	// Iterate over the value arguments and assign them to the
-    	// appropriate cut.
-    	for(int i = 0; i < cutValues.length; i++) {
-    		// If more values were given then cuts exist, break from
-    		// the loop.
-    		if(i == 11) { break; }
-    		
-    		// Set the current cut to its corresponding value.
-    		cuts.put(cutID[i], cutValues[i]);
-    	}
+        // Set the cuts to the default values.
+        this();
+        
+        // Define the cuts in the order that they correspond to the
+        // value arguments.
+        String[] cutID = { CLUSTER_HIT_COUNT_LOW, CLUSTER_SEED_ENERGY_LOW, CLUSTER_SEED_ENERGY_HIGH,
+                CLUSTER_TOTAL_ENERGY_LOW, CLUSTER_TOTAL_ENERGY_HIGH, PAIR_ENERGY_SUM_LOW, PAIR_ENERGY_SUM_HIGH,
+                PAIR_ENERGY_DIFFERENCE_HIGH, PAIR_ENERGY_SLOPE_LOW, PAIR_COPLANARITY_HIGH, PAIR_ENERGY_SLOPE_F };
+        
+        // Iterate over the value arguments and assign them to the
+        // appropriate cut.
+        for(int i = 0; i < cutValues.length; i++) {
+            // If more values were given then cuts exist, break from
+            // the loop.
+            if(i == 11) { break; }
+            
+            // Set the current cut to its corresponding value.
+            cuts.put(cutID[i], cutValues[i]);
+        }
     }
     
     /**
@@ -172,14 +172,14 @@
      * specified in the argument is not valid.
      */
     public double getCutValue(String cut) throws IllegalArgumentException {
-    	// Try to get the indicated cut.
-    	Double value = cuts.get(cut);
-    	
-    	// If the cut is valid, return it.
-    	if(value != null) { return value.doubleValue(); }
-    	
-    	// Otherwise, produce an exception.
-    	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
+        // Try to get the indicated cut.
+        Double value = cuts.get(cut);
+        
+        // If the cut is valid, return it.
+        if(value != null) { return value.doubleValue(); }
+        
+        // Otherwise, produce an exception.
+        else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
     }
     
     /**
@@ -190,22 +190,22 @@
      * @param config - The DAQ configuration settings.
      */
     public void loadDAQConfiguration(SinglesTriggerConfig config) {
-    	// Set the trigger values.
-    	setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
-    	setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
-    	setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
-    	
-    	// The remaining triggers should be set to their default values.
-    	// These settings effectively accept all possible clusters.
-    	cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
-    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
-    	cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
-    	cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
-    	cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
-    	cuts.put(PAIR_TIME_COINCIDENCE, Double.MAX_VALUE);
-    	
-    	// Set the default value of the energy slope parameter F.
-    	cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
+        // Set the trigger values.
+        setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
+        setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
+        setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
+        
+        // The remaining triggers should be set to their default values.
+        // These settings effectively accept all possible clusters.
+        cuts.put(PAIR_COPLANARITY_HIGH, 180.0);
+        cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, Double.MAX_VALUE);
+        cuts.put(PAIR_ENERGY_SLOPE_LOW, 0.0);
+        cuts.put(PAIR_ENERGY_SUM_LOW, 0.0);
+        cuts.put(PAIR_ENERGY_SUM_HIGH, Double.MAX_VALUE);
+        cuts.put(PAIR_TIME_COINCIDENCE, Double.MAX_VALUE);
+        
+        // Set the default value of the energy slope parameter F.
+        cuts.put(PAIR_ENERGY_SLOPE_F, 0.0055);
     }
     
     /**
@@ -215,22 +215,22 @@
      * @param config - The DAQ configuration settings.
      */
     public void loadDAQConfiguration(PairTriggerConfig config) {
-    	// Set the trigger values.
-    	setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
-    	setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
-    	setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
-    	
-    	// The remaining triggers should be set to their default values.
-    	// These settings effectively accept all possible clusters.
-    	cuts.put(PAIR_COPLANARITY_HIGH, config.getCoplanarityCutConfig().getUpperBound());
-    	cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, config.getEnergyDifferenceCutConfig().getUpperBound());
-    	cuts.put(PAIR_ENERGY_SLOPE_LOW, config.getEnergySlopeCutConfig().getLowerBound());
-    	cuts.put(PAIR_ENERGY_SUM_LOW, config.getEnergySumCutConfig().getLowerBound());
-    	cuts.put(PAIR_ENERGY_SUM_HIGH, config.getEnergySumCutConfig().getUpperBound());
-    	cuts.put(PAIR_TIME_COINCIDENCE, config.getTimeDifferenceCutConfig().getUpperBound() * 4.0);
-    	
-    	// Set the default value of the energy slope parameter F.
-    	cuts.put(PAIR_ENERGY_SLOPE_F, config.getEnergySlopeCutConfig().getParameterF());
+        // Set the trigger values.
+        setCutValue(CLUSTER_TOTAL_ENERGY_LOW,  config.getEnergyMinCutConfig().getLowerBound());
+        setCutValue(CLUSTER_TOTAL_ENERGY_HIGH, config.getEnergyMaxCutConfig().getUpperBound());
+        setCutValue(CLUSTER_HIT_COUNT_LOW,     config.getHitCountCutConfig().getLowerBound());
+        
+        // The remaining triggers should be set to their default values.
+        // These settings effectively accept all possible clusters.
+        cuts.put(PAIR_COPLANARITY_HIGH, config.getCoplanarityCutConfig().getUpperBound());
+        cuts.put(PAIR_ENERGY_DIFFERENCE_HIGH, config.getEnergyDifferenceCutConfig().getUpperBound());
+        cuts.put(PAIR_ENERGY_SLOPE_LOW, config.getEnergySlopeCutConfig().getLowerBound());
+        cuts.put(PAIR_ENERGY_SUM_LOW, config.getEnergySumCutConfig().getLowerBound());
+        cuts.put(PAIR_ENERGY_SUM_HIGH, config.getEnergySumCutConfig().getUpperBound());
+        cuts.put(PAIR_TIME_COINCIDENCE, config.getTimeDifferenceCutConfig().getUpperBound() * 4.0);
+        
+        // Set the default value of the energy slope parameter F.
+        cuts.put(PAIR_ENERGY_SLOPE_F, config.getEnergySlopeCutConfig().getParameterF());
     }
     
     /**
@@ -244,76 +244,76 @@
      * identifier is not valid.
      */
     public void setCutValue(String cut, double value) throws IllegalArgumentException {
-    	// Make sure that the cut exists. If it does, change it to the
-    	// new cut value.
-    	if(cuts.containsKey(cut)) {
-    		cuts.put(cut, value);
-    	}
-    	
-    	// Otherwise, throw an exception.
-    	else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
-    }
-    
-	/**
-	 * Sets the cluster singles cuts to the values parsed from an
-	 * argument string.
-	 * @param isSingles - Indicates whether the parser should expect
-	 * 10 cut values (for pairs) or 3 (for singles).
-	 * @param cutValues - A string representing the cuts values. This
-	 * must be formatted in the style of "Emin Emax Nmin ...".
-	 */
+        // Make sure that the cut exists. If it does, change it to the
+        // new cut value.
+        if(cuts.containsKey(cut)) {
+            cuts.put(cut, value);
+        }
+        
+        // Otherwise, throw an exception.
+        else { throw new IllegalArgumentException(String.format("Cut \"%s\" does not exist.", cut)); }
+    }
+    
+    /**
+     * Sets the cluster singles cuts to the values parsed from an
+     * argument string.
+     * @param isSingles - Indicates whether the parser should expect
+     * 10 cut values (for pairs) or 3 (for singles).
+     * @param cutValues - A string representing the cuts values. This
+     * must be formatted in the style of "Emin Emax Nmin ...".
+     */
     // TODO: Specify in JavaDoc what the order of these arguments is.
-	public void setCutValues(boolean isSingles, String cutValues) {
-		// Make sure that the string is not null.
-		if(cutValues == null) {
-			throw new NullPointerException(String.format("Cut arguments for trigger are null!"));
-		}
-		
-		// Tokenize the argument string.
-		StringTokenizer tokens = new StringTokenizer(cutValues);
-		
-		// Store the cut values. Entry format is:
-		// clusterEnergyMin clusterEnergyMax hitCountMin
-		// clusterEnergyMin clusterEnergyMax hitCountMin pairSumMin pairSumMax pairDiffMax pairSlopeMin pairSlopeF pairCoplanarityMax pairTimeCoincidence
-		double cuts[];
-		if(isSingles) { cuts = new double[] { 0.0, 8.191, 0 }; }
-		else { cuts = new double[] { 0.0, 8.191, 0, 0, 8.191, 8.191, 0, 0.0055, 180, Double.MAX_VALUE }; }
-		String[] cutNames = { "clusterEnergyMin", "clusterEnergyMax", "hitCountMin",
-				"pairSumMin", "pairSumMax", "pairDiffMax", "pairSlopeMin", "pairSlopeF",
-				"pairCoplanarityMax", "pairTimeCoincidence" };
-		
-		// Iterate over the number of cuts and extract that many values
-		// from the cut value string.
-		for(int cutNum = 0; cutNum < cuts.length; cutNum++) {
-			// If there are no more tokens left, the argument string
-			// is missing some values. Throw an exception!
-			if(tokens.hasMoreTokens()) {
-				// Get the next token from the string.
-				String arg = tokens.nextToken();
-				
-				// Try to parse the token as a double. All cut values
-				// should be rendered as doubles (or integers, which
-				// can be parsed as doubles). If it is not, the string
-				// is improperly formatted.
-				try { cuts[cutNum] = Double.parseDouble(arg); }
-				catch(NumberFormatException e) {
-					throw new NumberFormatException(String.format("Argument for \"%s\" improperly formatted: %s", cutNames[cutNum], arg));
-				}
-			}
-		}
-		
-		// Store the cuts in the trigger.
-		setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    cuts[0]);
-		setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   cuts[1]);
-		setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       cuts[2]);
-		setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         cuts[3]);
-		setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        cuts[4]);
-		setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, cuts[5]);
-		setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       cuts[6]);
-		setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         cuts[7]);
-		setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       cuts[8]);
-		setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       cuts[9]);
-	}
+    public void setCutValues(boolean isSingles, String cutValues) {
+        // Make sure that the string is not null.
+        if(cutValues == null) {
+            throw new NullPointerException(String.format("Cut arguments for trigger are null!"));
+        }
+        
+        // Tokenize the argument string.
+        StringTokenizer tokens = new StringTokenizer(cutValues);
+        
+        // Store the cut values. Entry format is:
+        // clusterEnergyMin clusterEnergyMax hitCountMin
+        // clusterEnergyMin clusterEnergyMax hitCountMin pairSumMin pairSumMax pairDiffMax pairSlopeMin pairSlopeF pairCoplanarityMax pairTimeCoincidence
+        double cuts[];
+        if(isSingles) { cuts = new double[] { 0.0, 8.191, 0 }; }
+        else { cuts = new double[] { 0.0, 8.191, 0, 0, 8.191, 8.191, 0, 0.0055, 180, Double.MAX_VALUE }; }
+        String[] cutNames = { "clusterEnergyMin", "clusterEnergyMax", "hitCountMin",
+                "pairSumMin", "pairSumMax", "pairDiffMax", "pairSlopeMin", "pairSlopeF",
+                "pairCoplanarityMax", "pairTimeCoincidence" };
+        
+        // Iterate over the number of cuts and extract that many values
+        // from the cut value string.
+        for(int cutNum = 0; cutNum < cuts.length; cutNum++) {
+            // If there are no more tokens left, the argument string
+            // is missing some values. Throw an exception!
+            if(tokens.hasMoreTokens()) {
+                // Get the next token from the string.
+                String arg = tokens.nextToken();
+                
+                // Try to parse the token as a double. All cut values
+                // should be rendered as doubles (or integers, which
+                // can be parsed as doubles). If it is not, the string
+                // is improperly formatted.
+                try { cuts[cutNum] = Double.parseDouble(arg); }
+                catch(NumberFormatException e) {
+                    throw new NumberFormatException(String.format("Argument for \"%s\" improperly formatted: %s", cutNames[cutNum], arg));
+                }
+            }
+        }
+        
+        // Store the cuts in the trigger.
+        setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    cuts[0]);
+        setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   cuts[1]);
+        setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       cuts[2]);
+        setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         cuts[3]);
+        setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        cuts[4]);
+        setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, cuts[5]);
+        setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       cuts[6]);
+        setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         cuts[7]);
+        setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       cuts[8]);
+        setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       cuts[9]);
+    }
     
     /**
      * Checks whether a cluster passes the cluster hit count cut. This
@@ -346,7 +346,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterSeedEnergyCut(Cluster cluster) {
-    	return clusterSeedEnergyCut(getValueClusterSeedEnergy(cluster));
+        return clusterSeedEnergyCut(getValueClusterSeedEnergy(cluster));
     }
     
     /**
@@ -357,7 +357,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterSeedEnergyCutHigh(Cluster cluster) {
-    	return clusterSeedEnergyCutHigh(getValueClusterSeedEnergy(cluster));
+        return clusterSeedEnergyCutHigh(getValueClusterSeedEnergy(cluster));
     }
     
     /**
@@ -368,7 +368,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterSeedEnergyCutLow(Cluster cluster) {
-    	return clusterSeedEnergyCutLow(getValueClusterSeedEnergy(cluster));
+        return clusterSeedEnergyCutLow(getValueClusterSeedEnergy(cluster));
     }
     
     /**
@@ -380,7 +380,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCut(Cluster cluster) {
-    	return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -392,7 +392,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCutHigh(Cluster cluster) {
-    	return clusterTotalEnergyCutHigh(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCutHigh(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -404,7 +404,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCutLow(Cluster cluster) {
-    	return clusterTotalEnergyCutLow(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCutLow(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -416,7 +416,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCut(SSPCluster cluster) {
-    	return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCut(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -428,7 +428,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCutHigh(SSPCluster cluster) {
-    	return clusterTotalEnergyCutHigh(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCutHigh(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -440,7 +440,7 @@
      * and <code>false</code> if the cluster does not.
      */
     public boolean clusterTotalEnergyCutLow(SSPCluster cluster) {
-    	return clusterTotalEnergyCutLow(getValueClusterTotalEnergy(cluster));
+        return clusterTotalEnergyCutLow(getValueClusterTotalEnergy(cluster));
     }
     
     /**
@@ -450,12 +450,12 @@
      * @return Returns displacement of the cluster.
      */
     public static double getClusterDistance(Cluster cluster) {
-    	// Get the variables from the cluster.
-    	double x = getClusterX(cluster);
-    	double y = getClusterY(cluster);
-    	
-    	// Perform the calculation.
-    	return getClusterDistance(x, y);
+        // Get the variables from the cluster.
+        double x = getClusterX(cluster);
+        double y = getClusterY(cluster);
+        
+        // Perform the calculation.
+        return getClusterDistance(x, y);
     }
     
     /**
@@ -465,12 +465,12 @@
      * @return Returns displacement of the cluster.
      */
     public static double getClusterDistance(SSPCluster cluster) {
-    	// Get the variables from the cluster.
-    	double x = getClusterX(cluster);
-    	double y = getClusterY(cluster);
-    	
-    	// Perform the calculation.
-    	return getClusterDistance(x, y);
+        // Get the variables from the cluster.
+        double x = getClusterX(cluster);
+        double y = getClusterY(cluster);
+        
+        // Perform the calculation.
+        return getClusterDistance(x, y);
     }
     
     /**
@@ -480,7 +480,7 @@
      * @return Returns the size as an <code>int</code>.
      */
     public static final double getClusterHitCount(Cluster cluster) {
-    	return cluster.getCalorimeterHits().size();
+        return cluster.getCalorimeterHits().size();
     }
     
     /**
@@ -490,7 +490,7 @@
      * @return Returns the size as an <code>int</code>.
      */
     public static final double getClusterHitCount(SSPCluster cluster) {
-    	return cluster.getHitCount();
+        return cluster.getHitCount();
     }
     
     /**
@@ -500,11 +500,11 @@
      * object.
      */
     public static final CalorimeterHit getClusterSeedHit(Cluster cluster) {
-    	if(getClusterHitCount(cluster) > 0) {
-    		return cluster.getCalorimeterHits().get(0);
-    	} else {
-    		throw new NullPointerException("Cluster does not define hits!");
-    	}
+        if(getClusterHitCount(cluster) > 0) {
+            return cluster.getCalorimeterHits().get(0);
+        } else {
+            throw new NullPointerException("Cluster does not define hits!");
+        }
     }
     
     /**
@@ -514,7 +514,7 @@
      * @return Returns the time as a <code>double</code>.
      */
     public static final double getClusterTime(Cluster cluster) {
-    	return getClusterSeedHit(cluster).getTime();
+        return getClusterSeedHit(cluster).getTime();
     }
     
     /**
@@ -524,7 +524,7 @@
      * @return Returns the time as a <code>double</code>.
      */
     public static final double getClusterTime(SSPCluster cluster) {
-    	return cluster.getTime();
+        return cluster.getTime();
     }
     
     /**
@@ -534,7 +534,7 @@
      * @return Returns the cluster x-position.
      */
     public static double getClusterX(Cluster cluster) {
-    	return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[0];
+        return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[0];
     }
     
     /**
@@ -544,7 +544,7 @@
      * @return Returns the cluster x-position.
      */
     public static double getClusterX(SSPCluster cluster) {
-    	return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[0];
+        return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[0];
     }
     
     /**
@@ -553,7 +553,7 @@
      * @return Returns the index as an <code>int</code>.
      */
     public static final int getClusterXIndex(Cluster cluster) {
-    	return getClusterSeedHit(cluster).getIdentifierFieldValue("ix");
+        return getClusterSeedHit(cluster).getIdentifierFieldValue("ix");
     }
     
     /**
@@ -562,7 +562,7 @@
      * @return Returns the index as an <code>int</code>.
      */
     public static final int getClusterXIndex(SSPCluster cluster) {
-    	return cluster.getXIndex();
+        return cluster.getXIndex();
     }
     
     /**
@@ -572,7 +572,7 @@
      * @return Returns the cluster y-position.
      */
     public static double getClusterY(Cluster cluster) {
-    	return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[1];
+        return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[1];
     }
     
     /**
@@ -582,7 +582,7 @@
      * @return Returns the cluster y-position.
      */
     public static double getClusterY(SSPCluster cluster) {
-    	return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[1];
+        return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[1];
     }
     
     /**
@@ -591,7 +591,7 @@
      * @return Returns the index as an <code>int</code>.
      */
     public static final int getClusterYIndex(Cluster cluster) {
-    	return getClusterSeedHit(cluster).getIdentifierFieldValue("iy");
+        return getClusterSeedHit(cluster).getIdentifierFieldValue("iy");
     }
     
     /**
@@ -600,7 +600,7 @@
      * @return Returns the index as an <code>int</code>.
      */
     public static final int getClusterYIndex(SSPCluster cluster) {
-    	return cluster.getYIndex();
+        return cluster.getYIndex();
     }
     
     /**
@@ -610,7 +610,7 @@
      * @return Returns the cluster z-position.
      */
     public static double getClusterZ(Cluster cluster) {
-    	return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[2];
+        return getCrystalPosition(getClusterXIndex(cluster), getClusterYIndex(cluster))[2];
     }
     
     /**
@@ -620,7 +620,7 @@
      * @return Returns the cluster z-position.
      */
     public static double getClusterZ(SSPCluster cluster) {
-    	return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[2];
+        return getCrystalPosition(cluster.getXIndex(), cluster.getYIndex())[2];
     }
     
     /**
@@ -632,48 +632,48 @@
      * first entry in the array is always the top cluster, with the
      * bottom cluster in the next position.
      */
-	public static <E> List<E[]> getTopBottomPairs(List<E> clusters, Class<E> clusterType) throws IllegalArgumentException {
-		// Ensure that only valid cluster types are processed.
-		if(!clusterType.equals(Cluster.class) && !clusterType.equals(SSPCluster.class)) {
-			throw new IllegalArgumentException("Class \"" + clusterType.getSimpleName() + "\" is not a supported cluster type.");
-		}
-		
-    	// Create a list to store top clusters, bottom clusters, and
-    	// cluster pairs.
-    	List<E> topClusters = new ArrayList<E>();
-    	List<E> botClusters = new ArrayList<E>();
-    	List<E[]> pairClusters = new ArrayList<E[]>();
-    	
-    	// Separate the cluster list into top/bottom clusters.
-    	for(E cluster : clusters) {
-    		// Process LCIO clusters...
-    		if(clusterType.equals(Cluster.class)) {
-				if(getClusterYIndex((Cluster) cluster) > 0) {
-					topClusters.add(cluster);
-				} else { botClusters.add(cluster); }
-    		}
-    		
-    		// Process SSP clusters...
-    		else if(clusterType.equals(SSPCluster.class)) {
-				if(getClusterYIndex((SSPCluster) cluster) > 0) {
-					topClusters.add(cluster);
-				} else { botClusters.add(cluster); }
-    		}
-    	}
-    	
-    	// Form all top/bottom cluster pairs.
-    	for(E topCluster : topClusters) {
-    		for(E botCluster : botClusters) {
-    			@SuppressWarnings("unchecked")
-				E[] pair = (E[]) Array.newInstance(clusterType, 2);
-    			pair[0] = topCluster;
-    			pair[1] = botCluster;
-    			pairClusters.add(pair);
-    		}
-    	}
-    	
-    	// Return the cluster pairs.
-    	return pairClusters;
+    public static <E> List<E[]> getTopBottomPairs(List<E> clusters, Class<E> clusterType) throws IllegalArgumentException {
+        // Ensure that only valid cluster types are processed.
+        if(!clusterType.equals(Cluster.class) && !clusterType.equals(SSPCluster.class)) {
+            throw new IllegalArgumentException("Class \"" + clusterType.getSimpleName() + "\" is not a supported cluster type.");
+        }
+        
+        // Create a list to store top clusters, bottom clusters, and
+        // cluster pairs.
+        List<E> topClusters = new ArrayList<E>();
+        List<E> botClusters = new ArrayList<E>();
+        List<E[]> pairClusters = new ArrayList<E[]>();
+        
+        // Separate the cluster list into top/bottom clusters.
+        for(E cluster : clusters) {
+            // Process LCIO clusters...
+            if(clusterType.equals(Cluster.class)) {
+                if(getClusterYIndex((Cluster) cluster) > 0) {
+                    topClusters.add(cluster);
+                } else { botClusters.add(cluster); }
+            }
+            
+            // Process SSP clusters...
+            else if(clusterType.equals(SSPCluster.class)) {
+                if(getClusterYIndex((SSPCluster) cluster) > 0) {
+                    topClusters.add(cluster);
+                } else { botClusters.add(cluster); }
+            }
+        }
+        
+        // Form all top/bottom cluster pairs.
+        for(E topCluster : topClusters) {
+            for(E botCluster : botClusters) {
+                @SuppressWarnings("unchecked")
+                E[] pair = (E[]) Array.newInstance(clusterType, 2);
+                pair[0] = topCluster;
+                pair[1] = botCluster;
+                pairClusters.add(pair);
+            }
+        }
+        
+        // Return the cluster pairs.
+        return pairClusters;
     }
     
     /**
@@ -685,29 +685,29 @@
      * first entry in the array is always the top cluster, with the
      * bottom cluster in the next position.
      */
-	public static List<Cluster[]> getTopBottomPairs(Cluster... clusters) {
-    	// Create a list to store top clusters, bottom clusters, and
-    	// cluster pairs.
-    	List<Cluster> topClusters = new ArrayList<Cluster>();
-    	List<Cluster> botClusters = new ArrayList<Cluster>();
-    	List<Cluster[]> pairClusters = new ArrayList<Cluster[]>();
-    	
-    	// Separate the cluster list into top/bottom clusters.
-    	for(Cluster cluster : clusters) {
-			if(getClusterYIndex(cluster) > 0) {
-				topClusters.add(cluster);
-			} else { botClusters.add(cluster); }
-    	}
-    	
-    	// Form all top/bottom cluster pairs.
-    	for(Cluster topCluster : topClusters) {
-    		for(Cluster botCluster : botClusters) {
-    			pairClusters.add(new Cluster[] { topCluster, botCluster });
-    		}
-    	}
-    	
-    	// Return the cluster pairs.
-    	return pairClusters;
+    public static List<Cluster[]> getTopBottomPairs(Cluster... clusters) {
+        // Create a list to store top clusters, bottom clusters, and
+        // cluster pairs.
+        List<Cluster> topClusters = new ArrayList<Cluster>();
+        List<Cluster> botClusters = new ArrayList<Cluster>();
+        List<Cluster[]> pairClusters = new ArrayList<Cluster[]>();
+        
+        // Separate the cluster list into top/bottom clusters.
+        for(Cluster cluster : clusters) {
+            if(getClusterYIndex(cluster) > 0) {
+                topClusters.add(cluster);
+            } else { botClusters.add(cluster); }
+        }
+        
+        // Form all top/bottom cluster pairs.
+        for(Cluster topCluster : topClusters) {
+            for(Cluster botCluster : botClusters) {
+                pairClusters.add(new Cluster[] { topCluster, botCluster });
+            }
+        }
+        
+        // Return the cluster pairs.
+        return pairClusters;
     }
     
     /**
@@ -719,29 +719,29 @@
      * The first entry in the array is always the top cluster, with
      * the bottom cluster in the next position.
      */
-	public static List<SSPCluster[]> getTopBottomPairs(SSPCluster... clusters) {
-    	// Create a list to store top clusters, bottom clusters, and
-    	// cluster pairs.
-    	List<SSPCluster> topClusters = new ArrayList<SSPCluster>();
-    	List<SSPCluster> botClusters = new ArrayList<SSPCluster>();
-    	List<SSPCluster[]> pairClusters = new ArrayList<SSPCluster[]>();
-    	
-    	// Separate the cluster list into top/bottom clusters.
-    	for(SSPCluster cluster : clusters) {
-			if(getClusterYIndex(cluster) > 0) {
-				topClusters.add(cluster);
-			} else { botClusters.add(cluster); }
-    	}
-    	
-    	// Form all top/bottom cluster pairs.
-    	for(SSPCluster topCluster : topClusters) {
-    		for(SSPCluster botCluster : botClusters) {
-    			pairClusters.add(new SSPCluster[] { topCluster, botCluster });
-    		}
-    	}
-    	
-    	// Return the cluster pairs.
-    	return pairClusters;
+    public static List<SSPCluster[]> getTopBottomPairs(SSPCluster... clusters) {
+        // Create a list to store top clusters, bottom clusters, and
+        // cluster pairs.
+        List<SSPCluster> topClusters = new ArrayList<SSPCluster>();
+        List<SSPCluster> botClusters = new ArrayList<SSPCluster>();
+        List<SSPCluster[]> pairClusters = new ArrayList<SSPCluster[]>();
+        
+        // Separate the cluster list into top/bottom clusters.
+        for(SSPCluster cluster : clusters) {
+            if(getClusterYIndex(cluster) > 0) {
+                topClusters.add(cluster);
+            } else { botClusters.add(cluster); }
+        }
+        
+        // Form all top/bottom cluster pairs.
+        for(SSPCluster topCluster : topClusters) {
+            for(SSPCluster botCluster : botClusters) {
+                pairClusters.add(new SSPCluster[] { topCluster, botCluster });
+            }
+        }
+        
+        // Return the cluster pairs.
+        return pairClusters;
     }
     
     /**
@@ -805,12 +805,12 @@
      * @return Returns the cut value.
      */
     public static double getValueCoplanarity(Cluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
-    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
-    	
-    	// Return the calculated value.
-    	return getValueCoplanarity(x, y);
+        // Get the variables used by the calculation.
+        double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+        double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+        
+        // Return the calculated value.
+        return getValueCoplanarity(x, y);
     }
     
     /**
@@ -821,12 +821,12 @@
      * @return Returns the cut value.
      */
     public static double getValueCoplanarity(SSPCluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
-    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
-    	
-    	// Return the calculated value.
-    	return getValueCoplanarity(x, y);
+        // Get the variables used by the calculation.
+        double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+        double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+        
+        // Return the calculated value.
+        return getValueCoplanarity(x, y);
     }
     
     /**
@@ -838,14 +838,14 @@
      */
     @Deprecated
     public static double getValueCoplanarityLegacy(Cluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double x[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("ix"),
-    			getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("ix") };
-    	double y[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("iy"),
-    			getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("iy") };
-    	
-    	// Return the calculated value.
-    	return getValueCoplanarityLegacy(x, y);
+        // Get the variables used by the calculation.
+        double x[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("ix"),
+                getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("ix") };
+        double y[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("iy"),
+                getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("iy") };
+        
+        // Return the calculated value.
+        return getValueCoplanarityLegacy(x, y);
     }
     
     /**
@@ -855,10 +855,10 @@
      * @return Returns the difference between the cluster energies.
      */
     public static double getValueEnergyDifference(Cluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	
-    	// Perform the calculation.
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        
+        // Perform the calculation.
         return getValueEnergyDifference(energy);
     }
     
@@ -869,10 +869,10 @@
      * @return Returns the difference between the cluster energies.
      */
     public static double getValueEnergyDifference(SSPCluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	
-    	// Perform the calculation.
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        
+        // Perform the calculation.
         return getValueEnergyDifference(energy);
     }
     
@@ -885,13 +885,13 @@
      * @return Returns the energy slope value.
      */
     public static double getValueEnergySlope(Cluster[] clusterPair, double energySlopeParamF) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
-    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
-    	
-    	// Perform the calculation.
-    	return getValueEnergySlope(energy, x, y, energySlopeParamF);
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+        double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+        
+        // Perform the calculation.
+        return getValueEnergySlope(energy, x, y, energySlopeParamF);
     }
     
     /**
@@ -903,13 +903,13 @@
      * @return Returns the energy slope value.
      */
     public static double getValueEnergySlope(SSPCluster[] clusterPair, double energySlopeParamF) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
-    	double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
-    	
-    	// Perform the calculation.
-    	return getValueEnergySlope(energy, x, y, energySlopeParamF);
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        double x[] = { getClusterX(clusterPair[0]), getClusterX(clusterPair[1]) };
+        double y[] = { getClusterY(clusterPair[0]), getClusterY(clusterPair[1]) };
+        
+        // Perform the calculation.
+        return getValueEnergySlope(energy, x, y, energySlopeParamF);
     }
     
     /**
@@ -924,15 +924,15 @@
      */
     @Deprecated
     public static double getValueEnergySlopeLegacy(Cluster[] clusterPair, double energySlopeParamF) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	double x[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("ix"),
-    			getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("ix") };
-    	double y[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("iy"),
-    			getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("iy") };
-    	
-    	// Perform the calculation.
-    	return getValueEnergySlopeLegacy(energy, x, y, energySlopeParamF);
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        double x[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("ix"),
+                getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("ix") };
+        double y[] = { getClusterSeedHit(clusterPair[0]).getIdentifierFieldValue("iy"),
+                getClusterSeedHit(clusterPair[1]).getIdentifierFieldValue("iy") };
+        
+        // Perform the calculation.
+        return getValueEnergySlopeLegacy(energy, x, y, energySlopeParamF);
     }
     
     /**
@@ -942,11 +942,11 @@
      * @return Returns the sum of the cluster energies.
      */
     public static double getValueEnergySum(Cluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	
-    	// Perform the calculation.
-    	return getValueEnergySum(energy);
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        
+        // Perform the calculation.
+        return getValueEnergySum(energy);
     }
     
     /**
@@ -956,11 +956,11 @@
      * @return Returns the sum of the cluster energies.
      */
     public static double getValueEnergySum(SSPCluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
-    	
-    	// Perform the calculation.
-    	return getValueEnergySum(energy);
+        // Get the variables used by the calculation.
+        double[] energy = { clusterPair[0].getEnergy(), clusterPair[1].getEnergy() };
+        
+        // Perform the calculation.
+        return getValueEnergySum(energy);
     }
     
     /**
@@ -970,12 +970,12 @@
      * @return Returns the absolute difference in the cluster times..
      */
     public static double getValueTimeCoincidence(Cluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] time = { clusterPair[0].getCalorimeterHits().get(0).getTime(),
-    			clusterPair[1].getCalorimeterHits().get(0).getTime() };
-    	
-    	// Perform the calculation.
-    	return getValueTimeCoincidence(time);
+        // Get the variables used by the calculation.
+        double[] time = { clusterPair[0].getCalorimeterHits().get(0).getTime(),
+                clusterPair[1].getCalorimeterHits().get(0).getTime() };
+        
+        // Perform the calculation.
+        return getValueTimeCoincidence(time);
     }
     
     /**
@@ -985,34 +985,34 @@
      * @return Returns the absolute difference in the cluster times..
      */
     public static double getValueTimeCoincidence(SSPCluster[] clusterPair) {
-    	// Get the variables used by the calculation.
-    	double[] time = { clusterPair[0].getTime(), clusterPair[1].getTime() };
-    	
-    	// Perform the calculation.
-    	return getValueTimeCoincidence(time);
-    }
-    
-    /**
-	 * Indicates whether the argument cluster is located in the fiducial
-	 * region or not.
-	 * @param cluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is located in
-	 * the fiducial region and <code>false</code> otherwise.
-	 */
-	public static final boolean inFiducialRegion(Cluster cluster) {
-		return inFiducialRegion(getClusterXIndex(cluster), getClusterYIndex(cluster));
-	}
-    
-    /**
-	 * Indicates whether the argument cluster is located in the fiducial
-	 * region or not.
-	 * @param cluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is located in
-	 * the fiducial region and <code>false</code> otherwise.
-	 */
-	public static final boolean inFiducialRegion(SSPCluster cluster) {
-		return inFiducialRegion(getClusterXIndex(cluster), getClusterYIndex(cluster));
-	}
+        // Get the variables used by the calculation.
+        double[] time = { clusterPair[0].getTime(), clusterPair[1].getTime() };
+        
+        // Perform the calculation.
+        return getValueTimeCoincidence(time);
+    }
+    
+    /**
+     * Indicates whether the argument cluster is located in the fiducial
+     * region or not.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is located in
+     * the fiducial region and <code>false</code> otherwise.
+     */
+    public static final boolean inFiducialRegion(Cluster cluster) {
+        return inFiducialRegion(getClusterXIndex(cluster), getClusterYIndex(cluster));
+    }
+    
+    /**
+     * Indicates whether the argument cluster is located in the fiducial
+     * region or not.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is located in
+     * the fiducial region and <code>false</code> otherwise.
+     */
+    public static final boolean inFiducialRegion(SSPCluster cluster) {
+        return inFiducialRegion(getClusterXIndex(cluster), getClusterYIndex(cluster));
+    }
     
     /**
      * Checks if a cluster pair is coplanar to the beam within a given
@@ -1094,7 +1094,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCut(Cluster[] clusterPair) {
-    	return pairEnergySumCut(getValueEnergySum(clusterPair));
+        return pairEnergySumCut(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1106,7 +1106,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCutHigh(Cluster[] clusterPair) {
-    	return pairEnergySumCutHigh(getValueEnergySum(clusterPair));
+        return pairEnergySumCutHigh(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1118,7 +1118,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCutLow(Cluster[] clusterPair) {
-    	return pairEnergySumCutLow(getValueEnergySum(clusterPair));
+        return pairEnergySumCutLow(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1131,7 +1131,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCut(SSPCluster[] clusterPair) {
-    	return pairEnergySumCut(getValueEnergySum(clusterPair));
+        return pairEnergySumCut(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1143,7 +1143,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCutHigh(SSPCluster[] clusterPair) {
-    	return pairEnergySumCutHigh(getValueEnergySum(clusterPair));
+        return pairEnergySumCutHigh(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1155,7 +1155,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairEnergySumCutLow(SSPCluster[] clusterPair) {
-    	return pairEnergySumCutLow(getValueEnergySum(clusterPair));
+        return pairEnergySumCutLow(getValueEnergySum(clusterPair));
     }
     
     /**
@@ -1167,7 +1167,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairTimeCoincidenceCut(Cluster[] clusterPair) {
-    	return pairTimeCoincidenceCut(getValueTimeCoincidence(clusterPair));
+        return pairTimeCoincidenceCut(getValueTimeCoincidence(clusterPair));
     }
     
     /**
@@ -1179,7 +1179,7 @@
      * the cut and <code>false</code> if it does not.
      */
     public boolean pairTimeCoincidenceCut(SSPCluster[] clusterPair) {
-    	return pairTimeCoincidenceCut(getValueTimeCoincidence(clusterPair));
+        return pairTimeCoincidenceCut(getValueTimeCoincidence(clusterPair));
     }
     
     /**
@@ -1280,22 +1280,22 @@
      * the x-index and either of the cases where <code>iy == 0</code>
      * or <code>|iy| > 5</code> for the y-index.
      */
-	private static double[] getCrystalPosition(int ix, int iy) throws IndexOutOfBoundsException {
-		// Make sure that the requested crystal is a valid crystal.
-		if(ix == 0 || ix < -23 || ix > 23) {
-			throw new IndexOutOfBoundsException(String.format("Value \"%d\" is invalid for field x-index.", ix));
-		} if(iy == 0 || iy < -5 || iy > 5) {
-			throw new IndexOutOfBoundsException(String.format("Value \"%d\" is invalid for field y-index.", iy));
-		}
-		
-		// Get the position map.
-		double posMap[];
-		if(ix < 1) { posMap = position[5 - iy][22 - ix]; }
-		else { posMap = position[5 - iy][23 - ix]; }
-		
-		// Return the corrected mapped position.
-		return new double[] { posMap[0], posMap[2], posMap[1] };
-	}
+    private static double[] getCrystalPosition(int ix, int iy) throws IndexOutOfBoundsException {
+        // Make sure that the requested crystal is a valid crystal.
+        if(ix == 0 || ix < -23 || ix > 23) {
+            throw new IndexOutOfBoundsException(String.format("Value \"%d\" is invalid for field x-index.", ix));
+        } if(iy == 0 || iy < -5 || iy > 5) {
+            throw new IndexOutOfBoundsException(String.format("Value \"%d\" is invalid for field y-index.", iy));
+        }
+        
+        // Get the position map.
+        double posMap[];
+        if(ix < 1) { posMap = position[5 - iy][22 - ix]; }
+        else { posMap = position[5 - iy][23 - ix]; }
+        
+        // Return the corrected mapped position.
+        return new double[] { posMap[0], posMap[2], posMap[1] };
+    }
     
     /**
      * Calculates the value used by the coplanarity cut.
@@ -1309,7 +1309,7 @@
         // Get the cluster angles.
         int[] clusterAngle = new int[2];
         for(int i = 0; i < 2; i++) {
-        	clusterAngle[i] = (int) Math.round(Math.atan(x[i] / y[i]) * 180.0 / Math.PI);
+            clusterAngle[i] = (int) Math.round(Math.atan(x[i] / y[i]) * 180.0 / Math.PI);
         }
         
         // Calculate the coplanarity cut value.
@@ -1357,9 +1357,9 @@
      * @return Returns the cut value.
      */
     private static double getValueEnergySlope(double energy[], double x[], double y[], double energySlopeParamF) {
-    	// Determine which cluster is the lower-energy cluster.
-    	int lei = energy[0] < energy[1] ? 0 : 1;
-    	
+        // Determine which cluster is the lower-energy cluster.
+        int lei = energy[0] < energy[1] ? 0 : 1;
+        
         // E + R*F
         // Get the low energy cluster energy.
         double slopeParamE = energy[lei];
@@ -1383,9 +1383,9 @@
      */
     @Deprecated
     private static double getValueEnergySlopeLegacy(double energy[], double x[], double y[], double energySlopeParamF) {
-    	// Determine which cluster is the lower-energy cluster.
-    	int lei = energy[0] < energy[1] ? 0 : 1;
-    	
+        // Determine which cluster is the lower-energy cluster.
+        int lei = energy[0] < energy[1] ? 0 : 1;
+        
         // E + R*F
         // Get the low energy cluster energy.
         double slopeParamE = energy[lei];
@@ -1415,52 +1415,52 @@
      * the two clusters.
      */
     private static double getValueTimeCoincidence(double[] time) {
-    	return Math.abs(time[0] - time[1]);
-    }
-    
-    /**
-	 * Indicates whether the argument cluster is located in the fiducial
-	 * region or not.
-	 * @param cluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is located in
-	 * the fiducial region and <code>false</code> otherwise.
-	 */
-	private static final boolean inFiducialRegion(int ix, int iy) {
-		// Get the x and y indices for the cluster.
-		int absx = Math.abs(ix);
-		int absy = Math.abs(iy);
-		
-		// Check if the cluster is on the top or the bottom of the
-		// calorimeter, as defined by |y| == 5. This is an edge cluster
-		// and is not in the fiducial region.
-		if(absy == 5) {
-			return false;
-		}
-		
-		// Check if the cluster is on the extreme left or right side
-		// of the calorimeter, as defined by |x| == 23. This is also
-		// and edge cluster is not in the fiducial region.
-		if(absx == 23) {
-			return false;
-		}
-		
-		// Check if the cluster is along the beam gap, as defined by
-		// |y| == 1. This is an internal edge cluster and is not in the
-		// fiducial region.
-		if(absy == 1) {
-			return false;
-		}
-		
-		// Lastly, check if the cluster falls along the beam hole, as
-		// defined by clusters with -11 <= x <= -1 and |y| == 2. This
-		// is not the fiducial region.
-		if(absy == 2 && ix <= -1 && ix >= -11) {
-			return false;
-		}
-		
-		// If all checks fail, the cluster is in the fiducial region.
-		return true;
-	}
+        return Math.abs(time[0] - time[1]);
+    }
+    
+    /**
+     * Indicates whether the argument cluster is located in the fiducial
+     * region or not.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is located in
+     * the fiducial region and <code>false</code> otherwise.
+     */
+    private static final boolean inFiducialRegion(int ix, int iy) {
+        // Get the x and y indices for the cluster.
+        int absx = Math.abs(ix);
+        int absy = Math.abs(iy);
+        
+        // Check if the cluster is on the top or the bottom of the
+        // calorimeter, as defined by |y| == 5. This is an edge cluster
+        // and is not in the fiducial region.
+        if(absy == 5) {
+            return false;
+        }
+        
+        // Check if the cluster is on the extreme left or right side
+        // of the calorimeter, as defined by |x| == 23. This is also
+        // and edge cluster is not in the fiducial region.
+        if(absx == 23) {
+            return false;
+        }
+        
+        // Check if the cluster is along the beam gap, as defined by
+        // |y| == 1. This is an internal edge cluster and is not in the
+        // fiducial region.
+        if(absy == 1) {
+            return false;
+        }
+        
+        // Lastly, check if the cluster falls along the beam hole, as
+        // defined by clusters with -11 <= x <= -1 and |y| == 2. This
+        // is not the fiducial region.
+        if(absy == 2 && ix <= -1 && ix >= -11) {
+            return false;
+        }
+        
+        // If all checks fail, the cluster is in the fiducial region.
+        return true;
+    }
     
     /**
      * Checks if a coplanarity angle is within threshold.
@@ -1536,7 +1536,7 @@
      * the cut and <code>false</code> if it does not.
      */
     private boolean pairTimeCoincidenceCut(double timeDifference) {
-    	return (timeDifference <= cuts.get(PAIR_TIME_COINCIDENCE));
+        return (timeDifference <= cuts.get(PAIR_TIME_COINCIDENCE));
     }
     
     /**
@@ -1549,193 +1549,193 @@
      * Note that in this table, position[][] = { x, z, y } by in the
      * coordinate system employed by the rest of the class.
      */
-	private static final double[][][] position = {
-		{	{ -340.003,   97.065,   87.845 }, { -324.283,   97.450,   87.875 }, { -308.648,   97.810,   87.900 },
-			{ -293.093,   98.150,   87.920 }, { -277.618,   98.470,   87.940 }, { -262.213,   98.765,   87.965 },
-			{ -246.878,   99.040,   87.980 }, { -231.603,   99.290,   87.995 }, { -216.393,   99.520,   88.010 },
-			{ -201.228,   99.725,   88.030 }, { -186.118,   99.905,   88.040 }, { -171.058,  100.070,   88.050 },
-			{ -156.038,  100.205,   88.055 }, { -141.058,  100.325,   88.070 }, { -126.113,  100.415,   88.075 },
-			{ -111.198,  100.485,   88.075 }, {  -96.313,  100.530,   88.080 }, {  -81.453,  100.555,   88.085 },
-			{  -66.608,  100.560,   88.085 }, {  -51.788,  100.540,   88.080 }, {  -36.983,  100.490,   88.075 },
-			{  -22.183,  100.425,   88.075 }, {   -7.393,  100.335,   88.070 }, {    7.393,  100.335,   88.070 },
-			{   22.183,  100.425,   88.075 }, {   36.983,  100.490,   88.075 }, {   51.793,  100.540,   88.080 },
-			{   66.613,  100.560,   88.085 }, {   81.453,  100.555,   88.085 }, {   96.313,  100.530,   88.080 },
-			{  111.198,  100.485,   88.075 }, {  126.113,  100.415,   88.075 }, {  141.053,  100.325,   88.070 },
-			{  156.038,  100.205,   88.055 }, {  171.053,  100.070,   88.050 }, {  186.118,   99.905,   88.040 },
-			{  201.228,   99.725,   88.030 }, {  216.388,   99.520,   88.010 }, {  231.608,   99.290,   87.995 },
-			{  246.878,   99.040,   87.980 }, {  262.218,   98.765,   87.965 }, {  277.623,   98.470,   87.940 },
-			{  293.098,   98.150,   87.920 }, {  308.653,   97.810,   87.900 }, {  324.288,   97.450,   87.875 },
-			{  340.008,   97.065,   87.845 }
-		},
-		{	{ -340.003,   97.040,   72.715 }, { -324.283,   97.420,   72.735 }, { -308.648,   97.785,   72.750 },
-			{ -293.093,   98.125,   72.765 }, { -277.618,   98.450,   72.785 }, { -262.213,   98.745,   72.800 },
-			{ -246.878,   99.015,   72.815 }, { -231.603,   99.265,   72.825 }, { -216.388,   99.495,   72.840 },
-			{ -201.228,   99.700,   72.850 }, { -186.118,   99.885,   72.860 }, { -171.058,  100.045,   72.865 },
-			{ -156.033,  100.185,   72.875 }, { -141.053,  100.300,   72.880 }, { -126.108,  100.395,   72.880 },
-			{ -111.193,  100.460,   72.890 }, {  -96.308,  100.510,   72.890 }, {  -81.448,  100.535,   72.895 },
-			{  -66.608,  100.535,   72.890 }, {  -51.788,  100.510,   72.890 }, {  -36.978,  100.470,   72.890 },
-			{  -22.183,  100.405,   72.880 }, {   -7.388,  100.310,   72.880 }, {    7.393,  100.310,   72.880 },
-			{   22.188,  100.405,   72.885 }, {   36.983,  100.470,   72.890 }, {   51.793,  100.510,   72.890 },
-			{   66.613,  100.535,   72.890 }, {   81.453,  100.535,   72.895 }, {   96.313,  100.510,   72.890 },
-			{  111.198,  100.460,   72.890 }, {  126.113,  100.395,   72.880 }, {  141.063,  100.300,   72.880 },
-			{  156.043,  100.185,   72.875 }, {  171.063,  100.045,   72.865 }, {  186.123,   99.885,   72.860 },
-			{  201.233,   99.700,   72.850 }, {  216.393,   99.495,   72.840 }, {  231.608,   99.265,   72.825 },
-			{  246.883,   99.015,   72.815 }, {  262.218,   98.745,   72.800 }, {  277.623,   98.450,   72.785 },
-			{  293.098,   98.125,   72.765 }, {  308.653,   97.785,   72.750 }, {  324.288,   97.420,   72.735 },
-			{  340.008,   97.040,   72.715 }
-		},
-		{	{ -340.003,   96.990,   57.600 }, { -324.283,   97.375,   57.610 }, { -308.648,   97.740,   57.625 },
-			{ -293.093,   98.080,   57.630 }, { -277.618,   98.395,   57.645 }, { -262.213,   98.700,   57.655 },
-			{ -246.873,   98.970,   57.660 }, { -231.603,   99.220,   57.670 }, { -216.383,   99.450,   57.680 },
-			{ -201.228,   99.660,   57.685 }, { -186.113,   99.840,   57.695 }, { -171.053,  100.005,   57.695 },
-			{ -156.033,  100.140,   57.700 }, { -141.053,  100.255,   57.710 }, { -126.108,  100.345,   57.710 },
-			{ -111.193,  100.420,   57.710 }, {  -96.308,  100.465,   57.715 }, {  -81.448,  100.490,   57.715 },
-			{  -66.608,  100.490,   57.715 }, {  -51.788,  100.470,   57.710 }, {  -36.978,  100.425,   57.710 },
-			{  -22.178,  100.355,   57.710 }, {   -7.388,  100.265,   57.705 }, {    7.398,  100.265,   57.705 },
-			{   22.188,  100.355,   57.710 }, {   36.988,  100.425,   57.710 }, {   51.793,  100.470,   57.710 },
-			{   66.613,  100.490,   57.715 }, {   81.458,  100.490,   57.715 }, {   96.318,  100.465,   57.715 },
-			{  111.198,  100.420,   57.710 }, {  126.118,  100.345,   57.710 }, {  141.063,  100.255,   57.710 },
-			{  156.043,  100.140,   57.700 }, {  171.063,  100.005,   57.695 }, {  186.123,   99.840,   57.695 },
-			{  201.233,   99.660,   57.685 }, {  216.393,   99.450,   57.680 }, {  231.608,   99.220,   57.670 },
-			{  246.883,   98.970,   57.660 }, {  262.218,   98.700,   57.655 }, {  277.623,   98.395,   57.645 },
-			{  293.098,   98.080,   57.630 }, {  308.653,   97.740,   57.625 }, {  324.288,   97.375,   57.610 },
-			{  340.008,   96.990,   57.600 }
-		},
-		{	{ -340.003,   96.925,   42.490 }, { -324.283,   97.305,   42.495 }, { -308.648,   97.675,   42.505 },
-			{ -293.093,   98.010,   42.510 }, { -277.618,   98.330,   42.510 }, { -262.213,   98.625,   42.515 },
-			{ -246.873,   98.900,   42.525 }, { -231.603,   99.155,   42.530 }, { -216.383,   99.385,   42.535 },
-			{ -201.223,   99.590,   42.530 }, { -186.113,   99.775,   42.535 }, { -171.048,   99.930,   42.540 },
-			{ -156.033,  100.070,   42.545 }, { -141.048,  100.185,   42.545 }, { -126.108,  100.280,   42.550 },
-			{ -111.193,  100.350,   42.545 }, {  -96.308,  100.400,   42.545 }, {  -81.448,  100.420,   42.550 },
-			{  -66.608,  100.425,   42.550 }, {  -51.788,  100.405,   42.550 }, {  -36.978,  100.355,   42.545 },
-			{  -22.178,  100.290,   42.545 }, {   -7.388,  100.200,   42.545 }, {    7.398,  100.200,   42.545 },
-			{   22.188,  100.290,   42.545 }, {   36.988,  100.355,   42.545 }, {   51.793,  100.405,   42.550 },
-			{   66.613,  100.425,   42.550 }, {   81.458,  100.420,   42.550 }, {   96.318,  100.400,   42.545 },
-			{  111.198,  100.350,   42.545 }, {  126.118,  100.280,   42.550 }, {  141.063,  100.185,   42.545 },
-			{  156.043,  100.070,   42.545 }, {  171.063,   99.930,   42.540 }, {  186.123,   99.775,   42.535 },
-			{  201.233,   99.590,   42.530 }, {  216.393,   99.385,   42.535 }, {  231.608,   99.155,   42.530 },
-			{  246.883,   98.900,   42.525 }, {  262.218,   98.625,   42.515 }, {  277.628,   98.330,   42.510 },
-			{  293.098,   98.010,   42.510 }, {  308.653,   97.675,   42.505 }, {  324.288,   97.305,   42.495 },
-			{  340.008,   96.925,   42.490 }
-		},
-		{	{ -340.003,   96.830,   27.385 }, { -324.278,   97.215,   27.385 }, { -308.648,   97.575,   27.385 },
-			{ -293.093,   97.915,   27.385 }, { -277.613,   98.240,   27.385 }, { -262.213,   98.535,   27.385 },
-			{ -246.878,   98.810,   27.385 }, { -231.603,   99.060,   27.385 }, { -216.383,   99.290,   27.385 },
-			{ -201.223,   99.495,   27.385 }, { -186.113,   99.680,   27.385 }, { -171.048,   99.840,   27.385 },
-			{ -156.033,   99.980,   27.385 }, { -141.048,  100.095,   27.385 }, { -126.103,  100.185,   27.385 },
-			{ -111.193,  100.255,   27.385 }, {  -96.303,  100.305,   27.385 }, {  -81.448,  100.330,   27.385 },
-			{  -66.608,  100.330,   27.385 }, {  -51.783,  100.310,   27.385 }, {  -36.973,  100.265,   27.385 },
-			{  -22.178,  100.200,   27.385 }, {   -7.388,  100.105,   27.385 }, {    7.403,  100.105,   27.385 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{  156.078,   99.980,   27.385 }, {  171.103,   99.840,   27.385 }, {  186.168,   99.680,   27.385 },
-			{  201.268,   99.495,   27.385 }, {  216.423,   99.290,   27.385 }, {  231.638,   99.060,   27.385 },
-			{  246.913,   98.810,   27.385 }, {  262.248,   98.535,   27.385 }, {  277.658,   98.240,   27.385 },
-			{  293.133,   97.920,   27.385 }, {  308.688,   97.575,   27.385 }, {  324.323,   97.215,   27.385 },
-			{  340.043,   96.830,   27.385 }
-		},
-		{	{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }
-		},
-		{	{ -339.998,   96.840,  -27.330 }, { -324.278,   97.225,  -27.340 }, { -308.643,   97.585,  -27.345 },
-			{ -293.093,   97.925,  -27.350 }, { -277.613,   98.245,  -27.360 }, { -262.213,   98.545,  -27.365 },
-			{ -246.868,   98.820,  -27.365 }, { -231.598,   99.070,  -27.370 }, { -216.383,   99.300,  -27.375 },
-			{ -201.223,   99.505,  -27.380 }, { -186.113,   99.690,  -27.385 }, { -171.048,   99.850,  -27.380 },
-			{ -156.028,   99.990,  -27.385 }, { -141.048,  100.100,  -27.390 }, { -126.103,  100.195,  -27.390 },
-			{ -111.193,  100.265,  -27.395 }, {  -96.303,  100.315,  -27.395 }, {  -81.443,  100.340,  -27.390 },
-			{  -66.603,  100.335,  -27.390 }, {  -51.783,  100.315,  -27.390 }, {  -36.973,  100.275,  -27.395 },
-			{  -22.173,  100.205,  -27.390 }, {   -7.383,  100.115,  -27.385 }, {    7.403,  100.115,  -27.385 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
-			{  156.088,   99.985,  -27.385 }, {  171.103,   99.845,  -27.380 }, {  186.168,   99.680,  -27.385 },
-			{  201.268,   99.495,  -27.380 }, {  216.428,   99.290,  -27.375 }, {  231.643,   99.060,  -27.370 },
-			{  246.913,   98.810,  -27.365 }, {  262.258,   98.535,  -27.365 }, {  277.658,   98.240,  -27.360 },
-			{  293.138,   97.925,  -27.350 }, {  308.688,   97.580,  -27.345 }, {  324.323,   97.215,  -27.340 },
-			{  340.043,   96.835,  -27.330 }
-		},
-		{	{ -339.998,   96.930,  -42.435 }, { -324.278,   97.315,  -42.445 }, { -308.648,   97.680,  -42.455 },
-			{ -293.093,   98.015,  -42.470 }, { -277.613,   98.340,  -42.480 }, { -262.208,   98.635,  -42.490 },
-			{ -246.873,   98.910,  -42.500 }, { -231.593,   99.160,  -42.510 }, { -216.383,   99.390,  -42.515 },
-			{ -201.223,   99.595,  -42.525 }, { -186.113,   99.780,  -42.525 }, { -171.048,   99.940,  -42.535 },
-			{ -156.028,  100.080,  -42.540 }, { -141.048,  100.195,  -42.540 }, { -126.103,  100.290,  -42.545 },
-			{ -111.193,  100.355,  -42.550 }, {  -96.303,  100.405,  -42.550 }, {  -81.443,  100.430,  -42.550 },
-			{  -66.608,  100.430,  -42.550 }, {  -51.783,  100.405,  -42.550 }, {  -36.973,  100.365,  -42.550 },
-			{  -22.178,  100.295,  -42.545 }, {   -7.388,  100.205,  -42.545 }, {    7.403,  100.205,  -42.545 },
-			{   22.193,  100.295,  -42.545 }, {   36.988,  100.365,  -42.550 }, {   51.798,  100.405,  -42.550 },
-			{   66.623,  100.430,  -42.550 }, {   81.458,  100.430,  -42.550 }, {   96.318,  100.405,  -42.550 },
-			{  111.208,  100.355,  -42.550 }, {  126.118,  100.290,  -42.545 }, {  141.063,  100.195,  -42.540 },
-			{  156.043,  100.080,  -42.540 }, {  171.063,   99.940,  -42.535 }, {  186.128,   99.780,  -42.525 },
-			{  201.238,   99.595,  -42.525 }, {  216.398,   99.390,  -42.515 }, {  231.613,   99.160,  -42.510 },
-			{  246.888,   98.910,  -42.500 }, {  262.223,   98.635,  -42.490 }, {  277.628,   98.340,  -42.480 },
-			{  293.108,   98.015,  -42.470 }, {  308.663,   97.680,  -42.455 }, {  324.293,   97.315,  -42.445 },
-			{  340.013,   96.930,  -42.435 }
-		},
-		{	{ -339.998,   97.000,  -57.540 }, { -324.278,   97.385,  -57.560 }, { -308.648,   97.745,  -57.575 },
-			{ -293.093,   98.090,  -57.595 }, { -277.613,   98.410,  -57.610 }, { -262.208,   98.705,  -57.625 },
-			{ -246.873,   98.975,  -57.640 }, { -231.593,   99.225,  -57.655 }, { -216.383,   99.455,  -57.665 },
-			{ -201.223,   99.665,  -57.675 }, { -186.113,   99.845,  -57.685 }, { -171.048,  100.010,  -57.690 },
-			{ -156.028,  100.145,  -57.700 }, { -141.048,  100.265,  -57.705 }, { -126.103,  100.355,  -57.710 },
-			{ -111.193,  100.425,  -57.710 }, {  -96.303,  100.475,  -57.720 }, {  -81.443,  100.495,  -57.715 },
-			{  -66.608,  100.500,  -57.720 }, {  -51.783,  100.480,  -57.715 }, {  -36.973,  100.430,  -57.710 },
-			{  -22.178,  100.365,  -57.710 }, {   -7.388,  100.275,  -57.705 }, {    7.403,  100.275,  -57.705 },
-			{   22.193,  100.365,  -57.710 }, {   36.988,  100.430,  -57.710 }, {   51.798,  100.480,  -57.715 },
-			{   66.623,  100.500,  -57.720 }, {   81.458,  100.495,  -57.715 }, {   96.318,  100.475,  -57.720 },
-			{  111.208,  100.425,  -57.710 }, {  126.118,  100.355,  -57.710 }, {  141.063,  100.265,  -57.705 },
-			{  156.043,  100.145,  -57.700 }, {  171.063,  100.010,  -57.690 }, {  186.128,   99.845,  -57.685 },
-			{  201.238,   99.665,  -57.675 }, {  216.398,   99.455,  -57.665 }, {  231.613,   99.225,  -57.655 },
-			{  246.888,   98.975,  -57.640 }, {  262.223,   98.705,  -57.625 }, {  277.628,   98.410,  -57.610 },
-			{  293.108,   98.090,  -57.595 }, {  308.663,   97.745,  -57.575 }, {  324.293,   97.385,  -57.560 },
-			{  340.013,   97.000,  -57.540 }
-		},
-		{	{ -339.998,   97.045,  -72.655 }, { -324.278,   97.435,  -72.680 }, { -308.648,   97.795,  -72.710 },
-			{ -293.093,   98.135,  -72.730 }, { -277.613,   98.455,  -72.750 }, { -262.208,   98.750,  -72.775 },
-			{ -246.873,   99.020,  -72.795 }, { -231.593,   99.280,  -72.810 }, { -216.383,   99.505,  -72.820 },
-			{ -201.223,   99.710,  -72.840 }, { -186.113,   99.895,  -72.850 }, { -171.048,  100.055,  -72.860 },
-			{ -156.028,  100.190,  -72.870 }, { -141.048,  100.305,  -72.880 }, { -126.103,  100.400,  -72.885 },
-			{ -111.193,  100.470,  -72.890 }, {  -96.303,  100.520,  -72.890 }, {  -81.443,  100.540,  -72.895 },
-			{  -66.608,  100.540,  -72.895 }, {  -51.783,  100.520,  -72.895 }, {  -36.973,  100.480,  -72.890 },
-			{  -22.178,  100.405,  -72.885 }, {   -7.388,  100.320,  -72.880 }, {    7.403,  100.320,  -72.880 },
-			{   22.193,  100.405,  -72.885 }, {   36.988,  100.480,  -72.890 }, {   51.798,  100.520,  -72.895 },
-			{   66.623,  100.540,  -72.895 }, {   81.458,  100.540,  -72.895 }, {   96.318,  100.520,  -72.890 },
-			{  111.208,  100.470,  -72.890 }, {  126.118,  100.400,  -72.885 }, {  141.063,  100.305,  -72.880 },
-			{  156.043,  100.190,  -72.870 }, {  171.063,  100.055,  -72.860 }, {  186.128,   99.895,  -72.850 },
-			{  201.238,   99.710,  -72.840 }, {  216.398,   99.505,  -72.820 }, {  231.613,   99.280,  -72.810 },
-			{  246.888,   99.020,  -72.795 }, {  262.223,   98.750,  -72.775 }, {  277.628,   98.455,  -72.750 },
-			{  293.108,   98.135,  -72.730 }, {  308.663,   97.795,  -72.710 }, {  324.293,   97.435,  -72.680 },
-			{  340.013,   97.045,  -72.655 }
-		},
-		{	{ -339.998,   97.070,  -87.790 }, { -324.278,   97.460,  -87.820 }, { -308.648,   97.820,  -87.850 },
-			{ -293.093,   98.160,  -87.885 }, { -277.613,   98.480,  -87.910 }, { -262.208,   98.775,  -87.935 },
-			{ -246.873,   99.050,  -87.960 }, { -231.593,   99.300,  -87.980 }, { -216.383,   99.530,  -88.000 },
-			{ -201.223,   99.735,  -88.015 }, { -186.113,   99.920,  -88.030 }, { -171.048,  100.080,  -88.045 },
-			{ -156.028,  100.215,  -88.055 }, { -141.048,  100.335,  -88.065 }, { -126.103,  100.420,  -88.070 },
-			{ -111.193,  100.490,  -88.075 }, {  -96.303,  100.540,  -88.085 }, {  -81.443,  100.565,  -88.085 },
-			{  -66.608,  100.560,  -88.085 }, {  -51.783,  100.540,  -88.085 }, {  -36.973,  100.500,  -88.080 },
-			{  -22.178,  100.430,  -88.075 }, {   -7.388,  100.340,  -88.065 }, {    7.403,  100.340,  -88.070 },
-			{   22.193,  100.430,  -88.075 }, {   36.988,  100.500,  -88.080 }, {   51.798,  100.540,  -88.085 },
-			{   66.623,  100.560,  -88.085 }, {   81.458,  100.565,  -88.085 }, {   96.318,  100.540,  -88.085 },
-			{  111.208,  100.490,  -88.075 }, {  126.118,  100.420,  -88.070 }, {  141.063,  100.335,  -88.065 },
-			{  156.043,  100.215,  -88.055 }, {  171.063,  100.080,  -88.045 }, {  186.128,   99.915,  -88.030 },
-			{  201.238,   99.735,  -88.015 }, {  216.398,   99.530,  -88.000 }, {  231.613,   99.300,  -87.980 },
-			{  246.888,   99.050,  -87.960 }, {  262.223,   98.775,  -87.935 }, {  277.628,   98.480,  -87.910 },
-			{  293.108,   98.160,  -87.885 }, {  308.663,   97.820,  -87.850 }, {  324.293,   97.460,  -87.820 },
-			{  340.013,   97.070,  -87.790 }
-		}
-	};
+    private static final double[][][] position = {
+        {   { -340.003,   97.065,   87.845 }, { -324.283,   97.450,   87.875 }, { -308.648,   97.810,   87.900 },
+            { -293.093,   98.150,   87.920 }, { -277.618,   98.470,   87.940 }, { -262.213,   98.765,   87.965 },
+            { -246.878,   99.040,   87.980 }, { -231.603,   99.290,   87.995 }, { -216.393,   99.520,   88.010 },
+            { -201.228,   99.725,   88.030 }, { -186.118,   99.905,   88.040 }, { -171.058,  100.070,   88.050 },
+            { -156.038,  100.205,   88.055 }, { -141.058,  100.325,   88.070 }, { -126.113,  100.415,   88.075 },
+            { -111.198,  100.485,   88.075 }, {  -96.313,  100.530,   88.080 }, {  -81.453,  100.555,   88.085 },
+            {  -66.608,  100.560,   88.085 }, {  -51.788,  100.540,   88.080 }, {  -36.983,  100.490,   88.075 },
+            {  -22.183,  100.425,   88.075 }, {   -7.393,  100.335,   88.070 }, {    7.393,  100.335,   88.070 },
+            {   22.183,  100.425,   88.075 }, {   36.983,  100.490,   88.075 }, {   51.793,  100.540,   88.080 },
+            {   66.613,  100.560,   88.085 }, {   81.453,  100.555,   88.085 }, {   96.313,  100.530,   88.080 },
+            {  111.198,  100.485,   88.075 }, {  126.113,  100.415,   88.075 }, {  141.053,  100.325,   88.070 },
+            {  156.038,  100.205,   88.055 }, {  171.053,  100.070,   88.050 }, {  186.118,   99.905,   88.040 },
+            {  201.228,   99.725,   88.030 }, {  216.388,   99.520,   88.010 }, {  231.608,   99.290,   87.995 },
+            {  246.878,   99.040,   87.980 }, {  262.218,   98.765,   87.965 }, {  277.623,   98.470,   87.940 },
+            {  293.098,   98.150,   87.920 }, {  308.653,   97.810,   87.900 }, {  324.288,   97.450,   87.875 },
+            {  340.008,   97.065,   87.845 }
+        },
+        {   { -340.003,   97.040,   72.715 }, { -324.283,   97.420,   72.735 }, { -308.648,   97.785,   72.750 },
+            { -293.093,   98.125,   72.765 }, { -277.618,   98.450,   72.785 }, { -262.213,   98.745,   72.800 },
+            { -246.878,   99.015,   72.815 }, { -231.603,   99.265,   72.825 }, { -216.388,   99.495,   72.840 },
+            { -201.228,   99.700,   72.850 }, { -186.118,   99.885,   72.860 }, { -171.058,  100.045,   72.865 },
+            { -156.033,  100.185,   72.875 }, { -141.053,  100.300,   72.880 }, { -126.108,  100.395,   72.880 },
+            { -111.193,  100.460,   72.890 }, {  -96.308,  100.510,   72.890 }, {  -81.448,  100.535,   72.895 },
+            {  -66.608,  100.535,   72.890 }, {  -51.788,  100.510,   72.890 }, {  -36.978,  100.470,   72.890 },
+            {  -22.183,  100.405,   72.880 }, {   -7.388,  100.310,   72.880 }, {    7.393,  100.310,   72.880 },
+            {   22.188,  100.405,   72.885 }, {   36.983,  100.470,   72.890 }, {   51.793,  100.510,   72.890 },
+            {   66.613,  100.535,   72.890 }, {   81.453,  100.535,   72.895 }, {   96.313,  100.510,   72.890 },
+            {  111.198,  100.460,   72.890 }, {  126.113,  100.395,   72.880 }, {  141.063,  100.300,   72.880 },
+            {  156.043,  100.185,   72.875 }, {  171.063,  100.045,   72.865 }, {  186.123,   99.885,   72.860 },
+            {  201.233,   99.700,   72.850 }, {  216.393,   99.495,   72.840 }, {  231.608,   99.265,   72.825 },
+            {  246.883,   99.015,   72.815 }, {  262.218,   98.745,   72.800 }, {  277.623,   98.450,   72.785 },
+            {  293.098,   98.125,   72.765 }, {  308.653,   97.785,   72.750 }, {  324.288,   97.420,   72.735 },
+            {  340.008,   97.040,   72.715 }
+        },
+        {   { -340.003,   96.990,   57.600 }, { -324.283,   97.375,   57.610 }, { -308.648,   97.740,   57.625 },
+            { -293.093,   98.080,   57.630 }, { -277.618,   98.395,   57.645 }, { -262.213,   98.700,   57.655 },
+            { -246.873,   98.970,   57.660 }, { -231.603,   99.220,   57.670 }, { -216.383,   99.450,   57.680 },
+            { -201.228,   99.660,   57.685 }, { -186.113,   99.840,   57.695 }, { -171.053,  100.005,   57.695 },
+            { -156.033,  100.140,   57.700 }, { -141.053,  100.255,   57.710 }, { -126.108,  100.345,   57.710 },
+            { -111.193,  100.420,   57.710 }, {  -96.308,  100.465,   57.715 }, {  -81.448,  100.490,   57.715 },
+            {  -66.608,  100.490,   57.715 }, {  -51.788,  100.470,   57.710 }, {  -36.978,  100.425,   57.710 },
+            {  -22.178,  100.355,   57.710 }, {   -7.388,  100.265,   57.705 }, {    7.398,  100.265,   57.705 },
+            {   22.188,  100.355,   57.710 }, {   36.988,  100.425,   57.710 }, {   51.793,  100.470,   57.710 },
+            {   66.613,  100.490,   57.715 }, {   81.458,  100.490,   57.715 }, {   96.318,  100.465,   57.715 },
+            {  111.198,  100.420,   57.710 }, {  126.118,  100.345,   57.710 }, {  141.063,  100.255,   57.710 },
+            {  156.043,  100.140,   57.700 }, {  171.063,  100.005,   57.695 }, {  186.123,   99.840,   57.695 },
+            {  201.233,   99.660,   57.685 }, {  216.393,   99.450,   57.680 }, {  231.608,   99.220,   57.670 },
+            {  246.883,   98.970,   57.660 }, {  262.218,   98.700,   57.655 }, {  277.623,   98.395,   57.645 },
+            {  293.098,   98.080,   57.630 }, {  308.653,   97.740,   57.625 }, {  324.288,   97.375,   57.610 },
+            {  340.008,   96.990,   57.600 }
+        },
+        {   { -340.003,   96.925,   42.490 }, { -324.283,   97.305,   42.495 }, { -308.648,   97.675,   42.505 },
+            { -293.093,   98.010,   42.510 }, { -277.618,   98.330,   42.510 }, { -262.213,   98.625,   42.515 },
+            { -246.873,   98.900,   42.525 }, { -231.603,   99.155,   42.530 }, { -216.383,   99.385,   42.535 },
+            { -201.223,   99.590,   42.530 }, { -186.113,   99.775,   42.535 }, { -171.048,   99.930,   42.540 },
+            { -156.033,  100.070,   42.545 }, { -141.048,  100.185,   42.545 }, { -126.108,  100.280,   42.550 },
+            { -111.193,  100.350,   42.545 }, {  -96.308,  100.400,   42.545 }, {  -81.448,  100.420,   42.550 },
+            {  -66.608,  100.425,   42.550 }, {  -51.788,  100.405,   42.550 }, {  -36.978,  100.355,   42.545 },
+            {  -22.178,  100.290,   42.545 }, {   -7.388,  100.200,   42.545 }, {    7.398,  100.200,   42.545 },
+            {   22.188,  100.290,   42.545 }, {   36.988,  100.355,   42.545 }, {   51.793,  100.405,   42.550 },
+            {   66.613,  100.425,   42.550 }, {   81.458,  100.420,   42.550 }, {   96.318,  100.400,   42.545 },
+            {  111.198,  100.350,   42.545 }, {  126.118,  100.280,   42.550 }, {  141.063,  100.185,   42.545 },
+            {  156.043,  100.070,   42.545 }, {  171.063,   99.930,   42.540 }, {  186.123,   99.775,   42.535 },
+            {  201.233,   99.590,   42.530 }, {  216.393,   99.385,   42.535 }, {  231.608,   99.155,   42.530 },
+            {  246.883,   98.900,   42.525 }, {  262.218,   98.625,   42.515 }, {  277.628,   98.330,   42.510 },
+            {  293.098,   98.010,   42.510 }, {  308.653,   97.675,   42.505 }, {  324.288,   97.305,   42.495 },
+            {  340.008,   96.925,   42.490 }
+        },
+        {   { -340.003,   96.830,   27.385 }, { -324.278,   97.215,   27.385 }, { -308.648,   97.575,   27.385 },
+            { -293.093,   97.915,   27.385 }, { -277.613,   98.240,   27.385 }, { -262.213,   98.535,   27.385 },
+            { -246.878,   98.810,   27.385 }, { -231.603,   99.060,   27.385 }, { -216.383,   99.290,   27.385 },
+            { -201.223,   99.495,   27.385 }, { -186.113,   99.680,   27.385 }, { -171.048,   99.840,   27.385 },
+            { -156.033,   99.980,   27.385 }, { -141.048,  100.095,   27.385 }, { -126.103,  100.185,   27.385 },
+            { -111.193,  100.255,   27.385 }, {  -96.303,  100.305,   27.385 }, {  -81.448,  100.330,   27.385 },
+            {  -66.608,  100.330,   27.385 }, {  -51.783,  100.310,   27.385 }, {  -36.973,  100.265,   27.385 },
+            {  -22.178,  100.200,   27.385 }, {   -7.388,  100.105,   27.385 }, {    7.403,  100.105,   27.385 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {  156.078,   99.980,   27.385 }, {  171.103,   99.840,   27.385 }, {  186.168,   99.680,   27.385 },
+            {  201.268,   99.495,   27.385 }, {  216.423,   99.290,   27.385 }, {  231.638,   99.060,   27.385 },
+            {  246.913,   98.810,   27.385 }, {  262.248,   98.535,   27.385 }, {  277.658,   98.240,   27.385 },
+            {  293.133,   97.920,   27.385 }, {  308.688,   97.575,   27.385 }, {  324.323,   97.215,   27.385 },
+            {  340.043,   96.830,   27.385 }
+        },
+        {   {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }
+        },
+        {   { -339.998,   96.840,  -27.330 }, { -324.278,   97.225,  -27.340 }, { -308.643,   97.585,  -27.345 },
+            { -293.093,   97.925,  -27.350 }, { -277.613,   98.245,  -27.360 }, { -262.213,   98.545,  -27.365 },
+            { -246.868,   98.820,  -27.365 }, { -231.598,   99.070,  -27.370 }, { -216.383,   99.300,  -27.375 },
+            { -201.223,   99.505,  -27.380 }, { -186.113,   99.690,  -27.385 }, { -171.048,   99.850,  -27.380 },
+            { -156.028,   99.990,  -27.385 }, { -141.048,  100.100,  -27.390 }, { -126.103,  100.195,  -27.390 },
+            { -111.193,  100.265,  -27.395 }, {  -96.303,  100.315,  -27.395 }, {  -81.443,  100.340,  -27.390 },
+            {  -66.603,  100.335,  -27.390 }, {  -51.783,  100.315,  -27.390 }, {  -36.973,  100.275,  -27.395 },
+            {  -22.173,  100.205,  -27.390 }, {   -7.383,  100.115,  -27.385 }, {    7.403,  100.115,  -27.385 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 }, {    0.000,    0.000,    0.000 },
+            {  156.088,   99.985,  -27.385 }, {  171.103,   99.845,  -27.380 }, {  186.168,   99.680,  -27.385 },
+            {  201.268,   99.495,  -27.380 }, {  216.428,   99.290,  -27.375 }, {  231.643,   99.060,  -27.370 },
+            {  246.913,   98.810,  -27.365 }, {  262.258,   98.535,  -27.365 }, {  277.658,   98.240,  -27.360 },
+            {  293.138,   97.925,  -27.350 }, {  308.688,   97.580,  -27.345 }, {  324.323,   97.215,  -27.340 },
+            {  340.043,   96.835,  -27.330 }
+        },
+        {   { -339.998,   96.930,  -42.435 }, { -324.278,   97.315,  -42.445 }, { -308.648,   97.680,  -42.455 },
+            { -293.093,   98.015,  -42.470 }, { -277.613,   98.340,  -42.480 }, { -262.208,   98.635,  -42.490 },
+            { -246.873,   98.910,  -42.500 }, { -231.593,   99.160,  -42.510 }, { -216.383,   99.390,  -42.515 },
+            { -201.223,   99.595,  -42.525 }, { -186.113,   99.780,  -42.525 }, { -171.048,   99.940,  -42.535 },
+            { -156.028,  100.080,  -42.540 }, { -141.048,  100.195,  -42.540 }, { -126.103,  100.290,  -42.545 },
+            { -111.193,  100.355,  -42.550 }, {  -96.303,  100.405,  -42.550 }, {  -81.443,  100.430,  -42.550 },
+            {  -66.608,  100.430,  -42.550 }, {  -51.783,  100.405,  -42.550 }, {  -36.973,  100.365,  -42.550 },
+            {  -22.178,  100.295,  -42.545 }, {   -7.388,  100.205,  -42.545 }, {    7.403,  100.205,  -42.545 },
+            {   22.193,  100.295,  -42.545 }, {   36.988,  100.365,  -42.550 }, {   51.798,  100.405,  -42.550 },
+            {   66.623,  100.430,  -42.550 }, {   81.458,  100.430,  -42.550 }, {   96.318,  100.405,  -42.550 },
+            {  111.208,  100.355,  -42.550 }, {  126.118,  100.290,  -42.545 }, {  141.063,  100.195,  -42.540 },
+            {  156.043,  100.080,  -42.540 }, {  171.063,   99.940,  -42.535 }, {  186.128,   99.780,  -42.525 },
+            {  201.238,   99.595,  -42.525 }, {  216.398,   99.390,  -42.515 }, {  231.613,   99.160,  -42.510 },
+            {  246.888,   98.910,  -42.500 }, {  262.223,   98.635,  -42.490 }, {  277.628,   98.340,  -42.480 },
+            {  293.108,   98.015,  -42.470 }, {  308.663,   97.680,  -42.455 }, {  324.293,   97.315,  -42.445 },
+            {  340.013,   96.930,  -42.435 }
+        },
+        {   { -339.998,   97.000,  -57.540 }, { -324.278,   97.385,  -57.560 }, { -308.648,   97.745,  -57.575 },
+            { -293.093,   98.090,  -57.595 }, { -277.613,   98.410,  -57.610 }, { -262.208,   98.705,  -57.625 },
+            { -246.873,   98.975,  -57.640 }, { -231.593,   99.225,  -57.655 }, { -216.383,   99.455,  -57.665 },
+            { -201.223,   99.665,  -57.675 }, { -186.113,   99.845,  -57.685 }, { -171.048,  100.010,  -57.690 },
+            { -156.028,  100.145,  -57.700 }, { -141.048,  100.265,  -57.705 }, { -126.103,  100.355,  -57.710 },
+            { -111.193,  100.425,  -57.710 }, {  -96.303,  100.475,  -57.720 }, {  -81.443,  100.495,  -57.715 },
+            {  -66.608,  100.500,  -57.720 }, {  -51.783,  100.480,  -57.715 }, {  -36.973,  100.430,  -57.710 },
+            {  -22.178,  100.365,  -57.710 }, {   -7.388,  100.275,  -57.705 }, {    7.403,  100.275,  -57.705 },
+            {   22.193,  100.365,  -57.710 }, {   36.988,  100.430,  -57.710 }, {   51.798,  100.480,  -57.715 },
+            {   66.623,  100.500,  -57.720 }, {   81.458,  100.495,  -57.715 }, {   96.318,  100.475,  -57.720 },
+            {  111.208,  100.425,  -57.710 }, {  126.118,  100.355,  -57.710 }, {  141.063,  100.265,  -57.705 },
+            {  156.043,  100.145,  -57.700 }, {  171.063,  100.010,  -57.690 }, {  186.128,   99.845,  -57.685 },
+            {  201.238,   99.665,  -57.675 }, {  216.398,   99.455,  -57.665 }, {  231.613,   99.225,  -57.655 },
+            {  246.888,   98.975,  -57.640 }, {  262.223,   98.705,  -57.625 }, {  277.628,   98.410,  -57.610 },
+            {  293.108,   98.090,  -57.595 }, {  308.663,   97.745,  -57.575 }, {  324.293,   97.385,  -57.560 },
+            {  340.013,   97.000,  -57.540 }
+        },
+        {   { -339.998,   97.045,  -72.655 }, { -324.278,   97.435,  -72.680 }, { -308.648,   97.795,  -72.710 },
+            { -293.093,   98.135,  -72.730 }, { -277.613,   98.455,  -72.750 }, { -262.208,   98.750,  -72.775 },
+            { -246.873,   99.020,  -72.795 }, { -231.593,   99.280,  -72.810 }, { -216.383,   99.505,  -72.820 },
+            { -201.223,   99.710,  -72.840 }, { -186.113,   99.895,  -72.850 }, { -171.048,  100.055,  -72.860 },
+            { -156.028,  100.190,  -72.870 }, { -141.048,  100.305,  -72.880 }, { -126.103,  100.400,  -72.885 },
+            { -111.193,  100.470,  -72.890 }, {  -96.303,  100.520,  -72.890 }, {  -81.443,  100.540,  -72.895 },
+            {  -66.608,  100.540,  -72.895 }, {  -51.783,  100.520,  -72.895 }, {  -36.973,  100.480,  -72.890 },
+            {  -22.178,  100.405,  -72.885 }, {   -7.388,  100.320,  -72.880 }, {    7.403,  100.320,  -72.880 },
+            {   22.193,  100.405,  -72.885 }, {   36.988,  100.480,  -72.890 }, {   51.798,  100.520,  -72.895 },
+            {   66.623,  100.540,  -72.895 }, {   81.458,  100.540,  -72.895 }, {   96.318,  100.520,  -72.890 },
+            {  111.208,  100.470,  -72.890 }, {  126.118,  100.400,  -72.885 }, {  141.063,  100.305,  -72.880 },
+            {  156.043,  100.190,  -72.870 }, {  171.063,  100.055,  -72.860 }, {  186.128,   99.895,  -72.850 },
+            {  201.238,   99.710,  -72.840 }, {  216.398,   99.505,  -72.820 }, {  231.613,   99.280,  -72.810 },
+            {  246.888,   99.020,  -72.795 }, {  262.223,   98.750,  -72.775 }, {  277.628,   98.455,  -72.750 },
+            {  293.108,   98.135,  -72.730 }, {  308.663,   97.795,  -72.710 }, {  324.293,   97.435,  -72.680 },
+            {  340.013,   97.045,  -72.655 }
+        },
+        {   { -339.998,   97.070,  -87.790 }, { -324.278,   97.460,  -87.820 }, { -308.648,   97.820,  -87.850 },
+            { -293.093,   98.160,  -87.885 }, { -277.613,   98.480,  -87.910 }, { -262.208,   98.775,  -87.935 },
+            { -246.873,   99.050,  -87.960 }, { -231.593,   99.300,  -87.980 }, { -216.383,   99.530,  -88.000 },
+            { -201.223,   99.735,  -88.015 }, { -186.113,   99.920,  -88.030 }, { -171.048,  100.080,  -88.045 },
+            { -156.028,  100.215,  -88.055 }, { -141.048,  100.335,  -88.065 }, { -126.103,  100.420,  -88.070 },
+            { -111.193,  100.490,  -88.075 }, {  -96.303,  100.540,  -88.085 }, {  -81.443,  100.565,  -88.085 },
+            {  -66.608,  100.560,  -88.085 }, {  -51.783,  100.540,  -88.085 }, {  -36.973,  100.500,  -88.080 },
+            {  -22.178,  100.430,  -88.075 }, {   -7.388,  100.340,  -88.065 }, {    7.403,  100.340,  -88.070 },
+            {   22.193,  100.430,  -88.075 }, {   36.988,  100.500,  -88.080 }, {   51.798,  100.540,  -88.085 },
+            {   66.623,  100.560,  -88.085 }, {   81.458,  100.565,  -88.085 }, {   96.318,  100.540,  -88.085 },
+            {  111.208,  100.490,  -88.075 }, {  126.118,  100.420,  -88.070 }, {  141.063,  100.335,  -88.065 },
+            {  156.043,  100.215,  -88.055 }, {  171.063,  100.080,  -88.045 }, {  186.128,   99.915,  -88.030 },
+            {  201.238,   99.735,  -88.015 }, {  216.398,   99.530,  -88.000 }, {  231.613,   99.300,  -87.980 },
+            {  246.888,   99.050,  -87.960 }, {  262.223,   98.775,  -87.935 }, {  277.628,   98.480,  -87.910 },
+            {  293.108,   98.160,  -87.885 }, {  308.663,   97.820,  -87.850 }, {  324.293,   97.460,  -87.820 },
+            {  340.013,   97.070,  -87.790 }
+        }
+    };
 }

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/StarterAnalysis.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/StarterAnalysis.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/analysis/StarterAnalysis.lcsim	Wed Mar  9 11:43:24 2016
@@ -20,4 +20,4 @@
         </driver>
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceMonitoringApp.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceMonitoringApp.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceMonitoringApp.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,9 +1,9 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">         
     <execute>
-    	<driver name="EventMarkerDriver"/>
+        <driver name="EventMarkerDriver"/>
         <driver name="EcalRunningPedestal"/>
-  	    <driver name="EcalRawConverter" />    
+        <driver name="EcalRawConverter" />    
         <driver name="LedAnalysisDriver"/>
         <driver name="EcalEventDisplay" />         <!-- Ecal event display -->
         <driver name="AidaSaveDriver"/>
@@ -48,5 +48,5 @@
         <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>LedSequenceMonitorOut.aida</outputFileName>
         </driver>
-	</drivers>
+    </drivers>
 </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceStandalone.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceStandalone.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalLedSequenceStandalone.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,43 +1,43 @@
-	<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
-	       xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">         
-	    <execute>
-	    	<driver name="EventMarkerDriver"/>
-	        <driver name="EcalRunningPedestal"/>
-	  	    <driver name="EcalRawConverter" />    
-	        <driver name="LedAnalysisDriver"/>
-	        <driver name="AidaSaveDriver"/>	     
-	    </execute>           
-	    <drivers>    
-	        <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
-	            <eventInterval>100000</eventInterval>            
-	        </driver>
-	         <driver name="EcalRunningPedestal" type="org.hps.recon.ecal.EcalRunningPedestalDriver">
-	            <minLookbackEvents>10</minLookbackEvents>
-	            <maxLookbackEvents>50</maxLookbackEvents>
-	        </driver>
-	        <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
-	            <ecalCollectionName>EcalCalHits</ecalCollectionName>
-	            <useTimestamps>false</useTimestamps>
-	            <useTruthTime>false</useTruthTime>
-	            <useRunningPedestal>true</useRunningPedestal>
-	            <useTimeWalkCorrection>true</useTimeWalkCorrection>
-	            <nsa>60</nsa>  <!-- these are critical since the defaults in software are 100 - 20, as in prod. runs -->
-       		    <nsb>16</nsb>
-	        </driver>       
-	        <driver name="LedAnalysisDriver" type="org.hps.monitoring.ecal.plots.EcalLedSequenceMonitor">
-	           <isMonitoringApp>false</isMonitoringApp>
-	           <doFullAnalysis>false</doFullAnalysis>
-	           <skipMin>0.2</skipMin>
-	           <skipInitial>0.05</skipInitial>    
-	           <useRawEnergy>true</useRawEnergy>
-	           <energyCut>2.0</energyCut>
-	           <nEventsMin>300</nEventsMin>
-	           <evnMinDraw>0.</evnMinDraw>
-	           <evnMaxDraw>80000.</evnMaxDraw>
-	           <saveTuple>false</saveTuple>
-	        </driver>
-	        <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
-	            <outputFileName>${outputFile}.LedAnalysis.aida</outputFileName>
-	        </driver>        
-		</drivers>
-	</lcsim>
+    <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
+           xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">         
+        <execute>
+            <driver name="EventMarkerDriver"/>
+            <driver name="EcalRunningPedestal"/>
+            <driver name="EcalRawConverter" />    
+            <driver name="LedAnalysisDriver"/>
+            <driver name="AidaSaveDriver"/>      
+        </execute>           
+        <drivers>    
+            <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+                <eventInterval>100000</eventInterval>            
+            </driver>
+             <driver name="EcalRunningPedestal" type="org.hps.recon.ecal.EcalRunningPedestalDriver">
+                <minLookbackEvents>10</minLookbackEvents>
+                <maxLookbackEvents>50</maxLookbackEvents>
+            </driver>
+            <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
+                <ecalCollectionName>EcalCalHits</ecalCollectionName>
+                <useTimestamps>false</useTimestamps>
+                <useTruthTime>false</useTruthTime>
+                <useRunningPedestal>true</useRunningPedestal>
+                <useTimeWalkCorrection>true</useTimeWalkCorrection>
+                <nsa>60</nsa>  <!-- these are critical since the defaults in software are 100 - 20, as in prod. runs -->
+                <nsb>16</nsb>
+            </driver>       
+            <driver name="LedAnalysisDriver" type="org.hps.monitoring.ecal.plots.EcalLedSequenceMonitor">
+               <isMonitoringApp>false</isMonitoringApp>
+               <doFullAnalysis>false</doFullAnalysis>
+               <skipMin>0.2</skipMin>
+               <skipInitial>0.05</skipInitial>    
+               <useRawEnergy>true</useRawEnergy>
+               <energyCut>2.0</energyCut>
+               <nEventsMin>300</nEventsMin>
+               <evnMinDraw>0.</evnMinDraw>
+               <evnMaxDraw>80000.</evnMaxDraw>
+               <saveTuple>false</saveTuple>
+            </driver>
+            <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
+                <outputFileName>${outputFile}.LedAnalysis.aida</outputFileName>
+            </driver>        
+        </drivers>
+    </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringFinal.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringFinal.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringFinal.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,7 +1,7 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
     <execute>
         <driver name="EcalRawConverter" />
-      	<driver name="EcalClusterer" />
+        <driver name="EcalClusterer" />
         <driver name="EcalMonitoringPlots" />      <!-- General plots -->
         <driver name="EcalHitPlots" />             <!-- Single hit distributions -->
         <driver name="EcalClusterPlots" />         <!-- Clusters distributions -->

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringOnly.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringOnly.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/EcalMonitoringOnly.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,7 +1,7 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
     <execute>
         <driver name="EcalRawConverter" />
-      	<driver name="EcalClusterer" />
+        <driver name="EcalClusterer" />
         <driver name="EcalMonitoringPlots" />      <!-- General plots -->
         <driver name="EcalHitPlots" />             <!-- Single hit distributions -->
         <driver name="EcalClusterPlots" />         <!-- Clusters distributions -->

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SvtOnlineMonitoring.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SvtOnlineMonitoring.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SvtOnlineMonitoring.lcsim	Wed Mar  9 11:43:24 2016
@@ -17,7 +17,7 @@
     </execute>
     <drivers>
         <driver name="SensorOccupancy" type="org.hps.monitoring.drivers.svt.SensorOccupancyPlotsDriver" >
-        	<eventRefreshRate>100</eventRefreshRate>
+            <eventRefreshRate>100</eventRefreshRate>
             <enablePositionPlots>false</enablePositionPlots>
             <enableMaxSamplePlots>true</enableMaxSamplePlots>
             <maxSamplePosition>3</maxSamplePosition>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/CommRun2014TightPairs.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/CommRun2014TightPairs.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/CommRun2014TightPairs.lcsim	Wed Mar  9 11:43:24 2016
@@ -44,7 +44,7 @@
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>false</use2014Gain>      
             <debug>true</debug>
-        </driver>	
+        </driver>   
         <driver name="EcalClusterer" type="org.hps.recon.ecal.cluster.GTPClusterDriver">
             <inputHitCollectionName>EcalCorrectedHits</inputHitCollectionName>
             <clusterWindow>1</clusterWindow>
@@ -62,7 +62,7 @@
             <energySlopeParamF>0.005500</energySlopeParamF>
             <energySlopeLow>0.4</energySlopeLow>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	      
+        </driver>         
         <driver name="AidaSaveDriver"
                 type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}_triggerPlots</outputFileName>
@@ -73,4 +73,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim	Wed Mar  9 11:43:24 2016
@@ -54,7 +54,7 @@
             <nsa>100</nsa>
             <nsb>20</nsb>
             <use2014Gain>false</use2014Gain> 
-        </driver>	
+        </driver>   
         <driver name="EcalClustererGTP" type="org.hps.recon.ecal.cluster.GTPClusterDriver">
             <inputHitCollectionName>EcalCorrectedHits</inputHitCollectionName>
             <outputClusterCollectionName>EcalClusters</outputClusterCollectionName>            
@@ -82,7 +82,7 @@
             <outputFileName>${outputFile}.triggers.singles0</outputFileName>
             <lcioFile>${outputFile}.singles0.slcio</lcioFile>    
             <!--<verbose>true</verbose>-->
-        </driver>	      
+        </driver>         
         <driver name="SinglesTrigger1" type="org.hps.readout.ecal.SinglesTriggerDriver">
             <clusterCollectionName>EcalClusters</clusterCollectionName>
             <deadTime>32</deadTime>
@@ -94,7 +94,7 @@
             <outputFileName>${outputFile}.triggers.singles1</outputFileName>
             <lcioFile>${outputFile}.singles1.slcio</lcioFile>            
             <!--<verbose>true</verbose>-->
-        </driver>	      
+        </driver>         
         <driver name="PairTrigger0" type="org.hps.readout.ecal.FADCPrimaryTriggerDriver">
             <clusterCollectionName>EcalClusters</clusterCollectionName>
             <deadTime>32</deadTime>
@@ -113,7 +113,7 @@
             <outputFileName>${outputFile}.triggers.pairs0</outputFileName>
             <lcioFile>${outputFile}.pairs0.slcio</lcioFile>            
             <!--<verbose>true</verbose>-->
-        </driver>	      
+        </driver>         
         <driver name="PairTrigger1" type="org.hps.readout.ecal.FADCPrimaryTriggerDriver">
             <clusterCollectionName>EcalClusters</clusterCollectionName>
             <deadTime>32</deadTime>
@@ -132,7 +132,7 @@
             <outputFileName>${outputFile}.triggers.pairs1</outputFileName>
             <lcioFile>${outputFile}.pairs1.slcio</lcioFile>
             <!--<verbose>true</verbose>-->
-        </driver>	      
+        </driver>         
         <driver name="AidaSaveDriver"
                 type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}_triggerPlots</outputFileName>
@@ -143,4 +143,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutNoPileup.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutNoPileup.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutNoPileup.lcsim	Wed Mar  9 11:43:24 2016
@@ -48,7 +48,7 @@
             <deadTime>0</deadTime>
             <pairCoincidence>0</pairCoincidence>
             <lcioFile>${outputFile}.slcio</lcioFile>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout">
             <noPileup>true</noPileup>
         </driver>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutToEvio.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutToEvio.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014ReadoutToEvio.lcsim	Wed Mar  9 11:43:24 2016
@@ -44,7 +44,7 @@
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>true</use2014Gain>
             <!--            <debug>true</debug>-->
-        </driver>	
+        </driver>   
         <driver name="EcalClusterer" type="org.hps.recon.ecal.cluster.GTPClusterDriver">
             <inputHitCollectionName>EcalCorrectedHits</inputHitCollectionName>
             <clusterWindow>1</clusterWindow>
@@ -54,7 +54,7 @@
             <deadTime>10</deadTime>
             <pairCoincidence>2</pairCoincidence>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout" />
         <driver name="ClockDriver" type="org.hps.readout.ecal.ClockDriver"/>
         <driver name="CleanupDriver" type="org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver">
@@ -62,4 +62,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014TruthReadoutToLcio.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014TruthReadoutToLcio.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/HPS2014TruthReadoutToLcio.lcsim	Wed Mar  9 11:43:24 2016
@@ -47,7 +47,7 @@
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>true</use2014Gain>
             <!--            <debug>true</debug>-->
-        </driver>	
+        </driver>   
         <driver name="EcalClusterer" type="org.hps.recon.ecal.cluster.GTPClusterDriver">
             <inputHitCollectionName>EcalCorrectedHits</inputHitCollectionName>
             <clusterWindow>1</clusterWindow>
@@ -57,7 +57,7 @@
             <deadTime>10</deadTime>
             <pairCoincidence>2</pairCoincidence>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout">
         </driver>
         <driver name="AidaSaveDriver"
@@ -70,4 +70,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/LcioToEvio.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/LcioToEvio.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/LcioToEvio.lcsim	Wed Mar  9 11:43:24 2016
@@ -15,7 +15,7 @@
             <period>1</period>
             <deadTime>0</deadTime>
             <triggerDelay>0</triggerDelay>
-        </driver>	
+        </driver>   
         <driver name="TestRunReconToEvio" type="org.hps.evio.TestRunTriggeredReconToEvio">
             <evioOutputFile>${outputFile}.evio</evioOutputFile>
         </driver>
@@ -23,4 +23,4 @@
         </driver>
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunNoPileup.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunNoPileup.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunNoPileup.lcsim	Wed Mar  9 11:43:24 2016
@@ -39,7 +39,7 @@
             <clusterCollectionName>EcalTriggerClusters</clusterCollectionName>
             <deadTime>0</deadTime>
             <lcioFile>${outputFile}.slcio</lcioFile>
-        </driver>	
+        </driver>   
         <driver name="ClockDriver" type="org.hps.readout.ecal.ClockDriver"/>
         <driver name="CleanupDriver" type="org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver"/>
     </drivers>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunReadoutToEvio.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunReadoutToEvio.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunReadoutToEvio.lcsim	Wed Mar  9 11:43:24 2016
@@ -20,7 +20,7 @@
         <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
             <eventInterval>1000</eventInterval>
         </driver> 
-        <driver name="BadChannelFilter" type="org.hps.recon.tracking.SVTBadChannelFilterDriver" /> 		
+        <driver name="BadChannelFilter" type="org.hps.recon.tracking.SVTBadChannelFilterDriver" />      
         <driver name="EcalReadout" type="org.hps.readout.ecal.FADCEcalReadoutDriver">
             <coincidenceWindow>8</coincidenceWindow>
             <ecalName>Ecal</ecalName>
@@ -39,7 +39,7 @@
             <rawCollectionName>EcalRawHits</rawCollectionName>
             <ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
             <scale>1</scale>
-        </driver>	
+        </driver>   
         <driver name="EcalTriggerFilter" type="org.hps.recon.ecal.EcalTriggerFilterDriver">
             <inputCollection>EcalCorrectedHits</inputCollection>
             <outputCollection>EcalFilteredHits</outputCollection>
@@ -55,7 +55,7 @@
             <clusterCollectionName>EcalClusters</clusterCollectionName>
             <deadTime>10</deadTime>
             <outputFileName>${outputFile}.triggers</outputFileName>
-        </driver>	
+        </driver>   
         <driver name="SimpleSVTReadout" type="org.hps.readout.svt.SimpleSvtReadout" />
         <driver name="ClockDriver" type="org.hps.readout.ecal.ClockDriver"/>
         <driver name="TestRunReconToEvio" type="org.hps.evio.TestRunTriggeredReconToEvio">

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon.lcsim	Wed Mar  9 11:43:24 2016
@@ -7,8 +7,8 @@
       @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
     -->
     <execute>
-    	<!--RF driver-->
-    	<driver name="RfFitter"/>
+        <!--RF driver-->
+        <driver name="RfFitter"/>
  
         <!-- Ecal reconstruction drivers -->        
         <driver name="EcalRunningPedestal"/>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EngineeringRun2015FullRecon.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EngineeringRun2015FullRecon.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EngineeringRun2015FullRecon.lcsim	Wed Mar  9 11:43:24 2016
@@ -12,8 +12,8 @@
         
         <driver name="UnblinderTriggerSkimmer"/>
         
-    	<!--RF driver-->
-    	<driver name="RfFitter"/>
+        <!--RF driver-->
+        <driver name="RfFitter"/>
  
         <driver name="EcalRawConverter" />
         <driver name="ReconClusterer" />

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedAnalysisFromEvio.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedAnalysisFromEvio.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedAnalysisFromEvio.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,9 +1,9 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">         
     <execute>
-    	<driver name="EventMarkerDriver"/>
+        <driver name="EventMarkerDriver"/>
         <driver name="EcalRunningPedestal"/>
-  	    <driver name="EcalRawConverter" />    
+        <driver name="EcalRawConverter" />    
         <driver name="AidaSaveDriver"/>
     </execute>           
     <drivers>    
@@ -25,5 +25,5 @@
         <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}.aida</outputFileName>
         </driver>
-	</drivers>
+    </drivers>
 </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedOnlineOfflineComparison.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedOnlineOfflineComparison.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/celentan/LedOnlineOfflineComparison.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,7 +1,7 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">         
     <execute>
-    	<driver name="EventMarkerDriver"/>
+        <driver name="EventMarkerDriver"/>
         <driver name="LedOnlineOfflineComparison"/>
         <driver name="AidaSaveDriver"/>
     </execute>           
@@ -14,5 +14,5 @@
         <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}.root</outputFileName>
         </driver>
-	</drivers>
+    </drivers>
 </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/ClusterRecon.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/ClusterRecon.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/ClusterRecon.lcsim	Wed Mar  9 11:43:24 2016
@@ -5,7 +5,7 @@
   @author Holly Szumila <[log in to unmask]>
 -->
     <execute>
-    	<driver name="EventMarkerDriver"/>
+        <driver name="EventMarkerDriver"/>
         <driver name="EcalRunningPedestal"/>
         <driver name="EcalRawConverter" />
         <driver name="ReconClusterer" />
@@ -13,7 +13,7 @@
         <driver name="LCIOWriter"/>
     </execute>    
     <drivers>    
-   		<driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+        <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
             <eventInterval>1000</eventInterval>
         </driver> 
         <driver name="EcalRunningPedestal" type="org.hps.recon.ecal.EcalRunningPedestalDriver">

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalFeeViewer.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalFeeViewer.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalFeeViewer.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,7 +1,7 @@
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
     xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
     <execute>
-    	<driver name="EcalRunningPedestal"/>	
+        <driver name="EcalRunningPedestal"/>    
         <driver name="EcalRawConverter" />
         <driver name="ReconClusterer"/>
         <driver name="FEEPlotter"/>
@@ -10,7 +10,7 @@
     </execute>
     <drivers>
         <driver name="EcalRunningPedestal" type="org.hps.recon.ecal.EcalRunningPedestalDriver">
-        	<logLevel>CONFIG</logLevel>
+            <logLevel>CONFIG</logLevel>
         </driver>
         <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
         </driver>      
@@ -18,7 +18,7 @@
             <logLevel>WARNING</logLevel>
         </driver> 
         <driver name="FEEPlotter" type="org.hps.analysis.ecal.FEEClusterPlotter">
-			<outputPlots>yes</outputPlots>
+            <outputPlots>yes</outputPlots>
         </driver>        
         <driver name="EcalFeeMonitor" type="org.hps.monitoring.ecal.plots.EcalFeeMonitor">
         </driver>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalSimReadout.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalSimReadout.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EcalSimReadout.lcsim	Wed Mar  9 11:43:24 2016
@@ -21,11 +21,11 @@
             <eventInterval>1000</eventInterval>
         </driver>       
         <driver name="ConditionsDriver" type="org.hps.conditions.ConditionsDriver">
-     		<runNumber>0</runNumber>
-    		<freeze>true</freeze>
-    		<detectorName>HPS-ECalCommissioning-v3-fieldmap</detectorName>
-   		 </driver>
-<!--   		 <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
+            <runNumber>0</runNumber>
+            <freeze>true</freeze>
+            <detectorName>HPS-ECalCommissioning-v3-fieldmap</detectorName>
+         </driver>
+<!--         <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
             <outputFile>${outputFile}.slcio</outputFile>
             <rejectBackground>true</rejectBackground>
         </driver>-->
@@ -45,7 +45,7 @@
             <ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
             <applyBadCrystalMap>false</applyBadCrystalMap>
             <use2014Gain>false</use2014Gain>      
-        </driver>	
+        </driver>   
         <driver name="ReconClusterer" type="org.hps.recon.ecal.cluster.ReconClusterDriver">
             <logLevel>WARNING</logLevel>
             <inputHitCollectionName>EcalCorrectedHits</inputHitCollectionName>
@@ -65,4 +65,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngRun2015FullReconMC_FEE.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngRun2015FullReconMC_FEE.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngRun2015FullReconMC_FEE.lcsim	Wed Mar  9 11:43:24 2016
@@ -74,11 +74,11 @@
             <eventInterval>1000</eventInterval>
         </driver>   
         <driver name="RfFitter" type="org.hps.evio.RfFitterDriver"/>       
-        <driver name="FEEFilterDriver" type="org.hps.recon.filtering.FEEFilterDriver">  	
+        <driver name="FEEFilterDriver" type="org.hps.recon.filtering.FEEFilterDriver">      
         </driver>   
         <driver name="FEEPlotter" type="org.hps.analysis.ecal.FEEClusterPlotter">
-        	<inputCollection>EcalClusters</inputCollection>
-        	<outputPlots>yes</outputPlots>
+            <inputCollection>EcalClusters</inputCollection>
+            <outputPlots>yes</outputPlots>
         </driver>  
         <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}.root</outputFileName>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngineeringRun2015EcalOnly.lcsim
 =============================================================================
Binary files - no diff available.

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/EngineeringRun2015_FEEIter_Filter.lcsim
 =============================================================================
Binary files - no diff available.

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/QuickEcalReadout.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/QuickEcalReadout.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/holly/QuickEcalReadout.lcsim	Wed Mar  9 11:43:24 2016
@@ -18,11 +18,11 @@
             <eventInterval>1000</eventInterval>
         </driver>       
         <driver name="ConditionsDriver" type="org.hps.conditions.ConditionsDriver">
-     		<runNumber>0</runNumber>
-    		<freeze>true</freeze>
-    		<detectorName>HPS-Proposal2014-v7-2pt2</detectorName>
-   		 </driver>
-   		 <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
+            <runNumber>0</runNumber>
+            <freeze>true</freeze>
+            <detectorName>HPS-Proposal2014-v7-2pt2</detectorName>
+         </driver>
+         <driver name="TestRunReconToLcio" type="org.hps.evio.TestRunTriggeredReconToLcio">
             <outputFile>${outputFile}.slcio</outputFile>
             <rejectBackground>true</rejectBackground>
         </driver>
@@ -44,4 +44,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalScoring.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalScoring.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalScoring.lcsim	Wed Mar  9 11:43:24 2016
@@ -25,4 +25,4 @@
 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/HitTimes.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/HitTimes.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/HitTimes.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,14 +1,14 @@
 
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
-	<execute>
-		<driver name="EventMarkerDriver"/>
-		<driver name="HitTimePrintDriver"/>
-	</execute>
-	<drivers>
-		<driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
-			<eventInterval>1</eventInterval>
-		</driver>
-		<driver name="HitTimePrintDriver" type="org.hps.users.meeg.HitTimePrintDriver"/>
-	</drivers>
+    <execute>
+        <driver name="EventMarkerDriver"/>
+        <driver name="HitTimePrintDriver"/>
+    </execute>
+    <drivers>
+        <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+            <eventInterval>1</eventInterval>
+        </driver>
+        <driver name="HitTimePrintDriver" type="org.hps.users.meeg.HitTimePrintDriver"/>
+    </drivers>
 </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/PairsSkimmer.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/PairsSkimmer.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/PairsSkimmer.lcsim	Wed Mar  9 11:43:24 2016
@@ -44,4 +44,4 @@
         </driver>
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/SmallHits.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/SmallHits.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/SmallHits.lcsim	Wed Mar  9 11:43:24 2016
@@ -1,18 +1,18 @@
 
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
        xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
-	<execute>
-		<driver name="EventMarkerDriver"/>
-		<driver name="SVTSmallHitsDriver"/>
+    <execute>
+        <driver name="EventMarkerDriver"/>
+        <driver name="SVTSmallHitsDriver"/>
         <driver name="AidaSaveDriver"/>
-	</execute>
-	<drivers>
-		<driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
-			<eventInterval>1000</eventInterval>
-		</driver>
-		<driver name="SVTSmallHitsDriver" type="org.hps.users.meeg.SVTSmallHitsDriver"/>
+    </execute>
+    <drivers>
+        <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+            <eventInterval>1000</eventInterval>
+        </driver>
+        <driver name="SVTSmallHitsDriver" type="org.hps.users.meeg.SVTSmallHitsDriver"/>
         <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>smallhits.root</outputFileName>
         </driver>
-	</drivers>
+    </drivers>
 </lcsim>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/TridentMCSkim.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/TridentMCSkim.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/TridentMCSkim.lcsim	Wed Mar  9 11:43:24 2016
@@ -27,4 +27,4 @@
         </driver>
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/ecal_fadc_bkgd.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/ecal_fadc_bkgd.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/ecal_fadc_bkgd.lcsim	Wed Mar  9 11:43:24 2016
@@ -10,11 +10,11 @@
         <driver name="EcalConverter" />
         <driver name="EcalClusterer" />
         <driver name="EcalTrigger" />
-<!--		<driver name="EcalPlots"/>-->
+<!--        <driver name="EcalPlots"/>-->
         <driver name="EcalFADCPlots" />
         <driver name="EcalTriggerPlots" />
         <driver name="MCParticlePlots" />
-<!--		<driver name="Writer"/>-->
+<!--        <driver name="Writer"/>-->
         <driver name="AidaSaveDriver" />
         <driver name="ClockDriver" />
     </execute>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/raw_triggers.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/raw_triggers.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/raw_triggers.lcsim	Wed Mar  9 11:43:24 2016
@@ -5,10 +5,10 @@
 -->
 <lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
     <execute>
-<!--		<driver name="EventMarkerDriver"/>-->
+<!--        <driver name="EventMarkerDriver"/>-->
         <driver name="EcalClusterer" />
         <driver name="EcalTrigger" />
-<!--		<driver name="MCParticlePlots"/>-->
+<!--        <driver name="MCParticlePlots"/>-->
         <driver name="AidaSaveDriver" />
         <driver name="ClockDriver" />
     </execute>

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TestRunOfflineRecon.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TestRunOfflineRecon.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TestRunOfflineRecon.lcsim	Wed Mar  9 11:43:24 2016
@@ -39,7 +39,7 @@
         </driver>
         <driver name="TrackerReconDriver" type="org.hps.recon.tracking.TrackerReconDriver">
             <debug>false</debug>
-		    <!--<strategyResource>/org/hps/recon/tracking/strategies/HPS-Test-All.xml</strategyResource>-->
+            <!--<strategyResource>/org/hps/recon/tracking/strategies/HPS-Test-All.xml</strategyResource>-->
             <strategyResource>/org/hps/recon/tracking/strategies/HPS-TestRun-357.xml</strategyResource>
         </driver>
         <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/rafo/TestSteering.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/rafo/TestSteering.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/rafo/TestSteering.lcsim	Wed Mar  9 11:43:24 2016
@@ -17,4 +17,4 @@
         </driver> 
     </drivers>
 </lcsim>
-	
+    

Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/users/spaul/MollerBeamtilt.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/spaul/MollerBeamtilt.lcsim	(original)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/spaul/MollerBeamtilt.lcsim	Wed Mar  9 11:43:24 2016
@@ -15,13 +15,13 @@
             <eventInterval>1000</eventInterval>
         </driver>
         
-       	<driver name="MollerBeamtilt" type="org.hps.users.spaul.moller.MollerBeamtiltAnalysis">
-       		<maxVtxChi2>15</maxVtxChi2>
-       		<maxTrkChi2>30</maxTrkChi2>
-       		<minMass>.030</minMass>
-      		<maxMass>.036</maxMass>
-       		<minPz>1.0</minPz>
-       		<maxPz>1.1</maxPz>
+        <driver name="MollerBeamtilt" type="org.hps.users.spaul.moller.MollerBeamtiltAnalysis">
+            <maxVtxChi2>15</maxVtxChi2>
+            <maxTrkChi2>30</maxTrkChi2>
+            <minMass>.030</minMass>
+            <maxMass>.036</maxMass>
+            <minPz>1.0</minPz>
+            <maxPz>1.1</maxPz>
         </driver>
          <driver name="AidaSaveDriver" type="org.lcsim.job.AidaSaveDriver">
             <outputFileName>${outputFile}</outputFileName>

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java	Wed Mar  9 11:43:24 2016
@@ -34,7 +34,7 @@
     }
     
     public Collection<ShapeFitParameters> fitShape(int channel, short[] samples, HpsSiSensor sensor){
-    	
+        
         ShapeFitParameters fitresults = new ShapeFitParameters();
         double[] pedSub = {-99.0, -99.0, -99.0, -99.0, -99.0, -99.0};
         double maxADC = -99999;

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java	Wed Mar  9 11:43:24 2016
@@ -161,7 +161,7 @@
             double signal = base_hit.getAmp();
             double noiseRMS = 0; 
             for(int sampleN = 0; sampleN < HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; sampleN++){
-            	noiseRMS += ((HpsSiSensor) rth.getDetectorElement()).getNoise(channel_number, sampleN);
+                noiseRMS += ((HpsSiSensor) rth.getDetectorElement()).getNoise(channel_number, sampleN);
             }
             noiseRMS = noiseRMS/HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES;
             
@@ -225,7 +225,7 @@
                 cluster_signal += hit.getAmp();
                 double strip_noise = 0; 
                 for(int sampleN = 0; sampleN < HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; sampleN++){
-                	strip_noise += ((HpsSiSensor) hit.getRawTrackerHit().getDetectorElement()).getNoise(clustered_cell, sampleN);
+                    strip_noise += ((HpsSiSensor) hit.getRawTrackerHit().getDetectorElement()).getNoise(clustered_cell, sampleN);
                 }
                 strip_noise = strip_noise/HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES;
                 cluster_noise_squared += Math.pow(strip_noise, 2); 

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java	Wed Mar  9 11:43:24 2016
@@ -164,8 +164,8 @@
 
         // Loop over the channels contained in the SiElectrodeDataCollection
         for (Integer channel : data.keySet()) {
-        	
-        	if(dropBadChannels && ((HpsSiSensor) electrodes.getDetectorElement()).isBadChannel(channel)){
+            
+            if(dropBadChannels && ((HpsSiSensor) electrodes.getDetectorElement()).isBadChannel(channel)){
             //===> if (dropBadChannels && HPSSVTCalibrationConstants.isBadChannel((SiSensor) electrodes.getDetectorElement(), channel)) {
                 // System.out.format("%d bad\n", channel);
                 continue;

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java	Wed Mar  9 11:43:24 2016
@@ -19,33 +19,33 @@
  */
 public class SVTBadChannelFilterDriver extends Driver {
 
-	// RawTrackerHit collection name 
+    // RawTrackerHit collection name 
     private String rawTrackerHitCollection = "SVTRawTrackerHits";
 
     @Override
     public void process(EventHeader event) {
-    	
+        
         if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollection)) {
             
-        	// Get the list of raw hits from the event
-        	List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollection);
-        	
+            // Get the list of raw hits from the event
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollection);
+            
             // Get the hits meta data from the event
-        	LCMetaData meta = event.getMetaData(hits);
+            LCMetaData meta = event.getMetaData(hits);
             
-        	// Iterate over all raw hits in the event.  If the raw hit is 
-        	// identified to come from a noisy/bad channel, remove it from
-        	// the list of raw hits.
+            // Iterate over all raw hits in the event.  If the raw hit is 
+            // identified to come from a noisy/bad channel, remove it from
+            // the list of raw hits.
             Iterator<RawTrackerHit> hitsIterator = hits.iterator();
             while (hitsIterator.hasNext()) {
                 
-            	RawTrackerHit hit = hitsIterator.next();
+                RawTrackerHit hit = hitsIterator.next();
                 //hit.setMetaData(meta);
                 int strip = hit.getIdentifierFieldValue("strip");
                 HpsSiSensor sensor = (HpsSiSensor) hit.getDetectorElement();
 
                 if(sensor.isBadChannel(strip)){
-                	hitsIterator.remove();
+                    hitsIterator.remove();
                 }
 
                 if (!sensor.getReadout().getHits(RawTrackerHit.class).isEmpty()) {

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackResidualsData.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackResidualsData.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackResidualsData.java	Wed Mar  9 11:43:24 2016
@@ -13,84 +13,84 @@
  */
 public class TrackResidualsData implements GenericObject {
 
-	List<Double> trackResidualsX = new ArrayList<Double>();
-	List<Float> trackResidualsY = new ArrayList<Float>();
-	List<Integer> layers = new ArrayList<Integer>();
-	
-	/**
-	 * Default Ctor
-	 * 
-	 * @param trackerVolume : The SVT volume to which the track used to calculate
-	 * 						  the residuals corresponds to.
-	 */
-	public TrackResidualsData(int trackerVolume, List<Integer> layers, List<Double> trackResidualsX, List<Float> trackResidualsY){
-		this.layers.addAll(layers);
-		this.layers.add(trackerVolume);
-		this.trackResidualsX.addAll(trackResidualsX);
-		this.trackResidualsY.addAll(trackResidualsY);
-	}
+    List<Double> trackResidualsX = new ArrayList<Double>();
+    List<Float> trackResidualsY = new ArrayList<Float>();
+    List<Integer> layers = new ArrayList<Integer>();
+    
+    /**
+     * Default Ctor
+     * 
+     * @param trackerVolume : The SVT volume to which the track used to calculate
+     *                        the residuals corresponds to.
+     */
+    public TrackResidualsData(int trackerVolume, List<Integer> layers, List<Double> trackResidualsX, List<Float> trackResidualsY){
+        this.layers.addAll(layers);
+        this.layers.add(trackerVolume);
+        this.trackResidualsX.addAll(trackResidualsX);
+        this.trackResidualsY.addAll(trackResidualsY);
+    }
 
-	/**
-	 * 
-	 * @return tracker volume : 0 if top 1 if bottom
-	 */
-	public int getTrackerVolume(){
-		return layers.get(layers.size() - 1);
-	}
-	
-	/**
-	 * 
-	 */
-	@Override
-	public double getDoubleVal(int index) {
-		return trackResidualsX.get(index);
-	}
+    /**
+     * 
+     * @return tracker volume : 0 if top 1 if bottom
+     */
+    public int getTrackerVolume(){
+        return layers.get(layers.size() - 1);
+    }
+    
+    /**
+     * 
+     */
+    @Override
+    public double getDoubleVal(int index) {
+        return trackResidualsX.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public float getFloatVal(int index) {
-		return trackResidualsY.get(index);
-	}
+    /**
+     * 
+     */
+    @Override
+    public float getFloatVal(int index) {
+        return trackResidualsY.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getIntVal(int index) {
-		return layers.get(index);
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getIntVal(int index) {
+        return layers.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNDouble() {
-		return trackResidualsX.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNDouble() {
+        return trackResidualsX.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNFloat() {
-		return trackResidualsY.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNFloat() {
+        return trackResidualsY.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNInt() {
-		return layers.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNInt() {
+        return layers.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public boolean isFixedSize() {
-		return false;
-	}
+    /**
+     * 
+     */
+    @Override
+    public boolean isFixedSize() {
+        return false;
+    }
 }

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTimeData.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTimeData.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTimeData.java	Wed Mar  9 11:43:24 2016
@@ -12,124 +12,124 @@
  */
 public class TrackTimeData implements GenericObject {
 
-	List<Float> trackTimeData = new ArrayList<Float>(); 
-	List<Double> t0Residuals = new ArrayList<Double>(); 
-	List<Integer> layers = new ArrayList<Integer>(); 
-	
-	// Constants
-	private final static int SVT_VOLUME_INDEX = 0;
-	private final static int TRACK_TIME_INDEX = 1;
-	
-	/**
-	 * Default Ctor
-	 * 
-	 * @param trackTime : The mean t0 time of all hits of a track
-	 * @param trackerVolume : The SVT volume to which the track used to calculate
-	 * 						  the track time corresponds to.
-	 *
-	 */
-	public TrackTimeData(float trackerVolume, double trackTime, List<Integer> layers, List<Double> t0Residuals){
-		trackTimeData.add(trackerVolume);
-		trackTimeData.add((float) trackTime);
-		this.layers.addAll(layers);
-		this.t0Residuals.addAll(t0Residuals);
-	}
-	
-	/**
-	 *	 
-	 * 
-	 * @param layer : 
-	 * @param t0Residual : 
-	 * 
-	 */
-	private void addResidual(int layer, double t0Residual) {
-		layers.add(layer); 
-		t0Residuals.add(t0Residual);
-	}
+    List<Float> trackTimeData = new ArrayList<Float>(); 
+    List<Double> t0Residuals = new ArrayList<Double>(); 
+    List<Integer> layers = new ArrayList<Integer>(); 
+    
+    // Constants
+    private final static int SVT_VOLUME_INDEX = 0;
+    private final static int TRACK_TIME_INDEX = 1;
+    
+    /**
+     * Default Ctor
+     * 
+     * @param trackTime : The mean t0 time of all hits of a track
+     * @param trackerVolume : The SVT volume to which the track used to calculate
+     *                        the track time corresponds to.
+     *
+     */
+    public TrackTimeData(float trackerVolume, double trackTime, List<Integer> layers, List<Double> t0Residuals){
+        trackTimeData.add(trackerVolume);
+        trackTimeData.add((float) trackTime);
+        this.layers.addAll(layers);
+        this.t0Residuals.addAll(t0Residuals);
+    }
+    
+    /**
+     *   
+     * 
+     * @param layer : 
+     * @param t0Residual : 
+     * 
+     */
+    private void addResidual(int layer, double t0Residual) {
+        layers.add(layer); 
+        t0Residuals.add(t0Residual);
+    }
 
-	/**
-	 * 
-	 */
-	public double getTrackTime() { 
-	    return trackTimeData.get(TRACK_TIME_INDEX); 
-	}
-	
-	/**
-	 * 
-	 * 
-	 */
-	public double getT0Residual(int layer) { 
-	    return this.getDoubleVal(layer);
-	}
+    /**
+     * 
+     */
+    public double getTrackTime() { 
+        return trackTimeData.get(TRACK_TIME_INDEX); 
+    }
+    
+    /**
+     * 
+     * 
+     */
+    public double getT0Residual(int layer) { 
+        return this.getDoubleVal(layer);
+    }
 
-	/**
-	 * 
-	 */
-	public double getClusterTime(int layer) {
-	   return this.getTrackTime() - this.getT0Residual(layer); 
-	}
-	
-	/**
-	 * 
-	 * 
-	 */
-	public boolean isTopSvtVolume() { 
-	    return (trackTimeData.get(SVT_VOLUME_INDEX) == 0) ? true : false;
-	}
-	
-	/**
-	 * 
-	 */
-	@Override
-	public double getDoubleVal(int index) {
-		return t0Residuals.get(index);
-	}
+    /**
+     * 
+     */
+    public double getClusterTime(int layer) {
+       return this.getTrackTime() - this.getT0Residual(layer); 
+    }
+    
+    /**
+     * 
+     * 
+     */
+    public boolean isTopSvtVolume() { 
+        return (trackTimeData.get(SVT_VOLUME_INDEX) == 0) ? true : false;
+    }
+    
+    /**
+     * 
+     */
+    @Override
+    public double getDoubleVal(int index) {
+        return t0Residuals.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public float getFloatVal(int index) {
-		return trackTimeData.get(index);
-	}
+    /**
+     * 
+     */
+    @Override
+    public float getFloatVal(int index) {
+        return trackTimeData.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getIntVal(int index) {
-		return layers.get(index);
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getIntVal(int index) {
+        return layers.get(index);
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNDouble() {
-		return t0Residuals.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNDouble() {
+        return t0Residuals.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNFloat() {
-		return trackTimeData.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNFloat() {
+        return trackTimeData.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public int getNInt() {
-		return layers.size();
-	}
+    /**
+     * 
+     */
+    @Override
+    public int getNInt() {
+        return layers.size();
+    }
 
-	/**
-	 * 
-	 */
-	@Override
-	public boolean isFixedSize() {
-		return false;
-	}
+    /**
+     * 
+     */
+    @Override
+    public boolean isFixedSize() {
+        return false;
+    }
 }

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java	Wed Mar  9 11:43:24 2016
@@ -38,8 +38,8 @@
      * @param bfield value and sign of magnetic field
      */
     public WTrack(HelicalTrackFit track, double bfield) {
-    	_htf = track;
-    	//_bfield = flip ? -1.0 * bfield : bfield; // flip if needed
+        _htf = track;
+        //_bfield = flip ? -1.0 * bfield : bfield; // flip if needed
         _bfield = bfield; 
         _a = -1 * Constants.fieldConversion * _bfield * Math.signum(track.R());
         double p = track.p(Math.abs(_bfield));
@@ -228,8 +228,8 @@
     }
 
     /*
-    	Calculate the exact position of the new helix parameters at path length s in an arbitrarily oriented, 
-    	constant magnetic field point xp is the point h is a unit vector in the direction of the magnetic field.         
+        Calculate the exact position of the new helix parameters at path length s in an arbitrarily oriented, 
+        constant magnetic field point xp is the point h is a unit vector in the direction of the magnetic field.         
      * @param s - path length
      * @param h - magnetic field unit vector
      * @return track parameters

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLEventData.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLEventData.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLEventData.java	Wed Mar  9 11:43:24 2016
@@ -3,87 +3,87 @@
 import org.lcsim.event.GenericObject;
 
 public class GBLEventData implements GenericObject {
-	
-	/*
-	 * 
-	 * Interface enumerator to access the correct data
-	 * 
-	 */
-	private static class GBLINT {
-		public static final int RUNNR = 0;
-		public static final int BANK_INT_SIZE = 1;
-	}
-	private static class GBLDOUBLE {
-		public static final int BFIELD = 0;
-		public static final int BANK_DOUBLE_SIZE = 1;
-	}
-	// array holding the integer data
-	private int bank_int[] = new int[GBLINT.BANK_INT_SIZE];
-	private double bank_double[] = new double[GBLDOUBLE.BANK_DOUBLE_SIZE];
-	
+    
+    /*
+     * 
+     * Interface enumerator to access the correct data
+     * 
+     */
+    private static class GBLINT {
+        public static final int RUNNR = 0;
+        public static final int BANK_INT_SIZE = 1;
+    }
+    private static class GBLDOUBLE {
+        public static final int BFIELD = 0;
+        public static final int BANK_DOUBLE_SIZE = 1;
+    }
+    // array holding the integer data
+    private int bank_int[] = new int[GBLINT.BANK_INT_SIZE];
+    private double bank_double[] = new double[GBLDOUBLE.BANK_DOUBLE_SIZE];
+    
 
-	/**
-	 * Constructor with event number as parameter
-	 * @param eventNumber the event number
-	 * 
-	 */
-	public GBLEventData(int eventNumber,double Bz) {
-		setRunNr(eventNumber);
-		setBfield(Bz);
-	}
-	
-	public void setRunNr(int val) {
-		bank_int[GBLINT.RUNNR] = val;
-	}
-	
-	public int getRunNr() {
-		return this.getIntVal(GBLINT.RUNNR);
-	}
-	
-	public void setBfield(double val) {
-		bank_double[GBLDOUBLE.BFIELD] = val;
-	}
-	
-	public double getBfield() {
-		return this.getDoubleVal(GBLDOUBLE.BFIELD);
-	}
-	
-	
-	@Override
-	public int getNInt() {
-		return GBLINT.BANK_INT_SIZE;
-	}
+    /**
+     * Constructor with event number as parameter
+     * @param eventNumber the event number
+     * 
+     */
+    public GBLEventData(int eventNumber,double Bz) {
+        setRunNr(eventNumber);
+        setBfield(Bz);
+    }
+    
+    public void setRunNr(int val) {
+        bank_int[GBLINT.RUNNR] = val;
+    }
+    
+    public int getRunNr() {
+        return this.getIntVal(GBLINT.RUNNR);
+    }
+    
+    public void setBfield(double val) {
+        bank_double[GBLDOUBLE.BFIELD] = val;
+    }
+    
+    public double getBfield() {
+        return this.getDoubleVal(GBLDOUBLE.BFIELD);
+    }
+    
+    
+    @Override
+    public int getNInt() {
+        return GBLINT.BANK_INT_SIZE;
+    }
 
-	@Override
-	public int getNFloat() {
-		return 0;
-	}
+    @Override
+    public int getNFloat() {
+        return 0;
+    }
 
-	@Override
-	public int getNDouble() {
-		return GBLDOUBLE.BANK_DOUBLE_SIZE;
-	}
+    @Override
+    public int getNDouble() {
+        return GBLDOUBLE.BANK_DOUBLE_SIZE;
+    }
 
-	@Override
-	public int getIntVal(int index) {
-		return bank_int[index];
-	}
+    @Override
+    public int getIntVal(int index) {
+        return bank_int[index];
+    }
 
-	@Override
-	public float getFloatVal(int index) {
-		// TODO Auto-generated method stub
-		return 0;
-	}
+    @Override
+    public float getFloatVal(int index) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
 
-	@Override
-	public double getDoubleVal(int index) {
-		return bank_double[index];
-	}
+    @Override
+    public double getDoubleVal(int index) {
+        return bank_double[index];
+    }
 
-	@Override
-	public boolean isFixedSize() {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean isFixedSize() {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
 }

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java	Wed Mar  9 11:43:24 2016
@@ -47,11 +47,11 @@
         }
     }
     private void openFile(String fileName) {
-    	if(fileName.equalsIgnoreCase("")) {
-    		System.out.printf("%s: no file name specified \n", this.getClass().getSimpleName());
-    		System.exit(1);
-    	}
-    	try {
+        if(fileName.equalsIgnoreCase("")) {
+            System.out.printf("%s: no file name specified \n", this.getClass().getSimpleName());
+            System.exit(1);
+        }
+        try {
             _fWriter = new FileWriter(fileName);
             _pWriter = new PrintWriter(_fWriter);
         } catch (IOException ex) {

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLStripClusterData.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLStripClusterData.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLStripClusterData.java	Wed Mar  9 11:43:24 2016
@@ -13,55 +13,55 @@
  * @version $Id:
  */
 public class GBLStripClusterData implements GenericObject {
-	
-	/*
-	 * 
-	 * Interface enumerator to access the correct data
-	 * 
-	 */
-	public static class GBLINT {
-		public static final int ID = 0;
-		public static final int BANK_INT_SIZE = 1;
-	}
-	public static class GBLDOUBLE {
-		public static final int PATH3D = 0;
-		public static final int PATH = 1;
-		public static final int UX = 2;
-		public static final int UY = 3;
-		public static final int UZ = 4;
-		public static final int VX = 5;
-		public static final int VY = 6;
-		public static final int VZ = 7;
-		public static final int WX = 8;
-		public static final int WY = 9;
-		public static final int WZ = 10;	
-		public static final int TDIRX = 11;	
-		public static final int TDIRY = 12;	
-		public static final int TDIRZ = 13;	
-		public static final int TPHI = 14;	
-		public static final int UMEAS = 15;	
-		public static final int TPOSU = 16	;	
-		public static final int TPOSV = 17;	
-		public static final int TPOSW = 18;	
-		public static final int UMEASERR = 19;	
-		public static final int MSANGLE = 20;
-		public static final int TLAMBDA = 21;
-		
-		
-		public static final int BANK_DOUBLE_SIZE = 22;
-		
-	}
-	// array holding the integer data
-	private int bank_int[] = new int[GBLINT.BANK_INT_SIZE];
-	// array holding the double data
-	private double bank_double[] = new double[GBLDOUBLE.BANK_DOUBLE_SIZE];
-	
-	/**
-	 * Default constructor
-	 */
-	public GBLStripClusterData(int id) {
-		setId(id);
-	}
+    
+    /*
+     * 
+     * Interface enumerator to access the correct data
+     * 
+     */
+    public static class GBLINT {
+        public static final int ID = 0;
+        public static final int BANK_INT_SIZE = 1;
+    }
+    public static class GBLDOUBLE {
+        public static final int PATH3D = 0;
+        public static final int PATH = 1;
+        public static final int UX = 2;
+        public static final int UY = 3;
+        public static final int UZ = 4;
+        public static final int VX = 5;
+        public static final int VY = 6;
+        public static final int VZ = 7;
+        public static final int WX = 8;
+        public static final int WY = 9;
+        public static final int WZ = 10;    
+        public static final int TDIRX = 11; 
+        public static final int TDIRY = 12; 
+        public static final int TDIRZ = 13; 
+        public static final int TPHI = 14;  
+        public static final int UMEAS = 15; 
+        public static final int TPOSU = 16  ;   
+        public static final int TPOSV = 17; 
+        public static final int TPOSW = 18; 
+        public static final int UMEASERR = 19;  
+        public static final int MSANGLE = 20;
+        public static final int TLAMBDA = 21;
+        
+        
+        public static final int BANK_DOUBLE_SIZE = 22;
+        
+    }
+    // array holding the integer data
+    private int bank_int[] = new int[GBLINT.BANK_INT_SIZE];
+    // array holding the double data
+    private double bank_double[] = new double[GBLDOUBLE.BANK_DOUBLE_SIZE];
+    
+    /**
+     * Default constructor
+     */
+    public GBLStripClusterData(int id) {
+        setId(id);
+    }
         
         /*
         * Constructor from GenericObject
@@ -79,239 +79,239 @@
             }
             
         }
-	
-	/**
-	 * @param set track id to val
-	 */
-	public void setId(int val) {
-		bank_int[GBLINT.ID] = val;
-	}
-	
-	/**
-	 * @return track id for this object
-	 */
-	public int getId() {
-		return this.getIntVal(GBLINT.ID);
-	}
-	
-	/**
-	 * Set path length to this strip cluster
-	 * @param val
-	 */
-	public void setPath(double val) {
-		bank_double[GBLDOUBLE.PATH] = val;
-	}
-	
-	/**
-	 * Get path length to this strip cluster
-	 */
-	public double getPath() {
-		return getDoubleVal(GBLDOUBLE.PATH);
-	}
-
-	/**
-	 * Set path length to this strip cluster
-	 * @param val
-	 */
-	public void setPath3D(double val) {
-		bank_double[GBLDOUBLE.PATH3D] = val;
-	}
-	
-	/**
-	 * Get path length to this strip cluster
-	 */
-	public double getPath3D() {
-		return getDoubleVal(GBLDOUBLE.PATH3D);
-	}
-
-
-	/**
-	 *  Set and get u vector for this strip sensor
-	 */
-	public void setU(Hep3Vector u) {
-		bank_double[GBLDOUBLE.UX] = u.x();
-		bank_double[GBLDOUBLE.UY] = u.y();
-		bank_double[GBLDOUBLE.UZ] = u.z();		
-	}
-	public Hep3Vector getU() {
-		return new BasicHep3Vector(getUx(),getUy(),getUz());
-	}
-	public double getUx() {
-		return getDoubleVal(GBLDOUBLE.UX);
-	}
-	public double getUy() {
-		return getDoubleVal(GBLDOUBLE.UY);
-	}
-	public double getUz() {
-		return getDoubleVal(GBLDOUBLE.UZ);
-	}
-	
-	/**
-	 *  Set and get v vector for this strip sensor
-	 */
-
-	public void setV(Hep3Vector v) {
-		bank_double[GBLDOUBLE.VX] = v.x();
-		bank_double[GBLDOUBLE.VY] = v.y();
-		bank_double[GBLDOUBLE.VZ] = v.z();		
-	}
-	public Hep3Vector getV() {
-		return new BasicHep3Vector(getVx(),getVy(),getVz());
-	}
-	public double getVx() {
-		return getDoubleVal(GBLDOUBLE.VX);
-	}
-	public double getVy() {
-		return getDoubleVal(GBLDOUBLE.VY);
-	}
-	public double getVz() {
-		return getDoubleVal(GBLDOUBLE.VZ);
-	}
-
-	/**
-	 *  Set and get w vector for this strip sensor
-	 */
-
-	public void setW(Hep3Vector v) {
-		bank_double[GBLDOUBLE.WX] = v.x();
-		bank_double[GBLDOUBLE.WY] = v.y();
-		bank_double[GBLDOUBLE.WZ] = v.z();		
-	}
-	public Hep3Vector getW() {
-		return new BasicHep3Vector(getWx(),getWy(),getWz());
-	}
-	public double getWx() {
-		return getDoubleVal(GBLDOUBLE.WX);
-	}
-	public double getWy() {
-		return getDoubleVal(GBLDOUBLE.WY);
-	}
-	public double getWz() {
-		return getDoubleVal(GBLDOUBLE.WZ);
-	}
-
-	/**
-	 * Set track direction at this cluster
-	 * 
-	 * @param tDir
-	 */
-	public void setTrackDir(Hep3Vector v) {
-		bank_double[GBLDOUBLE.TDIRX] = v.x();
-		bank_double[GBLDOUBLE.TDIRY] = v.y();
-		bank_double[GBLDOUBLE.TDIRZ] = v.z();		
-	}
-	public Hep3Vector getTrackDirection() {
-		return new BasicHep3Vector(getTx(),getTy(),getTz());
-	}
-	public double getTx() {
-		return getDoubleVal(GBLDOUBLE.TDIRX);
-	}
-	public double getTy() {
-		return getDoubleVal(GBLDOUBLE.TDIRY);
-	}
-	public double getTz() {
-		return getDoubleVal(GBLDOUBLE.TDIRZ);
-	}
-
-	public void setTrackPhi(double phi) {
-		bank_double[GBLDOUBLE.TPHI] = phi;
-	}
-	
-	public double getTrackPhi() {
-		return getDoubleVal(GBLDOUBLE.TPHI);
-	}
-
-	public void setTrackLambda(double lambda) {
-		bank_double[GBLDOUBLE.TLAMBDA] = lambda;
-	}
-	
-	public double getTrackLambda() {
-		return getDoubleVal(GBLDOUBLE.TLAMBDA);
-	}
-
-	
-	public void setMeas(double umeas) {
-		bank_double[GBLDOUBLE.UMEAS] = umeas;
-	}
-	
-	public double getMeas() {
-		return getDoubleVal(GBLDOUBLE.UMEAS);
-	}
-	
-	public void setMeasErr(double x) {
-		bank_double[GBLDOUBLE.UMEASERR] = x;
-	}
-
-	public double getMeasErr() {
-		return getDoubleVal(GBLDOUBLE.UMEASERR);
-	}
-
-	
-	/**
-	 * Set track position in local frame
-	 * @param trkpos_meas
-	 */
-	public void setTrackPos(Hep3Vector trkpos_meas) {
-		bank_double[GBLDOUBLE.TPOSU] = trkpos_meas.x();
-		bank_double[GBLDOUBLE.TPOSV] = trkpos_meas.y();
-		bank_double[GBLDOUBLE.TPOSW] = trkpos_meas.z();
-	}
-
-	public Hep3Vector getTrackPos() {
-		return new BasicHep3Vector(getTrackPosU(),getTrackPosV(),getTrackPosW());
-	}
-	
-	public double getTrackPosU() {
-		return getDoubleVal(GBLDOUBLE.TPOSU);
-	}
-
-	public double getTrackPosV() {
-		return getDoubleVal(GBLDOUBLE.TPOSV);
-	}
-
-	public double getTrackPosW() {
-		return getDoubleVal(GBLDOUBLE.TPOSW);
-	}
-
-	public void setScatterAngle(double scatAngle) {
-		bank_double[GBLDOUBLE.MSANGLE] = scatAngle;
-	}
-	
-	public double getScatterAngle() {
-		return getDoubleVal(GBLDOUBLE.MSANGLE);
-	}
-	
-	/*
-	 * The functions below are all overide from 
-	 * @see org.lcsim.event.GenericObject#getNInt()
-	 */
-	
-	public int getNInt() {
-		return GBLINT.BANK_INT_SIZE;
-	}
-
-	public int getNFloat() {
-		return 0;
-	}
-
-	public int getNDouble() {
-		return GBLDOUBLE.BANK_DOUBLE_SIZE;
-	}
-
-	public int getIntVal(int index) {
-		return bank_int[index];
-	}
-
-	public float getFloatVal(int index) {
-		return 0;
-	}
-
-	public double getDoubleVal(int index) {
-		return bank_double[index];
-	}
-
-	public boolean isFixedSize() {
-		return false;
-	}
+    
+    /**
+     * @param set track id to val
+     */
+    public void setId(int val) {
+        bank_int[GBLINT.ID] = val;
+    }
+    
+    /**
+     * @return track id for this object
+     */
+    public int getId() {
+        return this.getIntVal(GBLINT.ID);
+    }
+    
+    /**
+     * Set path length to this strip cluster
+     * @param val
+     */
+    public void setPath(double val) {
+        bank_double[GBLDOUBLE.PATH] = val;
+    }
+    
+    /**
+     * Get path length to this strip cluster
+     */
+    public double getPath() {
+        return getDoubleVal(GBLDOUBLE.PATH);
+    }
+
+    /**
+     * Set path length to this strip cluster
+     * @param val
+     */
+    public void setPath3D(double val) {
+        bank_double[GBLDOUBLE.PATH3D] = val;
+    }
+    
+    /**
+     * Get path length to this strip cluster
+     */
+    public double getPath3D() {
+        return getDoubleVal(GBLDOUBLE.PATH3D);
+    }
+
+
+    /**
+     *  Set and get u vector for this strip sensor
+     */
+    public void setU(Hep3Vector u) {
+        bank_double[GBLDOUBLE.UX] = u.x();
+        bank_double[GBLDOUBLE.UY] = u.y();
+        bank_double[GBLDOUBLE.UZ] = u.z();      
+    }
+    public Hep3Vector getU() {
+        return new BasicHep3Vector(getUx(),getUy(),getUz());
+    }
+    public double getUx() {
+        return getDoubleVal(GBLDOUBLE.UX);
+    }
+    public double getUy() {
+        return getDoubleVal(GBLDOUBLE.UY);
+    }
+    public double getUz() {
+        return getDoubleVal(GBLDOUBLE.UZ);
+    }
+    
+    /**
+     *  Set and get v vector for this strip sensor
+     */
+
+    public void setV(Hep3Vector v) {
+        bank_double[GBLDOUBLE.VX] = v.x();
+        bank_double[GBLDOUBLE.VY] = v.y();
+        bank_double[GBLDOUBLE.VZ] = v.z();      
+    }
+    public Hep3Vector getV() {
+        return new BasicHep3Vector(getVx(),getVy(),getVz());
+    }
+    public double getVx() {
+        return getDoubleVal(GBLDOUBLE.VX);
+    }
+    public double getVy() {
+        return getDoubleVal(GBLDOUBLE.VY);
+    }
+    public double getVz() {
+        return getDoubleVal(GBLDOUBLE.VZ);
+    }
+
+    /**
+     *  Set and get w vector for this strip sensor
+     */
+
+    public void setW(Hep3Vector v) {
+        bank_double[GBLDOUBLE.WX] = v.x();
+        bank_double[GBLDOUBLE.WY] = v.y();
+        bank_double[GBLDOUBLE.WZ] = v.z();      
+    }
+    public Hep3Vector getW() {
+        return new BasicHep3Vector(getWx(),getWy(),getWz());
+    }
+    public double getWx() {
+        return getDoubleVal(GBLDOUBLE.WX);
+    }
+    public double getWy() {
+        return getDoubleVal(GBLDOUBLE.WY);
+    }
+    public double getWz() {
+        return getDoubleVal(GBLDOUBLE.WZ);
+    }
+
+    /**
+     * Set track direction at this cluster
+     * 
+     * @param tDir
+     */
+    public void setTrackDir(Hep3Vector v) {
+        bank_double[GBLDOUBLE.TDIRX] = v.x();
+        bank_double[GBLDOUBLE.TDIRY] = v.y();
+        bank_double[GBLDOUBLE.TDIRZ] = v.z();       
+    }
+    public Hep3Vector getTrackDirection() {
+        return new BasicHep3Vector(getTx(),getTy(),getTz());
+    }
+    public double getTx() {
+        return getDoubleVal(GBLDOUBLE.TDIRX);
+    }
+    public double getTy() {
+        return getDoubleVal(GBLDOUBLE.TDIRY);
+    }
+    public double getTz() {
+        return getDoubleVal(GBLDOUBLE.TDIRZ);
+    }
+
+    public void setTrackPhi(double phi) {
+        bank_double[GBLDOUBLE.TPHI] = phi;
+    }
+    
+    public double getTrackPhi() {
+        return getDoubleVal(GBLDOUBLE.TPHI);
+    }
+
+    public void setTrackLambda(double lambda) {
+        bank_double[GBLDOUBLE.TLAMBDA] = lambda;
+    }
+    
+    public double getTrackLambda() {
+        return getDoubleVal(GBLDOUBLE.TLAMBDA);
+    }
+
+    
+    public void setMeas(double umeas) {
+        bank_double[GBLDOUBLE.UMEAS] = umeas;
+    }
+    
+    public double getMeas() {
+        return getDoubleVal(GBLDOUBLE.UMEAS);
+    }
+    
+    public void setMeasErr(double x) {
+        bank_double[GBLDOUBLE.UMEASERR] = x;
+    }
+
+    public double getMeasErr() {
+        return getDoubleVal(GBLDOUBLE.UMEASERR);
+    }
+
+    
+    /**
+     * Set track position in local frame
+     * @param trkpos_meas
+     */
+    public void setTrackPos(Hep3Vector trkpos_meas) {
+        bank_double[GBLDOUBLE.TPOSU] = trkpos_meas.x();
+        bank_double[GBLDOUBLE.TPOSV] = trkpos_meas.y();
+        bank_double[GBLDOUBLE.TPOSW] = trkpos_meas.z();
+    }
+
+    public Hep3Vector getTrackPos() {
+        return new BasicHep3Vector(getTrackPosU(),getTrackPosV(),getTrackPosW());
+    }
+    
+    public double getTrackPosU() {
+        return getDoubleVal(GBLDOUBLE.TPOSU);
+    }
+
+    public double getTrackPosV() {
+        return getDoubleVal(GBLDOUBLE.TPOSV);
+    }
+
+    public double getTrackPosW() {
+        return getDoubleVal(GBLDOUBLE.TPOSW);
+    }
+
+    public void setScatterAngle(double scatAngle) {
+        bank_double[GBLDOUBLE.MSANGLE] = scatAngle;
+    }
+    
+    public double getScatterAngle() {
+        return getDoubleVal(GBLDOUBLE.MSANGLE);
+    }
+    
+    /*
+     * The functions below are all overide from 
+     * @see org.lcsim.event.GenericObject#getNInt()
+     */
+    
+    public int getNInt() {
+        return GBLINT.BANK_INT_SIZE;
+    }
+
+    public int getNFloat() {
+        return 0;
+    }
+
+    public int getNDouble() {
+        return GBLDOUBLE.BANK_DOUBLE_SIZE;
+    }
+
+    public int getIntVal(int index) {
+        return bank_int[index];
+    }
+
+    public float getFloatVal(int index) {
+        return 0;
+    }
+
+    public double getDoubleVal(int index) {
+        return bank_double[index];
+    }
+
+    public boolean isFixedSize() {
+        return false;
+    }
 
 }

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblData.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblData.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblData.java	Wed Mar  9 11:43:24 2016
@@ -69,8 +69,8 @@
             nExt = extDer.getColumnDimension();
         }
         int nParMax = 5 + nLocal + nExt;
-//	theParameters.reserve(nParMax); // have to be sorted
-//	theDerivatives.reserve(nParMax);
+//  theParameters.reserve(nParMax); // have to be sorted
+//  theDerivatives.reserve(nParMax);
 
         if (derLocal != null) {
             for (int i = 0; i < derLocal.getColumnDimension(); ++i) // local derivatives
@@ -123,8 +123,8 @@
             nExtDer = extDer.getColumnDimension();
         }
         int nParMax = 7 + nExtDer;
-//	theParameters.reserve(nParMax); // have to be sorted
-//	theDerivatives.reserve(nParMax);
+//  theParameters.reserve(nParMax); // have to be sorted
+//  theDerivatives.reserve(nParMax);
 
         if (extDer != null) {
             for (int i = 0; i < extDer.getColumnDimension(); ++i) // external derivatives
@@ -151,14 +151,14 @@
 // * \param [in] derivatives Derivatives (vector)
 // */
 //void addDerivatives(const std::vector<unsigned int> &index,
-//		const std::vector<double> &derivatives) {
-//	for (unsigned int i = 0; i < derivatives.size(); ++i) // any derivatives
-//			{
-//		if (derivatives[i]) {
-//			theParameters.push_back(index[i]);
-//			theDerivatives.push_back(derivatives[i]);
-//		}
-//	}
+//      const std::vector<double> &derivatives) {
+//  for (unsigned int i = 0; i < derivatives.size(); ++i) // any derivatives
+//          {
+//      if (derivatives[i]) {
+//          theParameters.push_back(index[i]);
+//          theDerivatives.push_back(derivatives[i]);
+//      }
+//  }
 //}
 /// Calculate prediction for data from fit (by GblTrajectory::fit).
     void setPrediction(VVector aVector)
@@ -176,27 +176,27 @@
 // */
 //double setDownWeighting(unsigned int aMethod) {
 //
-//	double aWeight = 1.;
-//	double scaledResidual = fabs(theValue - thePrediction) * sqrt(thePrecision);
-//	if (aMethod == 1) // Tukey
-//			{
-//		if (scaledResidual < 4.6851) {
-//			aWeight = (1.0 - 0.045558 * scaledResidual * scaledResidual);
-//			aWeight *= aWeight;
-//		} else {
-//			aWeight = 0.;
-//		}
-//	} else if (aMethod == 2) //Huber
-//			{
-//		if (scaledResidual >= 1.345) {
-//			aWeight = 1.345 / scaledResidual;
-//		}
-//	} else if (aMethod == 3) //Cauchy
-//			{
-//		aWeight = 1.0 / (1.0 + (scaledResidual * scaledResidual / 5.6877));
-//	}
-//	theDownWeight = aWeight;
-//	return aWeight;
+//  double aWeight = 1.;
+//  double scaledResidual = fabs(theValue - thePrediction) * sqrt(thePrecision);
+//  if (aMethod == 1) // Tukey
+//          {
+//      if (scaledResidual < 4.6851) {
+//          aWeight = (1.0 - 0.045558 * scaledResidual * scaledResidual);
+//          aWeight *= aWeight;
+//      } else {
+//          aWeight = 0.;
+//      }
+//  } else if (aMethod == 2) //Huber
+//          {
+//      if (scaledResidual >= 1.345) {
+//          aWeight = 1.345 / scaledResidual;
+//      }
+//  } else if (aMethod == 3) //Cauchy
+//          {
+//      aWeight = 1.0 / (1.0 + (scaledResidual * scaledResidual / 5.6877));
+//  }
+//  theDownWeight = aWeight;
+//  return aWeight;
 //}
 //
 /// Calculate Chi2 contribution.

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblPoint.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblPoint.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblPoint.java	Wed Mar  9 11:43:24 2016
@@ -486,7 +486,7 @@
     {
         int ifail = 0;
 // to optimize: need only two last rows of inverse
-//	prevJacobian = aJac.InverseFast(ifail);
+//  prevJacobian = aJac.InverseFast(ifail);
 //  block matrix algebra
         Matrix CA = aJac.sub(2, 3, 3, 0).times(aJac.sub(3, 0, 0).inverse()); // C*A^-1
         Matrix DCAB = aJac.sub(2, 3, 3).minus(CA.times(aJac.sub(3, 2, 0, 3))); // D - C*A^-1 *B
@@ -531,14 +531,14 @@
         }
 
         matW.placeAt(matWt.inverse(), 0, 0);
-//	if (!matW.InvertFast()) {
-//		std::cout << " getDerivatives failed to invert matrix: "
-//				<< matW << "\n";
-//		std::cout
-//				<< " Possible reason for singular matrix: multiple GblPoints at same arc-length"
-//				<< "\n";
-//		throw std::overflow_error("Singular matrix inversion exception");
-//	}
+//  if (!matW.InvertFast()) {
+//      std::cout << " getDerivatives failed to invert matrix: "
+//              << matW << "\n";
+//      std::cout
+//              << " Possible reason for singular matrix: multiple GblPoints at same arc-length"
+//              << "\n";
+//      throw std::overflow_error("Singular matrix inversion exception");
+//  }
         matWJ.placeAt(matW.times(matJ), 0, 0);
         vecWd.placeAt(matW.times(vecd), 0, 0);
 

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblTrajectory.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblTrajectory.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblTrajectory.java	Wed Mar  9 11:43:24 2016
@@ -268,7 +268,7 @@
             List<GblPoint> list = thePoints.get(iTraj);
             int size = list.size();
             // first point is offset
-            list.get(0).setOffset(numOffsets++);		// intermediate scatterers are offsets
+            list.get(0).setOffset(numOffsets++);        // intermediate scatterers are offsets
             for (int i = 1; i < size - 1; ++i) {
                 GblPoint p = list.get(i);
                 if (p.hasScatterer()) {
@@ -434,7 +434,7 @@
             aPoint.getDerivatives(0, prevW, prevWJ, prevWd); // W-, W- * J-, W- * d-
             aPoint.getDerivatives(1, nextW, nextWJ, nextWd); // W-, W- * J-, W- * d-
             Matrix sumWJ = prevWJ.plus(nextWJ);
-//?		matN = sumWJ.inverse(ierr); // N = (W- * J- + W+ * J+)^-1
+//?     matN = sumWJ.inverse(ierr); // N = (W- * J- + W+ * J+)^-1
             // derivatives for u_int
             Matrix prevNW = matN.times(prevW); // N * W-
             Matrix nextNW = matN.times(nextW); // N * W+

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblUtils.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblUtils.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GblUtils.java	Wed Mar  9 11:43:24 2016
@@ -234,7 +234,7 @@
         /*
          Simple jacobian: quadratic in arc length difference.
          using lambda phi as directions
-	    
+        
          @param ds: arc length difference
          @type ds: float
          @param cosl: cos(lambda)

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/HpsGblRefitter.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/HpsGblRefitter.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/HpsGblRefitter.java	Wed Mar  9 11:43:24 2016
@@ -341,11 +341,11 @@
             // measurement/residual in the measurement system
             // only 1D measurement in u-direction, set strip measurement direction to zero
             Vector meas = new Vector(2);
-//		double uRes = strip->GetUmeas() - strip->GetTrackPos().x(); // how can this be correct?
+//      double uRes = strip->GetUmeas() - strip->GetTrackPos().x(); // how can this be correct?
             double uRes = strip.getMeas() - strip.getTrackPos().x();
             meas.set(0, uRes);
             meas.set(1, 0.);
-//		//meas[0][0] += deltaU[iLayer] # misalignment
+//      //meas[0][0] += deltaU[iLayer] # misalignment
             Vector measErr = new Vector(2);
             measErr.set(0, strip.getMeasErr());
             measErr.set(1, 0.);

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java	Wed Mar  9 11:43:24 2016
@@ -73,14 +73,14 @@
         Map<Integer, List<SimTrackerHit>> simHitsLayerMap = new HashMap<Integer, List<SimTrackerHit> >();
         Map<MCParticle, List<SimTrackerHit> > mcPartSimHitsMap = new HashMap<MCParticle, List<SimTrackerHit > >();
         for(SimTrackerHit sh : simTrackerHits) {
-        	 Hep3Vector shpos = CoordinateTransformations.transformVectorToTracking(sh.getPositionVec());
-        	if(Math.abs(shpos.x()) < 50.0) {
-        		 System.out.printf("%s: Weird hit at %s (%s) in layer %d for MC part %d org %s p %s\n",
+             Hep3Vector shpos = CoordinateTransformations.transformVectorToTracking(sh.getPositionVec());
+            if(Math.abs(shpos.x()) < 50.0) {
+                 System.out.printf("%s: Weird hit at %s (%s) in layer %d for MC part %d org %s p %s\n",
                          this.getClass().getSimpleName(),sh.getPositionVec().toString(),shpos.toString(),sh.getIdentifierFieldValue("layer"),
                          sh.getMCParticle().getPDGID(),sh.getMCParticle().getOrigin().toString(),sh.getMCParticle().getMomentum().toString());
-        		 System.exit(1);
-        	}
-        	
+                 System.exit(1);
+            }
+            
             int layer  = sh.getIdentifierFieldValue("layer");
             if(!simHitsLayerMap.containsKey(layer)) {
                 simHitsLayerMap.put(layer, new ArrayList<SimTrackerHit>());
@@ -96,28 +96,28 @@
 
         
         for(MCParticle mcp : mcPartSimHitsMap.keySet()) {
-        	this.h_mcp_org.fill(mcp.getOriginX(), mcp.getOriginY());
+            this.h_mcp_org.fill(mcp.getOriginX(), mcp.getOriginY());
         }
 
         // Find the particle responsible for the hit in each layer and compute the residual
         
         for(int layer=1;layer<13;++layer) {
-        	//System.out.printf("layer %d: \n",layer);
+            //System.out.printf("layer %d: \n",layer);
             
             List<SimTrackerHit> simHitsLayer = simHitsLayerMap.get(layer);
-        	
+            
             
             if(simHitsLayer != null ) {
-            	
-            	if(simHitsLayer.size()==2) continue;
-            	
+                
+                if(simHitsLayer.size()==2) continue;
+                
                 for(SimTrackerHit simHit : simHitsLayer) {
-                	
-                	 // Find the MC particle
+                    
+                     // Find the MC particle
                     MCParticle mcp = simHit.getMCParticle();
                     
                     if(mcp.getMomentum().magnitude()<0.5) continue;
-                	
+                    
                     // Position in tracking coord
                     Hep3Vector simHitPosTracking = CoordinateTransformations.transformVectorToTracking(simHit.getPositionVec());
                     
@@ -171,24 +171,24 @@
                     }
                     
                     if(layer == 1 && res.y() > 0.1 && this.firstWeirdTrack) {
-                    	double dx = 1.0;
-                    	double xpos = mcp.getOriginZ();
-                    	while(xpos< 100.) {
-                    		xpos += dx;
-                    		trkposExtraPolator = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(htfTruth,xpos));
-                    		double ypos = trkposExtraPolator.y();
-                    		trkpos_y_vs_x.fill(xpos,ypos);
-                    	}
-                    	
-                    	int idummy = 0;
-                    	while(idummy<2) {
-                    		trkpos_y_vs_x.fill(simHitPosTracking.x(),simHitPosTracking.y());
-                    		idummy++;
-                    		//System.out.printf("weird simhit res pos %s \n", simHitPosTracking.toString());
-                    	}
-                    	
-                    	this.firstWeirdTrack = false;
-                    	
+                        double dx = 1.0;
+                        double xpos = mcp.getOriginZ();
+                        while(xpos< 100.) {
+                            xpos += dx;
+                            trkposExtraPolator = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(htfTruth,xpos));
+                            double ypos = trkposExtraPolator.y();
+                            trkpos_y_vs_x.fill(xpos,ypos);
+                        }
+                        
+                        int idummy = 0;
+                        while(idummy<2) {
+                            trkpos_y_vs_x.fill(simHitPosTracking.x(),simHitPosTracking.y());
+                            idummy++;
+                            //System.out.printf("weird simhit res pos %s \n", simHitPosTracking.toString());
+                        }
+                        
+                        this.firstWeirdTrack = false;
+                        
                     }
                     
                 
@@ -200,12 +200,12 @@
 
   
     public IHistogram getResidual(int layer,String coord) {
-    	if( !this.res_truthsimhit.containsKey(layer) ) 
-    		throw new RuntimeException("Error the layer number is not valid");
-    	if( coord!="x" || coord!="y")
-    		throw new RuntimeException("Error the coord is not valid");
-    	IHistogram1D h = this.res_truthsimhit.get(layer).get(coord=="x"?0:1);
-    	return h;
+        if( !this.res_truthsimhit.containsKey(layer) ) 
+            throw new RuntimeException("Error the layer number is not valid");
+        if( coord!="x" || coord!="y")
+            throw new RuntimeException("Error the coord is not valid");
+        IHistogram1D h = this.res_truthsimhit.get(layer).get(coord=="x"?0:1);
+        return h;
     }
     
 

Modified: java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java	Wed Mar  9 11:43:24 2016
@@ -49,361 +49,361 @@
  * Class building a new compact.xml detector based on MillepedeII input
  * corrections.
  * 
- * @author 	Per Ola Hansson Adrian <[log in to unmask]>
- * @date 	January 15, 2014 
+ * @author  Per Ola Hansson Adrian <[log in to unmask]>
+ * @date    January 15, 2014 
  */
 public class BuildCompact {
 
-	private static int runNumber = -1; //1351;
-	private static String detectorName = ""; //"HPS-TestRun-v7";
-	private static ConditionsManager conditionsManager = null;
-	
-	private static Options createCmdLineOpts() {
-		Options options = new Options();
-		options.addOption(new Option("c",true,"The path to the compact xml file."));
-		options.addOption(new Option("o",true,"The name of the new compact xml file."));
-		options.addOption(new Option("d",true,"Detector name."));
-		options.addOption(new Option("r",true,"Run number."));
-		
-		return options;
-	}
-	
-	private static void printHelpAndExit(Options options) {
-		HelpFormatter help = new HelpFormatter();
-		help.printHelp(" ", options);
-		System.exit(1);
-	}
-	
-	//private static buildDetector()
-
-	
-	
-	
-	
-	
-	private static class MilleParameterSet {
-		private IDetectorElement _det = null;
-		 List<MilleParameter> params = new ArrayList<MilleParameter>();
-		public MilleParameterSet(IDetectorElement d) {
-			setDetector(d);
-		}
-		public void setDetector(IDetectorElement d) {
-			_det = d;
-		}
-		public IDetectorElement getDetector() {
-			return _det;
-		}
-		public void add(MilleParameter par) {
-			params.add(par);
-		}
-		public Hep3Vector getLocalTranslation() {
-			Map<String,Double> m = new HashMap<String,Double>();
-			for(MilleParameter p : params) {
-				if (p.getType() == 1) {
-					if (p.getDim() == 1) m.put("u", p.getValue());
-					else if(p.getDim() == 2) m.put("v", p.getValue());
-					else m.put("w", p.getValue());
-				}
-			}
-			if(m.size() != 3) {
-				System.out.println("bad trans!!");
-				System.exit(1);
-			}
-			return new BasicHep3Vector(m.get("u"),m.get("v"),m.get("w"));
-			 
-		}
-		public Hep3Vector getLocalRotation() {
-			Map<String,Double> m = new HashMap<String,Double>();
-			for(MilleParameter p : params) {
-				if (p.getType() == 2) {
-					if (p.getDim() == 1) m.put("alpha",p.getValue());
-					else if(p.getDim() == 2) m.put("beta", p.getValue());
-					else m.put("gamma", p.getValue());
-				}
-			}
-			if(m.size() != 3) {
-				System.out.println("bad rot!!");
-				System.exit(1);
-			}
-			return new BasicHep3Vector(m.get("alpha"),m.get("beta"),m.get("gamma"));
-		}
-		public Hep3Vector getGlobalTranslation() {
-			ITransform3D localToGlobal = getLocalToGlobal();
-			return localToGlobal.getRotation().rotated(getLocalTranslation());
-		}
-		public double getGlobalTranslation(int d) {
-			return getGlobalTranslation().v()[d-1];
-		}
-		public Hep3Vector getGlobalRotation() {
-			ITransform3D localToGlobal = getLocalToGlobal();
-			return localToGlobal.getRotation().rotated(getLocalRotation());
-		}
-		public double getGlobalRotation(int d) {
-			return getGlobalRotation().v()[d-1];
-		}
-		public ITransform3D getLocalToGlobal() {
-			ITransform3D localToGlobal = ( (SiSensor) _det).getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
-			return localToGlobal;
-		}		
-		
-	}
-	
-	public static void main(String[] args) {
-
-		// Setup command line input
-		Options options = createCmdLineOpts();
-		if (args.length == 0) {
-			printHelpAndExit(options);
-		}
-
-		CommandLineParser parser = new PosixParser();
-		CommandLine cl = null;
-		try {
-			cl = parser.parse(options, args);
-		} catch (ParseException e) {
-			throw new RuntimeException("Problem parsing command line options.",e);
-		}
-		
-		String compactFilename = null;  
-		if(cl.hasOption("c")) {
-			compactFilename = cl.getOptionValue("c");
-		} else {
-			printHelpAndExit(options);
-		}
-		
-		if(cl.hasOption("d")) {
-			detectorName = cl.getOptionValue("d");
-		} else {
-			printHelpAndExit(options);
-		}
-
-		if(cl.hasOption("r")) {
-			runNumber = Integer.parseInt(cl.getOptionValue("r"));
-		} else {
-			printHelpAndExit(options);
-		}
-
-		String compactFilenameNew = "compact_new.xml";
-		if(cl.hasOption("o")) {
-			compactFilenameNew = cl.getOptionValue("o");
-		}
-
-		
-		
-		File compactFile = new File(compactFilename);
-		
-		// read XML
-		SAXBuilder builder = new SAXBuilder();
-		Document compact_document = null;
-		try {
-			compact_document = (Document) builder.build(compactFile);
-		} catch (JDOMException | IOException e1) {
-			throw new RuntimeException("problem with JDOM ", e1);
-		}
-				
-		// read detector geometry
-		FileInputStream inCompact;
-		try {
-			inCompact = new FileInputStream(compactFile);
-		} catch (FileNotFoundException e) {
-			throw new RuntimeException("cannot open compact file",e);
-		}
-
-		GeometryReader reader = new GeometryReader();
-		Detector det;
-		try {
-			det = reader.read(inCompact);
-		} catch (IOException | JDOMException | ElementCreationException e) {
-			throw new RuntimeException("problem reading compact file",e);
-		}
-
-		
-		// set conditions in order to be able to determine which sensors are where in the geometry
-		setConditions(detectorName,runNumber);
-		
-		// Loop over all millepede input files and match parameters with detectors
-		
-		List<MilleParameterSet> list_det = new ArrayList<MilleParameterSet>();
-		
-		FileInputStream inMille = null;
-		BufferedReader brMille = null;
-		try {
-			for(String milleFilename : cl.getArgs()) {
-				inMille = new FileInputStream(milleFilename);
-				brMille = new BufferedReader(new InputStreamReader(inMille));
-				String line;
-				while((line = brMille.readLine()) != null) {
-					//System.out.printf("%s\n",line);
-					if(!line.contains("Parameter") && !line.contains("!")) {
-						
-						MilleParameter par = new MilleParameter(line);
-						//System.out.println(par.getXMLName() + " " + par.getValue());
-						
-						SiSensor detEle = getTrackerDetElement( det,  par);
-						if(detEle == null) {
-							System.out.println("Couldn't find detector for param " + par.getId());
-							System.exit(1);
-						}
-						System.out.println("Found detector  " + detEle.getName());
-						if(detEle.getClass().isInstance(SiSensor.class)) {
-							System.out.println("yeah");
-						}
-
-						// do we have it already?
-						MilleParameterSet useSet = null;
-						for(MilleParameterSet set : list_det) {
-							if(set.getDetector() == detEle) {
-								useSet = set;
-							}
-						}
-						
-						if (useSet == null) {
-							useSet = new MilleParameterSet(detEle);
-							list_det.add(useSet);
-						}
-						
-						//add the parameter
-						useSet.add(par);
-						
-						
-					}
-				}
-				brMille.close();
-			}
-		}
-		catch (IOException e) {
-			throw new RuntimeException("problem reading mille file",e);
-		}
-		
-		for(MilleParameterSet set : list_det) {
-			System.out.println("Detector " + set.getDetector().getName());
-			List<MilleParameter> pars = set.params;
-			for(MilleParameter p : pars) {
-				System.out.println(p.getXMLName() + " " + p.getValue());
-				Element node = findXMLNode(compact_document,p.getXMLName());
-				double value = 0.0;
-				if(p.getType() == 1){
-					value = set.getGlobalTranslation(p.getDim());
-				} else if(p.getType() == 2){
-					value = set.getGlobalRotation(p.getDim());
-				} else {
-					System.out.println("This type is illdefnied " + p.getType());
-					System.exit(1);
-				}
-				node.setAttribute("value", String.format("%.6f",value));
-			}
-			Hep3Vector u = getMeasuredCoordinate( (SiSensor )set.getDetector());
-			System.out.println("u  " + u.toString());
-			System.out.println("t (local)  " + set.getLocalTranslation().toString());
-			System.out.println("t (global) " + set.getGlobalTranslation().toString());
-			System.out.println("r (local)  " + set.getLocalRotation().toString());
-			System.out.println("r (global) " + set.getGlobalRotation().toString());
-			
-			
-		}
-
-		// Save new XML file
-		
-		XMLOutputter xmlOutput = new XMLOutputter();
-		// display nice 
-		//xmlOutput.setFormat(Format.getPrettyFormat());
-		try {
-			xmlOutput.output(compact_document, new FileWriter(compactFilenameNew));
-		} catch (IOException e) {
-			throw new RuntimeException("problem with xml output",e);
-		}
-			
-		
-		
-		
-		
-	}
-
-	private static Element findXMLNode(Document document, String name) {
-		Element rootNode = document.getRootElement();
-		List list = rootNode.getChildren("define");
-		for(int i = 0; i < list.size(); ++i ) {
-			Element node = (Element) list.get(i);
-			List llist = node.getChildren("constant");
-			//System.out.println("length of list " + llist.size());
-			for(int ii = 0; ii < llist.size(); ++ii ) {
-				Element nnode = (Element) llist.get(ii);
-				//System.out.println("node name " + nnode.getAttributeValue("name") + " " + nnode.getAttributeValue("value") );
-				//if(nnode.getAttributeValue("name").contains(name)) {
-				if(nnode.getAttributeValue("name").compareTo(name) ==0 ) {
-					return nnode;
-				}
-			}
-		}	
-		
-		return null;
-	}
-	
-	private static void setConditions(String detectorName, int run) {
-
-		try {
-			if(conditionsManager == null) {
-				conditionsManager = ConditionsManager.defaultInstance();				
-			}
-			conditionsManager.setDetector(detectorName, run);
-			
-		} catch (ConditionsNotFoundException e1) {
-			throw new RuntimeException("problem setting conditions",e1);
-		}
-		
-	}
-
-	private static SiSensor getTrackerDetElement(Detector det, MilleParameter par) {
-		List<SiSensor> sensors = det.getSubdetector("Tracker").getDetectorElement().findDescendants(SiSensor.class);
+    private static int runNumber = -1; //1351;
+    private static String detectorName = ""; //"HPS-TestRun-v7";
+    private static ConditionsManager conditionsManager = null;
+    
+    private static Options createCmdLineOpts() {
+        Options options = new Options();
+        options.addOption(new Option("c",true,"The path to the compact xml file."));
+        options.addOption(new Option("o",true,"The name of the new compact xml file."));
+        options.addOption(new Option("d",true,"Detector name."));
+        options.addOption(new Option("r",true,"Run number."));
+        
+        return options;
+    }
+    
+    private static void printHelpAndExit(Options options) {
+        HelpFormatter help = new HelpFormatter();
+        help.printHelp(" ", options);
+        System.exit(1);
+    }
+    
+    //private static buildDetector()
+
+    
+    
+    
+    
+    
+    private static class MilleParameterSet {
+        private IDetectorElement _det = null;
+         List<MilleParameter> params = new ArrayList<MilleParameter>();
+        public MilleParameterSet(IDetectorElement d) {
+            setDetector(d);
+        }
+        public void setDetector(IDetectorElement d) {
+            _det = d;
+        }
+        public IDetectorElement getDetector() {
+            return _det;
+        }
+        public void add(MilleParameter par) {
+            params.add(par);
+        }
+        public Hep3Vector getLocalTranslation() {
+            Map<String,Double> m = new HashMap<String,Double>();
+            for(MilleParameter p : params) {
+                if (p.getType() == 1) {
+                    if (p.getDim() == 1) m.put("u", p.getValue());
+                    else if(p.getDim() == 2) m.put("v", p.getValue());
+                    else m.put("w", p.getValue());
+                }
+            }
+            if(m.size() != 3) {
+                System.out.println("bad trans!!");
+                System.exit(1);
+            }
+            return new BasicHep3Vector(m.get("u"),m.get("v"),m.get("w"));
+             
+        }
+        public Hep3Vector getLocalRotation() {
+            Map<String,Double> m = new HashMap<String,Double>();
+            for(MilleParameter p : params) {
+                if (p.getType() == 2) {
+                    if (p.getDim() == 1) m.put("alpha",p.getValue());
+                    else if(p.getDim() == 2) m.put("beta", p.getValue());
+                    else m.put("gamma", p.getValue());
+                }
+            }
+            if(m.size() != 3) {
+                System.out.println("bad rot!!");
+                System.exit(1);
+            }
+            return new BasicHep3Vector(m.get("alpha"),m.get("beta"),m.get("gamma"));
+        }
+        public Hep3Vector getGlobalTranslation() {
+            ITransform3D localToGlobal = getLocalToGlobal();
+            return localToGlobal.getRotation().rotated(getLocalTranslation());
+        }
+        public double getGlobalTranslation(int d) {
+            return getGlobalTranslation().v()[d-1];
+        }
+        public Hep3Vector getGlobalRotation() {
+            ITransform3D localToGlobal = getLocalToGlobal();
+            return localToGlobal.getRotation().rotated(getLocalRotation());
+        }
+        public double getGlobalRotation(int d) {
+            return getGlobalRotation().v()[d-1];
+        }
+        public ITransform3D getLocalToGlobal() {
+            ITransform3D localToGlobal = ( (SiSensor) _det).getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
+            return localToGlobal;
+        }       
+        
+    }
+    
+    public static void main(String[] args) {
+
+        // Setup command line input
+        Options options = createCmdLineOpts();
+        if (args.length == 0) {
+            printHelpAndExit(options);
+        }
+
+        CommandLineParser parser = new PosixParser();
+        CommandLine cl = null;
+        try {
+            cl = parser.parse(options, args);
+        } catch (ParseException e) {
+            throw new RuntimeException("Problem parsing command line options.",e);
+        }
+        
+        String compactFilename = null;  
+        if(cl.hasOption("c")) {
+            compactFilename = cl.getOptionValue("c");
+        } else {
+            printHelpAndExit(options);
+        }
+        
+        if(cl.hasOption("d")) {
+            detectorName = cl.getOptionValue("d");
+        } else {
+            printHelpAndExit(options);
+        }
+
+        if(cl.hasOption("r")) {
+            runNumber = Integer.parseInt(cl.getOptionValue("r"));
+        } else {
+            printHelpAndExit(options);
+        }
+
+        String compactFilenameNew = "compact_new.xml";
+        if(cl.hasOption("o")) {
+            compactFilenameNew = cl.getOptionValue("o");
+        }
+
+        
+        
+        File compactFile = new File(compactFilename);
+        
+        // read XML
+        SAXBuilder builder = new SAXBuilder();
+        Document compact_document = null;
+        try {
+            compact_document = (Document) builder.build(compactFile);
+        } catch (JDOMException | IOException e1) {
+            throw new RuntimeException("problem with JDOM ", e1);
+        }
+                
+        // read detector geometry
+        FileInputStream inCompact;
+        try {
+            inCompact = new FileInputStream(compactFile);
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException("cannot open compact file",e);
+        }
+
+        GeometryReader reader = new GeometryReader();
+        Detector det;
+        try {
+            det = reader.read(inCompact);
+        } catch (IOException | JDOMException | ElementCreationException e) {
+            throw new RuntimeException("problem reading compact file",e);
+        }
+
+        
+        // set conditions in order to be able to determine which sensors are where in the geometry
+        setConditions(detectorName,runNumber);
+        
+        // Loop over all millepede input files and match parameters with detectors
+        
+        List<MilleParameterSet> list_det = new ArrayList<MilleParameterSet>();
+        
+        FileInputStream inMille = null;
+        BufferedReader brMille = null;
+        try {
+            for(String milleFilename : cl.getArgs()) {
+                inMille = new FileInputStream(milleFilename);
+                brMille = new BufferedReader(new InputStreamReader(inMille));
+                String line;
+                while((line = brMille.readLine()) != null) {
+                    //System.out.printf("%s\n",line);
+                    if(!line.contains("Parameter") && !line.contains("!")) {
+                        
+                        MilleParameter par = new MilleParameter(line);
+                        //System.out.println(par.getXMLName() + " " + par.getValue());
+                        
+                        SiSensor detEle = getTrackerDetElement( det,  par);
+                        if(detEle == null) {
+                            System.out.println("Couldn't find detector for param " + par.getId());
+                            System.exit(1);
+                        }
+                        System.out.println("Found detector  " + detEle.getName());
+                        if(detEle.getClass().isInstance(SiSensor.class)) {
+                            System.out.println("yeah");
+                        }
+
+                        // do we have it already?
+                        MilleParameterSet useSet = null;
+                        for(MilleParameterSet set : list_det) {
+                            if(set.getDetector() == detEle) {
+                                useSet = set;
+                            }
+                        }
+                        
+                        if (useSet == null) {
+                            useSet = new MilleParameterSet(detEle);
+                            list_det.add(useSet);
+                        }
+                        
+                        //add the parameter
+                        useSet.add(par);
+                        
+                        
+                    }
+                }
+                brMille.close();
+            }
+        }
+        catch (IOException e) {
+            throw new RuntimeException("problem reading mille file",e);
+        }
+        
+        for(MilleParameterSet set : list_det) {
+            System.out.println("Detector " + set.getDetector().getName());
+            List<MilleParameter> pars = set.params;
+            for(MilleParameter p : pars) {
+                System.out.println(p.getXMLName() + " " + p.getValue());
+                Element node = findXMLNode(compact_document,p.getXMLName());
+                double value = 0.0;
+                if(p.getType() == 1){
+                    value = set.getGlobalTranslation(p.getDim());
+                } else if(p.getType() == 2){
+                    value = set.getGlobalRotation(p.getDim());
+                } else {
+                    System.out.println("This type is illdefnied " + p.getType());
+                    System.exit(1);
+                }
+                node.setAttribute("value", String.format("%.6f",value));
+            }
+            Hep3Vector u = getMeasuredCoordinate( (SiSensor )set.getDetector());
+            System.out.println("u  " + u.toString());
+            System.out.println("t (local)  " + set.getLocalTranslation().toString());
+            System.out.println("t (global) " + set.getGlobalTranslation().toString());
+            System.out.println("r (local)  " + set.getLocalRotation().toString());
+            System.out.println("r (global) " + set.getGlobalRotation().toString());
+            
+            
+        }
+
+        // Save new XML file
+        
+        XMLOutputter xmlOutput = new XMLOutputter();
+        // display nice 
+        //xmlOutput.setFormat(Format.getPrettyFormat());
+        try {
+            xmlOutput.output(compact_document, new FileWriter(compactFilenameNew));
+        } catch (IOException e) {
+            throw new RuntimeException("problem with xml output",e);
+        }
+            
+        
+        
+        
+        
+    }
+
+    private static Element findXMLNode(Document document, String name) {
+        Element rootNode = document.getRootElement();
+        List list = rootNode.getChildren("define");
+        for(int i = 0; i < list.size(); ++i ) {
+            Element node = (Element) list.get(i);
+            List llist = node.getChildren("constant");
+            //System.out.println("length of list " + llist.size());
+            for(int ii = 0; ii < llist.size(); ++ii ) {
+                Element nnode = (Element) llist.get(ii);
+                //System.out.println("node name " + nnode.getAttributeValue("name") + " " + nnode.getAttributeValue("value") );
+                //if(nnode.getAttributeValue("name").contains(name)) {
+                if(nnode.getAttributeValue("name").compareTo(name) ==0 ) {
+                    return nnode;
+                }
+            }
+        }   
+        
+        return null;
+    }
+    
+    private static void setConditions(String detectorName, int run) {
+
+        try {
+            if(conditionsManager == null) {
+                conditionsManager = ConditionsManager.defaultInstance();                
+            }
+            conditionsManager.setDetector(detectorName, run);
+            
+        } catch (ConditionsNotFoundException e1) {
+            throw new RuntimeException("problem setting conditions",e1);
+        }
+        
+    }
+
+    private static SiSensor getTrackerDetElement(Detector det, MilleParameter par) {
+        List<SiSensor> sensors = det.getSubdetector("Tracker").getDetectorElement().findDescendants(SiSensor.class);
         //List<SiTrackerModule> modules = det.getDetectorElement().findDescendants(SiTrackerModule.class);
         //System.out.printf("%d sensors\n",sensors.size());
         for (SiSensor module: sensors) {
             // Create DAQ Maps
-        	boolean isTop = ((HpsSiSensor) module).isTopLayer();
-        	int h = par.getHalf();
-        	if ((isTop && h == 1) || (!isTop && h == 2)) {
-        		int layer = ((HpsSiSensor) module).getLayerNumber();
-        		if (layer == par.getSensor()) {
-        			//found match
-        			return module;
-        		}
-        	}
+            boolean isTop = ((HpsSiSensor) module).isTopLayer();
+            int h = par.getHalf();
+            if ((isTop && h == 1) || (!isTop && h == 2)) {
+                int layer = ((HpsSiSensor) module).getLayerNumber();
+                if (layer == par.getSensor()) {
+                    //found match
+                    return module;
+                }
+            }
         }
         return null;
-		
-	}
-	
-
-	
-	private static class DetectorList<K> extends ArrayList<DetAlignConstants> {
-		//List<DetAlignConstants> _detectors = new ArrayList<DetAlignConstants>();
-		public DetectorList() {
-		}
-		
-		public boolean contains(IDetectorElement detEle) {
-			return this.get(detEle) == null ? false : true;
-		}
-		
-		public DetAlignConstants get(IDetectorElement detEle) {
-			for(DetAlignConstants d : this) {
-				if (d == detEle) {
-					return d;
-				}
-			}
-			return null;
-		}
-		public void print() {
-			System.out.println("==== " + this.size() + " detectors has alignment corrections ====");
-			for(DetAlignConstants det : this) {
-				det.print();
-			}
-		}
-		
-	}
-	
-	
-	
-	private static Hep3Vector getTrackingMeasuredCoordinate(SiSensor sensor)
+        
+    }
+    
+
+    
+    private static class DetectorList<K> extends ArrayList<DetAlignConstants> {
+        //List<DetAlignConstants> _detectors = new ArrayList<DetAlignConstants>();
+        public DetectorList() {
+        }
+        
+        public boolean contains(IDetectorElement detEle) {
+            return this.get(detEle) == null ? false : true;
+        }
+        
+        public DetAlignConstants get(IDetectorElement detEle) {
+            for(DetAlignConstants d : this) {
+                if (d == detEle) {
+                    return d;
+                }
+            }
+            return null;
+        }
+        public void print() {
+            System.out.println("==== " + this.size() + " detectors has alignment corrections ====");
+            for(DetAlignConstants det : this) {
+                det.print();
+            }
+        }
+        
+    }
+    
+    
+    
+    private static Hep3Vector getTrackingMeasuredCoordinate(SiSensor sensor)
     {
         // p-side unit vector
         ITransform3D electrodes_to_global = sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
@@ -411,8 +411,8 @@
         measuredCoordinate = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(),electrodes_to_global.getRotation().getRotationMatrix()), measuredCoordinate);
         return measuredCoordinate;
     }
-	
-	private static Hep3Vector getMeasuredCoordinate(SiSensor sensor)
+    
+    private static Hep3Vector getMeasuredCoordinate(SiSensor sensor)
     {
         // p-side unit vector
         ITransform3D electrodes_to_global = sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
@@ -420,127 +420,127 @@
         measuredCoordinate = VecOp.mult(electrodes_to_global.getRotation().getRotationMatrix(), measuredCoordinate);
         return measuredCoordinate;
     }
-	
-	
-	
-	private static class SiSensorDetAlignConstants extends DetAlignConstants {
-		public SiSensorDetAlignConstants(IDetectorElement det) {
-			super(det);
-		}
-		public void transform() {
-			ITransform3D localToGlobal = null;
-			if(_det.getClass().isInstance(SiSensor.class)) {
-				localToGlobal = ( (SiSensor) _det).getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
-			}
-			//Translation
-			Hep3Vector t_local = _constants.getTranslationVector();
-			Hep3Vector t_global = localToGlobal.getRotation().rotated(t_local);
-			_constants.addGlobalTranslation(t_global);
-			//Rotation
-			Hep3Vector r_local = _constants.getRotationVector();
-			Hep3Vector r_global = localToGlobal.getRotation().rotated(r_local);
-			_constants.addGlobalRotation(r_global);
-		}
-		
-	}
-	
-	private static abstract class DetAlignConstants {
-		protected IDetectorElement _det = null;
-		protected AlignConstants<String,Double> _constants = new AlignConstants<String,Double>();
-		public DetAlignConstants(IDetectorElement det) {
-			_det = det;
-		}
-		public abstract void transform();
-		public void add(MilleParameter par) {
-			this._constants.add(par);
-		}
-		public void print() {
-			System.out.println(_det.getName());
-			for(Entry<String, Double>  c : this._constants.entrySet()) {
-				System.out.println(c.getKey() + " " + c.getValue());
-			}
-			System.out.println("Local translation  " + _constants.getTranslationVector().toString());
-			System.out.println("Global translation " + _constants.getTranslationVectorGlobal().toString());
-			System.out.println("Local rotation     " + _constants.getRotationVector().toString());
-			System.out.println("Global rotation    " + _constants.getRotationVectorGlobal().toString());
-			
-
-		}
-			
-		
-	}
-	
-	
-	
-	private static class AlignConstants<K,V> extends HashMap<String,Double> {
-		List<MilleParameter> _pars = new ArrayList<MilleParameter>();
-		public AlignConstants() {
-			super();
-		}
-		public void add(MilleParameter p) {
-			_pars.add(p);
-			if (p.getType() == 1) {
-				if (p.getDim() == 1) this.put("u", p.getValue());
-				else if(p.getDim() == 2) this.put("v", p.getValue());
-				else this.put("w", p.getValue());
-			}
-			else {
-				if (p.getDim() == 1) this.put("alpha", p.getValue());
-				else if(p.getDim() == 2) this.put("beta", p.getValue());
-				else this.put("gamma", p.getValue());
-			}
-		}
-		public void print() {
-			for(Entry<String,Double> e : this.entrySet()) {
-				System.out.println(e.getKey() + " " + e.getValue());
-			}
-		}
-		public Hep3Vector getTranslationVector() {
-			if(!this.containsKey("u") || !this.containsKey("v") || !this.containsKey("w")) {
-				System.out.println("missing pars for translation");
-				print();
-				System.exit(1);
-			}
-			return new BasicHep3Vector(this.get("u"),this.get("v"),this.get("w"));
-		}
-		public Hep3Vector getTranslationVectorGlobal() {
-			if(!this.containsKey("x") || !this.containsKey("y") || !this.containsKey("z")) {
-				System.out.println("missing pars for global translation");
-				print();
-				System.exit(1);
-			}
-			return new BasicHep3Vector(this.get("x"),this.get("y"),this.get("z"));
-		}
-		public Hep3Vector getRotationVector() {
-			if(!this.containsKey("alpha") || !this.containsKey("beta") || !this.containsKey("gamma")) {
-				System.out.println("missing pars for rotation");
-				print();
-				System.exit(1);
-			}
-			return new BasicHep3Vector(this.get("alpha"),this.get("beta"),this.get("gamma"));
-		}
-		public Hep3Vector getRotationVectorGlobal() {
-			if(!this.containsKey("rx") || !this.containsKey("ry") || !this.containsKey("rz")) {
-				System.out.println("missing pars for global rotation");
-				print();
-				System.exit(1);
-			}
-			return new BasicHep3Vector(this.get("rx"),this.get("ry"),this.get("rz"));
-		}
-		private void addGlobalTranslation(Hep3Vector t) {
-			this.put("x", t.x()); 
-			this.put("y", t.y());
-			this.put("z", t.z());
-		}
-		private void addGlobalRotation(Hep3Vector t) {
-			this.put("rx", t.x()); 
-			this.put("ry", t.y());
-			this.put("rz", t.z());
-		}
-		
-		
-	}
-	
-	
+    
+    
+    
+    private static class SiSensorDetAlignConstants extends DetAlignConstants {
+        public SiSensorDetAlignConstants(IDetectorElement det) {
+            super(det);
+        }
+        public void transform() {
+            ITransform3D localToGlobal = null;
+            if(_det.getClass().isInstance(SiSensor.class)) {
+                localToGlobal = ( (SiSensor) _det).getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
+            }
+            //Translation
+            Hep3Vector t_local = _constants.getTranslationVector();
+            Hep3Vector t_global = localToGlobal.getRotation().rotated(t_local);
+            _constants.addGlobalTranslation(t_global);
+            //Rotation
+            Hep3Vector r_local = _constants.getRotationVector();
+            Hep3Vector r_global = localToGlobal.getRotation().rotated(r_local);
+            _constants.addGlobalRotation(r_global);
+        }
+        
+    }
+    
+    private static abstract class DetAlignConstants {
+        protected IDetectorElement _det = null;
+        protected AlignConstants<String,Double> _constants = new AlignConstants<String,Double>();
+        public DetAlignConstants(IDetectorElement det) {
+            _det = det;
+        }
+        public abstract void transform();
+        public void add(MilleParameter par) {
+            this._constants.add(par);
+        }
+        public void print() {
+            System.out.println(_det.getName());
+            for(Entry<String, Double>  c : this._constants.entrySet()) {
+                System.out.println(c.getKey() + " " + c.getValue());
+            }
+            System.out.println("Local translation  " + _constants.getTranslationVector().toString());
+            System.out.println("Global translation " + _constants.getTranslationVectorGlobal().toString());
+            System.out.println("Local rotation     " + _constants.getRotationVector().toString());
+            System.out.println("Global rotation    " + _constants.getRotationVectorGlobal().toString());
+            
+
+        }
+            
+        
+    }
+    
+    
+    
+    private static class AlignConstants<K,V> extends HashMap<String,Double> {
+        List<MilleParameter> _pars = new ArrayList<MilleParameter>();
+        public AlignConstants() {
+            super();
+        }
+        public void add(MilleParameter p) {
+            _pars.add(p);
+            if (p.getType() == 1) {
+                if (p.getDim() == 1) this.put("u", p.getValue());
+                else if(p.getDim() == 2) this.put("v", p.getValue());
+                else this.put("w", p.getValue());
+            }
+            else {
+                if (p.getDim() == 1) this.put("alpha", p.getValue());
+                else if(p.getDim() == 2) this.put("beta", p.getValue());
+                else this.put("gamma", p.getValue());
+            }
+        }
+        public void print() {
+            for(Entry<String,Double> e : this.entrySet()) {
+                System.out.println(e.getKey() + " " + e.getValue());
+            }
+        }
+        public Hep3Vector getTranslationVector() {
+            if(!this.containsKey("u") || !this.containsKey("v") || !this.containsKey("w")) {
+                System.out.println("missing pars for translation");
+                print();
+                System.exit(1);
+            }
+            return new BasicHep3Vector(this.get("u"),this.get("v"),this.get("w"));
+        }
+        public Hep3Vector getTranslationVectorGlobal() {
+            if(!this.containsKey("x") || !this.containsKey("y") || !this.containsKey("z")) {
+                System.out.println("missing pars for global translation");
+                print();
+                System.exit(1);
+            }
+            return new BasicHep3Vector(this.get("x"),this.get("y"),this.get("z"));
+        }
+        public Hep3Vector getRotationVector() {
+            if(!this.containsKey("alpha") || !this.containsKey("beta") || !this.containsKey("gamma")) {
+                System.out.println("missing pars for rotation");
+                print();
+                System.exit(1);
+            }
+            return new BasicHep3Vector(this.get("alpha"),this.get("beta"),this.get("gamma"));
+        }
+        public Hep3Vector getRotationVectorGlobal() {
+            if(!this.containsKey("rx") || !this.containsKey("ry") || !this.containsKey("rz")) {
+                System.out.println("missing pars for global rotation");
+                print();
+                System.exit(1);
+            }
+            return new BasicHep3Vector(this.get("rx"),this.get("ry"),this.get("rz"));
+        }
+        private void addGlobalTranslation(Hep3Vector t) {
+            this.put("x", t.x()); 
+            this.put("y", t.y());
+            this.put("z", t.z());
+        }
+        private void addGlobalRotation(Hep3Vector t) {
+            this.put("rx", t.x()); 
+            this.put("ry", t.y());
+            this.put("rz", t.z());
+        }
+        
+        
+    }
+    
+    
 
 }

Modified: java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildMillepedeCompact.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildMillepedeCompact.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildMillepedeCompact.java	Wed Mar  9 11:43:24 2016
@@ -52,8 +52,8 @@
 
 public class BuildMillepedeCompact {
 
-	private static String detectorName = "Tracker";
-	private static boolean replaceConstant = false;
+    private static String detectorName = "Tracker";
+    private static boolean replaceConstant = false;
     private static boolean calcNewValue = true;
     private static boolean ignoreBeamspot = true;
     private static boolean flipRotationCorrection = false;
@@ -61,250 +61,250 @@
 
 
     private static Options createCmdLineOpts() {
-		Options options = new Options();
-		options.addOption(new Option("c",true,"The path to the compact xml file."));
-		options.addOption(new Option("o",true,"The name of the new compact xml file."));
-		options.addOption(new Option("r", false, "Replace correction instead of adding to it."));
+        Options options = new Options();
+        options.addOption(new Option("c",true,"The path to the compact xml file."));
+        options.addOption(new Option("o",true,"The name of the new compact xml file."));
+        options.addOption(new Option("r", false, "Replace correction instead of adding to it."));
         options.addOption(new Option("t", false, "Add a text string as a new value instead of adding to it."));
         options.addOption(new Option("f",false, "Flip sign of rotation corrections."));
-		return options;
-	}
-	
-	private static void printHelpAndExit(Options options) {
-		HelpFormatter help = new HelpFormatter();
-		help.printHelp(" ", options);
-		System.exit(1);
-	}
-	
-		
-	public static void main(String[] args) {
-
-		// Setup command line input
-		Options options = createCmdLineOpts();
-		if (args.length == 0) {
-			printHelpAndExit(options);
-		}
-
-		CommandLineParser parser = new PosixParser();
-		CommandLine cl = null;
-		try {
-			cl = parser.parse(options, args);
-		} catch (ParseException e) {
-			throw new RuntimeException("Problem parsing command line options.",e);
-		}
-		
-		String compactFilename = null;  
-		if(cl.hasOption("c")) {
-			compactFilename = cl.getOptionValue("c");
-		} else {
-			printHelpAndExit(options);
-		}
-		
-		String compactFilenameNew = "compact_new.xml";
-		if(cl.hasOption("o")) {
-			compactFilenameNew = cl.getOptionValue("o");
-		}
-		
-		
-		
-		if(cl.hasOption("r")) {
-		    replaceConstant = true;
-		}
-
-		if(cl.hasOption("t")) {
+        return options;
+    }
+    
+    private static void printHelpAndExit(Options options) {
+        HelpFormatter help = new HelpFormatter();
+        help.printHelp(" ", options);
+        System.exit(1);
+    }
+    
+        
+    public static void main(String[] args) {
+
+        // Setup command line input
+        Options options = createCmdLineOpts();
+        if (args.length == 0) {
+            printHelpAndExit(options);
+        }
+
+        CommandLineParser parser = new PosixParser();
+        CommandLine cl = null;
+        try {
+            cl = parser.parse(options, args);
+        } catch (ParseException e) {
+            throw new RuntimeException("Problem parsing command line options.",e);
+        }
+        
+        String compactFilename = null;  
+        if(cl.hasOption("c")) {
+            compactFilename = cl.getOptionValue("c");
+        } else {
+            printHelpAndExit(options);
+        }
+        
+        String compactFilenameNew = "compact_new.xml";
+        if(cl.hasOption("o")) {
+            compactFilenameNew = cl.getOptionValue("o");
+        }
+        
+        
+        
+        if(cl.hasOption("r")) {
+            replaceConstant = true;
+        }
+
+        if(cl.hasOption("t")) {
             calcNewValue = false;
         }
 
-		if(cl.hasOption("f")) {
-		    flipRotationCorrection = true;
-		}
-		
-		if (calcNewValue)
+        if(cl.hasOption("f")) {
+            flipRotationCorrection = true;
+        }
+        
+        if (calcNewValue)
             System.out.println("DO CALCULATE NEW VALUE");
         else
             System.out.println("DO NOT CALCULATE NEW VALUE");
         
-		
-		
-		if (flipRotationCorrection)
-		    System.out.println("DO FLIP ROTATIONS");
-		else
-		    System.out.println("DO NOT FLIP ROTATIONS");
-        
-		
-		
-		File compactFile = new File(compactFilename);
-		
-		// read XML
-		SAXBuilder builder = new SAXBuilder();
-		Document compact_document = null;
-		try {
-			compact_document = (Document) builder.build(compactFile);
-		} catch (JDOMException | IOException e1) {
-			throw new RuntimeException("problem with JDOM ", e1);
-		}
-		
-		
-		
-		// Loop over all millepede input files and build a list of parameters
-		
-		List<MilleParameter> params = new ArrayList<MilleParameter>();
-		
-		FileInputStream inMille = null;
-		BufferedReader brMille = null;
-		try {
-			for(String milleFilename : cl.getArgs()) {
-				inMille = new FileInputStream(milleFilename);
-				brMille = new BufferedReader(new InputStreamReader(inMille));
-				String line;
-				while((line = brMille.readLine()) != null) {
-					//System.out.printf("%s\n",line);
-					if(!line.contains("Parameter") && !line.contains("!")) {
-						
-						MilleParameter par = new MilleParameter(line);
-						//System.out.println(par.getXMLName() + " " + par.getValue());
-						
-						if (ignoreBeamspot) {
-						    if(par.getSensor() == 98 || par.getSensor() == 99) {
-						        System.out.printf("Ignoring %s\n", par.toString());
-						        continue;
-						    }
-						}
-						System.out.printf("Adding %s\n", par.toString());
-						//add the parameter
-						params.add(par);
-						
-					}
-				}
-				brMille.close();
-			}
-		}
-		catch (IOException e) {
-			throw new RuntimeException("problem reading mille file",e);
-		}
-		
-		System.out.printf("Found %d millepede parameters\n ", params.size());
-		
-		
-
-		Element rootNode = compact_document.getRootElement();
-		List<Element> detectors = rootNode.getChildren("detectors");
-		for(Element detectorsNode : detectors) {
-		    List<Element> detectorNode = detectorsNode.getChildren("detector");
-		    if(detectorNode!=null) {
-		        System.out.println(detectorNode.size() + " detectors");
-		        for(Element detector : detectorNode) {
-		            if(detector.getAttribute("name")!=null) {
-		                if(detector.getAttributeValue("name").compareTo(detectorName)==0 ) {
-		                    System.out.println("Found " + detectorName);
-		                    for(MilleParameter p : params) {
-		                        Element node = findMillepedeConstantNode(detector,Integer.toString(p.getId()));
-		                        if(node!=null) {
+        
+        
+        if (flipRotationCorrection)
+            System.out.println("DO FLIP ROTATIONS");
+        else
+            System.out.println("DO NOT FLIP ROTATIONS");
+        
+        
+        
+        File compactFile = new File(compactFilename);
+        
+        // read XML
+        SAXBuilder builder = new SAXBuilder();
+        Document compact_document = null;
+        try {
+            compact_document = (Document) builder.build(compactFile);
+        } catch (JDOMException | IOException e1) {
+            throw new RuntimeException("problem with JDOM ", e1);
+        }
+        
+        
+        
+        // Loop over all millepede input files and build a list of parameters
+        
+        List<MilleParameter> params = new ArrayList<MilleParameter>();
+        
+        FileInputStream inMille = null;
+        BufferedReader brMille = null;
+        try {
+            for(String milleFilename : cl.getArgs()) {
+                inMille = new FileInputStream(milleFilename);
+                brMille = new BufferedReader(new InputStreamReader(inMille));
+                String line;
+                while((line = brMille.readLine()) != null) {
+                    //System.out.printf("%s\n",line);
+                    if(!line.contains("Parameter") && !line.contains("!")) {
+                        
+                        MilleParameter par = new MilleParameter(line);
+                        //System.out.println(par.getXMLName() + " " + par.getValue());
+                        
+                        if (ignoreBeamspot) {
+                            if(par.getSensor() == 98 || par.getSensor() == 99) {
+                                System.out.printf("Ignoring %s\n", par.toString());
+                                continue;
+                            }
+                        }
+                        System.out.printf("Adding %s\n", par.toString());
+                        //add the parameter
+                        params.add(par);
+                        
+                    }
+                }
+                brMille.close();
+            }
+        }
+        catch (IOException e) {
+            throw new RuntimeException("problem reading mille file",e);
+        }
+        
+        System.out.printf("Found %d millepede parameters\n ", params.size());
+        
+        
+
+        Element rootNode = compact_document.getRootElement();
+        List<Element> detectors = rootNode.getChildren("detectors");
+        for(Element detectorsNode : detectors) {
+            List<Element> detectorNode = detectorsNode.getChildren("detector");
+            if(detectorNode!=null) {
+                System.out.println(detectorNode.size() + " detectors");
+                for(Element detector : detectorNode) {
+                    if(detector.getAttribute("name")!=null) {
+                        if(detector.getAttributeValue("name").compareTo(detectorName)==0 ) {
+                            System.out.println("Found " + detectorName);
+                            for(MilleParameter p : params) {
+                                Element node = findMillepedeConstantNode(detector,Integer.toString(p.getId()));
+                                if(node!=null) {
 
                                     double correction = p.getValue();
 
-		                            // have the option of adding a text value to the compact instead of actually computing the new value
-		                            if(calcNewValue) {
-
-		                                double oldValue = 0;
-		                                try {
-		                                    oldValue = node.getAttribute("value").getDoubleValue();
-		                                } catch (DataConversionException e) {
-		                                    e.printStackTrace();
-		                                }
-		                                double newValue;
-		                                if(replaceConstant) {
-		                                    newValue = correction;
-		                                } else {
-		                                    if (p.getType() == MilleParameter.Type.ROTATION.getType() && !flipRotationCorrection) {
-		                                        newValue = oldValue - correction;
-		                                        System.out.println("NOFLIP");
-		                                    } else {
-		                                        newValue = oldValue + correction;
+                                    // have the option of adding a text value to the compact instead of actually computing the new value
+                                    if(calcNewValue) {
+
+                                        double oldValue = 0;
+                                        try {
+                                            oldValue = node.getAttribute("value").getDoubleValue();
+                                        } catch (DataConversionException e) {
+                                            e.printStackTrace();
+                                        }
+                                        double newValue;
+                                        if(replaceConstant) {
+                                            newValue = correction;
+                                        } else {
+                                            if (p.getType() == MilleParameter.Type.ROTATION.getType() && !flipRotationCorrection) {
+                                                newValue = oldValue - correction;
+                                                System.out.println("NOFLIP");
+                                            } else {
+                                                newValue = oldValue + correction;
                                                 System.out.println("FLIP");
-		                                    }
-		                                }
-		                                System.out.println("Update " + p.getId() + ": " + oldValue + " (corr. " + correction + ") ->  "  + newValue );
-		                                node.setAttribute("value", String.format("%.6f",newValue));
-		                            
-		                            } else {
-		                                
-		                                String oldValue = node.getAttribute("value").getValue();
-		                                
-		                                if(replaceConstant)
-		                                    throw new RuntimeException("Doesn't make sense to try and replace with the string option?");
-
-		                                if( correction != 0.0) {
-		                                    String newValue;
-		                                    
-		                                    if (p.getType() == MilleParameter.Type.ROTATION.getType() && !flipRotationCorrection) {
-		                                        newValue = oldValue + " - " + String.format("%.6f",correction);
+                                            }
+                                        }
+                                        System.out.println("Update " + p.getId() + ": " + oldValue + " (corr. " + correction + ") ->  "  + newValue );
+                                        node.setAttribute("value", String.format("%.6f",newValue));
+                                    
+                                    } else {
+                                        
+                                        String oldValue = node.getAttribute("value").getValue();
+                                        
+                                        if(replaceConstant)
+                                            throw new RuntimeException("Doesn't make sense to try and replace with the string option?");
+
+                                        if( correction != 0.0) {
+                                            String newValue;
+                                            
+                                            if (p.getType() == MilleParameter.Type.ROTATION.getType() && !flipRotationCorrection) {
+                                                newValue = oldValue + " - " + String.format("%.6f",correction);
                                                 System.out.println("NOFLIP");
                                             } else {
                                                 newValue = oldValue + " + " + String.format("%.6f",correction);
                                                 System.out.println("FLIP");
                                             }
-		                                    
-		                                    System.out.println("Update " + p.getId() + ": " + oldValue + " (corr. " + correction + ") ->  "  + newValue );
-		                                    node.setAttribute("value", newValue);
-		                                }		                                
-		                            }
-		                            
-		                        } else {
-		                            throw new RuntimeException("no element found for " + p.getId() + " check format of compact file");
-		                        }
-		                    }       
-		                }
-		            } else {
-		                throw new RuntimeException("this detector node element is not formatted correctly");
-		            }
-		        }
-		    } else {
-		        throw new RuntimeException("this detector node element is not formatted correctly");
-		    }
-		}
-
-
-		// Save new XML file
-		
-		XMLOutputter xmlOutput = new XMLOutputter();
-		// display nice 
-		//xmlOutput.setFormat(Format.getPrettyFormat());
-		try {
-			xmlOutput.output(compact_document, new FileWriter(compactFilenameNew));
-		} catch (IOException e) {
-			throw new RuntimeException("problem with xml output",e);
-		}
-			
-		
-		
-		
-		
-	}
-
-
-	private static Element findMillepedeConstantNode(Element detector, String name) {
-	    Element element_constants = detector.getChild("millepede_constants");
-	    if(element_constants==null) {
-	        throw new RuntimeException("no alignment constants in this xml file.");
-	    }
-	    List<Element> list = element_constants.getChildren("millepede_constant");
-	    for(Element element : list) {
-	        if(element.getAttribute("name")!=null) {
-	            if(element.getAttributeValue("name").compareTo(name) == 0) {
-	                return element;
-	            } 
-	        } else {
-	            throw new RuntimeException("this element is not formatted correctly");
-	        }
-	    }
-	    return null;
-	}
-
-	
-
-	
-	
-	
+                                            
+                                            System.out.println("Update " + p.getId() + ": " + oldValue + " (corr. " + correction + ") ->  "  + newValue );
+                                            node.setAttribute("value", newValue);
+                                        }                                       
+                                    }
+                                    
+                                } else {
+                                    throw new RuntimeException("no element found for " + p.getId() + " check format of compact file");
+                                }
+                            }       
+                        }
+                    } else {
+                        throw new RuntimeException("this detector node element is not formatted correctly");
+                    }
+                }
+            } else {
+                throw new RuntimeException("this detector node element is not formatted correctly");
+            }
+        }
+
+
+        // Save new XML file
+        
+        XMLOutputter xmlOutput = new XMLOutputter();
+        // display nice 
+        //xmlOutput.setFormat(Format.getPrettyFormat());
+        try {
+            xmlOutput.output(compact_document, new FileWriter(compactFilenameNew));
+        } catch (IOException e) {
+            throw new RuntimeException("problem with xml output",e);
+        }
+            
+        
+        
+        
+        
+    }
+
+
+    private static Element findMillepedeConstantNode(Element detector, String name) {
+        Element element_constants = detector.getChild("millepede_constants");
+        if(element_constants==null) {
+            throw new RuntimeException("no alignment constants in this xml file.");
+        }
+        List<Element> list = element_constants.getChildren("millepede_constant");
+        for(Element element : list) {
+            if(element.getAttribute("name")!=null) {
+                if(element.getAttributeValue("name").compareTo(name) == 0) {
+                    return element;
+                } 
+            } else {
+                throw new RuntimeException("this element is not formatted correctly");
+            }
+        }
+        return null;
+    }
+
+    
+
+    
+    
+    
 
 }

Modified: java/trunk/tracking/src/main/java/org/hps/svt/alignment/MillepedeCompactDump.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/svt/alignment/MillepedeCompactDump.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/svt/alignment/MillepedeCompactDump.java	Wed Mar  9 11:43:24 2016
@@ -28,115 +28,115 @@
 
 public class MillepedeCompactDump {
 
-	private static String detectorName = "Tracker";
+    private static String detectorName = "Tracker";
 
 
 
     private static Options createCmdLineOpts() {
-		Options options = new Options();
-		options.addOption(new Option("c",true,"The path to the compact xml file."));
-		options.addOption(new Option("o",true,"The name of the output text file."));
-		return options;
-	}
-	
-	private static void printHelpAndExit(Options options) {
-		HelpFormatter help = new HelpFormatter();
-		help.printHelp(" ", options);
-		System.exit(1);
-	}
-	
-		
-	public static void main(String[] args) {
+        Options options = new Options();
+        options.addOption(new Option("c",true,"The path to the compact xml file."));
+        options.addOption(new Option("o",true,"The name of the output text file."));
+        return options;
+    }
+    
+    private static void printHelpAndExit(Options options) {
+        HelpFormatter help = new HelpFormatter();
+        help.printHelp(" ", options);
+        System.exit(1);
+    }
+    
+        
+    public static void main(String[] args) {
 
-		// Setup command line input
-		Options options = createCmdLineOpts();
-		if (args.length == 0) {
-			printHelpAndExit(options);
-		}
+        // Setup command line input
+        Options options = createCmdLineOpts();
+        if (args.length == 0) {
+            printHelpAndExit(options);
+        }
 
-		CommandLineParser parser = new PosixParser();
-		CommandLine cl = null;
-		try {
-			cl = parser.parse(options, args);
-		} catch (ParseException e) {
-			throw new RuntimeException("Problem parsing command line options.",e);
-		}
-		
-		String compactFilename = null;  
-		if(cl.hasOption("c")) {
-			compactFilename = cl.getOptionValue("c");
-		} else {
-			printHelpAndExit(options);
-		}
-		
-		String outputFilename = "millepede_dump.txt";// + compactFilename.replace(".xml", ".txt");
-		if(cl.hasOption("o")) {
-			outputFilename = cl.getOptionValue("o");
-		}
-		
+        CommandLineParser parser = new PosixParser();
+        CommandLine cl = null;
+        try {
+            cl = parser.parse(options, args);
+        } catch (ParseException e) {
+            throw new RuntimeException("Problem parsing command line options.",e);
+        }
+        
+        String compactFilename = null;  
+        if(cl.hasOption("c")) {
+            compactFilename = cl.getOptionValue("c");
+        } else {
+            printHelpAndExit(options);
+        }
+        
+        String outputFilename = "millepede_dump.txt";// + compactFilename.replace(".xml", ".txt");
+        if(cl.hasOption("o")) {
+            outputFilename = cl.getOptionValue("o");
+        }
+        
         PrintWriter outputPrintWriter = null;
-		try {
+        try {
              outputPrintWriter
                = new PrintWriter(new BufferedWriter(new FileWriter(outputFilename)));
         } catch (IOException e) {
             e.printStackTrace();
         }
-		 
-		
-		
-		
-		File compactFile = new File(compactFilename);
-		
-		// read XML
-		SAXBuilder builder = new SAXBuilder();
-		Document compact_document = null;
-		try {
-			compact_document = (Document) builder.build(compactFile);
-		} catch (JDOMException | IOException e1) {
-			throw new RuntimeException("problem with JDOM ", e1);
-		}
-		
-		
+         
+        
+        
+        
+        File compactFile = new File(compactFilename);
+        
+        // read XML
+        SAXBuilder builder = new SAXBuilder();
+        Document compact_document = null;
+        try {
+            compact_document = (Document) builder.build(compactFile);
+        } catch (JDOMException | IOException e1) {
+            throw new RuntimeException("problem with JDOM ", e1);
+        }
+        
+        
 
-		Element rootNode = compact_document.getRootElement();
-		
-		// find the constants needed to calculate the final millepede parameters
-		List<Element> definitions = rootNode.getChildren("define");
-		for(Element definition : definitions) {
-		    List<Element> constants = definition.getChildren("constant");
-		    
-		}
+        Element rootNode = compact_document.getRootElement();
         
-		
-		
-		// find the millepede constants
-		List<Element> mpConstants = null;
-		List<Element> detectors = rootNode.getChildren("detectors");
-		for(Element detectorsNode : detectors) {
-		    List<Element> detectorNode = detectorsNode.getChildren("detector");
-		    if(detectorNode!=null) {
-		        System.out.println(detectorNode.size() + " detectors");
-		        for(Element detector : detectorNode) {
-		            if(detector.getAttribute("name")!=null) {
-		                if(detector.getAttributeValue("name").compareTo(detectorName)==0 ) {
-		                    System.out.println("Found " + detectorName);
-		                    
-		                    Element element_constants = detector.getChild("millepede_constants");
-		                    if(element_constants==null) {
-		                        throw new RuntimeException("no alignment constants in this compact file.");
-		                    }
-		                    mpConstants = element_constants.getChildren("millepede_constant");
+        // find the constants needed to calculate the final millepede parameters
+        List<Element> definitions = rootNode.getChildren("define");
+        for(Element definition : definitions) {
+            List<Element> constants = definition.getChildren("constant");
+            
+        }
+        
+        
+        
+        // find the millepede constants
+        List<Element> mpConstants = null;
+        List<Element> detectors = rootNode.getChildren("detectors");
+        for(Element detectorsNode : detectors) {
+            List<Element> detectorNode = detectorsNode.getChildren("detector");
+            if(detectorNode!=null) {
+                System.out.println(detectorNode.size() + " detectors");
+                for(Element detector : detectorNode) {
+                    if(detector.getAttribute("name")!=null) {
+                        if(detector.getAttributeValue("name").compareTo(detectorName)==0 ) {
+                            System.out.println("Found " + detectorName);
+                            
+                            Element element_constants = detector.getChild("millepede_constants");
+                            if(element_constants==null) {
+                                throw new RuntimeException("no alignment constants in this compact file.");
+                            }
+                            mpConstants = element_constants.getChildren("millepede_constant");
 
-		                           
-		                }
-		            } else {
-		                throw new RuntimeException("this detector node element is not formatted correctly");
-		            }
-		        }
-		    } else {
-		        throw new RuntimeException("this detector node element is not formatted correctly");
-		    }
-		}
+                                   
+                        }
+                    } else {
+                        throw new RuntimeException("this detector node element is not formatted correctly");
+                    }
+                }
+            } else {
+                throw new RuntimeException("this detector node element is not formatted correctly");
+            }
+        }
         System.out.println("Found " + mpConstants.size() + " constants" );
         for(Element element : mpConstants) {
             String name = element.getAttributeValue("name");
@@ -147,19 +147,19 @@
         }
         
 
-		outputPrintWriter.close();
-		
-		
-		
-		
-	}
+        outputPrintWriter.close();
+        
+        
+        
+        
+    }
 
 
 
-	
+    
 
-	
-	
-	
+    
+    
+    
 
 }

Modified: java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Test-All.xml
 =============================================================================
--- java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Test-All.xml	(original)
+++ java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Test-All.xml	Wed Mar  9 11:43:24 2016
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <StrategyList xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://lcsim.org/recon/tracking/seedtracker/strategybuilder/strategies.xsd">
     <TargetDetector>HPS-Test-All</TargetDetector>
-	
+    
     <Strategy name="Strategy1-1">        
         <MinPT>0.250</MinPT>
         <MinHits>4</MinHits>
@@ -70,7 +70,7 @@
         </Layers>
     </Strategy>
 
-	<Strategy name="Strategy3-1">        
+    <Strategy name="Strategy3-1">        
         <MinPT>0.250</MinPT>
         <MinHits>4</MinHits>
         <MinConfirm>1</MinConfirm>        

Modified: java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java
 =============================================================================
--- java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java	(original)
+++ java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java	Wed Mar  9 11:43:24 2016
@@ -34,9 +34,9 @@
  */
 public class HelicalTrackHitDriverTest extends TestCase {
 
-	File commonOutputFile; 
-	File splitOutputFile; 
-	
+    File commonOutputFile; 
+    File splitOutputFile; 
+    
     /**
      * 
      */
@@ -124,9 +124,9 @@
             int numberTopClusters = 0; 
             int numberBotClusters = 0; 
             for(SiTrackerHit cluster : clusters){
-            	if(cluster.getPositionAsVector().y() > 0)
-            		numberTopClusters++; 
-            	else numberBotClusters++; 
+                if(cluster.getPositionAsVector().y() > 0)
+                    numberTopClusters++; 
+                else numberBotClusters++; 
             }
             
             if(!event.hasCollection(HelicalTrackHit.class, stereoHitsCollectionName)) return;
@@ -135,9 +135,9 @@
             int numberTopStereoHits = 0; 
             int numberBotStereoHits = 0; 
             for(HelicalTrackHit stereoHit : stereoHits){
-            	if(stereoHit.getPosition()[1] > 0)
-            		numberTopStereoHits++; 
-            	else numberBotStereoHits++; 
+                if(stereoHit.getPosition()[1] > 0)
+                    numberTopStereoHits++; 
+                else numberBotStereoHits++; 
             }
             
             nTopClusters.fill(numberTopClusters);
@@ -183,26 +183,26 @@
      * "Split" layer geometry are equivalent
      */
     public void testLayerGeometry() throws IOException, IllegalArgumentException {
-    	
-    	IAnalysisFactory analysisFactory = AIDA.defaultInstance().analysisFactory(); 
-		
-    	ITree commonTree = analysisFactory.createTreeFactory().create(commonOutputFile.getAbsolutePath());
-    	ITree splitTree  = analysisFactory.createTreeFactory().create(splitOutputFile.getAbsolutePath());
-    	
-    	double ksPvalue = CompareHistograms.getKolmogorovPValue( (IHistogram1D) splitTree.find("Number of Top Clusters"),
-    															 (IHistogram1D) commonTree.find("Number of Top Clusters"));	
-    	assertTrue("Number of top clusters is unequal!", ksPvalue > 0.05 );
-    
-    	ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Bottom Clusters"),
-    				                                     (IHistogram1D) splitTree.find("Number of Bottom Clusters"));
-    	assertTrue("Number of bottom clusters is unequal!", ksPvalue > 0.05 );
-    	
-    	ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Top Stereo Hits"),
-    				                                     (IHistogram1D) splitTree.find("Number of Top Stereo Hits"));
-    	assertTrue("Number of top stereo hits is unequal!", ksPvalue > 0.05 );
-    
-    	ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Bottom Stereo Hits"),
-    				                                     (IHistogram1D) splitTree.find("Number of Bottom Stereo Hits"));
-    	assertTrue("Number of bottom stereo hits is unequal!", ksPvalue > 0.05 );
+        
+        IAnalysisFactory analysisFactory = AIDA.defaultInstance().analysisFactory(); 
+        
+        ITree commonTree = analysisFactory.createTreeFactory().create(commonOutputFile.getAbsolutePath());
+        ITree splitTree  = analysisFactory.createTreeFactory().create(splitOutputFile.getAbsolutePath());
+        
+        double ksPvalue = CompareHistograms.getKolmogorovPValue( (IHistogram1D) splitTree.find("Number of Top Clusters"),
+                                                                 (IHistogram1D) commonTree.find("Number of Top Clusters")); 
+        assertTrue("Number of top clusters is unequal!", ksPvalue > 0.05 );
+    
+        ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Bottom Clusters"),
+                                                         (IHistogram1D) splitTree.find("Number of Bottom Clusters"));
+        assertTrue("Number of bottom clusters is unequal!", ksPvalue > 0.05 );
+        
+        ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Top Stereo Hits"),
+                                                         (IHistogram1D) splitTree.find("Number of Top Stereo Hits"));
+        assertTrue("Number of top stereo hits is unequal!", ksPvalue > 0.05 );
+    
+        ksPvalue = CompareHistograms.getKolmogorovPValue((IHistogram1D) commonTree.find("Number of Bottom Stereo Hits"),
+                                                         (IHistogram1D) splitTree.find("Number of Bottom Stereo Hits"));
+        assertTrue("Number of bottom stereo hits is unequal!", ksPvalue > 0.05 );
     }
 }

Modified: java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java
 =============================================================================
--- java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java	(original)
+++ java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java	Wed Mar  9 11:43:24 2016
@@ -33,92 +33,92 @@
  */
 public class TruthResidualTest extends TestCase {
 
-	
-	
-	private static final String testFileName = "";
-	private static final String testURLBase = null;
-	private static final long nEvents = 1000;
+    
+    
+    private static final String testFileName = "";
+    private static final String testURLBase = null;
+    private static final long nEvents = 1000;
 
-	public void testTruthResiduals() throws Exception{
-		 	File lcioInputFile = null;
+    public void testTruthResiduals() throws Exception{
+            File lcioInputFile = null;
 
-	        URL testURL = new URL(testURLBase + "/" + testFileName);
-	        FileCache cache = new FileCache();
-	        lcioInputFile = cache.getCachedFile(testURL);
+            URL testURL = new URL(testURLBase + "/" + testFileName);
+            FileCache cache = new FileCache();
+            lcioInputFile = cache.getCachedFile(testURL);
 
-	        //Process and write out the file
-	        LCSimLoop loop = new LCSimLoop();
-	        loop.setLCIORecordSource(lcioInputFile);
-	        loop.add(new MainTrackingDriver());
-	        File outputFile = new TestOutputFile(testFileName.replaceAll(".slcio", "") + "_hpsTrackTruthResidualTrackingTest.slcio");
-	        outputFile.getParentFile().mkdirs(); //make sure the parent directory exists
-	        loop.add(new LCIODriver(outputFile));
-	        loop.loop(nEvents, null);
-	        loop.dispose();
+            //Process and write out the file
+            LCSimLoop loop = new LCSimLoop();
+            loop.setLCIORecordSource(lcioInputFile);
+            loop.add(new MainTrackingDriver());
+            File outputFile = new TestOutputFile(testFileName.replaceAll(".slcio", "") + "_hpsTrackTruthResidualTrackingTest.slcio");
+            outputFile.getParentFile().mkdirs(); //make sure the parent directory exists
+            loop.add(new LCIODriver(outputFile));
+            loop.loop(nEvents, null);
+            loop.dispose();
 
-	        //Read LCIO back and test!
-	        LCSimLoop readLoop = new LCSimLoop();
-	        readLoop.add(new TestResiduals());
-	        readLoop.setLCIORecordSource(outputFile);
-	        readLoop.loop(nEvents, null);
-	        readLoop.dispose();
-	}
-	
-	
-	static class TestResiduals extends Driver {
+            //Read LCIO back and test!
+            LCSimLoop readLoop = new LCSimLoop();
+            readLoop.add(new TestResiduals());
+            readLoop.setLCIORecordSource(outputFile);
+            readLoop.loop(nEvents, null);
+            readLoop.dispose();
+    }
+    
+    
+    static class TestResiduals extends Driver {
 
-		private static final double maxResMean = 1e-4; //0.1um 
-		private static final double maxResRMS = 5e-4; //0.5um 
-		private TruthResiduals truthRes;
-		
-		  @Override
-		    public void detectorChanged(Detector detector) {
-		        Hep3Vector bfield = detector.getFieldMap().getField(new BasicHep3Vector(0., 0., 1.));
-		        truthRes = new TruthResiduals(bfield);
-		        truthRes.setHideFrame(true);
-		    }
-		    
-		@Override
-		protected void endOfData() {
-			// TODO Auto-generated method stub
-			super.endOfData();
-			
-			IHistogram hx = truthRes.getResidual(1, "x");
-			IHistogram hy = truthRes.getResidual(1, "y");
-			if (hx != null && hx.entries()>10) {
-				IHistogram1D hx1d = (IHistogram1D)hx;
-				assertTrue("Mean of layer 1 truth hit residual is not zero " + hx1d.mean(), Math.abs(hx1d.mean()) >maxResMean );
-				assertTrue("RMS of layer 1 truth hit residual is not zero" + hx1d.rms(), Math.abs(hx1d.rms()) >maxResRMS );
-			}
-			if (hy != null && hy.entries()>10) {
-				IHistogram1D hy1d = (IHistogram1D)hy;
-				assertTrue("Mean of layer 1 truth hit residual is not zero " + hy1d.mean(), Math.abs(hy1d.mean()) >maxResMean );
-				assertTrue("RMS of layer 1 truth hit residual is not zero " + hy1d.mean(), Math.abs(hy1d.rms()) >maxResRMS );
-			}
-		}
+        private static final double maxResMean = 1e-4; //0.1um 
+        private static final double maxResRMS = 5e-4; //0.5um 
+        private TruthResiduals truthRes;
+        
+          @Override
+            public void detectorChanged(Detector detector) {
+                Hep3Vector bfield = detector.getFieldMap().getField(new BasicHep3Vector(0., 0., 1.));
+                truthRes = new TruthResiduals(bfield);
+                truthRes.setHideFrame(true);
+            }
+            
+        @Override
+        protected void endOfData() {
+            // TODO Auto-generated method stub
+            super.endOfData();
+            
+            IHistogram hx = truthRes.getResidual(1, "x");
+            IHistogram hy = truthRes.getResidual(1, "y");
+            if (hx != null && hx.entries()>10) {
+                IHistogram1D hx1d = (IHistogram1D)hx;
+                assertTrue("Mean of layer 1 truth hit residual is not zero " + hx1d.mean(), Math.abs(hx1d.mean()) >maxResMean );
+                assertTrue("RMS of layer 1 truth hit residual is not zero" + hx1d.rms(), Math.abs(hx1d.rms()) >maxResRMS );
+            }
+            if (hy != null && hy.entries()>10) {
+                IHistogram1D hy1d = (IHistogram1D)hy;
+                assertTrue("Mean of layer 1 truth hit residual is not zero " + hy1d.mean(), Math.abs(hy1d.mean()) >maxResMean );
+                assertTrue("RMS of layer 1 truth hit residual is not zero " + hy1d.mean(), Math.abs(hy1d.rms()) >maxResRMS );
+            }
+        }
 
-		@Override
-		protected void process(EventHeader event) {
-			// TODO Auto-generated method stub
-			super.process(event);
-			
-			List<MCParticle> mcParticles = null;
-			if(event.hasCollection(MCParticle.class,"MCParticle")) {
-				mcParticles = event.get(MCParticle.class,"MCParticle");
-	        } 
-	            
-	        List<SimTrackerHit> simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits");
-	        
-	        
-	        if(simTrackerHits != null && mcParticles != null) {
-				truthRes.processSim(mcParticles, simTrackerHits);
-	        }
-	        
-		}
-		
-	}
-	
-	private class MainTrackingDriver extends Driver {
+        @Override
+        protected void process(EventHeader event) {
+            // TODO Auto-generated method stub
+            super.process(event);
+            
+            List<MCParticle> mcParticles = null;
+            if(event.hasCollection(MCParticle.class,"MCParticle")) {
+                mcParticles = event.get(MCParticle.class,"MCParticle");
+            } 
+                
+            List<SimTrackerHit> simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits");
+            
+            
+            if(simTrackerHits != null && mcParticles != null) {
+                truthRes.processSim(mcParticles, simTrackerHits);
+            }
+            
+        }
+        
+    }
+    
+    private class MainTrackingDriver extends Driver {
         
         public MainTrackingDriver() {
 
@@ -138,7 +138,7 @@
         }
 
     }
-	
-	
-	
+    
+    
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitFunction.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitFunction.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitFunction.java	Wed Mar  9 11:43:24 2016
@@ -7,29 +7,29 @@
  * Straight line fit
  */
 public class RfFitFunction extends AbstractIFunction {
-	protected double intercept=0;
-	protected double slope=0;
-	public RfFitFunction() {
-		this("");
-	}
-	public RfFitFunction(String title) {
-		super();
-		this.variableNames=new String[]{"time"};
-		this.parameterNames=new String[]{"intercept","slope"};
+    protected double intercept=0;
+    protected double slope=0;
+    public RfFitFunction() {
+        this("");
+    }
+    public RfFitFunction(String title) {
+        super();
+        this.variableNames=new String[]{"time"};
+        this.parameterNames=new String[]{"intercept","slope"};
 
-		init(title);
-	}
-	public double value(double [] v) {
-		return  intercept + (v[0])*slope;
-	}
-	public void setParameters(double[] pars) throws IllegalArgumentException {
-		super.setParameters(pars);
-		intercept=pars[0];
-		slope=pars[1];
-	}
-	public void setParameter(String key,double value) throws IllegalArgumentException{
-		super.setParameter(key,value);
-		if      (key.equals("intercept")) intercept=value;
-		else if (key.equals("slope"))    slope=value;
-	}
+        init(title);
+    }
+    public double value(double [] v) {
+        return  intercept + (v[0])*slope;
+    }
+    public void setParameters(double[] pars) throws IllegalArgumentException {
+        super.setParameters(pars);
+        intercept=pars[0];
+        slope=pars[1];
+    }
+    public void setParameter(String key,double value) throws IllegalArgumentException{
+        super.setParameter(key,value);
+        if      (key.equals("intercept")) intercept=value;
+        else if (key.equals("slope"))    slope=value;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitterDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitterDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/baltzell/RfFitterDriver.java	Wed Mar  9 11:43:24 2016
@@ -24,14 +24,14 @@
  */
 public class RfFitterDriver extends Driver {
 
-	static final double NOISE=2.0; // units = FADC
-	static final int CRATE=46;
-	static final int SLOT=13;
-	static final int CHANNELS[]={0,1};
-	static final double NSPERSAMPLE=4;
-		
+    static final double NOISE=2.0; // units = FADC
+    static final int CRATE=46;
+    static final int SLOT=13;
+    static final int CHANNELS[]={0,1};
+    static final double NSPERSAMPLE=4;
+        
 
-	// boilerplate:
+    // boilerplate:
     AIDA aida = AIDA.defaultInstance();
     IAnalysisFactory analysisFactory = aida.analysisFactory();
     IFunctionFactory functionFactory = analysisFactory.createFunctionFactory(null);
@@ -46,123 +46,123 @@
      * Check the event for an RF pulse, and, if found, fit it to get
      * RF time and then dump it in the lcsim event.
      */
-	public void process(EventHeader event) {
-		if (!event.hasCollection(GenericObject.class,"FADCGenericHits")) return;
-		
-		boolean foundRf=false;
-    	double times[]={-9999,-9999};
-    	
-    	for (GenericObject gob : event.get(GenericObject.class,"FADCGenericHits")) {
-			FADCGenericHit hit=(FADCGenericHit)gob;
-    		
-			// ignore hits not from proper RF signals based on crate/slot/channel:
-			if (hit.getCrate()!=CRATE || hit.getSlot()!=SLOT) continue;
-    		for (int ii=0; ii<CHANNELS.length; ii++) {
-				if (hit.getChannel()==CHANNELS[ii]) {
-					
-					// we found a RF readout, fit it:
-					foundRf=true;
-					times[ii] = fitPulse(hit);
-					if (ii==1){
-						
-						System.out.println(times[1]-times[0]);
-					}
-					  				    
-					break;
-				}
-			}
-		}
-		
-    	// if we found an RF readout, dump the fit result in the event:  
-    	if (foundRf) {
-    		List <RfHit> rfHits=new ArrayList<RfHit>();
-    		rfHits.add(new RfHit(times));
-	    	event.put("RFHits", rfHits, RfHit.class, 1);
-		}
-	}
+    public void process(EventHeader event) {
+        if (!event.hasCollection(GenericObject.class,"FADCGenericHits")) return;
+        
+        boolean foundRf=false;
+        double times[]={-9999,-9999};
+        
+        for (GenericObject gob : event.get(GenericObject.class,"FADCGenericHits")) {
+            FADCGenericHit hit=(FADCGenericHit)gob;
+            
+            // ignore hits not from proper RF signals based on crate/slot/channel:
+            if (hit.getCrate()!=CRATE || hit.getSlot()!=SLOT) continue;
+            for (int ii=0; ii<CHANNELS.length; ii++) {
+                if (hit.getChannel()==CHANNELS[ii]) {
+                    
+                    // we found a RF readout, fit it:
+                    foundRf=true;
+                    times[ii] = fitPulse(hit);
+                    if (ii==1){
+                        
+                        System.out.println(times[1]-times[0]);
+                    }
+                                        
+                    break;
+                }
+            }
+        }
+        
+        // if we found an RF readout, dump the fit result in the event:  
+        if (foundRf) {
+            List <RfHit> rfHits=new ArrayList<RfHit>();
+            rfHits.add(new RfHit(times));
+            event.put("RFHits", rfHits, RfHit.class, 1);
+        }
+    }
 
-	/*
-	 * Perform the fit to the RF pulse:
-	 */
-	public double fitPulse(FADCGenericHit hit) {
-		fitData.clear();
-		final int adcSamples[]=hit.getData();
-		//stores the number of peaks
-		int iz=0;
-		int peakBin[]={-999,-999};
-		final int threshold = 300;	
-		double fitThresh[]={-999,-999};
-		double pedVal[]={-999,-999};
-		
-		// Look for bins containing the peaks (2-3 peaks)
-		for (int ii=4; ii<adcSamples.length; ii++) {
-			// After 2 peaks, stop looking for more
-			if (iz==2){break;}
-			if ((adcSamples[ii+1]>0) && (adcSamples[ii-1]>0) && (adcSamples[ii]>threshold) && ii>8){
-				if ((adcSamples[ii]>adcSamples[ii+1]) && (adcSamples[ii]>=adcSamples[ii-1]) ){
-					
-					peakBin[iz]=ii;
-					iz++;
-				}
-			}
-		}
-		
-		
-		int jj=0;
-		// Choose peak closest to center of window (second peak, ik=1)
-		final int ik=1;
-		pedVal[ik] = (adcSamples[peakBin[ik]-6]+adcSamples[peakBin[ik]-7]+adcSamples[peakBin[ik]-8]+adcSamples[peakBin[ik]-9])/4.0;
-		fitThresh[ik]= (adcSamples[peakBin[ik]]+pedVal[ik])/3.0;
-	
-		// Initial values: we find/fit 3 points:
-		double itime[] = {-999,-999,-999};
-		double ifadc[] = {-999,-999,-999};
-		
-		// Find the points of the peak bin to peak bin-5 
-		for (int ll=0; ll<5; ll++){	
-			if ((adcSamples[peakBin[ik]-5+ll]) > fitThresh[ik]){
-				// One point is below fit threshold and two points are above	
-				if(jj==0 && (adcSamples[peakBin[ik]-6+ll] > pedVal[ik])){
-					final int zz=fitData.size();	
-					fitData.addPoint();
-					itime[zz] = peakBin[ik]-6+ll;
-					ifadc[zz] = adcSamples[peakBin[ik]-6+ll];
-					fitData.point(zz).coordinate(0).setValue(peakBin[ik]-6+ll);
-					fitData.point(zz).coordinate(1).setValue(adcSamples[peakBin[ik]-6+ll]);
-					fitData.point(zz).coordinate(1).setErrorMinus(NOISE);
-					fitData.point(zz).coordinate(1).setErrorPlus(NOISE);		
-					jj++;	
-				}
-				final int zz=fitData.size();	
-				fitData.addPoint();
-				itime[zz] = peakBin[ik]-5+ll;
-				ifadc[zz] = adcSamples[peakBin[ik]-5+ll];
-				fitData.point(zz).coordinate(0).setValue(peakBin[ik]-5+ll);
-				fitData.point(zz).coordinate(1).setValue(adcSamples[peakBin[ik]-5+ll]);
-				fitData.point(zz).coordinate(1).setErrorMinus(NOISE);
-				fitData.point(zz).coordinate(1).setErrorPlus(NOISE);
-					
-				jj++;
-				if (jj==3) {break;}					
-			}
-		}
-		
-		double islope = ((double)(ifadc[2]-ifadc[0]))/(itime[2]-itime[0]);
-		double icept = ifadc[1] - islope*itime[1];
-		// Initialize fit parameters:
-		fitFunction.setParameter("intercept",icept);
-		fitFunction.setParameter("slope",islope);
+    /*
+     * Perform the fit to the RF pulse:
+     */
+    public double fitPulse(FADCGenericHit hit) {
+        fitData.clear();
+        final int adcSamples[]=hit.getData();
+        //stores the number of peaks
+        int iz=0;
+        int peakBin[]={-999,-999};
+        final int threshold = 300;  
+        double fitThresh[]={-999,-999};
+        double pedVal[]={-999,-999};
+        
+        // Look for bins containing the peaks (2-3 peaks)
+        for (int ii=4; ii<adcSamples.length; ii++) {
+            // After 2 peaks, stop looking for more
+            if (iz==2){break;}
+            if ((adcSamples[ii+1]>0) && (adcSamples[ii-1]>0) && (adcSamples[ii]>threshold) && ii>8){
+                if ((adcSamples[ii]>adcSamples[ii+1]) && (adcSamples[ii]>=adcSamples[ii-1]) ){
+                    
+                    peakBin[iz]=ii;
+                    iz++;
+                }
+            }
+        }
+        
+        
+        int jj=0;
+        // Choose peak closest to center of window (second peak, ik=1)
+        final int ik=1;
+        pedVal[ik] = (adcSamples[peakBin[ik]-6]+adcSamples[peakBin[ik]-7]+adcSamples[peakBin[ik]-8]+adcSamples[peakBin[ik]-9])/4.0;
+        fitThresh[ik]= (adcSamples[peakBin[ik]]+pedVal[ik])/3.0;
+    
+        // Initial values: we find/fit 3 points:
+        double itime[] = {-999,-999,-999};
+        double ifadc[] = {-999,-999,-999};
+        
+        // Find the points of the peak bin to peak bin-5 
+        for (int ll=0; ll<5; ll++){ 
+            if ((adcSamples[peakBin[ik]-5+ll]) > fitThresh[ik]){
+                // One point is below fit threshold and two points are above    
+                if(jj==0 && (adcSamples[peakBin[ik]-6+ll] > pedVal[ik])){
+                    final int zz=fitData.size();    
+                    fitData.addPoint();
+                    itime[zz] = peakBin[ik]-6+ll;
+                    ifadc[zz] = adcSamples[peakBin[ik]-6+ll];
+                    fitData.point(zz).coordinate(0).setValue(peakBin[ik]-6+ll);
+                    fitData.point(zz).coordinate(1).setValue(adcSamples[peakBin[ik]-6+ll]);
+                    fitData.point(zz).coordinate(1).setErrorMinus(NOISE);
+                    fitData.point(zz).coordinate(1).setErrorPlus(NOISE);        
+                    jj++;   
+                }
+                final int zz=fitData.size();    
+                fitData.addPoint();
+                itime[zz] = peakBin[ik]-5+ll;
+                ifadc[zz] = adcSamples[peakBin[ik]-5+ll];
+                fitData.point(zz).coordinate(0).setValue(peakBin[ik]-5+ll);
+                fitData.point(zz).coordinate(1).setValue(adcSamples[peakBin[ik]-5+ll]);
+                fitData.point(zz).coordinate(1).setErrorMinus(NOISE);
+                fitData.point(zz).coordinate(1).setErrorPlus(NOISE);
+                    
+                jj++;
+                if (jj==3) {break;}                 
+            }
+        }
+        
+        double islope = ((double)(ifadc[2]-ifadc[0]))/(itime[2]-itime[0]);
+        double icept = ifadc[1] - islope*itime[1];
+        // Initialize fit parameters:
+        fitFunction.setParameter("intercept",icept);
+        fitFunction.setParameter("slope",islope);
 
-		// this used to be turned on somewhere else on every event, dunno if it still is:
-		//Logger.getLogger("org.freehep.math.minuit").setLevel(Level.OFF);
-	
-		IFitResult fitResults = fitter.fit(fitData,fitFunction);
-		
-		// Read the time value at this location on the fit:
-		double halfVal = (adcSamples[peakBin[1]]+pedVal[1])/2.0;	
-	
-		return NSPERSAMPLE*(halfVal-fitResults.fittedParameter("intercept"))/fitResults.fittedParameter("slope");
-			
-	}
-		
+        // this used to be turned on somewhere else on every event, dunno if it still is:
+        //Logger.getLogger("org.freehep.math.minuit").setLevel(Level.OFF);
+    
+        IFitResult fitResults = fitter.fit(fitData,fitFunction);
+        
+        // Read the time value at this location on the fit:
+        double halfVal = (adcSamples[peakBin[1]]+pedVal[1])/2.0;    
+    
+        return NSPERSAMPLE*(halfVal-fitResults.fittedParameter("intercept"))/fitResults.fittedParameter("slope");
+            
+    }
+        
 }

Modified: java/trunk/users/src/main/java/org/hps/users/baltzell/RfHit.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/baltzell/RfHit.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/baltzell/RfHit.java	Wed Mar  9 11:43:24 2016
@@ -6,13 +6,13 @@
  * class to store RF times after extracting from waveform.
  */
 public class RfHit implements GenericObject {
-	private double[] times;
-	public RfHit(double[] times) { this.times=times; }
-	public int getNInt()    { return 0; }
-	public int getNFloat()  { return 0; }
-	public int getNDouble() { return times.length; }
-	public double getDoubleVal(int ii) { return times[ii]; }
-	public float  getFloatVal (int ii) { return 0; }
-	public int    getIntVal   (int ii) { return 0; }
-	public boolean isFixedSize() { return false; }
+    private double[] times;
+    public RfHit(double[] times) { this.times=times; }
+    public int getNInt()    { return 0; }
+    public int getNFloat()  { return 0; }
+    public int getNDouble() { return times.length; }
+    public double getDoubleVal(int ii) { return times[ii]; }
+    public float  getFloatVal (int ii) { return 0; }
+    public int    getIntVal   (int ii) { return 0; }
+    public boolean isFixedSize() { return false; }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/celentan/LedOnlineOfflineComparisonDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/celentan/LedOnlineOfflineComparisonDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/celentan/LedOnlineOfflineComparisonDriver.java	Wed Mar  9 11:43:24 2016
@@ -46,161 +46,161 @@
 public class LedOnlineOfflineComparisonDriver extends Driver {    
 
 
-	int runNumber;
-
-	AIDA aida;
-
-	DatabaseConditionsManager conditionsManager;
-
-	private EcalChannelCollection ChannelCollection;	
-	private EcalLedCollection LEDCollection;
-	private EcalConditions ecalConditions;
-	private EcalLedCalibrationCollection LEDCalibrations;
-
-
-	IHistogram1D hChargeChannelsOnline;
-	IHistogram1D hChargeChannelsOffline;
-	IHistogram1D hChargeChannelsRatio;
-	IHistogram1D hChargeChannelsRatioAll;
-	
-	IHistogram2D hChargeChannelsRatio2D;
-	
-	Map < Integer,Double > onlineResponse;
-	Map < Integer,Double > offlineResponse;
-	Map < Integer,Double > onlineRMS;
-	Map < Integer,Double > offlineRMS;
-
-
-	private static final int NUM_CHANNELS = 442;
-	/**
-	 * Your Driver should have a public constructor.
-	 */
-	public  LedOnlineOfflineComparisonDriver() {
-		getLogger().info("Hello  LedOnlineOfflineComparisonDriver!");
-	}
-
-
-	/**
-	 * Process a single event.  
-	 * Your analysis code should go in here.
-	 * @param event The LCSim event to process.
-	 */
-	public void process(EventHeader event) {
-
-	}
-
-	/**
-	 * Initialization code should go here that doesn't need the conditions system or Detector.
-	 */
-	public void startOfData() {
-		getLogger().info("start of data");
-	}
-
-	/**
-	 * Driver setup should go here that needs information from the conditions system or Detector.
-	 * @param detector The LCSim Detector object.
-	 */
-	public void detectorChanged(Detector detector) {
-		getLogger().info("detector changed");
-
-		onlineResponse = new HashMap< Integer , Double >();
-		offlineResponse= new HashMap< Integer , Double >();
-		onlineRMS= new HashMap< Integer , Double >();
-		offlineRMS= new HashMap< Integer , Double >();
-
-		conditionsManager = DatabaseConditionsManager.getInstance();
-		ChannelCollection = conditionsManager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();	
-		ecalConditions = conditionsManager.getEcalConditions();		
-		LEDCollection = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
-		LEDCalibrations =  conditionsManager.getCachedConditions(EcalLedCalibrationCollection.class,"ecal_led_calibrations").getCachedData();
-
-
-		// Setup plots
-		aida = AIDA.defaultInstance();
-		aida.tree().cd("/");
-		hChargeChannelsOnline =  aida.histogram1D("LEDonline",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
-		hChargeChannelsOffline = aida.histogram1D("LEDoffline",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
-		hChargeChannelsRatio = aida.histogram1D("ratio",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
-		hChargeChannelsRatioAll = aida.histogram1D("ratioAll",100,-0.03,0.03);
-		
-		hChargeChannelsRatio2D  = aida.histogram2D("ratio2D",47, -23.5, 23.5, 11, -5.5, 5.5);
-	}
-
-
-	public void endOfData(){
-
-		int channel_id;
-		int row,column;
-		double led_response_online,led_rms_online;
-		double led_response_offline,led_rms_offline;
-		double diff,ratio;
-
-
-		getLogger().info("end of data");
-		runNumber= conditionsManager.getRun();
-		System.out.println("runNumber is:"+runNumber);
-		for (EcalLedCalibration LEDcalibration : LEDCalibrations){
-
-			channel_id=LEDcalibration.getFieldValue("ecal_channel_id");
-			led_response_online=LEDcalibration.getFieldValue("led_response");
-			led_rms_online=LEDcalibration.getFieldValue("rms");
-
-
-			onlineResponse.put(channel_id,led_response_online);
-			onlineRMS.put(channel_id, led_rms_online);
-		}
-		String fileName = runNumber+".raw.txt";
-		try {
-			//Create object of FileReader
-			FileReader inputFile = new FileReader(fileName);
-
-			//Instantiate the BufferedReader Class
-			BufferedReader bufferReader = new BufferedReader(inputFile);
-
-			//Variable to hold the one line data
-			String line;
-
-			while ((line = bufferReader.readLine()) != null)   {
-				Scanner s=new Scanner(line);
-				channel_id=s.nextInt();
-				column=s.nextInt();
-				row=s.nextInt();
-				led_response_offline=s.nextDouble();
-				led_rms_offline=s.nextDouble();
-				s.close();
-				offlineResponse.put(channel_id,led_response_offline);
-				offlineRMS.put(channel_id, led_rms_offline);
-
-
-			}
-			//Close the buffer reader
-			bufferReader.close();
-		} catch (IOException e) {
-			System.err.println(e);
-		}
-		/*now some comparisons*/
-		for (EcalLedCalibration LEDcalibration : LEDCalibrations){
-			channel_id=LEDcalibration.getFieldValue("ecal_channel_id");
-
-			EcalChannel channel = ChannelCollection.findChannel(channel_id);
-			row=channel.getY();
-			column=channel.getX();
-			
-			System.out.println(channel_id+" "+column+" "+row);
-			led_response_online=onlineResponse.get(channel_id);
-			led_response_offline=offlineResponse.get(channel_id);
-
-			diff=led_response_online-led_response_offline;
-			ratio=2*diff/(led_response_online+led_response_offline);
-			
-			ratio =  led_response_online/led_response_offline;
-			
-			hChargeChannelsOnline.fill(channel_id,led_response_online);
-			hChargeChannelsOffline.fill(channel_id,led_response_offline);
-			hChargeChannelsRatio.fill(channel_id,ratio);
-			hChargeChannelsRatioAll.fill(ratio);
-			if ((column==-14)&&(row==-2)) continue;
-			hChargeChannelsRatio2D.fill(column,row,ratio);
-		}
-	}
+    int runNumber;
+
+    AIDA aida;
+
+    DatabaseConditionsManager conditionsManager;
+
+    private EcalChannelCollection ChannelCollection;    
+    private EcalLedCollection LEDCollection;
+    private EcalConditions ecalConditions;
+    private EcalLedCalibrationCollection LEDCalibrations;
+
+
+    IHistogram1D hChargeChannelsOnline;
+    IHistogram1D hChargeChannelsOffline;
+    IHistogram1D hChargeChannelsRatio;
+    IHistogram1D hChargeChannelsRatioAll;
+    
+    IHistogram2D hChargeChannelsRatio2D;
+    
+    Map < Integer,Double > onlineResponse;
+    Map < Integer,Double > offlineResponse;
+    Map < Integer,Double > onlineRMS;
+    Map < Integer,Double > offlineRMS;
+
+
+    private static final int NUM_CHANNELS = 442;
+    /**
+     * Your Driver should have a public constructor.
+     */
+    public  LedOnlineOfflineComparisonDriver() {
+        getLogger().info("Hello  LedOnlineOfflineComparisonDriver!");
+    }
+
+
+    /**
+     * Process a single event.  
+     * Your analysis code should go in here.
+     * @param event The LCSim event to process.
+     */
+    public void process(EventHeader event) {
+
+    }
+
+    /**
+     * Initialization code should go here that doesn't need the conditions system or Detector.
+     */
+    public void startOfData() {
+        getLogger().info("start of data");
+    }
+
+    /**
+     * Driver setup should go here that needs information from the conditions system or Detector.
+     * @param detector The LCSim Detector object.
+     */
+    public void detectorChanged(Detector detector) {
+        getLogger().info("detector changed");
+
+        onlineResponse = new HashMap< Integer , Double >();
+        offlineResponse= new HashMap< Integer , Double >();
+        onlineRMS= new HashMap< Integer , Double >();
+        offlineRMS= new HashMap< Integer , Double >();
+
+        conditionsManager = DatabaseConditionsManager.getInstance();
+        ChannelCollection = conditionsManager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();    
+        ecalConditions = conditionsManager.getEcalConditions();     
+        LEDCollection = conditionsManager.getCachedConditions(EcalLedCollection.class, "ecal_leds").getCachedData();
+        LEDCalibrations =  conditionsManager.getCachedConditions(EcalLedCalibrationCollection.class,"ecal_led_calibrations").getCachedData();
+
+
+        // Setup plots
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        hChargeChannelsOnline =  aida.histogram1D("LEDonline",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
+        hChargeChannelsOffline = aida.histogram1D("LEDoffline",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
+        hChargeChannelsRatio = aida.histogram1D("ratio",NUM_CHANNELS,-0.5,NUM_CHANNELS-0.5);
+        hChargeChannelsRatioAll = aida.histogram1D("ratioAll",100,-0.03,0.03);
+        
+        hChargeChannelsRatio2D  = aida.histogram2D("ratio2D",47, -23.5, 23.5, 11, -5.5, 5.5);
+    }
+
+
+    public void endOfData(){
+
+        int channel_id;
+        int row,column;
+        double led_response_online,led_rms_online;
+        double led_response_offline,led_rms_offline;
+        double diff,ratio;
+
+
+        getLogger().info("end of data");
+        runNumber= conditionsManager.getRun();
+        System.out.println("runNumber is:"+runNumber);
+        for (EcalLedCalibration LEDcalibration : LEDCalibrations){
+
+            channel_id=LEDcalibration.getFieldValue("ecal_channel_id");
+            led_response_online=LEDcalibration.getFieldValue("led_response");
+            led_rms_online=LEDcalibration.getFieldValue("rms");
+
+
+            onlineResponse.put(channel_id,led_response_online);
+            onlineRMS.put(channel_id, led_rms_online);
+        }
+        String fileName = runNumber+".raw.txt";
+        try {
+            //Create object of FileReader
+            FileReader inputFile = new FileReader(fileName);
+
+            //Instantiate the BufferedReader Class
+            BufferedReader bufferReader = new BufferedReader(inputFile);
+
+            //Variable to hold the one line data
+            String line;
+
+            while ((line = bufferReader.readLine()) != null)   {
+                Scanner s=new Scanner(line);
+                channel_id=s.nextInt();
+                column=s.nextInt();
+                row=s.nextInt();
+                led_response_offline=s.nextDouble();
+                led_rms_offline=s.nextDouble();
+                s.close();
+                offlineResponse.put(channel_id,led_response_offline);
+                offlineRMS.put(channel_id, led_rms_offline);
+
+
+            }
+            //Close the buffer reader
+            bufferReader.close();
+        } catch (IOException e) {
+            System.err.println(e);
+        }
+        /*now some comparisons*/
+        for (EcalLedCalibration LEDcalibration : LEDCalibrations){
+            channel_id=LEDcalibration.getFieldValue("ecal_channel_id");
+
+            EcalChannel channel = ChannelCollection.findChannel(channel_id);
+            row=channel.getY();
+            column=channel.getX();
+            
+            System.out.println(channel_id+" "+column+" "+row);
+            led_response_online=onlineResponse.get(channel_id);
+            led_response_offline=offlineResponse.get(channel_id);
+
+            diff=led_response_online-led_response_offline;
+            ratio=2*diff/(led_response_online+led_response_offline);
+            
+            ratio =  led_response_online/led_response_offline;
+            
+            hChargeChannelsOnline.fill(channel_id,led_response_online);
+            hChargeChannelsOffline.fill(channel_id,led_response_offline);
+            hChargeChannelsRatio.fill(channel_id,ratio);
+            hChargeChannelsRatioAll.fill(ratio);
+            if ((column==-14)&&(row==-2)) continue;
+            hChargeChannelsRatio2D.fill(column,row,ratio);
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/celentan/RawPedestalComputator.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/celentan/RawPedestalComputator.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/celentan/RawPedestalComputator.java	Wed Mar  9 11:43:24 2016
@@ -22,122 +22,122 @@
 
 public class RawPedestalComputator extends Driver {
 
-	String inputCollectionRaw = "EcalReadoutHits";
-	int row, column;
-	double energy;
+    String inputCollectionRaw = "EcalReadoutHits";
+    int row, column;
+    double energy;
 
-	int[] windowRaw = new int[47 * 11];// in case we have the raw waveform, this is the window lenght (in samples)
-	boolean[] isFirstRaw = new boolean[47 * 11];
+    int[] windowRaw = new int[47 * 11];// in case we have the raw waveform, this is the window lenght (in samples)
+    boolean[] isFirstRaw = new boolean[47 * 11];
 
-	double[] pedestal = new double[47 * 11];
-	double[] noise = new double[47 * 11];
-	double[] result;
+    double[] pedestal = new double[47 * 11];
+    double[] noise = new double[47 * 11];
+    double[] result;
 
-	int pedSamples = 50;
-	int nEvents = 0;
+    int pedSamples = 50;
+    int nEvents = 0;
 
-	private EcalConditions conditions;
-	private IIdentifierHelper helper;
-	private int systemId;
+    private EcalConditions conditions;
+    private IIdentifierHelper helper;
+    private int systemId;
 
-	@Override
-	public void detectorChanged(Detector detector) {
+    @Override
+    public void detectorChanged(Detector detector) {
 
-		DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
-		this.conditions = manager.getCachedConditions(EcalConditions.class, "ecal_conditions").getCachedData();
-		this.helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-		this.systemId = detector.getSubdetector("Ecal").getSystemID();
+        DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
+        this.conditions = manager.getCachedConditions(EcalConditions.class, "ecal_conditions").getCachedData();
+        this.helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
+        this.systemId = detector.getSubdetector("Ecal").getSystemID();
 
-		System.out.println("Pedestal computator: detector changed");
-		for (int ii = 0; ii < 11 * 47; ii++) {
-			isFirstRaw[ii] = true;
-			pedestal[ii] = 0;
-			noise[ii] = 0;
-		}
-	}
+        System.out.println("Pedestal computator: detector changed");
+        for (int ii = 0; ii < 11 * 47; ii++) {
+            isFirstRaw[ii] = true;
+            pedestal[ii] = 0;
+            noise[ii] = 0;
+        }
+    }
 
-	@Override
-	public void process(EventHeader event) {
-		int ii = 0;
-		if (event.hasCollection(RawTrackerHit.class, inputCollectionRaw)) {
-			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollectionRaw);
-			for (RawTrackerHit hit : hits) {
-				row = hit.getIdentifierFieldValue("iy");
-				column = hit.getIdentifierFieldValue("ix");
-				ii = EcalMonitoringUtilities.getHistoIDFromRowColumn(row, column);
-				if ((row != 0) && (column != 0)) {
-					if (!EcalMonitoringUtilities.isInHole(row, column)) {
-						if (isFirstRaw[ii]) { // at the very first hit we read for this channel, we need to read the window length and save it
-							isFirstRaw[ii] = false;
-							windowRaw[ii] = hit.getADCValues().length;
-						}
-						result = EcalUtils.computeAmplitude(hit.getADCValues(), windowRaw[ii], pedSamples);
-						pedestal[ii] += result[1];
-						noise[ii] += result[2];
-					}
-				}
-			}
-		}
+    @Override
+    public void process(EventHeader event) {
+        int ii = 0;
+        if (event.hasCollection(RawTrackerHit.class, inputCollectionRaw)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollectionRaw);
+            for (RawTrackerHit hit : hits) {
+                row = hit.getIdentifierFieldValue("iy");
+                column = hit.getIdentifierFieldValue("ix");
+                ii = EcalMonitoringUtilities.getHistoIDFromRowColumn(row, column);
+                if ((row != 0) && (column != 0)) {
+                    if (!EcalMonitoringUtilities.isInHole(row, column)) {
+                        if (isFirstRaw[ii]) { // at the very first hit we read for this channel, we need to read the window length and save it
+                            isFirstRaw[ii] = false;
+                            windowRaw[ii] = hit.getADCValues().length;
+                        }
+                        result = EcalUtils.computeAmplitude(hit.getADCValues(), windowRaw[ii], pedSamples);
+                        pedestal[ii] += result[1];
+                        noise[ii] += result[2];
+                    }
+                }
+            }
+        }
 
-		if (event.hasCollection(CalorimeterHit.class, "EcalCalHits")) {
-			List<CalorimeterHit> hits = event.get(CalorimeterHit.class,"EcalCalHits");
-			for (CalorimeterHit hit : hits) {
-				column = hit.getIdentifierFieldValue("ix");
-				row = hit.getIdentifierFieldValue("iy");
-				energy = hit.getCorrectedEnergy();
-				System.out.println("Row: "+row+" Column "+column+" Energy: "+energy);
-			}
-		}		
+        if (event.hasCollection(CalorimeterHit.class, "EcalCalHits")) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class,"EcalCalHits");
+            for (CalorimeterHit hit : hits) {
+                column = hit.getIdentifierFieldValue("ix");
+                row = hit.getIdentifierFieldValue("iy");
+                energy = hit.getCorrectedEnergy();
+                System.out.println("Row: "+row+" Column "+column+" Energy: "+energy);
+            }
+        }       
 
 
-		nEvents++;
-	}
+        nEvents++;
+    }
 
-	@Override
-	public void endOfData() {
-		try {
-			PrintWriter writerTop = new PrintWriter("default01.ped", "UTF-8");
-			PrintWriter writerBottom = new PrintWriter("default02.ped", "UTF-8");
+    @Override
+    public void endOfData() {
+        try {
+            PrintWriter writerTop = new PrintWriter("default01.ped", "UTF-8");
+            PrintWriter writerBottom = new PrintWriter("default02.ped", "UTF-8");
 
-			for (int ii = 0; ii < 11 * 47; ii++) {
-				int row, column;
-				row = EcalMonitoringUtilities.getRowFromHistoID(ii);
-				column = EcalMonitoringUtilities.getColumnFromHistoID(ii);
-				if (EcalMonitoringUtilities.isInHole(row, column))
-					continue;
-				if ((row == 0) || (column == 0))
-					continue;
-				pedestal[ii] /= nEvents;
-				noise[ii] /= nEvents;
+            for (int ii = 0; ii < 11 * 47; ii++) {
+                int row, column;
+                row = EcalMonitoringUtilities.getRowFromHistoID(ii);
+                column = EcalMonitoringUtilities.getColumnFromHistoID(ii);
+                if (EcalMonitoringUtilities.isInHole(row, column))
+                    continue;
+                if ((row == 0) || (column == 0))
+                    continue;
+                pedestal[ii] /= nEvents;
+                noise[ii] /= nEvents;
 
-				// FIXME: Is this right? --JM
-				EcalChannel ecalChannel = conditions.getChannelCollection().findChannel(new GeometryId(helper, new int[] {systemId, column, row}));
-				int crate = ecalChannel.getCrate();
-				int slot = ecalChannel.getSlot();
-				int channel = ecalChannel.getChannel();
+                // FIXME: Is this right? --JM
+                EcalChannel ecalChannel = conditions.getChannelCollection().findChannel(new GeometryId(helper, new int[] {systemId, column, row}));
+                int crate = ecalChannel.getCrate();
+                int slot = ecalChannel.getSlot();
+                int channel = ecalChannel.getChannel();
 
-				System.out.println(column + " " + row + " " + crate + " " + slot + " " + channel + " " + pedestal[ii] + " " + noise[ii]);
+                System.out.println(column + " " + row + " " + crate + " " + slot + " " + channel + " " + pedestal[ii] + " " + noise[ii]);
 
-				if (crate == 37) {
-					writerTop.print(slot + " " + channel + " " + (int) (Math.round(pedestal[ii])) + " " + (int) (Math.round(noise[ii])) + "\r\n");
-				} else if (crate == 39) {
-					writerBottom.print(slot + " " + channel + " " + (int) (Math.round(pedestal[ii])) + " " + (int) (Math.round(noise[ii])) + "\r\n");
-				}
+                if (crate == 37) {
+                    writerTop.print(slot + " " + channel + " " + (int) (Math.round(pedestal[ii])) + " " + (int) (Math.round(noise[ii])) + "\r\n");
+                } else if (crate == 39) {
+                    writerBottom.print(slot + " " + channel + " " + (int) (Math.round(pedestal[ii])) + " " + (int) (Math.round(noise[ii])) + "\r\n");
+                }
 
-			}
+            }
 
-			writerTop.close();
-			writerBottom.close();
-		} catch (FileNotFoundException fnfe) {
+            writerTop.close();
+            writerBottom.close();
+        } catch (FileNotFoundException fnfe) {
 
-			System.out.println(fnfe.getMessage());
+            System.out.println(fnfe.getMessage());
 
-		}
+        }
 
-		catch (IOException ioe) {
+        catch (IOException ioe) {
 
-			System.out.println(ioe.getMessage());
+            System.out.println(ioe.getMessage());
 
-		}
-	}
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/celentan/StripChartTest.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/celentan/StripChartTest.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/celentan/StripChartTest.java	Wed Mar  9 11:43:24 2016
@@ -6,5 +6,5 @@
  */
 public class StripChartTest  {
            
-	int dummy;    
+    int dummy;    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/holly/ClusterDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/holly/ClusterDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/holly/ClusterDriver.java	Wed Mar  9 11:43:24 2016
@@ -84,8 +84,8 @@
      * @param correctionClusterCollectionName
      */
     public void setCorrectionClusterCollectionName(String correctionClusterCollectionName){
-    	this.correctionClusterCollectionName = correctionClusterCollectionName;
-    	getLogger().config("correctionClusterCollectionName = " + this.correctionClusterCollectionName);
+        this.correctionClusterCollectionName = correctionClusterCollectionName;
+        getLogger().config("correctionClusterCollectionName = " + this.correctionClusterCollectionName);
     }
     
     /**
@@ -147,7 +147,7 @@
      * @param copyClusterCollection
      */
     public void setCopyClusterCollection(boolean copyClusterCollection) {
-    	this.copyClusterCollection = copyClusterCollection;
+        this.copyClusterCollection = copyClusterCollection;
     }
            
     /**
@@ -267,9 +267,9 @@
                 event.put(outputClusterCollectionName, clusters, Cluster.class, flags);
                         
                 if (copyClusterCollection 
-                		&& event.hasCollection(Cluster.class, outputClusterCollectionName)){
-                	List<Cluster> clusterCopy = event.get(Cluster.class, outputClusterCollectionName);	
-                	event.put(correctionClusterCollectionName,clusterCopy,Cluster.class,flags);
+                        && event.hasCollection(Cluster.class, outputClusterCollectionName)){
+                    List<Cluster> clusterCopy = event.get(Cluster.class, outputClusterCollectionName);  
+                    event.put(correctionClusterCollectionName,clusterCopy,Cluster.class,flags);
                 }
                                
                 if (!this.writeClusterCollection) {

Modified: java/trunk/users/src/main/java/org/hps/users/holly/EcalClusterICPosition.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/holly/EcalClusterICPosition.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/holly/EcalClusterICPosition.java	Wed Mar  9 11:43:24 2016
@@ -53,7 +53,7 @@
  *
  */
 public class EcalClusterICPosition extends Driver {
-	// File writer to output cluster results.
+    // File writer to output cluster results.
     FileWriter writeHits;
     // LCIO collection name for calorimeter hits.
     String ecalCollectionName="EcalCalHits";
@@ -95,7 +95,7 @@
 
     
     public void setTrackerCollectionName(String trackerCollectionName){
-    	this.trackerCollectionName = trackerCollectionName;
+        this.trackerCollectionName = trackerCollectionName;
     }
     
        
@@ -112,7 +112,7 @@
     }
     
     public void setRejectedHitName(String rejectedHitName){
-    	this.rejectedHitName = rejectedHitName;
+        this.rejectedHitName = rejectedHitName;
     }
     
     /**
@@ -176,7 +176,7 @@
     //get the list of Ecal scoring Tracker hits
     public ArrayList<SimTrackerHit> trackHits = new ArrayList<SimTrackerHit>();
     public void addTrackHit(SimTrackerHit trHit){
-    	trackHits.add(trHit);
+        trackHits.add(trHit);
     }
     
     // Make a map for quick calculation of the x-y position of crystal face
@@ -187,11 +187,11 @@
     
     //attempt for mc particle list
     public void addMCGen(MCParticle genMC){
-    	mcList.add(genMC);
+        mcList.add(genMC);
     }
     
     public void startOfData() {
-    	// Make sure that the calorimeter hit collection name is defined.
+        // Make sure that the calorimeter hit collection name is defined.
         if (ecalCollectionName == null) {
             throw new RuntimeException("The parameter ecalCollectionName was not set!");
         }
@@ -211,25 +211,25 @@
 
     public void detectorChanged(Detector detector) {
         // Get the calorimeter.
-    	HPSEcal3 ecal = (HPSEcal3) detector.getSubdetector(ecalName);
-    	
+        HPSEcal3 ecal = (HPSEcal3) detector.getSubdetector(ecalName);
+        
         // Store the map of neighbor crystals for the current calorimeter set-up.
         neighborMap = ecal.getNeighborMap();
     }
 
     public void process(EventHeader event) {
-    	// Make sure the current event contains calorimeter hits.
+        // Make sure the current event contains calorimeter hits.
         if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
-        	
-        	// Get generated hits
+            
+            // Get generated hits
             List<MCParticle> genPart = event.getMCParticles();
             for(MCParticle m : genPart){
-            	mcList.add(m);
+                mcList.add(m);
             }
             
             List<SimTrackerHit> trHit = event.get(SimTrackerHit.class, trackerCollectionName);
             for (SimTrackerHit t : trHit){
-            	trackHits.add(t);
+                trackHits.add(t);
             }
             
 
@@ -241,13 +241,13 @@
     }
 
     public void createClusters(EventHeader event) throws IOException {
-    	
-    	// Create a list to store the event hits in.
+        
+        // Create a list to store the event hits in.
         List<CalorimeterHit> hitList = new ArrayList<CalorimeterHit>();
         List<CalorimeterHit> baseList = event.get(CalorimeterHit.class, ecalCollectionName);
         for(CalorimeterHit r : baseList) {
-        	hitEnergyMap.put(r, (r.getCorrectedEnergy()+rNum.nextGaussian()*0.003));
-        	hitList.add(r);
+            hitEnergyMap.put(r, (r.getCorrectedEnergy()+rNum.nextGaussian()*0.003));
+            hitList.add(r);
         }
         
         // Create a list to store the newly created clusters in.
@@ -263,32 +263,32 @@
         // designated threshold.
         filterLoop:
         for(int index = hitList.size() - 1; index >= 0; index--) {
-        	// If the hit is below threshold or outside of time window, kill it.
-/*        	if((hitList.get(index).getCorrectedEnergy() < hitEnergyThreshold)||
-        			(timeCut && (hitList.get(index).getTime() < minTime || hitList.get(index).getTime() > (minTime + timeWindow)))) {
-        		rejectedHitList.add(hitList.get(index));
-        		hitList.remove(index);
-        	}*/
-        	if((hitEnergyMap.get(hitList.get(index))< hitEnergyThreshold)||
-        			(timeCut && (hitList.get(index).getTime() < minTime || hitList.get(index).getTime() > (minTime + timeWindow)))) {
-        		rejectedHitList.add(hitList.get(index));
-        		hitList.remove(index);
-        	}
-        	
-        	
-        	
-        	
-        	
-        	// Since the hits are sorted by energy from highest to
-        	// lowest, any hit that is above threshold means that all
-        	// subsequent hits will also be above threshold. Continue through
-        	// list to check in time window. 
-        	else { continue; }
-        }
-        
-    	// Create a map to connect the cell ID of a calorimeter crystal
+            // If the hit is below threshold or outside of time window, kill it.
+/*          if((hitList.get(index).getCorrectedEnergy() < hitEnergyThreshold)||
+                    (timeCut && (hitList.get(index).getTime() < minTime || hitList.get(index).getTime() > (minTime + timeWindow)))) {
+                rejectedHitList.add(hitList.get(index));
+                hitList.remove(index);
+            }*/
+            if((hitEnergyMap.get(hitList.get(index))< hitEnergyThreshold)||
+                    (timeCut && (hitList.get(index).getTime() < minTime || hitList.get(index).getTime() > (minTime + timeWindow)))) {
+                rejectedHitList.add(hitList.get(index));
+                hitList.remove(index);
+            }
+            
+            
+            
+            
+            
+            // Since the hits are sorted by energy from highest to
+            // lowest, any hit that is above threshold means that all
+            // subsequent hits will also be above threshold. Continue through
+            // list to check in time window. 
+            else { continue; }
+        }
+        
+        // Create a map to connect the cell ID of a calorimeter crystal
         // to the hit which occurred in that crystal.
-    	HashMap<Long, CalorimeterHit> hitMap = new HashMap<Long, CalorimeterHit>();
+        HashMap<Long, CalorimeterHit> hitMap = new HashMap<Long, CalorimeterHit>();
         for (CalorimeterHit hit : hitList) { hitMap.put(hit.getCellID(), hit); }
         
         // Map a crystal to a list of all clusters in which it is a member.
@@ -297,13 +297,13 @@
         // Map a crystal to the seed of the cluster of which it is a member.
         HashMap<CalorimeterHit, CalorimeterHit> hitSeedMap = new HashMap<CalorimeterHit, CalorimeterHit>();
         
-      	// Set containing hits immediately around a seed hit.
-      	HashSet<CalorimeterHit> surrSeedSet = new HashSet<CalorimeterHit>();
+        // Set containing hits immediately around a seed hit.
+        HashSet<CalorimeterHit> surrSeedSet = new HashSet<CalorimeterHit>();
         
         // Loop through all calorimeter hits to locate seeds and perform
         // first pass calculations for component and common hits.
         for (CalorimeterHit hit : hitList) {
-        	// Get the set of all neighboring crystals to the current hit.
+            // Get the set of all neighboring crystals to the current hit.
             Set<Long> neighbors = neighborMap.get(hit.getCellID());
             
             // Generate a list to store any neighboring hits in.
@@ -313,11 +313,11 @@
             // which corresponds to a neighbor, add it to the list of
             // neighboring hits.
             for (Long neighbor : neighbors) {
-            	// Get the neighboring hit.
-            	CalorimeterHit neighborHit = hitMap.get(neighbor);
-                        	
-            	// If it exists, add it to the list.
-            	if(neighborHit != null) { neighborHits.add(neighborHit); }
+                // Get the neighboring hit.
+                CalorimeterHit neighborHit = hitMap.get(neighbor);
+                            
+                // If it exists, add it to the list.
+                if(neighborHit != null) { neighborHits.add(neighborHit); }
             }
             
             // Track whether the current hit is a seed hit or not.
@@ -328,10 +328,10 @@
             // neighboring hits.
             seedHitLoop:
             for(CalorimeterHit neighbor : neighborHits) {
-            	if(!equalEnergies(hit, neighbor)) {
-            		isSeed = false;
-               		break seedHitLoop;
-            	}
+                if(!equalEnergies(hit, neighbor)) {
+                    isSeed = false;
+                    break seedHitLoop;
+                }
            
             }
             
@@ -343,22 +343,22 @@
             else {
                 // Sort through the list of neighboring hits.
                 for (CalorimeterHit neighborHit : neighborHits) {
-                	// Check whether the neighboring hit is a seed.
-                	if(hitSeedMap.get(neighborHit) == neighborHit) {
+                    // Check whether the neighboring hit is a seed.
+                    if(hitSeedMap.get(neighborHit) == neighborHit) {
                         // If the neighboring hit is a seed hit and the
                         // current hit has been associated with a cluster,
                         // then it is a common hit between its previous
                         // seed and the neighboring seed.
                         if (hitSeedMap.containsKey(hit)) {
-                        	// Check and see if a list of common seeds
-                        	// for this hit already exists or not.
-                        	List<CalorimeterHit> commonHitList = commonHits.get(hit);
-                        	
-                        	// If it does not, make a new one.
-                        	if(commonHitList == null) { commonHitList = new ArrayList<CalorimeterHit>(); }
-                        	
-                        	// Add the neighbors to the seeds to set of
-                        	// common seeds.
+                            // Check and see if a list of common seeds
+                            // for this hit already exists or not.
+                            List<CalorimeterHit> commonHitList = commonHits.get(hit);
+                            
+                            // If it does not, make a new one.
+                            if(commonHitList == null) { commonHitList = new ArrayList<CalorimeterHit>(); }
+                            
+                            // Add the neighbors to the seeds to set of
+                            // common seeds.
                             commonHitList.add(neighborHit);
                             commonHitList.add(hitSeedMap.get(hit));
 
@@ -368,14 +368,14 @@
                         }
                         
                         // If the neighboring hit is a seed hit and the
-                    	// current hit has not been added to a cluster yet
-                    	// associate it with the neighboring seed and note
+                        // current hit has not been added to a cluster yet
+                        // associate it with the neighboring seed and note
                         // that it has been clustered.
                         else {
-                          	hitSeedMap.put(hit, neighborHit);
-                        	surrSeedSet.add(hit);
+                            hitSeedMap.put(hit, neighborHit);
+                            surrSeedSet.add(hit);
                         }
-                	}
+                    }
                 }
             }
         } // End primary seed loop.
@@ -383,11 +383,11 @@
         // Performs second pass calculations for component hits.
         secondaryHitsLoop:
         for (CalorimeterHit secondaryHit : hitList) {
-        	// If the secondary hit is not associated with a seed, then
-        	// the rest of there is nothing further to be done.
-        	if(!hitSeedMap.containsKey(secondaryHit)) { continue secondaryHitsLoop; }
-        	
-        	// Get the secondary hit's neighboring crystals.
+            // If the secondary hit is not associated with a seed, then
+            // the rest of there is nothing further to be done.
+            if(!hitSeedMap.containsKey(secondaryHit)) { continue secondaryHitsLoop; }
+            
+            // Get the secondary hit's neighboring crystals.
             Set<Long> secondaryNeighbors = neighborMap.get(secondaryHit.getCellID());
             
             // Make a list to store the hits associated with the
@@ -396,27 +396,27 @@
             
             // Loop through the neighboring crystals.
             for (Long secondaryNeighbor : secondaryNeighbors) {
-            	// Get the hit associated with the neighboring crystal.
-            	CalorimeterHit secondaryNeighborHit = hitMap.get(secondaryNeighbor);
-            	
-            	// If the neighboring crystal exists and is not already
-            	// in a cluster, add it to the list of neighboring hits.
+                // Get the hit associated with the neighboring crystal.
+                CalorimeterHit secondaryNeighborHit = hitMap.get(secondaryNeighbor);
+                
+                // If the neighboring crystal exists and is not already
+                // in a cluster, add it to the list of neighboring hits.
                 if (secondaryNeighborHit != null && !hitSeedMap.containsKey(secondaryNeighborHit)) { //!clusteredHitSet.contains(secondaryNeighborHit)) {
-                	secondaryNeighborHits.add(secondaryNeighborHit);
+                    secondaryNeighborHits.add(secondaryNeighborHit);
                 }
             }
             
             // Loop over the secondary neighbor hits.
             for (CalorimeterHit secondaryNeighborHit : secondaryNeighborHits) {
-            	// If the neighboring hit is of lower energy than the
-            	// current secondary hit, then associate the neighboring
-            	// hit with the current secondary hit's seed.
-            	
-            	//  if (secondaryNeighborHit.getCorrectedEnergy() < secondaryHit.getCorrectedEnergy()) {
-            	if(!equalEnergies(secondaryNeighborHit, secondaryHit)) {
-                	hitSeedMap.put(secondaryNeighborHit, hitSeedMap.get(secondaryHit));
+                // If the neighboring hit is of lower energy than the
+                // current secondary hit, then associate the neighboring
+                // hit with the current secondary hit's seed.
+                
+                //  if (secondaryNeighborHit.getCorrectedEnergy() < secondaryHit.getCorrectedEnergy()) {
+                if(!equalEnergies(secondaryNeighborHit, secondaryHit)) {
+                    hitSeedMap.put(secondaryNeighborHit, hitSeedMap.get(secondaryHit));
                 }
-            	else {continue;}
+                else {continue;}
             }
         } // End component hits loop.
 
@@ -427,10 +427,10 @@
         // Performs second pass calculations for common hits.
         commonHitsLoop:
         for (CalorimeterHit clusteredHit : hitSeedMap.keySet()) {
-        	// Seed hits are never common hits and can be skipped.
-        	if(hitSeedMap.get(clusteredHit) == clusteredHit || surrSeedSet.contains(clusteredHit)) { continue commonHitsLoop; }
-        	
-    		// Get the current clustered hit's neighboring crystals.
+            // Seed hits are never common hits and can be skipped.
+            if(hitSeedMap.get(clusteredHit) == clusteredHit || surrSeedSet.contains(clusteredHit)) { continue commonHitsLoop; }
+            
+            // Get the current clustered hit's neighboring crystals.
             Set<Long> clusteredNeighbors = neighborMap.get(clusteredHit.getCellID());
             
             // Store a list of all the clustered hits neighboring
@@ -439,12 +439,12 @@
             
             // Loop through the neighbors and see if they have hits.
             for (Long neighbor : clusteredNeighbors) {
-            	// Get the hit associated with the neighbor.
-            	CalorimeterHit clusteredNeighborHit = hitMap.get(neighbor);
-            	
-            	// If it exists, add it to the neighboring hit list.
+                // Get the hit associated with the neighbor.
+                CalorimeterHit clusteredNeighborHit = hitMap.get(neighbor);
+                
+                // If it exists, add it to the neighboring hit list.
                 if (clusteredNeighborHit != null) {
-                	clusteredNeighborHits.add(clusteredNeighborHit);
+                    clusteredNeighborHits.add(clusteredNeighborHit);
                 }
             }
             
@@ -453,25 +453,25 @@
             
             // Loop over the clustered neighbor hits.
             for (CalorimeterHit clusteredNeighborHit : clusteredNeighborHits) {
-            	// Check to make sure that the clustered neighbor hit
-            	// is not already associated with the current clustered
-            	// hit's seed.
-            	
+                // Check to make sure that the clustered neighbor hit
+                // is not already associated with the current clustered
+                // hit's seed.
+                
                 if (hitSeedMap.get(clusteredNeighborHit) != clusteredHitSeed){
 
                     //if (clusteredHit.getCorrectedEnergy() < clusteredNeighborHit.getCorrectedEnergy()) {
-                	if(!equalEnergies(clusteredHit, clusteredNeighborHit)){
-                	// Check and see if a list of common seeds
-                    	// for this hit already exists or not.
-                    	List<CalorimeterHit> commonHitList = commonHits.get(clusteredHit);
-                    	
-                    	// If it does not, make a new one.
-                    	if(commonHitList == null) { commonHitList = new ArrayList<CalorimeterHit>(); }
-                    	
-                    	// Add the neighbors to the seeds to set of
-                    	// common seeds.
+                    if(!equalEnergies(clusteredHit, clusteredNeighborHit)){
+                    // Check and see if a list of common seeds
+                        // for this hit already exists or not.
+                        List<CalorimeterHit> commonHitList = commonHits.get(clusteredHit);
+                        
+                        // If it does not, make a new one.
+                        if(commonHitList == null) { commonHitList = new ArrayList<CalorimeterHit>(); }
+                        
+                        // Add the neighbors to the seeds to set of
+                        // common seeds.
                         commonHitList.add(clusteredHitSeed);
-                       	commonHitList.add(hitSeedMap.get(clusteredNeighborHit));
+                        commonHitList.add(hitSeedMap.get(clusteredNeighborHit));
                         
                         // Put the common seed list back into the set.
                         commonHits.put(clusteredHit, commonHitList);
@@ -485,7 +485,7 @@
         
         // Remove any common hits from the clustered hits collection.
         for(CalorimeterHit commonHit : commonHits.keySet()) {
-        	hitSeedMap.remove(commonHit);
+            hitSeedMap.remove(commonHit);
         }
         
         
@@ -501,7 +501,7 @@
         // Get energy of each cluster, excluding common hits
         for (CalorimeterHit iSeed : hitList) {
             if(hitSeedMap.get(iSeed) == iSeed) {
-            	seedEnergy.put(iSeed, 0.0);
+                seedEnergy.put(iSeed, 0.0);
             }
         }
         
@@ -517,24 +517,24 @@
         Map<CalorimeterHit, Double> seedEnergyTot = seedEnergy;
         
         for (Map.Entry<CalorimeterHit, List<CalorimeterHit>> entry1 : commonHits.entrySet()) {
-        	CalorimeterHit commonCell = entry1.getKey();
-        	CalorimeterHit seedA = entry1.getValue().get(0);
-        	CalorimeterHit seedB = entry1.getValue().get(1);    	
-        	double eFractionA = seedEnergy.get(seedA)/(seedEnergy.get(seedA)+seedEnergy.get(seedB));
-        	double eFractionB = seedEnergy.get(seedB)/(seedEnergy.get(seedA)+seedEnergy.get(seedB));
-        	double currEnergyA = seedEnergyTot.get(seedA);
-        	double currEnergyB = seedEnergyTot.get(seedB);
-        	currEnergyA += eFractionA * (hitEnergyMap.get(commonCell));
-        	currEnergyB += eFractionB * (hitEnergyMap.get(commonCell));
-
-        	seedEnergyTot.put(seedA, currEnergyA);
-        	seedEnergyTot.put(seedB, currEnergyB);
+            CalorimeterHit commonCell = entry1.getKey();
+            CalorimeterHit seedA = entry1.getValue().get(0);
+            CalorimeterHit seedB = entry1.getValue().get(1);        
+            double eFractionA = seedEnergy.get(seedA)/(seedEnergy.get(seedA)+seedEnergy.get(seedB));
+            double eFractionB = seedEnergy.get(seedB)/(seedEnergy.get(seedA)+seedEnergy.get(seedB));
+            double currEnergyA = seedEnergyTot.get(seedA);
+            double currEnergyB = seedEnergyTot.get(seedB);
+            currEnergyA += eFractionA * (hitEnergyMap.get(commonCell));
+            currEnergyB += eFractionB * (hitEnergyMap.get(commonCell));
+
+            seedEnergyTot.put(seedA, currEnergyA);
+            seedEnergyTot.put(seedB, currEnergyB);
         }
 
         // Choose only the highest energy cluster
          List<CalorimeterHit> seedList = new ArrayList<CalorimeterHit>();
         for (Map.Entry<CalorimeterHit, Double> entry1 : seedEnergyTot.entrySet()) {
-        	seedList.add(entry1.getKey());
+            seedList.add(entry1.getKey());
         }
         
         Collections.sort(seedList, new EnergyComparator());
@@ -550,64 +550,64 @@
         double w0 = 3.1;
         
         for (Map.Entry<CalorimeterHit, CalorimeterHit> entry1 : hitSeedMap.entrySet()) {
-        	CalorimeterHit eSeed1 = entry1.getValue();
-        	if(seedList.get(0)==eSeed1){// Check for if belonging to highest seed only.
-
-        		
-        		// Method 3 calculation.
-        		// Calculates x-y centroid for each crystal face
-//            	IGeometryInfo geom = entry1.getKey().getDetectorElement().getGeometry();
-//    	        double[] pos = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()),(Hep3Vector)new BasicHep3Vector(0,0,-1*((Trd)geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
-    	       
-    	       ///////////////////////////////
-    	       // Get the hit indices as a Point.
-    	        int ix = entry1.getKey().getIdentifierFieldValue("ix");
-    	        int iy = entry1.getKey().getIdentifierFieldValue("iy");
-    	        Point hitIndex = new Point(ix, iy);
-
-    	        // Get the corrected position for this index pair.
-    	        Double[] position = correctedPositionMap.get(hitIndex);
-
-    	        // If the result is null, it hasn't been calculated yet.
-    	        if(position == null) {
-    	                // Calculate the corrected position.
-    	                IGeometryInfo geom = entry1.getKey().getDetectorElement().getGeometry();
-    	                double[] pos = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()),(Hep3Vector)new BasicHep3Vector(0,0,-1*((Trd)geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
-    	                
-    	                // Convert the result to  a Double[] array.
-    	                position = new Double[3];
-    	                position[0] = pos[0];
-    	                position[1] = pos[1];
-    	                position[2] = pos[2];
-    	                
-    	                // Store the result in the map.
-    	                correctedPositionMap.put(hitIndex, position);
-//    	               writeHits.append("\t"+ix+"\t"+iy+"\t"+position[0]+"\t"+position[1]+"\n"); //write out slic crystal maps
-    	        }
-    	        ///////////////////////////////
-    	        // Method 3:
-        		eNumX += Math.max(0.0,(w0+Math.log((hitEnergyMap.get(entry1.getKey()))
-        				/seedEnergyTot.get(eSeed1))))*(correctedPositionMap.get(hitIndex)[0]/10.0);
-        		eNumY += Math.max(0.0,(w0+Math.log((hitEnergyMap.get(entry1.getKey()))
-        				/seedEnergyTot.get(eSeed1))))*(correctedPositionMap.get(hitIndex)[1]/10.0);
-        		eDen += Math.max(0.0, w0+Math.log((hitEnergyMap.get(entry1.getKey()))/
-        				seedEnergyTot.get(eSeed1)));
-        
-        		// Method 1:
-/*        		eNumX += (hitEnergyMap.get(entry1.getKey()))*correctedPositionMap.get(hitIndex)[0]/10.0;
-        		eNumY += (hitEnergyMap.get(entry1.getKey()))*correctedPositionMap.get(hitIndex)[1]/10.0;
-        		eDen += hitEnergyMap.get(entry1.getKey());
-*/        		
-        		
-        		
-        		//Method 2:
-/*        		eNumX += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())))*correctedPositionMap.get(hitIndex)[0]/10.0;
-        		eNumY += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())))*correctedPositionMap.get(hitIndex)[1]/10.0;
-        		eDen += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())));
-*/        	
-        		crystalAngle = 0.967826*(eSeed1.getIdentifierFieldValue("ix"));
-
-        	}
+            CalorimeterHit eSeed1 = entry1.getValue();
+            if(seedList.get(0)==eSeed1){// Check for if belonging to highest seed only.
+
+                
+                // Method 3 calculation.
+                // Calculates x-y centroid for each crystal face
+//              IGeometryInfo geom = entry1.getKey().getDetectorElement().getGeometry();
+//              double[] pos = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()),(Hep3Vector)new BasicHep3Vector(0,0,-1*((Trd)geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
+               
+               ///////////////////////////////
+               // Get the hit indices as a Point.
+                int ix = entry1.getKey().getIdentifierFieldValue("ix");
+                int iy = entry1.getKey().getIdentifierFieldValue("iy");
+                Point hitIndex = new Point(ix, iy);
+
+                // Get the corrected position for this index pair.
+                Double[] position = correctedPositionMap.get(hitIndex);
+
+                // If the result is null, it hasn't been calculated yet.
+                if(position == null) {
+                        // Calculate the corrected position.
+                        IGeometryInfo geom = entry1.getKey().getDetectorElement().getGeometry();
+                        double[] pos = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()),(Hep3Vector)new BasicHep3Vector(0,0,-1*((Trd)geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
+                        
+                        // Convert the result to  a Double[] array.
+                        position = new Double[3];
+                        position[0] = pos[0];
+                        position[1] = pos[1];
+                        position[2] = pos[2];
+                        
+                        // Store the result in the map.
+                        correctedPositionMap.put(hitIndex, position);
+//                     writeHits.append("\t"+ix+"\t"+iy+"\t"+position[0]+"\t"+position[1]+"\n"); //write out slic crystal maps
+                }
+                ///////////////////////////////
+                // Method 3:
+                eNumX += Math.max(0.0,(w0+Math.log((hitEnergyMap.get(entry1.getKey()))
+                        /seedEnergyTot.get(eSeed1))))*(correctedPositionMap.get(hitIndex)[0]/10.0);
+                eNumY += Math.max(0.0,(w0+Math.log((hitEnergyMap.get(entry1.getKey()))
+                        /seedEnergyTot.get(eSeed1))))*(correctedPositionMap.get(hitIndex)[1]/10.0);
+                eDen += Math.max(0.0, w0+Math.log((hitEnergyMap.get(entry1.getKey()))/
+                        seedEnergyTot.get(eSeed1)));
+        
+                // Method 1:
+/*              eNumX += (hitEnergyMap.get(entry1.getKey()))*correctedPositionMap.get(hitIndex)[0]/10.0;
+                eNumY += (hitEnergyMap.get(entry1.getKey()))*correctedPositionMap.get(hitIndex)[1]/10.0;
+                eDen += hitEnergyMap.get(entry1.getKey());
+*/              
+                
+                
+                //Method 2:
+/*              eNumX += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())))*correctedPositionMap.get(hitIndex)[0]/10.0;
+                eNumY += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())))*correctedPositionMap.get(hitIndex)[1]/10.0;
+                eDen += Math.log10(1000*(hitEnergyMap.get(entry1.getKey())));
+*/          
+                crystalAngle = 0.967826*(eSeed1.getIdentifierFieldValue("ix"));
+
+            }
 
         }
         
@@ -621,36 +621,36 @@
         
         
         if(trackHits.size() != 0 ){
-        	
-	        // Calculates the final generated particle position
-	        double d0 = 139.3 - trackHits.get(0).getPositionVec().z()/10.0;
-	        double px = trackHits.get(0).getMomentum()[0];
-	        double py = trackHits.get(0).getMomentum()[1];
-	        double pz = trackHits.get(0).getMomentum()[2];
-	        double xpos = trackHits.get(0).getPosition()[0]/10.0;
-	        double ypos = trackHits.get(0).getPosition()[1]/10.0;
-	        
-	        double xGen = xpos + d0*px/pz;
-	        double yGen = ypos + d0*py/pz;
-	        
-	        boolean validNum = false;
-	        if((Math.abs(xCl)>0)&&(Math.abs(yCl)>0)&&(Math.abs(xGen)>0)&&(Math.abs(yGen)>0)){
-	        	validNum=true;
-	        }
-	        
-	        
-	       
-        	 //position fitting
-//        	        writeHits.append("\t"+seedList.get(0).getIdentifierFieldValue("ix")+"\t"+seedList.get(0).getIdentifierFieldValue("iy")+"\t"
-//        	 +xCl+"\t"+yCl+"\t"+xF+"\t"+yF+"\t"+mcList.get(0).getEnergy()+"\t"+crystalAngle+"\t"+ECl+"\n");
-        	  if(validNum==true){      
-//        	        writeHits.append("\t"+xCl+"\t"+yCl+"\t"+xGen+"\t"+yGen+"\t"+mcList.get(0).getEnergy()+"\t"+crystalAngle+"\t"+ECl+"\n");
-        	                	        
-        	  }    
-
-        	        }
-        	        
-   	        
+            
+            // Calculates the final generated particle position
+            double d0 = 139.3 - trackHits.get(0).getPositionVec().z()/10.0;
+            double px = trackHits.get(0).getMomentum()[0];
+            double py = trackHits.get(0).getMomentum()[1];
+            double pz = trackHits.get(0).getMomentum()[2];
+            double xpos = trackHits.get(0).getPosition()[0]/10.0;
+            double ypos = trackHits.get(0).getPosition()[1]/10.0;
+            
+            double xGen = xpos + d0*px/pz;
+            double yGen = ypos + d0*py/pz;
+            
+            boolean validNum = false;
+            if((Math.abs(xCl)>0)&&(Math.abs(yCl)>0)&&(Math.abs(xGen)>0)&&(Math.abs(yGen)>0)){
+                validNum=true;
+            }
+            
+            
+           
+             //position fitting
+//                  writeHits.append("\t"+seedList.get(0).getIdentifierFieldValue("ix")+"\t"+seedList.get(0).getIdentifierFieldValue("iy")+"\t"
+//           +xCl+"\t"+yCl+"\t"+xF+"\t"+yF+"\t"+mcList.get(0).getEnergy()+"\t"+crystalAngle+"\t"+ECl+"\n");
+              if(validNum==true){      
+//                  writeHits.append("\t"+xCl+"\t"+yCl+"\t"+xGen+"\t"+yGen+"\t"+mcList.get(0).getEnergy()+"\t"+crystalAngle+"\t"+ECl+"\n");
+                                        
+              }    
+
+                    }
+                    
+            
         }// end seedList.size != 0 
         
         int flag = 1 << LCIOConstants.CLBIT_HITS;
@@ -663,95 +663,95 @@
         
 
     public void endOfData() {
-    	// Close the event display output writer.
+        // Close the event display output writer.
         try { writeHits.close(); }
         catch (IOException e) { }
     }
     
   
     private static class EnergyComparator implements Comparator<CalorimeterHit> {
-    	/**
-    	 * Compares the first hit with respect to the second. This
-    	 * method will compare hits first by energy, and the spatially.
-    	 * In the case of equal energy hits, the hit closest to the
-    	 * beam gap and closest to the positron side of the detector
-    	 * will be selected. If all of these conditions are true, the
-    	 * hit with the positive y-index will be selected. Hits with
-    	 * all four conditions matching are the same hit.
-    	 * @param hit1 The hit to compare.
-    	 * @param hit2 The hit with respect to which the first should
-    	 * be compared.
-    	 */
+        /**
+         * Compares the first hit with respect to the second. This
+         * method will compare hits first by energy, and the spatially.
+         * In the case of equal energy hits, the hit closest to the
+         * beam gap and closest to the positron side of the detector
+         * will be selected. If all of these conditions are true, the
+         * hit with the positive y-index will be selected. Hits with
+         * all four conditions matching are the same hit.
+         * @param hit1 The hit to compare.
+         * @param hit2 The hit with respect to which the first should
+         * be compared.
+         */
     public int compare(CalorimeterHit hit1, CalorimeterHit hit2) {
-    	// Hits are sorted on a hierarchy by three conditions. First,
-    	// the hits with the highest energy come first. Next, they
-    	// are ranked by vertical proximity to the beam gap, and
-    	// lastly, they are sorted by horizontal proximity to the
-    	// positron side of the detector.
-    	
-    	// Get the hit energies.
-    	double[] e = { hit1.getCorrectedEnergy(), hit2.getCorrectedEnergy() };
-    	
-    	// Perform the energy comparison. The higher energy hit
-    	// will be ordered first.
-    	if(e[0] < e[1]) { return 1; }
-    	else if(e[0] > e[1]) { return -1; }
-    	
-    	// If the hits are the same energy, we must perform the
-    	// spatial comparisons.
-    	else {
-    		// Get the position with respect to the beam gap.
-    		int[] iy = { Math.abs(hit1.getIdentifierFieldValue("iy")), Math.abs(hit2.getIdentifierFieldValue("iy")) };
-    		
-    		// The closest hit is first.
-    		if(iy[0] > iy[1]) { return -1; }
-    		else if(iy[0] < iy[1]) { return 1; }
-    		
-    		// Hits that are identical in vertical distance from
-    		// beam gap and energy are differentiated with distance
-    		// horizontally from the positron side of the detector.
-    		else {
-        		// Get the position from the positron side.
-        		int[] ix = { hit1.getIdentifierFieldValue("ix"), hit2.getIdentifierFieldValue("ix") };
-        		
-        		// The closest hit is first.
-        		if(ix[0] > ix[1]) { return 1; }
-        		else if(ix[0] < ix[1]) { return -1; }
-    			
-        		// If all of these checks are the same, compare
-        		// the raw value for iy. If these are identical,
-        		// then the two hits are the same. Otherwise, sort
-        		// the numerical value of iy. (This removes the
-        		// issue where hits (x, y) and (x, -y) can have
-        		// the same energy and be otherwise seen as the
-        		// same hit from the above checks.
-        		else { return Integer.compare(hit1.getIdentifierFieldValue("iy"), hit2.getIdentifierFieldValue("iy")); }
-    		}
-    	}
+        // Hits are sorted on a hierarchy by three conditions. First,
+        // the hits with the highest energy come first. Next, they
+        // are ranked by vertical proximity to the beam gap, and
+        // lastly, they are sorted by horizontal proximity to the
+        // positron side of the detector.
+        
+        // Get the hit energies.
+        double[] e = { hit1.getCorrectedEnergy(), hit2.getCorrectedEnergy() };
+        
+        // Perform the energy comparison. The higher energy hit
+        // will be ordered first.
+        if(e[0] < e[1]) { return 1; }
+        else if(e[0] > e[1]) { return -1; }
+        
+        // If the hits are the same energy, we must perform the
+        // spatial comparisons.
+        else {
+            // Get the position with respect to the beam gap.
+            int[] iy = { Math.abs(hit1.getIdentifierFieldValue("iy")), Math.abs(hit2.getIdentifierFieldValue("iy")) };
+            
+            // The closest hit is first.
+            if(iy[0] > iy[1]) { return -1; }
+            else if(iy[0] < iy[1]) { return 1; }
+            
+            // Hits that are identical in vertical distance from
+            // beam gap and energy are differentiated with distance
+            // horizontally from the positron side of the detector.
+            else {
+                // Get the position from the positron side.
+                int[] ix = { hit1.getIdentifierFieldValue("ix"), hit2.getIdentifierFieldValue("ix") };
+                
+                // The closest hit is first.
+                if(ix[0] > ix[1]) { return 1; }
+                else if(ix[0] < ix[1]) { return -1; }
+                
+                // If all of these checks are the same, compare
+                // the raw value for iy. If these are identical,
+                // then the two hits are the same. Otherwise, sort
+                // the numerical value of iy. (This removes the
+                // issue where hits (x, y) and (x, -y) can have
+                // the same energy and be otherwise seen as the
+                // same hit from the above checks.
+                else { return Integer.compare(hit1.getIdentifierFieldValue("iy"), hit2.getIdentifierFieldValue("iy")); }
+            }
+        }
     }
 }
     
 
     // Handles pathological case where multiple neighboring crystals have EXACTLY the same energy.
     private boolean equalEnergies(CalorimeterHit hit, CalorimeterHit neighbor){
-    	boolean isSeed = true;
-    	
-    	int hix = hit.getIdentifierFieldValue("ix");
-    	int hiy = Math.abs(hit.getIdentifierFieldValue("iy"));
-    	int nix = neighbor.getIdentifierFieldValue("ix");
-    	int niy = Math.abs(neighbor.getIdentifierFieldValue("iy"));
-    	double hE = hit.getCorrectedEnergy();
-    	double nE = neighbor.getCorrectedEnergy();
-    	if(hE < nE) {
-    		isSeed = false;
-    	}
-    	else if((hE == nE) && (hiy > niy)) {
-    		isSeed = false;
-    	}
-    	else if((hE == nE) && (hiy == niy) && (hix > nix)) {
-    		isSeed = false;
-    	}
-    	return isSeed;	
+        boolean isSeed = true;
+        
+        int hix = hit.getIdentifierFieldValue("ix");
+        int hiy = Math.abs(hit.getIdentifierFieldValue("iy"));
+        int nix = neighbor.getIdentifierFieldValue("ix");
+        int niy = Math.abs(neighbor.getIdentifierFieldValue("iy"));
+        double hE = hit.getCorrectedEnergy();
+        double nE = neighbor.getCorrectedEnergy();
+        if(hE < nE) {
+            isSeed = false;
+        }
+        else if((hE == nE) && (hiy > niy)) {
+            isSeed = false;
+        }
+        else if((hE == nE) && (hiy == niy) && (hix > nix)) {
+            isSeed = false;
+        }
+        return isSeed;  
     }
     
     

Modified: java/trunk/users/src/main/java/org/hps/users/holly/EcalClustererCosmics.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/holly/EcalClustererCosmics.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/holly/EcalClustererCosmics.java	Wed Mar  9 11:43:24 2016
@@ -124,13 +124,13 @@
 
         // Loop over ECal hits to find cluster seeds.
         for (CalorimeterHit hit : map.values()) {
-        //	int ix = hit.getIdentifierFieldValue("ix");
+        //  int ix = hit.getIdentifierFieldValue("ix");
          //   int iy = hit.getIdentifierFieldValue("iy");
       //      System.out.println("ix = "+ix);
       //      System.out.println("iy = "+iy);
             
-              	
-        	// Cut on min seed E.
+                
+            // Cut on min seed E.
             if (hit.getRawEnergy() < seedEMin) {
                 continue;
             }

Modified: java/trunk/users/src/main/java/org/hps/users/holly/EcalRawConverter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/holly/EcalRawConverter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/holly/EcalRawConverter.java	Wed Mar  9 11:43:24 2016
@@ -106,42 +106,42 @@
     private EcalConditions ecalConditions = null;
 
     public EcalRawConverter() {
-    	// Track changes in the DAQ configuration.
-    	ConfigurationManager.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// If the DAQ configuration should be used, load the
-				// relevant settings into the driver.
-				if(useDAQConfig) {
-					// Get the FADC configuration.
-					config = ConfigurationManager.getInstance().getFADCConfig();
-					
-					// Load the settings.
-					NSB = config.getNSB();
-					NSA = config.getNSA();
-					windowSamples = config.getWindowWidth() / 4;
-					
-					// Get the number of peaks.
-					if(config.getMode() == 1) {
-						nPeak = Integer.MAX_VALUE;
-					} else {
-						nPeak = config.getMaxPulses();
-					}
-					
-					// Print the FADC configuration.
-					System.out.println();
-					System.out.println();
-					System.out.printf("NSA            :: %d ns%n", NSA);
-					System.out.printf("NSB            :: %d ns%n", NSB);
-					System.out.printf("Window Samples :: %d clock-cycles%n", windowSamples);
-					System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
-					System.out.println("======================================================================");
-					System.out.println("=== FADC Pulse-Processing Settings ===================================");
-					System.out.println("======================================================================");
-					config.printConfig(System.out);
-				}
-			}
-    	});
+        // Track changes in the DAQ configuration.
+        ConfigurationManager.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // If the DAQ configuration should be used, load the
+                // relevant settings into the driver.
+                if(useDAQConfig) {
+                    // Get the FADC configuration.
+                    config = ConfigurationManager.getInstance().getFADCConfig();
+                    
+                    // Load the settings.
+                    NSB = config.getNSB();
+                    NSA = config.getNSA();
+                    windowSamples = config.getWindowWidth() / 4;
+                    
+                    // Get the number of peaks.
+                    if(config.getMode() == 1) {
+                        nPeak = Integer.MAX_VALUE;
+                    } else {
+                        nPeak = config.getMaxPulses();
+                    }
+                    
+                    // Print the FADC configuration.
+                    System.out.println();
+                    System.out.println();
+                    System.out.printf("NSA            :: %d ns%n", NSA);
+                    System.out.printf("NSB            :: %d ns%n", NSB);
+                    System.out.printf("Window Samples :: %d clock-cycles%n", windowSamples);
+                    System.out.printf("Max Peaks      :: %d peaks%n", nPeak);
+                    System.out.println("======================================================================");
+                    System.out.println("=== FADC Pulse-Processing Settings ===================================");
+                    System.out.println("======================================================================");
+                    config.printConfig(System.out);
+                }
+            }
+        });
     }
   
     public void setLeadingEdgeThreshold(double thresh) {
@@ -196,7 +196,7 @@
     }
     
     public void setUseDAQConfig(boolean state) {
-    	useDAQConfig = state;
+        useDAQConfig = state;
     }
 
     /*
@@ -206,10 +206,10 @@
         EcalChannelConstants channelData = findChannel(hit.getCellID());
         double pedestal;
         if(useDAQConfig) {
-    		//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
-    		pedestal = config.getPedestal(hit.getCellID());
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
+            pedestal = config.getPedestal(hit.getCellID());
         } else {
-        	pedestal = channelData.getCalibration().getPedestal();
+            pedestal = channelData.getCalibration().getPedestal();
         }
         
         int sum = 0;
@@ -237,10 +237,10 @@
      * Choose whether to use static pedestal from database or running pedestal from mode-7.
      */
     public double getSingleSamplePedestal(EventHeader event,long cellID) {
-    	if(useDAQConfig) {
-    		//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(cellID);
-    		return config.getPedestal(cellID);
-    	}
+        if(useDAQConfig) {
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(cellID);
+            return config.getPedestal(cellID);
+        }
         if (useRunningPedestal && event!=null) {
             if (event.hasItem("EcalRunningPedestals")) {
                 Map<EcalChannel, Double> runningPedMap = (Map<EcalChannel, Double>) event.get("EcalRunningPedestals");
@@ -409,12 +409,12 @@
         // threshold is pedestal plus threshold configuration parameter:
         final int absoluteThreshold;
         if(useDAQConfig) {
-        	//EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
-        	//int leadingEdgeThreshold = ConfigurationManager.getInstance().getFADCConfig().getThreshold(channel.getChannelId());
-        	int leadingEdgeThreshold = config.getThreshold(cellID);
-        	absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
+            //EcalChannel channel = ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
+            //int leadingEdgeThreshold = ConfigurationManager.getInstance().getFADCConfig().getThreshold(channel.getChannelId());
+            int leadingEdgeThreshold = config.getThreshold(cellID);
+            absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
         } else {
-        	absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
+            absoluteThreshold = (int) (getSingleSamplePedestal(event, cellID) + leadingEdgeThreshold);
         }
         
         ArrayList <Integer> thresholdCrossings = new ArrayList<Integer>();
@@ -435,10 +435,10 @@
                 // search for next threshold crossing begins at end of this pulse:
                 if(useDAQConfig && ConfigurationManager.getInstance().getFADCConfig().getMode() == 1) {
                     // special case, emulating SSP:
-                	ii += 8;
+                    ii += 8;
                 } else {
                     // "normal" case, emulating FADC250:
-                	ii += NSA/nsPerSample - 1;
+                    ii += NSA/nsPerSample - 1;
                 }
 
                 // firmware limit on # of peaks:
@@ -532,8 +532,8 @@
         EcalChannelConstants channelData = findChannel(cellID);
         
         if(useDAQConfig) {
-        	//float gain = ConfigurationManager.getInstance().getFADCConfig().getGain(ecalConditions.getChannelCollection().findGeometric(cellID));
-        	return config.getGain(cellID) * adcSum * EcalUtils.MeV;
+            //float gain = ConfigurationManager.getInstance().getFADCConfig().getGain(ecalConditions.getChannelCollection().findGeometric(cellID));
+            return config.getGain(cellID) * adcSum * EcalUtils.MeV;
         }  else if(use2014Gain) {
             if (constantGain) {
                 return adcSum * EcalUtils.gainFactor * EcalUtils.ecalReadoutPeriod;

Modified: java/trunk/users/src/main/java/org/hps/users/holly/HPSEcalClusterIC.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/holly/HPSEcalClusterIC.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/holly/HPSEcalClusterIC.java	Wed Mar  9 11:43:24 2016
@@ -55,11 +55,11 @@
     }
     
     public void addSharedHit(CalorimeterHit sharedHit) {
-    	sharedHitList.add(sharedHit);
+        sharedHitList.add(sharedHit);
     }
     
     public List<CalorimeterHit> getSharedHits() {
-    	return sharedHitList;
+        return sharedHitList;
     }
     
 //    public double[] getPosition() {
@@ -155,12 +155,12 @@
         for(int i=0;i<hits.size();i++)
         {
             CalorimeterHit hit = hits.get(i);
-            //	CalorimeterIDDecoder decoder = hit.getDecoder();
-            //	decoder.setID(hit.getCellID());
-            //	double[] pos = new double[3];
-            //	pos[0] = decoder.getX();
-            //	pos[1] = decoder.getY();
-            //	pos[2] = decoder.getZ();
+            //  CalorimeterIDDecoder decoder = hit.getDecoder();
+            //  decoder.setID(hit.getCellID());
+            //  double[] pos = new double[3];
+            //  pos[0] = decoder.getX();
+            //  pos[1] = decoder.getY();
+            //  pos[2] = decoder.getZ();
             //double[] pos = hit.getPosition();
             //Find position at shower max
             IGeometryInfo geom = hit.getDetectorElement().getGeometry();
@@ -296,104 +296,104 @@
             EV[1] = E2;
             EV[2] = E3;
             // Now calculate principal axes
-	    // For eigenvalue EV, the axis is (nx, ny, nz) where:
-	    //    (Exx - EV)nx + (Exy)ny + (Exz)nz = 0
-	    //    (Eyx)nx + (Eyy - EV)ny + (Eyz)nz = 0
-	    //    (Ezx)nx + (Ezy)ny + (Ezz - EV)nz = 0
-	    // Setting nx = 1, we have:
-	    //    (Exx - EV) + (Exy)ny + (Exz)nz = 0
-	    //    (Eyx) + (Eyy - EV)ny + (Eyz)nz = 0
-	    //    (Ezx) + (Ezy)ny + (Ezz - EV)nz = 0
-	    // and so
-	    //    (Exy)ny = EV - Exx - (Exz)nz  =>  ny = (EV - Exx - Exz*nz)/Exy
-	    // What if Exy = 0? Then provided Eyz is non-zero we can write:
-	    //    (Ezx) + (Ezy)ny + (Ezz - EV)nz = 0
-	    //    ny = (Exz - (Ezz-EV)*nz)/Eyz
-	    // What if Exy = 0 and Eyz = 0 but (Eyy - EV) is non-zero?
-	    //    (Eyy - EV)ny + (Eyz)nz = 0
-	    //    ny = -(Eyz*nz)/(Eyy-EV)
-
-	    // In the pathological case where Exz = Eyz = Ezz = 0:
-	    //    (Exx - EV)nx + (Exy)ny = 0  =>  ny/nx = -(Exx-EV)/Exy
-	    //    (Eyx)nx + (Eyy - EV)ny = 0  =>  ny/nx = -Eyx/(Eyy-EV)
-	    //    (EV)nz = 0
-	    // so
-	    //     -ny/nx = (EV-Exx)/Exy = Eyx/(EV-Eyy)
-	    // But watch out for order! Recalculate eigenvalues for this pathological case.
-	    //     (EV-Exx)(EV-Eyy) = Eyx*Exy
-	    //     EV^2 - EV(Exx+Eyy) + Exx*Eyy - Eyx*Exy = 0
-	    // 
-	    // In another pathological case, Exz = Exy = 0:
-	    //    (Exx - EV)nx = 0
-	    //    (Eyy - EV)ny + (Eyz)nz = 0 => ny/nz = -(Eyz)/(Eyy-EV)
-	    //    (Ezy)ny + (Ezz - EV)nz = 0 => ny/nz = -(Ezz-EV)/(Ezy)
-	    // so we cannot set nx = 1. Instead, write:
-	    //    -ny/nz = (Eyz)/(Eyy-EV) = (Ezz-EV)/(Ezy)
-	    // Then
-	    //    (Eyz)(Ezy) = (Eyy-EV)(Ezz-EV)
-	    //    (Eyz)^2 = (Eyy)(Ezz) - (Eyy)(EV) - (Ezz)(EV) + (EV)^2
-	    //    EV^2 - EV(Eyy+Ezz) + Eyy*Ezz - Eyz*Eyz = 0
-
-	    // Handle pathological case
-	    if (Exz == 0.0 && Eyz == 0.0) {
-		// Recompute eigenvectors.
-		EV[0] = 0.5*(Exx+Eyy) + 0.5*Math.sqrt((Exx+Eyy)*(Exx+Eyy) + 4.0*Exy*Exy);
-		EV[1] = 0.5*(Exx+Eyy) - 0.5*Math.sqrt((Exx+Eyy)*(Exx+Eyy) + 4.0*Exy*Exy);
-		EV[2] = 0.0;
-		for( int i = 0 ; i < 2 ; i++ ) {
-		    double nx_over_ny = Exy / (Exx-EV[i]);
-		    double nx_unnormalized = nx_over_ny;
-		    double ny_unnormalized = 1.0;
-		    double norm = Math.sqrt(nx_unnormalized*nx_unnormalized + ny_unnormalized*ny_unnormalized);
-		    mm_PA[i][0] = ny_unnormalized/norm;
-		    mm_PA[i][1] = nx_unnormalized/norm;
-		    mm_PA[i][2] = 0.0;
-		}
-		// ... and now set third eigenvector to the z direction:
-		mm_PA[2][0] = 0.0;
-		mm_PA[2][1] = 0.0;
-		mm_PA[2][2] = 1.0;
-	    } else if (Exz == 0.0 && Exy == 0.0) {
-		// Another pathological case
-		EV[0] = 0.5*(Eyy+Ezz) + 0.5*Math.sqrt((Eyy+Ezz)*(Eyy+Ezz) + 4.0*Eyz*Eyz);
-		EV[1] = 0.5*(Eyy+Ezz) - 0.5*Math.sqrt((Eyy+Ezz)*(Eyy+Ezz) + 4.0*Eyz*Eyz);
-		EV[2] = 0.0;
-		for( int i = 0 ; i < 2 ; i++ ) {
-		    double ny_over_nz = Eyz / (Eyy-EV[i]);
-		    double ny_unnormalized = ny_over_nz;
-		    double nz_unnormalized = 1.0;
-		    double norm = Math.sqrt(ny_unnormalized*ny_unnormalized + nz_unnormalized*nz_unnormalized);
-		    mm_PA[i][0] = nz_unnormalized/norm;
-		    mm_PA[i][1] = ny_unnormalized/norm;
-		    mm_PA[i][2] = 0.0;
-		}
-		mm_PA[2][0] = 0.0;
-		mm_PA[2][1] = 0.0;
-		mm_PA[2][2] = 1.0;
-	    } else {
-		for( int i = 0 ; i < 3 ; i++ )
-		    {
-			double[] C = new double[3];
-			C[0] = 1.0;
-			C[2] = (Exy*Exy + (Eyy - EV[i])*(EV[i] - Exx))/
-			    ((Eyy - EV[i])*Exz - Eyz*Exy);
-			C[1] = (EV[i] - Exx - Exz*C[2])/Exy;
-			if (Exy == 0.0) {
-			    // Recompute
-			    if (Eyz != 0.0) {
-				// ny = (Exz - (Ezz-EV)*nz)/Eyz
-				C[1] = (Exz - (Ezz-EV[i])*C[2])/Eyz;
-			    } else {
-				// ny = -(Eyz*nz)/(Eyy-EV)
-				C[1] = -(Eyz*C[2])/(Eyy-EV[i]);
-			    }
-			}
-			double norm = Math.sqrt(C[0]*C[0] + C[1]*C[1] + C[2]*C[2]);
-			mm_PA[i][0] = C[0]/norm;
-			mm_PA[i][1] = C[1]/norm;
-			mm_PA[i][2] = C[2]/norm;
-		    }
-	    }
+        // For eigenvalue EV, the axis is (nx, ny, nz) where:
+        //    (Exx - EV)nx + (Exy)ny + (Exz)nz = 0
+        //    (Eyx)nx + (Eyy - EV)ny + (Eyz)nz = 0
+        //    (Ezx)nx + (Ezy)ny + (Ezz - EV)nz = 0
+        // Setting nx = 1, we have:
+        //    (Exx - EV) + (Exy)ny + (Exz)nz = 0
+        //    (Eyx) + (Eyy - EV)ny + (Eyz)nz = 0
+        //    (Ezx) + (Ezy)ny + (Ezz - EV)nz = 0
+        // and so
+        //    (Exy)ny = EV - Exx - (Exz)nz  =>  ny = (EV - Exx - Exz*nz)/Exy
+        // What if Exy = 0? Then provided Eyz is non-zero we can write:
+        //    (Ezx) + (Ezy)ny + (Ezz - EV)nz = 0
+        //    ny = (Exz - (Ezz-EV)*nz)/Eyz
+        // What if Exy = 0 and Eyz = 0 but (Eyy - EV) is non-zero?
+        //    (Eyy - EV)ny + (Eyz)nz = 0
+        //    ny = -(Eyz*nz)/(Eyy-EV)
+
+        // In the pathological case where Exz = Eyz = Ezz = 0:
+        //    (Exx - EV)nx + (Exy)ny = 0  =>  ny/nx = -(Exx-EV)/Exy
+        //    (Eyx)nx + (Eyy - EV)ny = 0  =>  ny/nx = -Eyx/(Eyy-EV)
+        //    (EV)nz = 0
+        // so
+        //     -ny/nx = (EV-Exx)/Exy = Eyx/(EV-Eyy)
+        // But watch out for order! Recalculate eigenvalues for this pathological case.
+        //     (EV-Exx)(EV-Eyy) = Eyx*Exy
+        //     EV^2 - EV(Exx+Eyy) + Exx*Eyy - Eyx*Exy = 0
+        // 
+        // In another pathological case, Exz = Exy = 0:
+        //    (Exx - EV)nx = 0
+        //    (Eyy - EV)ny + (Eyz)nz = 0 => ny/nz = -(Eyz)/(Eyy-EV)
+        //    (Ezy)ny + (Ezz - EV)nz = 0 => ny/nz = -(Ezz-EV)/(Ezy)
+        // so we cannot set nx = 1. Instead, write:
+        //    -ny/nz = (Eyz)/(Eyy-EV) = (Ezz-EV)/(Ezy)
+        // Then
+        //    (Eyz)(Ezy) = (Eyy-EV)(Ezz-EV)
+        //    (Eyz)^2 = (Eyy)(Ezz) - (Eyy)(EV) - (Ezz)(EV) + (EV)^2
+        //    EV^2 - EV(Eyy+Ezz) + Eyy*Ezz - Eyz*Eyz = 0
+
+        // Handle pathological case
+        if (Exz == 0.0 && Eyz == 0.0) {
+        // Recompute eigenvectors.
+        EV[0] = 0.5*(Exx+Eyy) + 0.5*Math.sqrt((Exx+Eyy)*(Exx+Eyy) + 4.0*Exy*Exy);
+        EV[1] = 0.5*(Exx+Eyy) - 0.5*Math.sqrt((Exx+Eyy)*(Exx+Eyy) + 4.0*Exy*Exy);
+        EV[2] = 0.0;
+        for( int i = 0 ; i < 2 ; i++ ) {
+            double nx_over_ny = Exy / (Exx-EV[i]);
+            double nx_unnormalized = nx_over_ny;
+            double ny_unnormalized = 1.0;
+            double norm = Math.sqrt(nx_unnormalized*nx_unnormalized + ny_unnormalized*ny_unnormalized);
+            mm_PA[i][0] = ny_unnormalized/norm;
+            mm_PA[i][1] = nx_unnormalized/norm;
+            mm_PA[i][2] = 0.0;
+        }
+        // ... and now set third eigenvector to the z direction:
+        mm_PA[2][0] = 0.0;
+        mm_PA[2][1] = 0.0;
+        mm_PA[2][2] = 1.0;
+        } else if (Exz == 0.0 && Exy == 0.0) {
+        // Another pathological case
+        EV[0] = 0.5*(Eyy+Ezz) + 0.5*Math.sqrt((Eyy+Ezz)*(Eyy+Ezz) + 4.0*Eyz*Eyz);
+        EV[1] = 0.5*(Eyy+Ezz) - 0.5*Math.sqrt((Eyy+Ezz)*(Eyy+Ezz) + 4.0*Eyz*Eyz);
+        EV[2] = 0.0;
+        for( int i = 0 ; i < 2 ; i++ ) {
+            double ny_over_nz = Eyz / (Eyy-EV[i]);
+            double ny_unnormalized = ny_over_nz;
+            double nz_unnormalized = 1.0;
+            double norm = Math.sqrt(ny_unnormalized*ny_unnormalized + nz_unnormalized*nz_unnormalized);
+            mm_PA[i][0] = nz_unnormalized/norm;
+            mm_PA[i][1] = ny_unnormalized/norm;
+            mm_PA[i][2] = 0.0;
+        }
+        mm_PA[2][0] = 0.0;
+        mm_PA[2][1] = 0.0;
+        mm_PA[2][2] = 1.0;
+        } else {
+        for( int i = 0 ; i < 3 ; i++ )
+            {
+            double[] C = new double[3];
+            C[0] = 1.0;
+            C[2] = (Exy*Exy + (Eyy - EV[i])*(EV[i] - Exx))/
+                ((Eyy - EV[i])*Exz - Eyz*Exy);
+            C[1] = (EV[i] - Exx - Exz*C[2])/Exy;
+            if (Exy == 0.0) {
+                // Recompute
+                if (Eyz != 0.0) {
+                // ny = (Exz - (Ezz-EV)*nz)/Eyz
+                C[1] = (Exz - (Ezz-EV[i])*C[2])/Eyz;
+                } else {
+                // ny = -(Eyz*nz)/(Eyy-EV)
+                C[1] = -(Eyz*C[2])/(Eyy-EV[i]);
+                }
+            }
+            double norm = Math.sqrt(C[0]*C[0] + C[1]*C[1] + C[2]*C[2]);
+            mm_PA[i][0] = C[0]/norm;
+            mm_PA[i][1] = C[1]/norm;
+            mm_PA[i][2] = C[2]/norm;
+            }
+        }
         }
         mm_NE[0] = NE1;
         mm_NE[1] = NE2;
@@ -417,7 +417,7 @@
             double dr = Math.sqrt(  (position[0]+mm_PA[0][0])*(position[0]+mm_PA[0][0]) +
                     (position[1]+mm_PA[0][1])*(position[1]+mm_PA[0][1]) +
                     (position[2]+mm_PA[0][2])*(position[2]+mm_PA[0][2]) ) -
-                    Math.sqrt(	(position[0])*(position[0]) +
+                    Math.sqrt(  (position[0])*(position[0]) +
                     (position[1])*(position[1]) +
                     (position[2])*(position[2]) ) ;
             double sign = 1.;

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/ClusterAnalysisDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/ClusterAnalysisDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/ClusterAnalysisDriver.java	Wed Mar  9 11:43:24 2016
@@ -11,84 +11,84 @@
 import org.lcsim.util.aida.AIDA;
 
 public class ClusterAnalysisDriver extends Driver {
-	// Analysis plots.
+    // Analysis plots.
     AIDA aida = AIDA.defaultInstance();
-	IHistogram1D clusterTotalEnergy;
-	IHistogram1D clusterSeedEnergy;
-	IHistogram1D clusterHitCount;
-	IHistogram2D clusterDistribution;
-	
-	IHistogram1D fClusterTotalEnergy;
-	IHistogram1D fClusterSeedEnergy;
-	IHistogram1D fClusterHitCount;
-	IHistogram2D fClusterDistribution;
-	
-	IHistogram1D nClusterTotalEnergy;
-	IHistogram1D nClusterSeedEnergy;
-	IHistogram1D nClusterHitCount;
-	IHistogram2D nClusterDistribution;
-	
-	// Hit collection names.
-	private String clusterCollectionName = "EcalClusters";
-	
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
-	
-	@Override
-	public void startOfData() {
-		// Initialize the histograms.
-		clusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy", 110, 0.00, 2.2);
-		clusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy", 110, 0.00, 2.2);
-		clusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count", 8, 1, 9);
-		clusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
-		
-		// Initialize the filtered histograms.
-		fClusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy (Over 100 MeV)", 110, 0.00, 2.2);
-		fClusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy (Over 100 MeV)", 110, 0.00, 2.2);
-		fClusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count (Over 100 MeV)", 8, 1, 9);
-		fClusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution (Over 100 MeV)", 46, -23, 23, 11, -5.5, 5.5);
-		
-		// Initialize the more filtered histograms.
-		nClusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy (Over 100 MeV, > 1 Hit)", 110, 0.00, 2.2);
-		nClusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy (Over 100 MeV, > 1 Hit)", 110, 0.00, 2.2);
-		nClusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count (Over 100 MeV, > 1 Hit)", 8, 1, 9);
-		nClusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution (Over 100 MeV, > 1 Hit)", 46, -23, 23, 11, -5.5, 5.5);
-	}
-	
-	public void process(EventHeader event) {
-		// Check if there exists a cluster collection.
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Get the raw hit collection.
-			List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-			
-			// Output the information on each hit to the histograms.
-			for(Cluster cluster : clusterList) {
-				// Get the x and y indices for the hits.
-				int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-				int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-				if(ix > 0) { ix = ix - 1; }
-				
-				// Write to the histograms.
-				clusterTotalEnergy.fill(cluster.getEnergy());
-				clusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
-				clusterHitCount.fill(cluster.getCalorimeterHits().size());
-				clusterDistribution.fill(ix, iy, 1.0);
-				
-				if(cluster.getCalorimeterHits().get(0).getCorrectedEnergy() > 0.100) {
-					fClusterTotalEnergy.fill(cluster.getEnergy());
-					fClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
-					fClusterHitCount.fill(cluster.getCalorimeterHits().size());
-					fClusterDistribution.fill(ix, iy, 1.0);
-					
-					if(cluster.getCalorimeterHits().size() > 1) {
-						nClusterTotalEnergy.fill(cluster.getEnergy());
-						nClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
-						nClusterHitCount.fill(cluster.getCalorimeterHits().size());
-						nClusterDistribution.fill(ix, iy, 1.0);
-					}
-				}
-			}
-		}
-	}
+    IHistogram1D clusterTotalEnergy;
+    IHistogram1D clusterSeedEnergy;
+    IHistogram1D clusterHitCount;
+    IHistogram2D clusterDistribution;
+    
+    IHistogram1D fClusterTotalEnergy;
+    IHistogram1D fClusterSeedEnergy;
+    IHistogram1D fClusterHitCount;
+    IHistogram2D fClusterDistribution;
+    
+    IHistogram1D nClusterTotalEnergy;
+    IHistogram1D nClusterSeedEnergy;
+    IHistogram1D nClusterHitCount;
+    IHistogram2D nClusterDistribution;
+    
+    // Hit collection names.
+    private String clusterCollectionName = "EcalClusters";
+    
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    @Override
+    public void startOfData() {
+        // Initialize the histograms.
+        clusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy", 110, 0.00, 2.2);
+        clusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy", 110, 0.00, 2.2);
+        clusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count", 8, 1, 9);
+        clusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
+        
+        // Initialize the filtered histograms.
+        fClusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy (Over 100 MeV)", 110, 0.00, 2.2);
+        fClusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy (Over 100 MeV)", 110, 0.00, 2.2);
+        fClusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count (Over 100 MeV)", 8, 1, 9);
+        fClusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution (Over 100 MeV)", 46, -23, 23, 11, -5.5, 5.5);
+        
+        // Initialize the more filtered histograms.
+        nClusterTotalEnergy = aida.histogram1D("Cluster Plot :: Cluster Total Energy (Over 100 MeV, > 1 Hit)", 110, 0.00, 2.2);
+        nClusterSeedEnergy = aida.histogram1D("Cluster Plot :: Seed Hit Energy (Over 100 MeV, > 1 Hit)", 110, 0.00, 2.2);
+        nClusterHitCount = aida.histogram1D("Cluster Plot :: Cluster Hit Count (Over 100 MeV, > 1 Hit)", 8, 1, 9);
+        nClusterDistribution = aida.histogram2D("Cluster Plot :: Seed Hit Distribution (Over 100 MeV, > 1 Hit)", 46, -23, 23, 11, -5.5, 5.5);
+    }
+    
+    public void process(EventHeader event) {
+        // Check if there exists a cluster collection.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the raw hit collection.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Output the information on each hit to the histograms.
+            for(Cluster cluster : clusterList) {
+                // Get the x and y indices for the hits.
+                int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                int iy = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+                if(ix > 0) { ix = ix - 1; }
+                
+                // Write to the histograms.
+                clusterTotalEnergy.fill(cluster.getEnergy());
+                clusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
+                clusterHitCount.fill(cluster.getCalorimeterHits().size());
+                clusterDistribution.fill(ix, iy, 1.0);
+                
+                if(cluster.getCalorimeterHits().get(0).getCorrectedEnergy() > 0.100) {
+                    fClusterTotalEnergy.fill(cluster.getEnergy());
+                    fClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
+                    fClusterHitCount.fill(cluster.getCalorimeterHits().size());
+                    fClusterDistribution.fill(ix, iy, 1.0);
+                    
+                    if(cluster.getCalorimeterHits().size() > 1) {
+                        nClusterTotalEnergy.fill(cluster.getEnergy());
+                        nClusterSeedEnergy.fill(cluster.getCalorimeterHits().get(0).getCorrectedEnergy());
+                        nClusterHitCount.fill(cluster.getCalorimeterHits().size());
+                        nClusterDistribution.fill(ix, iy, 1.0);
+                    }
+                }
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/CountTriggersDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/CountTriggersDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/CountTriggersDriver.java	Wed Mar  9 11:43:24 2016
@@ -16,64 +16,64 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class CountTriggersDriver extends Driver {
-	// Store programmable parameters.
-	private String bankCollectionName = "TriggerBank";
-	
-	// Track the number of triggers seen for each trigger type.
-	private int[] triggers = new int[6];
-	private static final int PULSER   = 0;
-	private static final int SINGLES0 = 1;
-	private static final int SINGLES1 = 2;
-	private static final int PAIR0    = 3;
-	private static final int PAIR1    = 4;
-	private static final int COSMIC   = 5;
-	
-	/**
-	 * Outputs the total number of triggers seen for each trigger type.
-	 */
-	@Override
-	public void endOfData() {
-		System.out.println("Trigger Counts:");
-		System.out.printf("Singles 0 :: %d%n", triggers[SINGLES0]);
-		System.out.printf("Singles 1 :: %d%n", triggers[SINGLES1]);
-		System.out.printf("Pair 0    :: %d%n", triggers[PAIR0]);
-		System.out.printf("Pair 1    :: %d%n", triggers[PAIR1]);
-		System.out.printf("Pulser    :: %d%n", triggers[PULSER]);
-		System.out.printf("Cosmic    :: %d%n", triggers[COSMIC]);
-	}
-	
-	/**
-	 * Checks whether a trigger of each given type was seen by the TI
-	 * for each event and increments the total trigger count for that
-	 * type as appropriate.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		// Extract the TI bank from the data stream.
-		TIData tiBank = null;
-		if(event.hasCollection(GenericObject.class, bankCollectionName)) {
-			// Get the bank list.
-			List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-			
-			// Search through the banks and get the TI bank.
-			for(GenericObject obj : bankList) {
-				if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
-					tiBank = new TIData(obj);
-				}
-			}
-		}
-		
-		// If there is no TI bank, the event can not be processed.
-		if(tiBank == null) {
-			return;
-		}
-		
-		// Otherwise, increment the relevant trigger counts.
-		if(tiBank.isPulserTrigger()) { triggers[PULSER]++; }
-		if(tiBank.isSingle0Trigger()) { triggers[SINGLES0]++; }
-		if(tiBank.isSingle1Trigger()) { triggers[SINGLES1]++; }
-		if(tiBank.isPair0Trigger()) { triggers[PAIR0]++; }
-		if(tiBank.isPair1Trigger()) { triggers[PAIR1]++; }
-		if(tiBank.isCalibTrigger()) { triggers[COSMIC]++; }
-	}
+    // Store programmable parameters.
+    private String bankCollectionName = "TriggerBank";
+    
+    // Track the number of triggers seen for each trigger type.
+    private int[] triggers = new int[6];
+    private static final int PULSER   = 0;
+    private static final int SINGLES0 = 1;
+    private static final int SINGLES1 = 2;
+    private static final int PAIR0    = 3;
+    private static final int PAIR1    = 4;
+    private static final int COSMIC   = 5;
+    
+    /**
+     * Outputs the total number of triggers seen for each trigger type.
+     */
+    @Override
+    public void endOfData() {
+        System.out.println("Trigger Counts:");
+        System.out.printf("Singles 0 :: %d%n", triggers[SINGLES0]);
+        System.out.printf("Singles 1 :: %d%n", triggers[SINGLES1]);
+        System.out.printf("Pair 0    :: %d%n", triggers[PAIR0]);
+        System.out.printf("Pair 1    :: %d%n", triggers[PAIR1]);
+        System.out.printf("Pulser    :: %d%n", triggers[PULSER]);
+        System.out.printf("Cosmic    :: %d%n", triggers[COSMIC]);
+    }
+    
+    /**
+     * Checks whether a trigger of each given type was seen by the TI
+     * for each event and increments the total trigger count for that
+     * type as appropriate.
+     */
+    @Override
+    public void process(EventHeader event) {
+        // Extract the TI bank from the data stream.
+        TIData tiBank = null;
+        if(event.hasCollection(GenericObject.class, bankCollectionName)) {
+            // Get the bank list.
+            List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+            
+            // Search through the banks and get the TI bank.
+            for(GenericObject obj : bankList) {
+                if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
+                    tiBank = new TIData(obj);
+                }
+            }
+        }
+        
+        // If there is no TI bank, the event can not be processed.
+        if(tiBank == null) {
+            return;
+        }
+        
+        // Otherwise, increment the relevant trigger counts.
+        if(tiBank.isPulserTrigger()) { triggers[PULSER]++; }
+        if(tiBank.isSingle0Trigger()) { triggers[SINGLES0]++; }
+        if(tiBank.isSingle1Trigger()) { triggers[SINGLES1]++; }
+        if(tiBank.isPair0Trigger()) { triggers[PAIR0]++; }
+        if(tiBank.isPair1Trigger()) { triggers[PAIR1]++; }
+        if(tiBank.isCalibTrigger()) { triggers[COSMIC]++; }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/EvioAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/EvioAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/EvioAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -17,17 +17,17 @@
 import org.lcsim.util.aida.AIDA;
 
 public class EvioAnalysis extends Driver {
-	// Store index reference variables.
+    // Store index reference variables.
         private static final int RECON     = 0;
         private static final int SSP       = 1;
-	
-	// Create histogram arrays for cut distributions.
+    
+    // Create histogram arrays for cut distributions.
         private AIDA aida = AIDA.defaultInstance();
         private IHistogram1D[] clusterEnergyPlot = new IHistogram1D[2];
         private IHistogram1D[] clusterHitCountPlot = new IHistogram1D[2];
         private IHistogram1D[] clusterTimePlot = new IHistogram1D[2];
-	private IHistogram2D[] clusterSlopePlot = new IHistogram2D[2];
-	
+    private IHistogram2D[] clusterSlopePlot = new IHistogram2D[2];
+    
         private IHistogram1D[] pairClusterEnergyPlot = new IHistogram1D[2];
         private IHistogram1D[] pairHitCountPlot = new IHistogram1D[2];
         private IHistogram1D[] pairTimePlot = new IHistogram1D[2];
@@ -38,129 +38,129 @@
         private IHistogram1D[] pairCoplanarityPlot = new IHistogram1D[2];
         private IHistogram1D[] pairTriggerTimePlot = new IHistogram1D[2];
 
-	// Store programmable values.
-	private String clusterCollectionName = "EcalClusters";
-	private String bankCollectionName = "SSPData";
-	private double energySlopeParamF = 0.0055;
-	private double beamEnergy = 1.1;
-	
-	@Override
-	public void startOfData() {
-		// Store the plot source type name.
-		String[] plotType = new String[2];
-		plotType[RECON] = " (Recon)";
-		plotType[SSP] = " (SSP)";
-		
-		// Set the bin sizes based on the beam energy.
-		int bins = (int) beamEnergy * 100;
-		
-		for(int i = 0; i < 2; i++) {
-			// Instantiate the single cluster distribution plots.
-			clusterEnergyPlot[i] = aida.histogram1D("Raw/Cluster Energy" + plotType[i], bins, 0.0, beamEnergy);
-			clusterHitCountPlot[i] = aida.histogram1D("Raw/Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
-			clusterTimePlot[i] = aida.histogram1D("Raw/Cluster Time" + plotType[i], 100, 0, 400);
-			clusterSlopePlot[i] = aida.histogram2D("Raw/Cluster Energy Slope" + plotType[i], 300, 0.0, 3.0, 200, 0, 400);
-			
-			// Instantiate the cluster pair distribution plots.
-			pairSumPlot[i] = aida.histogram1D("Raw/Pair Energy Sum" + plotType[i], (int) 1.5 * bins, 0.0, 1.5 * beamEnergy);
-			pairSumEnergiesPlot[i] = aida.histogram2D("Raw/Pair 2D Energy Sum" + plotType[i], (int) 1.5 * bins, 0.0, 1.5 * beamEnergy, (int) 1.5 * bins, 0.0, 1.5 * beamEnergy);
-			pairDiffPlot[i] = aida.histogram1D("Raw/Pair Energy Difference" + plotType[i], bins, 0.0, beamEnergy);
-			pairSlopePlot[i] = aida.histogram1D("Raw/Pair Energy Slope" + plotType[i], 100, 0.0, 4.0);
-			pairCoplanarityPlot[i] = aida.histogram1D("Raw/Pair Coplanarity" + plotType[i], 180, 0.0, 180);
-		}
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Skip the event if there are no clusters.
-		if(!event.hasCollection(Cluster.class, clusterCollectionName) || !event.hasCollection(GenericObject.class, bankCollectionName)) {
-			return;
-		}
-		
-		// Get the list of clusters.
-		List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
-		
-		// Get the SSP data bank.
-		List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-		
-		// Get the SSP bank from the generic object bank list.
-		SSPData sspBank = null;
-		for(GenericObject obj : bankList) {
-			if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
-				sspBank = new SSPData(obj);
-			}
-		}
-		
-		// Make sure that the SSP bank was initialized.
-		if(sspBank == null) {
-			return;
-		}
-		
-		// Iterate over the reconstructed clusters and populate
-		// the singles plots.
-		for(Cluster cluster : clusters) {
-			// Get the cluster properties.
-			int hitCount = cluster.getCalorimeterHits().size();
-			double x = TriggerModule.getClusterX(cluster);
-			double z = TriggerModule.getClusterZ(cluster);
-			double slopeParamR = Math.sqrt((x * x) + (z * z));
-			
-			// Populate the plots.
-			clusterEnergyPlot[RECON].fill(cluster.getEnergy());
-			clusterHitCountPlot[RECON].fill(cluster.getCalorimeterHits().size());
-			clusterTimePlot[RECON].fill(cluster.getCalorimeterHits().get(0).getTime());
-			clusterSlopePlot[RECON].fill(cluster.getEnergy(), slopeParamR);
-		}
-		
-		// Get the list of pairs.
-		List<Cluster[]> pairs = makePairs(clusters);
-		
-		// Iterate over the pairs and populate the pair plots.
-		for(Cluster[] pair : pairs) {
-			pairSumPlot[RECON].fill(TriggerModule.getValueEnergySum(pair));
-			pairSumEnergiesPlot[RECON].fill(pair[0].getEnergy(), pair[1].getEnergy());
-			pairDiffPlot[RECON].fill(TriggerModule.getValueEnergyDifference(pair));
-			pairSlopePlot[RECON].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
-			pairCoplanarityPlot[RECON].fill(TriggerModule.getValueCoplanarity(pair));
-		}
-	}
-	
-	private List<Cluster[]> makePairs(List<Cluster> clusters) {
-		// Create seperate lists for top and bottom clusters.
-		List<Cluster> topList = new ArrayList<Cluster>();
-		List<Cluster> bottomList = new ArrayList<Cluster>();
-		List<Cluster[]> pairList = new ArrayList<Cluster[]>();
-		
-		// Sort the clusters into the appropriate list.
-		for(Cluster cluster : clusters) {
-			if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
-				topList.add(cluster);
-			} else {
-				bottomList.add(cluster);
-			}
-		}
-		
-		// Create all possible cluster pairs.
-		for(Cluster topCluster : topList) {
-			for(Cluster bottomCluster : bottomList) {
-				Cluster[] pair = { topCluster, bottomCluster };
-				pairList.add(pair);
-			}
-		}
-		
-		// Return the list of cluster pairs.
-		return pairList;
-	}
-	
-	public void setClusterCollectionName(String clusterCollectionName) {
-		this.clusterCollectionName = clusterCollectionName;
-	}
-	
-	public void setBankCollectionName(String bankCollectionName) {
-		this.bankCollectionName = bankCollectionName;
-	}
-	
-	public void setEnergySlopeParamF(double energySlopeParamF) {
-		this.energySlopeParamF = energySlopeParamF;
-	}
+    // Store programmable values.
+    private String clusterCollectionName = "EcalClusters";
+    private String bankCollectionName = "SSPData";
+    private double energySlopeParamF = 0.0055;
+    private double beamEnergy = 1.1;
+    
+    @Override
+    public void startOfData() {
+        // Store the plot source type name.
+        String[] plotType = new String[2];
+        plotType[RECON] = " (Recon)";
+        plotType[SSP] = " (SSP)";
+        
+        // Set the bin sizes based on the beam energy.
+        int bins = (int) beamEnergy * 100;
+        
+        for(int i = 0; i < 2; i++) {
+            // Instantiate the single cluster distribution plots.
+            clusterEnergyPlot[i] = aida.histogram1D("Raw/Cluster Energy" + plotType[i], bins, 0.0, beamEnergy);
+            clusterHitCountPlot[i] = aida.histogram1D("Raw/Cluster Hit Count" + plotType[i], 9, 0.5, 9.5);
+            clusterTimePlot[i] = aida.histogram1D("Raw/Cluster Time" + plotType[i], 100, 0, 400);
+            clusterSlopePlot[i] = aida.histogram2D("Raw/Cluster Energy Slope" + plotType[i], 300, 0.0, 3.0, 200, 0, 400);
+            
+            // Instantiate the cluster pair distribution plots.
+            pairSumPlot[i] = aida.histogram1D("Raw/Pair Energy Sum" + plotType[i], (int) 1.5 * bins, 0.0, 1.5 * beamEnergy);
+            pairSumEnergiesPlot[i] = aida.histogram2D("Raw/Pair 2D Energy Sum" + plotType[i], (int) 1.5 * bins, 0.0, 1.5 * beamEnergy, (int) 1.5 * bins, 0.0, 1.5 * beamEnergy);
+            pairDiffPlot[i] = aida.histogram1D("Raw/Pair Energy Difference" + plotType[i], bins, 0.0, beamEnergy);
+            pairSlopePlot[i] = aida.histogram1D("Raw/Pair Energy Slope" + plotType[i], 100, 0.0, 4.0);
+            pairCoplanarityPlot[i] = aida.histogram1D("Raw/Pair Coplanarity" + plotType[i], 180, 0.0, 180);
+        }
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Skip the event if there are no clusters.
+        if(!event.hasCollection(Cluster.class, clusterCollectionName) || !event.hasCollection(GenericObject.class, bankCollectionName)) {
+            return;
+        }
+        
+        // Get the list of clusters.
+        List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
+        
+        // Get the SSP data bank.
+        List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+        
+        // Get the SSP bank from the generic object bank list.
+        SSPData sspBank = null;
+        for(GenericObject obj : bankList) {
+            if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
+                sspBank = new SSPData(obj);
+            }
+        }
+        
+        // Make sure that the SSP bank was initialized.
+        if(sspBank == null) {
+            return;
+        }
+        
+        // Iterate over the reconstructed clusters and populate
+        // the singles plots.
+        for(Cluster cluster : clusters) {
+            // Get the cluster properties.
+            int hitCount = cluster.getCalorimeterHits().size();
+            double x = TriggerModule.getClusterX(cluster);
+            double z = TriggerModule.getClusterZ(cluster);
+            double slopeParamR = Math.sqrt((x * x) + (z * z));
+            
+            // Populate the plots.
+            clusterEnergyPlot[RECON].fill(cluster.getEnergy());
+            clusterHitCountPlot[RECON].fill(cluster.getCalorimeterHits().size());
+            clusterTimePlot[RECON].fill(cluster.getCalorimeterHits().get(0).getTime());
+            clusterSlopePlot[RECON].fill(cluster.getEnergy(), slopeParamR);
+        }
+        
+        // Get the list of pairs.
+        List<Cluster[]> pairs = makePairs(clusters);
+        
+        // Iterate over the pairs and populate the pair plots.
+        for(Cluster[] pair : pairs) {
+            pairSumPlot[RECON].fill(TriggerModule.getValueEnergySum(pair));
+            pairSumEnergiesPlot[RECON].fill(pair[0].getEnergy(), pair[1].getEnergy());
+            pairDiffPlot[RECON].fill(TriggerModule.getValueEnergyDifference(pair));
+            pairSlopePlot[RECON].fill(TriggerModule.getValueEnergySlope(pair, energySlopeParamF));
+            pairCoplanarityPlot[RECON].fill(TriggerModule.getValueCoplanarity(pair));
+        }
+    }
+    
+    private List<Cluster[]> makePairs(List<Cluster> clusters) {
+        // Create seperate lists for top and bottom clusters.
+        List<Cluster> topList = new ArrayList<Cluster>();
+        List<Cluster> bottomList = new ArrayList<Cluster>();
+        List<Cluster[]> pairList = new ArrayList<Cluster[]>();
+        
+        // Sort the clusters into the appropriate list.
+        for(Cluster cluster : clusters) {
+            if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
+                topList.add(cluster);
+            } else {
+                bottomList.add(cluster);
+            }
+        }
+        
+        // Create all possible cluster pairs.
+        for(Cluster topCluster : topList) {
+            for(Cluster bottomCluster : bottomList) {
+                Cluster[] pair = { topCluster, bottomCluster };
+                pairList.add(pair);
+            }
+        }
+        
+        // Return the list of cluster pairs.
+        return pairList;
+    }
+    
+    public void setClusterCollectionName(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    public void setBankCollectionName(String bankCollectionName) {
+        this.bankCollectionName = bankCollectionName;
+    }
+    
+    public void setEnergySlopeParamF(double energySlopeParamF) {
+        this.energySlopeParamF = energySlopeParamF;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/FADCAnalysisDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/FADCAnalysisDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/FADCAnalysisDriver.java	Wed Mar  9 11:43:24 2016
@@ -11,82 +11,82 @@
 import org.lcsim.util.aida.AIDA;
 
 public class FADCAnalysisDriver extends Driver {
-	// Analysis plots.
+    // Analysis plots.
     AIDA aida = AIDA.defaultInstance();
-	IHistogram1D rawHitEnergy;
-	IHistogram1D fadcHitEnergy;
-	IHistogram2D rawHitDistribution;
-	IHistogram2D fadcHitDistribution;
-	IHistogram2D fadcFilteredHitDistribution;
-	IHistogram1D eventRawHitCount;
-	IHistogram1D eventFADCHitCount;
-	
-	// Hit collection names.
-	private String rawHitsCollectionName = "EcalHits";
-	private String fadcHitsCollectionName = "EcalCorrectedHits";
-	
-	public void setFadcHitsCollectionName(String fadcHitsCollectionName) {
-		this.fadcHitsCollectionName = fadcHitsCollectionName;
-	}
-	
-	public void setRawHitsCollectionName(String rawHitsCollectionName) {
-		this.rawHitsCollectionName = rawHitsCollectionName;
-	}
-	
-	@Override
-	public void startOfData() {
-		// Initialize the histograms.
-		rawHitEnergy = aida.histogram1D("FADC Plot :: Raw Hit Energy", 110, 0.00, 2.2);
-		fadcHitEnergy = aida.histogram1D("FADC Plot :: FADC Hit Energy", 80, 0.00, 1.6);
-		rawHitDistribution = aida.histogram2D("FADC Plot :: Raw Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
-		fadcHitDistribution = aida.histogram2D("FADC Plot :: FADC Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
-		fadcFilteredHitDistribution = aida.histogram2D("FADC Plot :: FADC Hit Distribution Over 100 MeV", 46, -23, 23, 11, -5.5, 5.5);
-		eventRawHitCount = aida.histogram1D("FADC Plot :: Event Raw Hit Count", 159, 1, 160);
-		eventFADCHitCount = aida.histogram1D("FADC Plot :: Event FADC Hit Count", 15, 1, 16);
-	}
-	
-	public void process(EventHeader event) {
-		// Check if there exists a raw hits collection.
-		if(event.hasCollection(CalorimeterHit.class, rawHitsCollectionName)) {
-			// Get the raw hit collection.
-			List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, rawHitsCollectionName);
-			
-			// Output the information on each hit to the histograms.
-			for(CalorimeterHit hit : hitList) {
-				// Get the x and y indices for the hits.
-				int ix = hit.getIdentifierFieldValue("ix");
-				int iy = hit.getIdentifierFieldValue("iy");
-				if(ix > 0) { ix = ix - 1; }
-				
-				// Write to the histograms.
-				rawHitEnergy.fill(hit.getCorrectedEnergy());
-				rawHitDistribution.fill(ix, iy, 1.0);
-				
-				// If there are hits, fill the hit count histogram.
-				if(hitList.size() != 0) { eventRawHitCount.fill(hitList.size()); }
-			}
-		}
-		
-		// Check if there exists an FADC hits collection.
-		if(event.hasCollection(CalorimeterHit.class, fadcHitsCollectionName)) {
-			// Get the raw hit collection.
-			List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, fadcHitsCollectionName);
-			
-			// Output the information on each hit to the histograms.
-			for(CalorimeterHit hit : hitList) {
-				// Get the x and y indices for the hits.
-				int ix = hit.getIdentifierFieldValue("ix");
-				int iy = hit.getIdentifierFieldValue("iy");
-				if(ix > 0) { ix = ix - 1; }
-				
-				// Write to the histograms.
-				fadcHitEnergy.fill(hit.getCorrectedEnergy());
-				fadcHitDistribution.fill(ix, iy, 1.0);
-				if(hit.getCorrectedEnergy() > 0.100) { fadcFilteredHitDistribution.fill(ix, iy, 1.0); }
-				
-				// If there are hits, fill the hit count histogram.
-				if(hitList.size() != 0) { eventFADCHitCount.fill(hitList.size()); }
-			}
-		}
-	}
+    IHistogram1D rawHitEnergy;
+    IHistogram1D fadcHitEnergy;
+    IHistogram2D rawHitDistribution;
+    IHistogram2D fadcHitDistribution;
+    IHistogram2D fadcFilteredHitDistribution;
+    IHistogram1D eventRawHitCount;
+    IHistogram1D eventFADCHitCount;
+    
+    // Hit collection names.
+    private String rawHitsCollectionName = "EcalHits";
+    private String fadcHitsCollectionName = "EcalCorrectedHits";
+    
+    public void setFadcHitsCollectionName(String fadcHitsCollectionName) {
+        this.fadcHitsCollectionName = fadcHitsCollectionName;
+    }
+    
+    public void setRawHitsCollectionName(String rawHitsCollectionName) {
+        this.rawHitsCollectionName = rawHitsCollectionName;
+    }
+    
+    @Override
+    public void startOfData() {
+        // Initialize the histograms.
+        rawHitEnergy = aida.histogram1D("FADC Plot :: Raw Hit Energy", 110, 0.00, 2.2);
+        fadcHitEnergy = aida.histogram1D("FADC Plot :: FADC Hit Energy", 80, 0.00, 1.6);
+        rawHitDistribution = aida.histogram2D("FADC Plot :: Raw Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
+        fadcHitDistribution = aida.histogram2D("FADC Plot :: FADC Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
+        fadcFilteredHitDistribution = aida.histogram2D("FADC Plot :: FADC Hit Distribution Over 100 MeV", 46, -23, 23, 11, -5.5, 5.5);
+        eventRawHitCount = aida.histogram1D("FADC Plot :: Event Raw Hit Count", 159, 1, 160);
+        eventFADCHitCount = aida.histogram1D("FADC Plot :: Event FADC Hit Count", 15, 1, 16);
+    }
+    
+    public void process(EventHeader event) {
+        // Check if there exists a raw hits collection.
+        if(event.hasCollection(CalorimeterHit.class, rawHitsCollectionName)) {
+            // Get the raw hit collection.
+            List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, rawHitsCollectionName);
+            
+            // Output the information on each hit to the histograms.
+            for(CalorimeterHit hit : hitList) {
+                // Get the x and y indices for the hits.
+                int ix = hit.getIdentifierFieldValue("ix");
+                int iy = hit.getIdentifierFieldValue("iy");
+                if(ix > 0) { ix = ix - 1; }
+                
+                // Write to the histograms.
+                rawHitEnergy.fill(hit.getCorrectedEnergy());
+                rawHitDistribution.fill(ix, iy, 1.0);
+                
+                // If there are hits, fill the hit count histogram.
+                if(hitList.size() != 0) { eventRawHitCount.fill(hitList.size()); }
+            }
+        }
+        
+        // Check if there exists an FADC hits collection.
+        if(event.hasCollection(CalorimeterHit.class, fadcHitsCollectionName)) {
+            // Get the raw hit collection.
+            List<CalorimeterHit> hitList = event.get(CalorimeterHit.class, fadcHitsCollectionName);
+            
+            // Output the information on each hit to the histograms.
+            for(CalorimeterHit hit : hitList) {
+                // Get the x and y indices for the hits.
+                int ix = hit.getIdentifierFieldValue("ix");
+                int iy = hit.getIdentifierFieldValue("iy");
+                if(ix > 0) { ix = ix - 1; }
+                
+                // Write to the histograms.
+                fadcHitEnergy.fill(hit.getCorrectedEnergy());
+                fadcHitDistribution.fill(ix, iy, 1.0);
+                if(hit.getCorrectedEnergy() > 0.100) { fadcFilteredHitDistribution.fill(ix, iy, 1.0); }
+                
+                // If there are hits, fill the hit count histogram.
+                if(hitList.size() != 0) { eventFADCHitCount.fill(hitList.size()); }
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/HPSEcalDataPlotsDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/HPSEcalDataPlotsDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/HPSEcalDataPlotsDriver.java	Wed Mar  9 11:43:24 2016
@@ -27,22 +27,22 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class HPSEcalDataPlotsDriver extends Driver {
-	private String plotsGroupName= "Data Plots";
-	private String bankCollectionName = "TriggerBank";
-	private String clusterCollectionName = "EcalClusters";
-	
-	private static final int PULSER   = 0;
-	private static final int SINGLES0 = 1;
-	private static final int SINGLES1 = 2;
-	private static final int PAIR0    = 3;
-	private static final int PAIR1    = 4;
-	
-	private static final int ALL       = 0;
-	private static final int EDGE      = 1;
-	private static final int FIDUCIAL = 2;
-	
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[][] clusterTotalEnergy = new IHistogram1D[5][3];
+    private String plotsGroupName= "Data Plots";
+    private String bankCollectionName = "TriggerBank";
+    private String clusterCollectionName = "EcalClusters";
+    
+    private static final int PULSER   = 0;
+    private static final int SINGLES0 = 1;
+    private static final int SINGLES1 = 2;
+    private static final int PAIR0    = 3;
+    private static final int PAIR1    = 4;
+    
+    private static final int ALL       = 0;
+    private static final int EDGE      = 1;
+    private static final int FIDUCIAL = 2;
+    
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D[][] clusterTotalEnergy = new IHistogram1D[5][3];
     private IHistogram1D[][] clusterTime = new IHistogram1D[5][3];
     private IHistogram1D[][] clusterHitCount = new IHistogram1D[5][3];
     private IHistogram1D[][] clusterSeedEnergy = new IHistogram1D[5][3];
@@ -56,249 +56,249 @@
     private IHistogram2D[][] clusterSeedPosition = new IHistogram2D[5][3];
     private IHistogram2D[][] pairEnergySlope2D = new IHistogram2D[5][3];
     private IHistogram2D[][] pairCoplanarityEnergySum = new IHistogram2D[5][3];
-	
+    
     /**
      * Initializes the plots.
      */
-	@Override
-	public void startOfData() {
-		// Define trigger names.
-		String[] triggerNames = {
-			"Pulser", "Singles 0", "Singles 1", "Pair 0", "Pair 1"	
-		};
-		
-		// Define the positional names.
-		String[] positionNames = {
-				"All", "Edge", "Fiducial"
-		};
-		
-		// Instantiate the plots.
-		for(int i = 0; i < 5; i++) {
-			for(int j = 0; j < 3; j++) {
-				clusterTotalEnergy[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Cluster Total Energy", 150, 0.000, 1.500);
+    @Override
+    public void startOfData() {
+        // Define trigger names.
+        String[] triggerNames = {
+            "Pulser", "Singles 0", "Singles 1", "Pair 0", "Pair 1"  
+        };
+        
+        // Define the positional names.
+        String[] positionNames = {
+                "All", "Edge", "Fiducial"
+        };
+        
+        // Instantiate the plots.
+        for(int i = 0; i < 5; i++) {
+            for(int j = 0; j < 3; j++) {
+                clusterTotalEnergy[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
+                        + positionNames[j] + "/Cluster Total Energy", 150, 0.000, 1.500);
                 clusterTime[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Cluster Hit Time", 100, 0.0, 100.0);
+                        + positionNames[j] + "/Cluster Hit Time", 100, 0.0, 100.0);
                 clusterHitCount[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Cluster Hit Count", 10, -0.5, 9.5);
+                        + positionNames[j] + "/Cluster Hit Count", 10, -0.5, 9.5);
                 clusterSeedEnergy[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Cluster Seed Energy", 150, 0.000, 1.500);
+                        + positionNames[j] + "/Cluster Seed Energy", 150, 0.000, 1.500);
                 pairEnergySum[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Pair Energy Sum", 150, 0.000, 1.500);
+                        + positionNames[j] + "/Pair Energy Sum", 150, 0.000, 1.500);
                 pairEnergyDifference[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Pair Energy Difference", 150, 0.000, 1.500);
+                        + positionNames[j] + "/Pair Energy Difference", 150, 0.000, 1.500);
                 pairEnergySlope[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Pair Energy Slope", 100, 0.000, 4.000);
+                        + positionNames[j] + "/Pair Energy Slope", 100, 0.000, 4.000);
                 pairCoplanarity[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Pair Coplanarity", 180, 0.000, 180);
+                        + positionNames[j] + "/Pair Coplanarity", 180, 0.000, 180);
                 pairTimeCoincidence[i][j] = aida.histogram1D(plotsGroupName + "/" + triggerNames[i] + "/"
-						+ positionNames[j] + "/Pair Time Coincidence", 80, 0, 20);
+                        + positionNames[j] + "/Pair Time Coincidence", 80, 0, 20);
                 
                 clusterSeedPosition[i][j] = aida.histogram2D(plotsGroupName + "/" + triggerNames[i] + "/"
-                		+ positionNames[j] + "/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
+                        + positionNames[j] + "/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
                 pairEnergySum2D[i][j] = aida.histogram2D(plotsGroupName + "/" + triggerNames[i] + "/"
-                		+ positionNames[j] + "/Pair Energy Sum 2D", 150, 0.000, 1.500, 150, 0.000, 1.500);
+                        + positionNames[j] + "/Pair Energy Sum 2D", 150, 0.000, 1.500, 150, 0.000, 1.500);
                 pairCoplanarityEnergySum[i][j] = aida.histogram2D(plotsGroupName + "/" + triggerNames[i] + "/"
-                		+ positionNames[j] + "/Pair Energy Sum vs. Coplanarity", 150, 0.000, 1.500, 180, 0, 180);
+                        + positionNames[j] + "/Pair Energy Sum vs. Coplanarity", 150, 0.000, 1.500, 180, 0, 180);
                 pairEnergySlope2D[i][j] = aida.histogram2D(plotsGroupName + "/" + triggerNames[i] + "/"
-                		+ positionNames[j] + "/Pair Energy Slope 2D", 75, 0.000, 1.500, 100, 0.0, 400.0);
-			}
-		}
-	}
-	
-	/**
-	 * Processes the event clusters and populates distribution charts
-	 * from them for each trigger. Also creates separate plots for the
-	 * edge and fiducial regions.
-	 * @param event - The event containing LCIO collections to be used
-	 * for plot population.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		// Get the TI and SSP banks.
-		TIData tiBank = null;
-		SSPData sspBank = null;
-		if(event.hasCollection(GenericObject.class, bankCollectionName)) {
-			// Get the bank list.
-			List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-			
-			// Search through the banks and get the SSP and TI banks.
-			for(GenericObject obj : bankList) {
-				// If this is an SSP bank, parse it.
-				if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
-					sspBank = new SSPData(obj);
-				}
-				
-				// Otherwise, if this is a TI bank, parse it.
-				else if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
-					tiBank = new TIData(obj);
-				}
-			}
-		}
-		
-		// Get the list of clusters.
-		List<Cluster> clusters = null;
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			clusters = event.get(Cluster.class, clusterCollectionName);
-		}
-		
-		// Require that all collections be initialized.
-		if(sspBank == null || tiBank == null || clusters == null) {
-			return;
-		}
-		
-		// Track which triggers are active.
-		boolean[] activeTrigger = new boolean[5];
-		activeTrigger[PULSER] = tiBank.isPulserTrigger();
-		activeTrigger[SINGLES0] = tiBank.isSingle0Trigger();
-		activeTrigger[SINGLES1] = tiBank.isSingle1Trigger();
-		activeTrigger[PAIR0] = tiBank.isPair0Trigger();
-		activeTrigger[PAIR1] = tiBank.isPair1Trigger();
-		
-		// Plot all cluster properties for each trigger.
-		for(Cluster cluster : clusters) {
-			// Check whether the cluster is a fiducial or edge cluster.
-			int positional = inFiducialRegion(cluster) ? FIDUCIAL : EDGE;
-			
-			// Fill the appropriate plots for each trigger with an
-			// active trigger bit for single clusters.
-			for(int i = 0; i < 5; i++) {
-				if(activeTrigger[i]) {
-					// Populate the ALL plots.
-					clusterSeedEnergy[i][ALL].fill(TriggerModule.getValueClusterSeedEnergy(cluster));
-					clusterTotalEnergy[i][ALL].fill(cluster.getEnergy());
-					clusterHitCount[i][ALL].fill(TriggerModule.getClusterHitCount(cluster));
-					clusterTime[i][ALL].fill(TriggerModule.getClusterTime(cluster));
-					clusterSeedPosition[i][ALL].fill(TriggerModule.getClusterXIndex(cluster),
-							TriggerModule.getClusterYIndex(cluster));
-					
-					// Populate the positional plots.
-					clusterSeedEnergy[i][positional].fill(TriggerModule.getValueClusterSeedEnergy(cluster));
-					clusterTotalEnergy[i][positional].fill(cluster.getEnergy());
-					clusterHitCount[i][positional].fill(TriggerModule.getClusterHitCount(cluster));
-					clusterTime[i][positional].fill(TriggerModule.getClusterTime(cluster));
-					clusterSeedPosition[i][positional].fill(TriggerModule.getClusterXIndex(cluster),
-							TriggerModule.getClusterYIndex(cluster));
-				}
-			}
-		}
-		
-		// Plot all pair properties for each trigger.
-		List<Cluster[]> pairs = TriggerModule.getTopBottomPairs(clusters, Cluster.class);
-		for(Cluster[] pair : pairs) {
-			// Check whether the cluster is a fiducial or edge cluster.
-			boolean[] isFiducial = {
-					inFiducialRegion(pair[0]),
-					inFiducialRegion(pair[1])
-			};
-			int positional = (isFiducial[0] && isFiducial[1]) ? FIDUCIAL : EDGE;
-			
-			// Fill the appropriate plots for each trigger with an
-			// active trigger bit for single clusters.
-			for(int i = 0; i < 5; i++) {
-				if(activeTrigger[i]) {
-					// Calculate the values.
-					double energySum = TriggerModule.getValueEnergySum(pair);
-					double energyDiff = TriggerModule.getValueEnergyDifference(pair);
-					double energySlope = TriggerModule.getValueEnergySlope(pair, 0.00550);
-					double coplanarity = TriggerModule.getValueCoplanarity(pair);
-					double timeCoincidence = TriggerModule.getValueTimeCoincidence(pair);
-					
-					// Get the energy slope values.
-					Cluster lowCluster = pair[0].getEnergy() < pair[1].getEnergy() ? pair[0] : pair[1];
-					double clusterDistance = TriggerModule.getClusterDistance(lowCluster);
-					
-					// Populate the ALL plots.
-					pairEnergySum[i][ALL].fill(energySum);
-					pairEnergyDifference[i][ALL].fill(energyDiff);
-					pairEnergySlope[i][ALL].fill(energySlope);
-					pairCoplanarity[i][ALL].fill(coplanarity);
-					pairTimeCoincidence[i][ALL].fill(timeCoincidence);
-					pairEnergySum2D[i][ALL].fill(pair[0].getEnergy(), pair[1].getEnergy());
-					pairCoplanarityEnergySum[i][ALL].fill(energySum, coplanarity);
-					pairEnergySlope2D[i][ALL].fill(lowCluster.getEnergy(), clusterDistance);
-					
-					// Populate the positional plots.
-					pairEnergySum[i][positional].fill(energySum);
-					pairEnergyDifference[i][positional].fill(energyDiff);
-					pairEnergySlope[i][positional].fill(energySlope);
-					pairCoplanarity[i][positional].fill(coplanarity);
-					pairTimeCoincidence[i][positional].fill(timeCoincidence);
-					pairEnergySum2D[i][positional].fill(pair[0].getEnergy(), pair[1].getEnergy());
-					pairCoplanarityEnergySum[i][positional].fill(energySum, coplanarity);
-					pairEnergySlope2D[i][positional].fill(lowCluster.getEnergy(), clusterDistance);
-				}
-			}
-		}
-	}
-	
-	/**
-	 * Indicates whether the argument cluster is located in the fiducial
-	 * region or not.
-	 * @param cluster - The cluster to check.
-	 * @return Returns <code>true</code> if the cluster is located in
-	 * the fiducial region and <code>false</code> otherwise.
-	 */
-	private static final boolean inFiducialRegion(Cluster cluster) {
-		// Get the x and y indices for the cluster.
-		int ix   = TriggerModule.getClusterXIndex(cluster);
-		int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
-		int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
-		
-		// Check if the cluster is on the top or the bottom of the
-		// calorimeter, as defined by |y| == 5. This is an edge cluster
-		// and is not in the fiducial region.
-		if(absy == 5) {
-			return false;
-		}
-		
-		// Check if the cluster is on the extreme left or right side
-		// of the calorimeter, as defined by |x| == 23. This is also
-		// and edge cluster is not in the fiducial region.
-		if(absx == 23) {
-			return false;
-		}
-		
-		// Check if the cluster is along the beam gap, as defined by
-		// |y| == 1. This is an internal edge cluster and is not in the
-		// fiducial region.
-		if(absy == 1) {
-			return false;
-		}
-		
-		// Lastly, check if the cluster falls along the beam hole, as
-		// defined by clusters with -11 <= x <= -1 and |y| == 2. This
-		// is not the fiducial region.
-		if(absy == 2 && ix <= -1 && ix >= -11) {
-			return false;
-		}
-		
-		// If all checks fail, the cluster is in the fiducial region.
-		return true;
-	}
-	
-	/**
-	 * Sets the name of the LCIO collection containing the clusters
-	 * that are to be plotted.
-	 * @param collection - The LCIO collection name.
-	 */
-	public void setClusterCollectionName(String collection) {
-		clusterCollectionName = collection;
-	}
-	
-	/**
-	 * Defines the name of the LCIO collection containing the TI bank.
-	 * @param collection - The LCIO collection name.
-	 */
-	public void setBankCollectionName(String collection) {
-		bankCollectionName = collection;
-	}
-	
-	/**
-	 * Sets the name of the super-group folder containing all plots.
-	 * @param name - The name of the plots folder.
-	 */
-	public void setPlotsGroupName(String name) {
-		plotsGroupName = name;
-	}
+                        + positionNames[j] + "/Pair Energy Slope 2D", 75, 0.000, 1.500, 100, 0.0, 400.0);
+            }
+        }
+    }
+    
+    /**
+     * Processes the event clusters and populates distribution charts
+     * from them for each trigger. Also creates separate plots for the
+     * edge and fiducial regions.
+     * @param event - The event containing LCIO collections to be used
+     * for plot population.
+     */
+    @Override
+    public void process(EventHeader event) {
+        // Get the TI and SSP banks.
+        TIData tiBank = null;
+        SSPData sspBank = null;
+        if(event.hasCollection(GenericObject.class, bankCollectionName)) {
+            // Get the bank list.
+            List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+            
+            // Search through the banks and get the SSP and TI banks.
+            for(GenericObject obj : bankList) {
+                // If this is an SSP bank, parse it.
+                if(AbstractIntData.getTag(obj) == SSPData.BANK_TAG) {
+                    sspBank = new SSPData(obj);
+                }
+                
+                // Otherwise, if this is a TI bank, parse it.
+                else if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
+                    tiBank = new TIData(obj);
+                }
+            }
+        }
+        
+        // Get the list of clusters.
+        List<Cluster> clusters = null;
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            clusters = event.get(Cluster.class, clusterCollectionName);
+        }
+        
+        // Require that all collections be initialized.
+        if(sspBank == null || tiBank == null || clusters == null) {
+            return;
+        }
+        
+        // Track which triggers are active.
+        boolean[] activeTrigger = new boolean[5];
+        activeTrigger[PULSER] = tiBank.isPulserTrigger();
+        activeTrigger[SINGLES0] = tiBank.isSingle0Trigger();
+        activeTrigger[SINGLES1] = tiBank.isSingle1Trigger();
+        activeTrigger[PAIR0] = tiBank.isPair0Trigger();
+        activeTrigger[PAIR1] = tiBank.isPair1Trigger();
+        
+        // Plot all cluster properties for each trigger.
+        for(Cluster cluster : clusters) {
+            // Check whether the cluster is a fiducial or edge cluster.
+            int positional = inFiducialRegion(cluster) ? FIDUCIAL : EDGE;
+            
+            // Fill the appropriate plots for each trigger with an
+            // active trigger bit for single clusters.
+            for(int i = 0; i < 5; i++) {
+                if(activeTrigger[i]) {
+                    // Populate the ALL plots.
+                    clusterSeedEnergy[i][ALL].fill(TriggerModule.getValueClusterSeedEnergy(cluster));
+                    clusterTotalEnergy[i][ALL].fill(cluster.getEnergy());
+                    clusterHitCount[i][ALL].fill(TriggerModule.getClusterHitCount(cluster));
+                    clusterTime[i][ALL].fill(TriggerModule.getClusterTime(cluster));
+                    clusterSeedPosition[i][ALL].fill(TriggerModule.getClusterXIndex(cluster),
+                            TriggerModule.getClusterYIndex(cluster));
+                    
+                    // Populate the positional plots.
+                    clusterSeedEnergy[i][positional].fill(TriggerModule.getValueClusterSeedEnergy(cluster));
+                    clusterTotalEnergy[i][positional].fill(cluster.getEnergy());
+                    clusterHitCount[i][positional].fill(TriggerModule.getClusterHitCount(cluster));
+                    clusterTime[i][positional].fill(TriggerModule.getClusterTime(cluster));
+                    clusterSeedPosition[i][positional].fill(TriggerModule.getClusterXIndex(cluster),
+                            TriggerModule.getClusterYIndex(cluster));
+                }
+            }
+        }
+        
+        // Plot all pair properties for each trigger.
+        List<Cluster[]> pairs = TriggerModule.getTopBottomPairs(clusters, Cluster.class);
+        for(Cluster[] pair : pairs) {
+            // Check whether the cluster is a fiducial or edge cluster.
+            boolean[] isFiducial = {
+                    inFiducialRegion(pair[0]),
+                    inFiducialRegion(pair[1])
+            };
+            int positional = (isFiducial[0] && isFiducial[1]) ? FIDUCIAL : EDGE;
+            
+            // Fill the appropriate plots for each trigger with an
+            // active trigger bit for single clusters.
+            for(int i = 0; i < 5; i++) {
+                if(activeTrigger[i]) {
+                    // Calculate the values.
+                    double energySum = TriggerModule.getValueEnergySum(pair);
+                    double energyDiff = TriggerModule.getValueEnergyDifference(pair);
+                    double energySlope = TriggerModule.getValueEnergySlope(pair, 0.00550);
+                    double coplanarity = TriggerModule.getValueCoplanarity(pair);
+                    double timeCoincidence = TriggerModule.getValueTimeCoincidence(pair);
+                    
+                    // Get the energy slope values.
+                    Cluster lowCluster = pair[0].getEnergy() < pair[1].getEnergy() ? pair[0] : pair[1];
+                    double clusterDistance = TriggerModule.getClusterDistance(lowCluster);
+                    
+                    // Populate the ALL plots.
+                    pairEnergySum[i][ALL].fill(energySum);
+                    pairEnergyDifference[i][ALL].fill(energyDiff);
+                    pairEnergySlope[i][ALL].fill(energySlope);
+                    pairCoplanarity[i][ALL].fill(coplanarity);
+                    pairTimeCoincidence[i][ALL].fill(timeCoincidence);
+                    pairEnergySum2D[i][ALL].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                    pairCoplanarityEnergySum[i][ALL].fill(energySum, coplanarity);
+                    pairEnergySlope2D[i][ALL].fill(lowCluster.getEnergy(), clusterDistance);
+                    
+                    // Populate the positional plots.
+                    pairEnergySum[i][positional].fill(energySum);
+                    pairEnergyDifference[i][positional].fill(energyDiff);
+                    pairEnergySlope[i][positional].fill(energySlope);
+                    pairCoplanarity[i][positional].fill(coplanarity);
+                    pairTimeCoincidence[i][positional].fill(timeCoincidence);
+                    pairEnergySum2D[i][positional].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                    pairCoplanarityEnergySum[i][positional].fill(energySum, coplanarity);
+                    pairEnergySlope2D[i][positional].fill(lowCluster.getEnergy(), clusterDistance);
+                }
+            }
+        }
+    }
+    
+    /**
+     * Indicates whether the argument cluster is located in the fiducial
+     * region or not.
+     * @param cluster - The cluster to check.
+     * @return Returns <code>true</code> if the cluster is located in
+     * the fiducial region and <code>false</code> otherwise.
+     */
+    private static final boolean inFiducialRegion(Cluster cluster) {
+        // Get the x and y indices for the cluster.
+        int ix   = TriggerModule.getClusterXIndex(cluster);
+        int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
+        int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
+        
+        // Check if the cluster is on the top or the bottom of the
+        // calorimeter, as defined by |y| == 5. This is an edge cluster
+        // and is not in the fiducial region.
+        if(absy == 5) {
+            return false;
+        }
+        
+        // Check if the cluster is on the extreme left or right side
+        // of the calorimeter, as defined by |x| == 23. This is also
+        // and edge cluster is not in the fiducial region.
+        if(absx == 23) {
+            return false;
+        }
+        
+        // Check if the cluster is along the beam gap, as defined by
+        // |y| == 1. This is an internal edge cluster and is not in the
+        // fiducial region.
+        if(absy == 1) {
+            return false;
+        }
+        
+        // Lastly, check if the cluster falls along the beam hole, as
+        // defined by clusters with -11 <= x <= -1 and |y| == 2. This
+        // is not the fiducial region.
+        if(absy == 2 && ix <= -1 && ix >= -11) {
+            return false;
+        }
+        
+        // If all checks fail, the cluster is in the fiducial region.
+        return true;
+    }
+    
+    /**
+     * Sets the name of the LCIO collection containing the clusters
+     * that are to be plotted.
+     * @param collection - The LCIO collection name.
+     */
+    public void setClusterCollectionName(String collection) {
+        clusterCollectionName = collection;
+    }
+    
+    /**
+     * Defines the name of the LCIO collection containing the TI bank.
+     * @param collection - The LCIO collection name.
+     */
+    public void setBankCollectionName(String collection) {
+        bankCollectionName = collection;
+    }
+    
+    /**
+     * Sets the name of the super-group folder containing all plots.
+     * @param name - The name of the plots folder.
+     */
+    public void setPlotsGroupName(String name) {
+        plotsGroupName = name;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/InvariantMassPairDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/InvariantMassPairDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/InvariantMassPairDriver.java	Wed Mar  9 11:43:24 2016
@@ -15,255 +15,255 @@
 import org.lcsim.util.aida.AIDA;
 
 public class InvariantMassPairDriver extends Driver {
-	private int[] events = new int[3];
-	private TriggerModule[] trigger = new TriggerModule[2];
-	
-	private String gtpClusterCollectionName = "EcalClustersGTP";
-	private String particleCollectionName = "FinalStateParticles";
-	private String reconParticleCollectionName = "UnconstrainedV0Candidates";
-	
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D electronEnergyHist = aida.histogram1D("Trident Analysis/Electron Energy", 150, 0.000, 1.500);
-	private IHistogram1D positronEnergyHist = aida.histogram1D("Trident Analysis/Positron Energy", 150, 0.000, 1.500);
-	private IHistogram1D pairEnergyHist = aida.histogram1D("Trident Analysis/Energy Sum Distribution", 220, 0.00, 2.200);
-	private IHistogram2D pair2DEnergyHist = aida.histogram2D("Trident Analysis/2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1);
-	private IHistogram1D pair1MassHist = aida.histogram1D("Trident Analysis/Particle Invariant Mass (1 Hit)", 240, 0.000, 0.120);
-	private IHistogram1D pair1ModMassHist = aida.histogram1D("Trident Analysis/Particle Invariant Mass (2 Hit)", 240, 0.000, 0.120);
-	private IHistogram1D elasticElectronEnergyHist = aida.histogram1D("Trident Analysis/Trident Electron Energy", 150, 0.000, 1.500);
-	private IHistogram1D elasticPositronEnergyHist = aida.histogram1D("Trident Analysis/Trident Positron Energy", 150, 0.000, 1.500);
-	
-	@Override
-	public void startOfData() {
-		// Instantiate the pair 1 trigger.
-		trigger[0] = new TriggerModule();
-		trigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
-		trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.054);
-		trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   0.630);
-		trigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 0.540);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.180);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        0.860);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.600);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         0.0055);
-		trigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       12);
-		
-		// Instantiate the pair 1 trigger with a hit count cut of two.
-		trigger[1] = new TriggerModule();
-		trigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       2);
-		trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.054);
-		trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   0.630);
-		trigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 0.540);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.180);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        0.860);
-		trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.600);
-		trigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         0.0055);
-		trigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       12);
-	}
-	
-	@Override
-	public void endOfData() {
-		System.out.printf("Pair 1     :: %d / %d%n", events[0], events[2]);
-		System.out.printf("Pair 1 Mod :: %d / %d%n", events[1], events[2]);
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Skip the event if there is no reconstructed particle list.
-		if(!event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
-			return;
-		}
-		
-		// Get a list of all tracks in the event.
-		List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
-		
-		// Plot the energies of the electrons and positrons.
-		for(ReconstructedParticle track : trackList) {
-			// Positive tracks are assumed to be positrons.
-			if(track.getCharge() > 0) {
-				positronEnergyHist.fill(track.getMomentum().magnitude());
-			}
-			
-			// Negative tracks are assumed to be electrons.
-			else if(track.getCharge() < 0) {
-				electronEnergyHist.fill(track.getMomentum().magnitude());
-			}
-		}
-		
-		// Get track pairs.
-		List<ReconstructedParticle[]> trackPairList = getTrackPairs(trackList);
-		
-		// Populate the pair plots.
-		trackPairLoop:
-		for(ReconstructedParticle[] trackPair : trackPairList) {
-			// Note the polarity of the tracks.
-			boolean[] trackIsPositive = {
-					trackPair[0].getCharge() > 0,
-					trackPair[1].getCharge() > 0
-			};
-			
-			// Require that one track be positive and one be negative.
-			if(!(trackIsPositive[0] ^ trackIsPositive[1])) {
-				continue trackPairLoop;
-			}
-			
-			// Populate the track pair plots.
-			pairEnergyHist.fill(VecOp.add(trackPair[0].getMomentum(), trackPair[1].getMomentum()).magnitude());
-			if(trackIsPositive[0]) {
-				pair2DEnergyHist.fill(trackPair[0].getMomentum().magnitude(), trackPair[1].getMomentum().magnitude());
-			} else {
-				pair2DEnergyHist.fill(trackPair[1].getMomentum().magnitude(), trackPair[0].getMomentum().magnitude());
-			}
-		}
-		
-		// Check that the event has a collection of GTP clusters.
-		if(!event.hasCollection(Cluster.class, gtpClusterCollectionName)) {
-			return;
-		}
-		
-		// Increment the total event count.
-		events[2]++;
-		
-		// Get the GTP clusters.
-		List<Cluster> clusters = event.get(Cluster.class, gtpClusterCollectionName);
-		
-		// Get the list of top/bottom pairs.
-		List<Cluster[]> pairs = getClusterPairs(clusters);
-		
-		// Iterate over the pairs and determine if any cluster passes
-		// pair 1 trigger or the pair 1 modified trigger.
-		boolean passedPair1 = false;
-		boolean passedPair1Mod = false;
-		pairLoop:
-		for(Cluster[] pair : pairs) {
-			// Check the cluster energy cut.
-			if(!trigger[0].clusterTotalEnergyCut(pair[0])) { continue pairLoop; }
-			if(!trigger[0].clusterTotalEnergyCut(pair[1])) { continue pairLoop; }
-			
-			// Check the pair cuts.
-			if(!trigger[0].pairCoplanarityCut(pair)) { continue pairLoop; }
-			if(!trigger[0].pairEnergyDifferenceCut(pair)) { continue pairLoop; }
-			if(!trigger[0].pairEnergySumCut(pair)) { continue pairLoop; }
-			if(!trigger[0].pairEnergySlopeCut(pair)) { continue pairLoop; }
-			
-			// Check if the pair passes the singles 0 hit count cut.
-			if(trigger[0].clusterHitCountCut(pair[0]) && trigger[0].clusterHitCountCut(pair[1])) {
-				// Note that a pair passed the pair 1 trigger.
-				passedPair1 = true;
-				
-				// Check whether the pair passed the modified pair 1
-				// trigger hit count cut.
-				if(trigger[1].clusterHitCountCut(pair[0]) && trigger[1].clusterHitCountCut(pair[1])) {
-					passedPair1Mod = true;
-				}
-			} else { continue pairLoop; }
-		}
-		
-		// If no pair passed the pair 1 cut, nothing further need be done.
-		if(!passedPair1) { return; }
-		
-		// Otherwise, increment the "passed pair 1" count and the
-		// "passed pair 1 mod" count, if appropriate.
-		events[0]++;
-		if(passedPair1Mod) { events[1]++; }
-		
-		// Get the collection of reconstructed V0 candidates.
-		List<ReconstructedParticle> candidateList = event.get(ReconstructedParticle.class, reconParticleCollectionName);
-		
-		// Populate the invariant mass plot.
-		candidateLoop:
-		for(ReconstructedParticle particle : candidateList) {
-			// Track the electron and positron momenta.
-			double electronMomentum = 0.0;
-			double positronMomentum = 0.0;
-			
-			// Check that it has component particles that meet the
-			// trident condition.
-			boolean seenPositive = false;
-			boolean seenNegative = false;
-			for(ReconstructedParticle track : particle.getParticles()) {
-				// Exactly one track must be negative. Its energy is
-				// disallowed from exceeding 900 MeV.
-				if(track.getCharge() < 0) {
-					// Reject a second negative particle.
-					if(seenNegative) { continue candidateLoop; }
-					
-					// Otherwise, note that one has been seen.
-					seenNegative = true;
-					electronMomentum = track.getMomentum().magnitude();
-					
-					// Reject electrons with a momentum exceeding 900 MeV.
-					if(track.getMomentum().magnitude() > 0.900) {
-						continue candidateLoop;
-					}
-				}
-				
-				// Exactly one track must be positive. Its energy is
-				// not constrained.
-				else if(track.getCharge() > 0) {
-					// Reject a second positive particle.
-					if(seenPositive) { continue candidateLoop; }
-					
-					// Otherwise, note that one has been seen.
-					seenPositive = true;
-					positronMomentum = track.getMomentum().magnitude();
-				}
-				
-				// Lastly, reject any particle that produced a photon.
-				else { continue candidateLoop; }
-			}
-			
-			// Populate the plots.
-			pair1MassHist.fill(particle.getMass());
-			elasticElectronEnergyHist.fill(electronMomentum);
-			elasticPositronEnergyHist.fill(positronMomentum);
-			if(passedPair1Mod) { pair1ModMassHist.fill(particle.getMass()); }
-		}
-	}
-	
-	/**
-	 * Creates a list of top/bottom cluster pairs.
-	 * @param clusters - A <code>List</code> collection of objects of
-	 * type <code>Cluster</code>.
-	 * @return Returns a <code>List</code> collection of 2-entry arrays
-	 * of <code>Cluster</code> objects representing top/bottom cluster
-	 * pairs. The first entry is always the top cluster.
-	 */
-	private static final List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
-		// Separate the clusters into top and bottom clusters.
-		List<Cluster> topList = new ArrayList<Cluster>();
-		List<Cluster> botList = new ArrayList<Cluster>();
-		for(Cluster cluster : clusters) {
-			if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
-				topList.add(cluster);
-			}
-			else { botList.add(cluster); }
-		}
-		
-		// Create a list of all top/bottom pairs.
-		List<Cluster[]> pairs = new ArrayList<Cluster[]>();
-		for(Cluster topCluster : topList) {
-			for(Cluster botCluster : botList) {
-				pairs.add(new Cluster[] { topCluster, botCluster });
-			}
-		}
-		
-		// Return the list of cluster pairs.
-		return pairs;
-	}
-	
-	private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> trackList) {
-		// Create an empty list for the pairs.
-		List<ReconstructedParticle[]> pairs = new ArrayList<ReconstructedParticle[]>();
-		
-		// Add all possible pairs of tracks.
-		for(int i = 0; i < trackList.size(); i++) {
-			for(int j = i + 1; j < trackList.size(); j++) {
-				pairs.add(new ReconstructedParticle[] { trackList.get(i), trackList.get(j) });
-			}
-		}
-		
-		// Return the list of tracks.
-		return pairs;
-	}
+    private int[] events = new int[3];
+    private TriggerModule[] trigger = new TriggerModule[2];
+    
+    private String gtpClusterCollectionName = "EcalClustersGTP";
+    private String particleCollectionName = "FinalStateParticles";
+    private String reconParticleCollectionName = "UnconstrainedV0Candidates";
+    
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D electronEnergyHist = aida.histogram1D("Trident Analysis/Electron Energy", 150, 0.000, 1.500);
+    private IHistogram1D positronEnergyHist = aida.histogram1D("Trident Analysis/Positron Energy", 150, 0.000, 1.500);
+    private IHistogram1D pairEnergyHist = aida.histogram1D("Trident Analysis/Energy Sum Distribution", 220, 0.00, 2.200);
+    private IHistogram2D pair2DEnergyHist = aida.histogram2D("Trident Analysis/2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1);
+    private IHistogram1D pair1MassHist = aida.histogram1D("Trident Analysis/Particle Invariant Mass (1 Hit)", 240, 0.000, 0.120);
+    private IHistogram1D pair1ModMassHist = aida.histogram1D("Trident Analysis/Particle Invariant Mass (2 Hit)", 240, 0.000, 0.120);
+    private IHistogram1D elasticElectronEnergyHist = aida.histogram1D("Trident Analysis/Trident Electron Energy", 150, 0.000, 1.500);
+    private IHistogram1D elasticPositronEnergyHist = aida.histogram1D("Trident Analysis/Trident Positron Energy", 150, 0.000, 1.500);
+    
+    @Override
+    public void startOfData() {
+        // Instantiate the pair 1 trigger.
+        trigger[0] = new TriggerModule();
+        trigger[0].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       1);
+        trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.054);
+        trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   0.630);
+        trigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 0.540);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.180);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        0.860);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.600);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         0.0055);
+        trigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       12);
+        
+        // Instantiate the pair 1 trigger with a hit count cut of two.
+        trigger[1] = new TriggerModule();
+        trigger[1].setCutValue(TriggerModule.CLUSTER_HIT_COUNT_LOW,       2);
+        trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_LOW,    0.054);
+        trigger[0].setCutValue(TriggerModule.CLUSTER_TOTAL_ENERGY_HIGH,   0.630);
+        trigger[0].setCutValue(TriggerModule.PAIR_COPLANARITY_HIGH,       30);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_DIFFERENCE_HIGH, 0.540);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_LOW,         0.180);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SUM_HIGH,        0.860);
+        trigger[0].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_LOW,       0.600);
+        trigger[1].setCutValue(TriggerModule.PAIR_ENERGY_SLOPE_F,         0.0055);
+        trigger[0].setCutValue(TriggerModule.PAIR_TIME_COINCIDENCE,       12);
+    }
+    
+    @Override
+    public void endOfData() {
+        System.out.printf("Pair 1     :: %d / %d%n", events[0], events[2]);
+        System.out.printf("Pair 1 Mod :: %d / %d%n", events[1], events[2]);
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Skip the event if there is no reconstructed particle list.
+        if(!event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
+            return;
+        }
+        
+        // Get a list of all tracks in the event.
+        List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
+        
+        // Plot the energies of the electrons and positrons.
+        for(ReconstructedParticle track : trackList) {
+            // Positive tracks are assumed to be positrons.
+            if(track.getCharge() > 0) {
+                positronEnergyHist.fill(track.getMomentum().magnitude());
+            }
+            
+            // Negative tracks are assumed to be electrons.
+            else if(track.getCharge() < 0) {
+                electronEnergyHist.fill(track.getMomentum().magnitude());
+            }
+        }
+        
+        // Get track pairs.
+        List<ReconstructedParticle[]> trackPairList = getTrackPairs(trackList);
+        
+        // Populate the pair plots.
+        trackPairLoop:
+        for(ReconstructedParticle[] trackPair : trackPairList) {
+            // Note the polarity of the tracks.
+            boolean[] trackIsPositive = {
+                    trackPair[0].getCharge() > 0,
+                    trackPair[1].getCharge() > 0
+            };
+            
+            // Require that one track be positive and one be negative.
+            if(!(trackIsPositive[0] ^ trackIsPositive[1])) {
+                continue trackPairLoop;
+            }
+            
+            // Populate the track pair plots.
+            pairEnergyHist.fill(VecOp.add(trackPair[0].getMomentum(), trackPair[1].getMomentum()).magnitude());
+            if(trackIsPositive[0]) {
+                pair2DEnergyHist.fill(trackPair[0].getMomentum().magnitude(), trackPair[1].getMomentum().magnitude());
+            } else {
+                pair2DEnergyHist.fill(trackPair[1].getMomentum().magnitude(), trackPair[0].getMomentum().magnitude());
+            }
+        }
+        
+        // Check that the event has a collection of GTP clusters.
+        if(!event.hasCollection(Cluster.class, gtpClusterCollectionName)) {
+            return;
+        }
+        
+        // Increment the total event count.
+        events[2]++;
+        
+        // Get the GTP clusters.
+        List<Cluster> clusters = event.get(Cluster.class, gtpClusterCollectionName);
+        
+        // Get the list of top/bottom pairs.
+        List<Cluster[]> pairs = getClusterPairs(clusters);
+        
+        // Iterate over the pairs and determine if any cluster passes
+        // pair 1 trigger or the pair 1 modified trigger.
+        boolean passedPair1 = false;
+        boolean passedPair1Mod = false;
+        pairLoop:
+        for(Cluster[] pair : pairs) {
+            // Check the cluster energy cut.
+            if(!trigger[0].clusterTotalEnergyCut(pair[0])) { continue pairLoop; }
+            if(!trigger[0].clusterTotalEnergyCut(pair[1])) { continue pairLoop; }
+            
+            // Check the pair cuts.
+            if(!trigger[0].pairCoplanarityCut(pair)) { continue pairLoop; }
+            if(!trigger[0].pairEnergyDifferenceCut(pair)) { continue pairLoop; }
+            if(!trigger[0].pairEnergySumCut(pair)) { continue pairLoop; }
+            if(!trigger[0].pairEnergySlopeCut(pair)) { continue pairLoop; }
+            
+            // Check if the pair passes the singles 0 hit count cut.
+            if(trigger[0].clusterHitCountCut(pair[0]) && trigger[0].clusterHitCountCut(pair[1])) {
+                // Note that a pair passed the pair 1 trigger.
+                passedPair1 = true;
+                
+                // Check whether the pair passed the modified pair 1
+                // trigger hit count cut.
+                if(trigger[1].clusterHitCountCut(pair[0]) && trigger[1].clusterHitCountCut(pair[1])) {
+                    passedPair1Mod = true;
+                }
+            } else { continue pairLoop; }
+        }
+        
+        // If no pair passed the pair 1 cut, nothing further need be done.
+        if(!passedPair1) { return; }
+        
+        // Otherwise, increment the "passed pair 1" count and the
+        // "passed pair 1 mod" count, if appropriate.
+        events[0]++;
+        if(passedPair1Mod) { events[1]++; }
+        
+        // Get the collection of reconstructed V0 candidates.
+        List<ReconstructedParticle> candidateList = event.get(ReconstructedParticle.class, reconParticleCollectionName);
+        
+        // Populate the invariant mass plot.
+        candidateLoop:
+        for(ReconstructedParticle particle : candidateList) {
+            // Track the electron and positron momenta.
+            double electronMomentum = 0.0;
+            double positronMomentum = 0.0;
+            
+            // Check that it has component particles that meet the
+            // trident condition.
+            boolean seenPositive = false;
+            boolean seenNegative = false;
+            for(ReconstructedParticle track : particle.getParticles()) {
+                // Exactly one track must be negative. Its energy is
+                // disallowed from exceeding 900 MeV.
+                if(track.getCharge() < 0) {
+                    // Reject a second negative particle.
+                    if(seenNegative) { continue candidateLoop; }
+                    
+                    // Otherwise, note that one has been seen.
+                    seenNegative = true;
+                    electronMomentum = track.getMomentum().magnitude();
+                    
+                    // Reject electrons with a momentum exceeding 900 MeV.
+                    if(track.getMomentum().magnitude() > 0.900) {
+                        continue candidateLoop;
+                    }
+                }
+                
+                // Exactly one track must be positive. Its energy is
+                // not constrained.
+                else if(track.getCharge() > 0) {
+                    // Reject a second positive particle.
+                    if(seenPositive) { continue candidateLoop; }
+                    
+                    // Otherwise, note that one has been seen.
+                    seenPositive = true;
+                    positronMomentum = track.getMomentum().magnitude();
+                }
+                
+                // Lastly, reject any particle that produced a photon.
+                else { continue candidateLoop; }
+            }
+            
+            // Populate the plots.
+            pair1MassHist.fill(particle.getMass());
+            elasticElectronEnergyHist.fill(electronMomentum);
+            elasticPositronEnergyHist.fill(positronMomentum);
+            if(passedPair1Mod) { pair1ModMassHist.fill(particle.getMass()); }
+        }
+    }
+    
+    /**
+     * Creates a list of top/bottom cluster pairs.
+     * @param clusters - A <code>List</code> collection of objects of
+     * type <code>Cluster</code>.
+     * @return Returns a <code>List</code> collection of 2-entry arrays
+     * of <code>Cluster</code> objects representing top/bottom cluster
+     * pairs. The first entry is always the top cluster.
+     */
+    private static final List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
+        // Separate the clusters into top and bottom clusters.
+        List<Cluster> topList = new ArrayList<Cluster>();
+        List<Cluster> botList = new ArrayList<Cluster>();
+        for(Cluster cluster : clusters) {
+            if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
+                topList.add(cluster);
+            }
+            else { botList.add(cluster); }
+        }
+        
+        // Create a list of all top/bottom pairs.
+        List<Cluster[]> pairs = new ArrayList<Cluster[]>();
+        for(Cluster topCluster : topList) {
+            for(Cluster botCluster : botList) {
+                pairs.add(new Cluster[] { topCluster, botCluster });
+            }
+        }
+        
+        // Return the list of cluster pairs.
+        return pairs;
+    }
+    
+    private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> trackList) {
+        // Create an empty list for the pairs.
+        List<ReconstructedParticle[]> pairs = new ArrayList<ReconstructedParticle[]>();
+        
+        // Add all possible pairs of tracks.
+        for(int i = 0; i < trackList.size(); i++) {
+            for(int j = i + 1; j < trackList.size(); j++) {
+                pairs.add(new ReconstructedParticle[] { trackList.get(i), trackList.get(j) });
+            }
+        }
+        
+        // Return the list of tracks.
+        return pairs;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/MTEAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/MTEAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/MTEAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -24,145 +24,145 @@
 import org.lcsim.util.aida.AIDA;
 
 public class MTEAnalysis extends Driver {
-	// Define track LCIO information.
-	private boolean skipBadSVT = true;
-	private String bankCollectionName = "TriggerBank";
-	private String particleCollectionName = "FinalStateParticles";
-	private static final AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[] chargedTracksPlot = {
-			aida.histogram1D("MTE Analysis/Møller Event Tracks", 10, -0.5, 9.5),
-			aida.histogram1D("MTE Analysis/Trident Event Tracks", 10, -0.5, 9.5),
-			aida.histogram1D("MTE Analysis/Elastic Event Tracks", 10, -0.5, 9.5)
-	};
-	private IHistogram1D[] clusterCountPlot = {
-			aida.histogram1D("MTE Analysis/Møller Event Clusters", 10, -0.5, 9.5),
-			aida.histogram1D("MTE Analysis/Trident Event Clusters", 10, -0.5, 9.5),
-			aida.histogram1D("MTE Analysis/Elastic Event Clusters", 10, -0.5, 9.5)
-	};
-	private IHistogram1D[] energyPlot = {
-			aida.histogram1D("MTE Analysis/Møller Energy Sum Distribution", 220, 0, 2.2),
-			aida.histogram1D("MTE Analysis/Trident Energy Sum Distribution", 220, 0, 2.2),
-			aida.histogram1D("MTE Analysis/Elastic Energy Distribution", 110, 0, 1.5)
-	};
-	private IHistogram1D[] electronPlot = {
-			aida.histogram1D("MTE Analysis/Møller Electron Energy Distribution", 220, 0, 2.2),
-			aida.histogram1D("MTE Analysis/Trident Electron Energy Distribution", 220, 0, 2.2),
-	};
-	private IHistogram1D positronPlot = aida.histogram1D("MTE Analysis/Trident Positron Energy Distribution", 220, 0, 2.2);
-	private IHistogram2D[] energy2DPlot = {
-			aida.histogram2D("MTE Analysis/Møller 2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1),
-			aida.histogram2D("MTE Analysis/Trident 2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1),
-	};
-	private IHistogram1D timePlot = aida.histogram1D("MTE Analysis/Track Cluster Time Distribution", 4000, 0, 400);
-	private IHistogram1D timeCoincidencePlot = aida.histogram1D("MTE Analysis/Møller Time Coincidence Distribution", 1000, 0, 100);
-	private IHistogram1D timeCoincidenceAllCutsPlot = aida.histogram1D("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)", 1000, 0, 100);
-	private IHistogram1D negTrackCount = aida.histogram1D("MTE Analysis/All Negative Tracks", 10, -0.5, 9.5);
-	private IHistogram1D posTrackCount = aida.histogram1D("MTE Analysis/All Positive Event Tracks", 10, -0.5, 9.5);
-	private IHistogram1D chargedTrackCount = aida.histogram1D("MTE Analysis/All Event Event Tracks", 10, -0.5, 9.5);
-	
-	private IHistogram1D trInvariantMassAll            = aida.histogram1D("Trident/Invariant Mass",                     1500,   0.0,  1.5);
-	private IHistogram1D trInvariantMassFiducial       = aida.histogram1D("Trident/Invariant Mass (Fiducial Region)",   1500,   0.0,  1.5);
-	private IHistogram1D trTimeCoincidenceAll          = aida.histogram1D("Trident/Time Coincidence",                    300, -15.0, 15.0);
-	private IHistogram1D trTimeCoincidenceFiducial     = aida.histogram1D("Trident/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
-	private IHistogram1D trEnergySumAll                = aida.histogram1D("Trident/Energy Sum",                          300,   0.0,  1.5);
-	private IHistogram1D trEnergySumFiducial           = aida.histogram1D("Trident/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
-	private IHistogram2D trEnergySum2DAll              = aida.histogram2D("Trident/First Cluster Energy vs. Second Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D trEnergySum2DFiducial         = aida.histogram2D("Trident/First Cluster Energy vs. Second Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D trSumCoplanarityAll           = aida.histogram2D("Trident/Hardware Coplanarity vs. Energy Sum",                              300, 0, 1.5, 115,   0, 180);
-	private IHistogram2D trSumCoplanarityFiducial      = aida.histogram2D("Trident/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",            300, 0, 1.5, 115,   0, 180);
-	private IHistogram2D trSumCoplanarityCalcAll       = aida.histogram2D("Trident/Calculated Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D trSumCoplanarityCalcFiducial  = aida.histogram2D("Trident/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D trTimeEnergyAll               = aida.histogram2D("Trident/Cluster Time vs. Cluster Energy",                                  300, 0, 1.5, 100,   0, 100);
-	private IHistogram2D trTimeEnergyFiducial          = aida.histogram2D("Trident/Cluster Time vs. Cluster Energy (Fiducial Region)",                300, 0, 1.5, 100,   0, 100);
-	
-	private TriggerPlotsModule allPlots = new TriggerPlotsModule("All");
-	private TriggerPlotsModule møllerPlots = new TriggerPlotsModule("Møller");
-	private TriggerPlotsModule tridentPlots = new TriggerPlotsModule("Trident");
-	private TriggerPlotsModule elasticPlots = new TriggerPlotsModule("Elastic");
-	private static final int MØLLER  = 0;
-	private static final int TRIDENT = 1;
-	private static final int ELASTIC = 2;
-	private boolean verbose = false;
-	private boolean excludeNoTrackEvents = false;
-	private double timeCoincidenceCut = Double.MAX_VALUE;
-	private Map<String, Integer> møllerBitMap = new HashMap<String, Integer>();
-	private Map<String, Integer> tridentBitMap = new HashMap<String, Integer>();
-	private Map<String, Integer> elasticBitMap = new HashMap<String, Integer>();
-	private int møllerEvents = 0;
-	private int tridentEvents = 0;
-	private int elasticEvents = 0;
-	private int totalEvents = 0;
-	private int pair1Events = 0;
-	private int pair0Events = 0;
-	private int singles1Events = 0;
-	private int singles0Events = 0;
-	private int pulserEvents = 0;
-	
-	@Override
-	public void startOfData() {
-		for(int s0 = 0; s0 <= 1; s0++) {
-			for(int s1 = 0; s1 <= 1; s1++) {
-				for(int p0 = 0; p0 <= 1; p0++) {
-					for(int p1 = 0; p1 <= 1; p1++) {
-						for(int pulser = 0; pulser <=1; pulser++) {
-							// Set each "trigger bit."
-							boolean s0bit = (s0 == 1);
-							boolean s1bit = (s1 == 1);
-							boolean p0bit = (p0 == 1);
-							boolean p1bit = (p1 == 1);
-							boolean pulserBit = (p1 == 1);
-							
-							// Generate the bit string.
-							String bitString = getBitString(s0bit, s1bit, p0bit, p1bit, pulserBit);
-							
-							// Set a default value of zero for this bit combination.
-							møllerBitMap.put(bitString, 1);
-							tridentBitMap.put(bitString, 1);
-							elasticBitMap.put(bitString, 1);
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	@Override
-	public void endOfData() {
-		System.out.println("Møller  Events   :: " + møllerEvents);
-		System.out.println("Trident Events   :: " + tridentEvents);
-		System.out.println("Elastic Events   :: " + elasticEvents);
-		System.out.println("Total Events     :: " + totalEvents);
-		System.out.println("Pair 1 Events    :: " + pair1Events);
-		System.out.println("Pair 0 Events    :: " + pair0Events);
-		System.out.println("Singles 1 Events :: " + singles1Events);
-		System.out.println("Singles 0 Events :: " + singles0Events);
-		System.out.println("Pulser Events    :: " + pulserEvents);
-		
-		System.out.println("Plsr\tS0\tS1\tP0\tP1\tMøller");
-		for(Entry<String, Integer> entry : møllerBitMap.entrySet()) {
-			System.out.println(entry.getKey() + "\t" + entry.getValue());
-		}
-		
-		System.out.println("Plsr\tS0\tS1\tP0\tP1\tTrident");
-		for(Entry<String, Integer> entry : tridentBitMap.entrySet()) {
-			System.out.println(entry.getKey() + "\t" + entry.getValue());
-		}
-		
-		System.out.println("Plsr\tS0\tS1\tP0\tP1\tElastic");
-		for(Entry<String, Integer> entry : elasticBitMap.entrySet()) {
-			System.out.println(entry.getKey() + "\t" + entry.getValue());
-		}
-	}
-	
-	private static final String getBitString(boolean s0, boolean s1, boolean p0, boolean p1, boolean pulser) {
-		return String.format("%d\t%d\t%d\t%d\t%d", (pulser ? 1 : 0), (s0 ? 1 : 0), (s1 ? 1 : 0), (p0 ? 1 : 0), (p1 ? 1 : 0));
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Check whether the SVT was active in this event.
-		final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
-		boolean svtGood = true;
+    // Define track LCIO information.
+    private boolean skipBadSVT = true;
+    private String bankCollectionName = "TriggerBank";
+    private String particleCollectionName = "FinalStateParticles";
+    private static final AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D[] chargedTracksPlot = {
+            aida.histogram1D("MTE Analysis/Møller Event Tracks", 10, -0.5, 9.5),
+            aida.histogram1D("MTE Analysis/Trident Event Tracks", 10, -0.5, 9.5),
+            aida.histogram1D("MTE Analysis/Elastic Event Tracks", 10, -0.5, 9.5)
+    };
+    private IHistogram1D[] clusterCountPlot = {
+            aida.histogram1D("MTE Analysis/Møller Event Clusters", 10, -0.5, 9.5),
+            aida.histogram1D("MTE Analysis/Trident Event Clusters", 10, -0.5, 9.5),
+            aida.histogram1D("MTE Analysis/Elastic Event Clusters", 10, -0.5, 9.5)
+    };
+    private IHistogram1D[] energyPlot = {
+            aida.histogram1D("MTE Analysis/Møller Energy Sum Distribution", 220, 0, 2.2),
+            aida.histogram1D("MTE Analysis/Trident Energy Sum Distribution", 220, 0, 2.2),
+            aida.histogram1D("MTE Analysis/Elastic Energy Distribution", 110, 0, 1.5)
+    };
+    private IHistogram1D[] electronPlot = {
+            aida.histogram1D("MTE Analysis/Møller Electron Energy Distribution", 220, 0, 2.2),
+            aida.histogram1D("MTE Analysis/Trident Electron Energy Distribution", 220, 0, 2.2),
+    };
+    private IHistogram1D positronPlot = aida.histogram1D("MTE Analysis/Trident Positron Energy Distribution", 220, 0, 2.2);
+    private IHistogram2D[] energy2DPlot = {
+            aida.histogram2D("MTE Analysis/Møller 2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1),
+            aida.histogram2D("MTE Analysis/Trident 2D Energy Distribution", 55, 0, 1.1, 55, 0, 1.1),
+    };
+    private IHistogram1D timePlot = aida.histogram1D("MTE Analysis/Track Cluster Time Distribution", 4000, 0, 400);
+    private IHistogram1D timeCoincidencePlot = aida.histogram1D("MTE Analysis/Møller Time Coincidence Distribution", 1000, 0, 100);
+    private IHistogram1D timeCoincidenceAllCutsPlot = aida.histogram1D("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)", 1000, 0, 100);
+    private IHistogram1D negTrackCount = aida.histogram1D("MTE Analysis/All Negative Tracks", 10, -0.5, 9.5);
+    private IHistogram1D posTrackCount = aida.histogram1D("MTE Analysis/All Positive Event Tracks", 10, -0.5, 9.5);
+    private IHistogram1D chargedTrackCount = aida.histogram1D("MTE Analysis/All Event Event Tracks", 10, -0.5, 9.5);
+    
+    private IHistogram1D trInvariantMassAll            = aida.histogram1D("Trident/Invariant Mass",                     1500,   0.0,  1.5);
+    private IHistogram1D trInvariantMassFiducial       = aida.histogram1D("Trident/Invariant Mass (Fiducial Region)",   1500,   0.0,  1.5);
+    private IHistogram1D trTimeCoincidenceAll          = aida.histogram1D("Trident/Time Coincidence",                    300, -15.0, 15.0);
+    private IHistogram1D trTimeCoincidenceFiducial     = aida.histogram1D("Trident/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
+    private IHistogram1D trEnergySumAll                = aida.histogram1D("Trident/Energy Sum",                          300,   0.0,  1.5);
+    private IHistogram1D trEnergySumFiducial           = aida.histogram1D("Trident/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
+    private IHistogram2D trEnergySum2DAll              = aida.histogram2D("Trident/First Cluster Energy vs. Second Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D trEnergySum2DFiducial         = aida.histogram2D("Trident/First Cluster Energy vs. Second Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D trSumCoplanarityAll           = aida.histogram2D("Trident/Hardware Coplanarity vs. Energy Sum",                              300, 0, 1.5, 115,   0, 180);
+    private IHistogram2D trSumCoplanarityFiducial      = aida.histogram2D("Trident/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",            300, 0, 1.5, 115,   0, 180);
+    private IHistogram2D trSumCoplanarityCalcAll       = aida.histogram2D("Trident/Calculated Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D trSumCoplanarityCalcFiducial  = aida.histogram2D("Trident/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D trTimeEnergyAll               = aida.histogram2D("Trident/Cluster Time vs. Cluster Energy",                                  300, 0, 1.5, 100,   0, 100);
+    private IHistogram2D trTimeEnergyFiducial          = aida.histogram2D("Trident/Cluster Time vs. Cluster Energy (Fiducial Region)",                300, 0, 1.5, 100,   0, 100);
+    
+    private TriggerPlotsModule allPlots = new TriggerPlotsModule("All");
+    private TriggerPlotsModule møllerPlots = new TriggerPlotsModule("Møller");
+    private TriggerPlotsModule tridentPlots = new TriggerPlotsModule("Trident");
+    private TriggerPlotsModule elasticPlots = new TriggerPlotsModule("Elastic");
+    private static final int MØLLER  = 0;
+    private static final int TRIDENT = 1;
+    private static final int ELASTIC = 2;
+    private boolean verbose = false;
+    private boolean excludeNoTrackEvents = false;
+    private double timeCoincidenceCut = Double.MAX_VALUE;
+    private Map<String, Integer> møllerBitMap = new HashMap<String, Integer>();
+    private Map<String, Integer> tridentBitMap = new HashMap<String, Integer>();
+    private Map<String, Integer> elasticBitMap = new HashMap<String, Integer>();
+    private int møllerEvents = 0;
+    private int tridentEvents = 0;
+    private int elasticEvents = 0;
+    private int totalEvents = 0;
+    private int pair1Events = 0;
+    private int pair0Events = 0;
+    private int singles1Events = 0;
+    private int singles0Events = 0;
+    private int pulserEvents = 0;
+    
+    @Override
+    public void startOfData() {
+        for(int s0 = 0; s0 <= 1; s0++) {
+            for(int s1 = 0; s1 <= 1; s1++) {
+                for(int p0 = 0; p0 <= 1; p0++) {
+                    for(int p1 = 0; p1 <= 1; p1++) {
+                        for(int pulser = 0; pulser <=1; pulser++) {
+                            // Set each "trigger bit."
+                            boolean s0bit = (s0 == 1);
+                            boolean s1bit = (s1 == 1);
+                            boolean p0bit = (p0 == 1);
+                            boolean p1bit = (p1 == 1);
+                            boolean pulserBit = (p1 == 1);
+                            
+                            // Generate the bit string.
+                            String bitString = getBitString(s0bit, s1bit, p0bit, p1bit, pulserBit);
+                            
+                            // Set a default value of zero for this bit combination.
+                            møllerBitMap.put(bitString, 1);
+                            tridentBitMap.put(bitString, 1);
+                            elasticBitMap.put(bitString, 1);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    @Override
+    public void endOfData() {
+        System.out.println("Møller  Events   :: " + møllerEvents);
+        System.out.println("Trident Events   :: " + tridentEvents);
+        System.out.println("Elastic Events   :: " + elasticEvents);
+        System.out.println("Total Events     :: " + totalEvents);
+        System.out.println("Pair 1 Events    :: " + pair1Events);
+        System.out.println("Pair 0 Events    :: " + pair0Events);
+        System.out.println("Singles 1 Events :: " + singles1Events);
+        System.out.println("Singles 0 Events :: " + singles0Events);
+        System.out.println("Pulser Events    :: " + pulserEvents);
+        
+        System.out.println("Plsr\tS0\tS1\tP0\tP1\tMøller");
+        for(Entry<String, Integer> entry : møllerBitMap.entrySet()) {
+            System.out.println(entry.getKey() + "\t" + entry.getValue());
+        }
+        
+        System.out.println("Plsr\tS0\tS1\tP0\tP1\tTrident");
+        for(Entry<String, Integer> entry : tridentBitMap.entrySet()) {
+            System.out.println(entry.getKey() + "\t" + entry.getValue());
+        }
+        
+        System.out.println("Plsr\tS0\tS1\tP0\tP1\tElastic");
+        for(Entry<String, Integer> entry : elasticBitMap.entrySet()) {
+            System.out.println(entry.getKey() + "\t" + entry.getValue());
+        }
+    }
+    
+    private static final String getBitString(boolean s0, boolean s1, boolean p0, boolean p1, boolean pulser) {
+        return String.format("%d\t%d\t%d\t%d\t%d", (pulser ? 1 : 0), (s0 ? 1 : 0), (s1 ? 1 : 0), (p0 ? 1 : 0), (p1 ? 1 : 0));
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Check whether the SVT was active in this event.
+        final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
+        boolean svtGood = true;
         for(int i = 0; i < flagNames.length; i++) {
             int[] flag = event.getIntegerParameters().get(flagNames[i]);
             if(flag == null || flag[0] == 0) {
@@ -172,437 +172,437 @@
         
         // If the SVT was bad, then skip the event.
         if(!svtGood && skipBadSVT) {
-        	return;
-        }
-        
-		if(event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
-			// Get the list of tracks.
-			List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
-			
-			// Plot the time stamps of all tracks.
-			for(ReconstructedParticle track : trackList) {
-				if(track.getClusters().size() != 0) {
-					Cluster cluster = track.getClusters().get(0);
-					timePlot.fill(cluster.getCalorimeterHits().get(0).getTime());
-				}
-			}
-			
-			if(verbose) {
-				System.out.println(trackList.size() + " tracks found.");
-				for(ReconstructedParticle track : trackList) {
-					System.out.printf("Track :: Q = %4.1f; E = %6.3f%n",
-							track.getCharge(), track.getEnergy());
-				}
-			}
-			
-			// Populate the all cluster plots.
-			List<Cluster> topClusters = new ArrayList<Cluster>();
-			List<Cluster> botClusters = new ArrayList<Cluster>();
-			List<Cluster> clusters = event.get(Cluster.class, "EcalClusters");
-			for(Cluster cluster : clusters) {
-				allPlots.addCluster(cluster);
-				if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) { topClusters.add(cluster); }
-				else { botClusters.add(cluster); }
-			}
-			
-			// Make cluster pairs.
-			List<Cluster[]> clusterPairs = new ArrayList<Cluster[]>();
-			for(Cluster topCluster : topClusters) {
-				for(Cluster botCluster : botClusters) {
-					clusterPairs.add(new Cluster[] { topCluster, botCluster });
-				}
-			}
-			
-			// Populate the all cluster pair plots.
-			for(Cluster[] pair : clusterPairs) {
-				allPlots.addClusterPair(pair);
-			}
-			
-			// Check each of the event-type conditions.
-			boolean isMøller = false;
-			boolean isTrident = false;
-			boolean isElastic = false;
-			
-			// Produce all possible pairs of tracks.
-			List<ReconstructedParticle[]> pairList = getTrackPairs(trackList);
-			
-			// Check the Møller condition. A Møller event is expected
-			// to have two tracks, both negative, with a net energy
-			// within a certain band of the beam energy.
-			møllerTrackLoop:
-			for(ReconstructedParticle[] pair : pairList) {
-				// If trackless events are to be excluded, then require
-				// that each "track" have a real track.
-				if(excludeNoTrackEvents && (pair[0].getTracks().isEmpty() || pair[1].getTracks().isEmpty())) {
-					continue møllerTrackLoop;
-				}
-				
-				// Both tracks are required to be negatively charged.
-				if(pair[0].getCharge() >= 0 || pair[1].getCharge() >= 0) {
-					continue møllerTrackLoop;
-				}
-				
-				// Both tracks must have clusters associated with them.
-				Cluster[] trackClusters = new Cluster[2];
-				for(int i = 0; i < 2; i++) {
-					// Disallow tracks with no associated clusters.
-					if(pair[i].getClusters().size() == 0) {
-						continue møllerTrackLoop;
-					}
-					
-					// Store the first cluster associated with the track.
-					trackClusters[i] = pair[i].getClusters().get(0);
-				}
-				
-				// Require that the track clusters be within a certain
-				// time window of one another.
-				CalorimeterHit[] seeds = new CalorimeterHit[2];
-				seeds[0] = trackClusters[0].getCalorimeterHits().get(0);
-				seeds[1] = trackClusters[1].getCalorimeterHits().get(0);
-				timeCoincidencePlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
-				if(Math.abs(trackClusters[0].getCalorimeterHits().get(0).getTime() - trackClusters[1].getCalorimeterHits().get(0).getTime()) > timeCoincidenceCut) {
-					continue møllerTrackLoop;
-				}
-				
-				// Require both tracks to occur within the range of
-				// 36.5 and 49 ns.
-				if(seeds[0].getTime() < 36.5 || seeds[0].getTime() > 49) {
-					continue møllerTrackLoop;
-				} if(seeds[1].getTime() < 36.5 || seeds[1].getTime() > 49) {
-					continue møllerTrackLoop;
-				}
-				
-				// No track may have an energy that exceeds 900 MeV.
-				if(pair[0].getMomentum().magnitude() >= 0.900 || pair[1].getMomentum().magnitude() >= 0.900) {
-					continue møllerTrackLoop;
-				}
-				
-				// Get the energy sum.
-				double sum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
-				
-				// "Møller-like" track pairs must have energies within
-				// an allowed energy range.
-				if(sum < 0.800 || sum > 1.500) {
-					continue møllerTrackLoop;
-				}
-				
-				//timeCoincidenceAllCutsPlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
-				
-				// Note that this is a Møller event.
-				isMøller = true;
-				
-				// Populate the Møller plots.
-				energyPlot[MØLLER].fill(sum);
-				møllerPlots.addClusterPair(trackClusters);
-				electronPlot[MØLLER].fill(pair[0].getMomentum().magnitude());
-				electronPlot[MØLLER].fill(pair[1].getMomentum().magnitude());
-				energy2DPlot[MØLLER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-			}
-			
-			// Check the elastic condition. Elastic events should be
-			// negatively and have an energy approximately equal to
-			// the beam energy.
-			elasticTrackLoop:
-			for(ReconstructedParticle track : trackList) {
-				// If trackless events are to be excluded, then require
-				// that the "track" has a real track.
-				if(excludeNoTrackEvents && track.getTracks().isEmpty()) {
-					continue elasticTrackLoop;
-				}
-				
-				// Check the elastic condition.
-				if(track.getCharge() < 0 && track.getMomentum().magnitude() >= 0.900) {
-					isElastic = true;
-					energyPlot[ELASTIC].fill(track.getMomentum().magnitude());
-					if(!track.getClusters().isEmpty()) {
-						elasticPlots.addCluster(track.getClusters().get(0));
-					}
-				}
-			}
-			
-			// Check the trident condition. Tridents are events that
-			// contain both one positive and one negative track.
-			tridentTrackLoop:
-			for(ReconstructedParticle[] pair : pairList) {
-				// If trackless events are to be excluded, then require
-				// that each "track" have a real track.
-				if(pair[0].getTracks().isEmpty() || pair[1].getTracks().isEmpty()) {
-					continue tridentTrackLoop;
-				}
-				
-				// Require that all tridents consist of a positive and
-				// negative pair.
-				boolean isPosNeg = (pair[0].getCharge() < 0 && pair[1].getCharge() > 0) || (pair[0].getCharge() > 0 && pair[1].getCharge() < 0);
-				if(!isPosNeg) { continue tridentTrackLoop; }
-				
-				// Both tracks must have clusters associated with them.
-				Cluster[] trackClusters = new Cluster[pair.length];
-				for(int i = 0; i < pair.length; i++) {
-					// Disallow tracks with no associated clusters.
-					if(pair[i].getClusters().size() == 0) {
-						continue tridentTrackLoop;
-					}
-					
-					// Store the first cluster associated with the track.
-					trackClusters[i] = pair[i].getClusters().get(0);
-				}
-				
-				// Make sure that the clusters are not the same.
-				if(trackClusters[0] == trackClusters[1]) {
-					continue tridentTrackLoop;
-				}
-				
-				// Require that tridents also be a top/bottom pair.
-				boolean isTopBot = (TriggerModule.getClusterYIndex(trackClusters[0]) > 0 && TriggerModule.getClusterYIndex(trackClusters[1]) < 0)
-						|| (TriggerModule.getClusterYIndex(trackClusters[0]) < 0 && TriggerModule.getClusterYIndex(trackClusters[1]) > 0);
-				if(!isTopBot) {
-					continue tridentTrackLoop;
-				}
-				
-				// Require that the track clusters be within a certain
-				// time window of one another.
-				CalorimeterHit[] seeds = new CalorimeterHit[2];
-				seeds[0] = trackClusters[0].getCalorimeterHits().get(0);
-				seeds[1] = trackClusters[1].getCalorimeterHits().get(0);
-				timeCoincidencePlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
-				if(Math.abs(trackClusters[0].getCalorimeterHits().get(0).getTime() - trackClusters[1].getCalorimeterHits().get(0).getTime()) > timeCoincidenceCut) {
-					continue tridentTrackLoop;
-				}
-				
-				// Require that the energy of the electron is below
-				// 900 MeV.
-				boolean electronNotElastic = (pair[0].getCharge() < 0 && pair[0].getMomentum().magnitude() < 0.900)
-						|| (pair[1].getCharge() < 0 && pair[1].getMomentum().magnitude() < 0.900);
-				if(!electronNotElastic) {
-					continue tridentTrackLoop;
-				}
-				
-				// If all tests are passed, this is a trident. Note
-				// this and populate the trident plots.
-				isTrident = true;
-				tridentPlots.addClusterPair(trackClusters);
-				if(pair[0].getCharge() > 0) {
-					positronPlot.fill(pair[1].getMomentum().magnitude());
-					electronPlot[TRIDENT].fill(pair[0].getMomentum().magnitude());
-				} else {
-					positronPlot.fill(pair[0].getMomentum().magnitude());
-					electronPlot[TRIDENT].fill(pair[1].getMomentum().magnitude());
-				}
-				energyPlot[TRIDENT].fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
-				energy2DPlot[TRIDENT].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-				
-				// Track which clusters have already been added to the
-				// singles plot so that there are no repeats.
-				Set<Cluster> plotSet = new HashSet<Cluster>();
-				Set<Cluster> plotFiducial = new HashSet<Cluster>();
-				
-				// Fill the all pairs plots.
-				double pairEnergy = trackClusters[0].getEnergy() + trackClusters[1].getEnergy();
-				trEnergySumAll.fill(pairEnergy);
-				trEnergySum2DAll.fill(trackClusters[1].getEnergy(), trackClusters[0].getEnergy());
-				trTimeCoincidenceAll.fill(RafoAnalysis.getTimeConicidence(trackClusters));
-				trSumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(trackClusters));
-				trSumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(trackClusters));
-				trInvariantMassAll.fill(RafoAnalysis.getInvariantMass(pair));
-				
-				// Fill the singles plots.
-				if(!plotSet.contains(trackClusters[0])) {
-					plotSet.add(trackClusters[0]);
-					trTimeEnergyAll.fill(trackClusters[0].getEnergy(), TriggerModule.getClusterTime(trackClusters[0]));
-				} if(!plotSet.contains(trackClusters[1])) {
-					plotSet.add(trackClusters[1]);
-					trTimeEnergyAll.fill(trackClusters[1].getEnergy(), TriggerModule.getClusterTime(trackClusters[1]));
-				}
-				
-				// Fill the fiducial plots if appropriate.
-				if(inFiducialRegion(trackClusters[0]) && inFiducialRegion(trackClusters[1])) {
-					trEnergySumFiducial.fill(pairEnergy);
-					trEnergySum2DFiducial.fill(trackClusters[1].getEnergy(), trackClusters[0].getEnergy());
-					trTimeCoincidenceFiducial.fill(RafoAnalysis.getTimeConicidence(trackClusters));
-					trSumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(trackClusters));
-					trSumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(trackClusters));
-					trInvariantMassFiducial.fill(RafoAnalysis.getInvariantMass(pair));
-				}
-				
-				// Fill the singles fiducial plots if appropriate.
-				if(!plotFiducial.contains(trackClusters[0]) && inFiducialRegion(trackClusters[0])) {
-					plotFiducial.add(trackClusters[0]);
-					trTimeEnergyFiducial.fill(trackClusters[0].getEnergy(), TriggerModule.getClusterTime(trackClusters[0]));
-				} if(!plotFiducial.contains(trackClusters[1]) && inFiducialRegion(trackClusters[1])) {
-					plotFiducial.add(trackClusters[1]);
-					trTimeEnergyFiducial.fill(trackClusters[1].getEnergy(), TriggerModule.getClusterTime(trackClusters[1]));
-				}
-			}
-			
-			if(verbose) {
-				System.out.printf("\tMøller  :: %b%n", isMøller);
-				System.out.printf("\tTrident :: %b%n", isTrident);
-				System.out.printf("\tElastic :: %b%n", isElastic);
-				System.out.println();
-			}
-			
-			// Get the TI bits.
-			String bitString = null;
-			TIData tiBank = null;
-			List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
-			for(GenericObject obj : bankList) {
-				if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
-					tiBank = new TIData(obj);
-					bitString = getBitString(tiBank.isPulserTrigger(), tiBank.isSingle0Trigger(),
-							tiBank.isSingle1Trigger(), tiBank.isPair0Trigger(), tiBank.isPair1Trigger());
-					
-					if(tiBank.isPair1Trigger()) {
-						pair1Events++;
-					} else if(tiBank.isPair0Trigger()) {
-						pair0Events++;
-					} else if(tiBank.isSingle1Trigger()) {
-						singles1Events++;
-					} else if(tiBank.isSingle0Trigger()) {
-						singles0Events++;
-					} else if(tiBank.isPulserTrigger()) {
-						pulserEvents++;
-					}
-				}
-			}
-			if(bitString == null) {
-				System.out.println("No TI data found!!");
-			}
-			
-			// Get the number of charged tracks in the event.
-			int tracks = 0;
-			int posTracks = 0;
-			int negTracks = 0;
-			for(ReconstructedParticle track : trackList) {
-				if(track.getCharge() != 0 && tiBank.isPulserTrigger()) {
-					if(excludeNoTrackEvents && !track.getTracks().isEmpty()) {
-						tracks++;
-						if(track.getCharge() > 0) { posTracks++; }
-						else { negTracks++; }
-					} else {
-						tracks++;
-						if(track.getCharge() > 0) { posTracks++; }
-						else { negTracks++; }
-					}
-				}
-			}
-			
-			// Populate the "all tracks" plots.
-			posTrackCount.fill(posTracks);
-			negTrackCount.fill(negTracks);
-			chargedTrackCount.fill(tracks);
-			
-			// Add the result to the appropriate plots and increment
-			// the appropriate trigger bit combination.
-			if(isMøller) {
-				møllerEvents++;
-				chargedTracksPlot[MØLLER].fill(tracks);
-				clusterCountPlot[MØLLER].fill(clusters.size());
-				
-				Integer val = møllerBitMap.get(bitString);
-				if(val == null) { møllerBitMap.put(bitString, 1); }
-				else { møllerBitMap.put(bitString, val + 1); }
-			} else if(isTrident) {
-				tridentEvents++;
-				chargedTracksPlot[TRIDENT].fill(tracks);
-				clusterCountPlot[TRIDENT].fill(clusters.size());
-				
-				Integer val = tridentBitMap.get(bitString);
-				if(val == null) { tridentBitMap.put(bitString, 1); }
-				else { tridentBitMap.put(bitString, val + 1); }
-			} else if(isElastic) {
-				elasticEvents++;
-				chargedTracksPlot[ELASTIC].fill(tracks);
-				clusterCountPlot[ELASTIC].fill(clusters.size());
-				
-				Integer val = elasticBitMap.get(bitString);
-				if(val == null) { elasticBitMap.put(bitString, 1); }
-				else { elasticBitMap.put(bitString, val + 1); }
-			}
-			totalEvents++;
-		}
-	}
-	
-	private static final double getCalculatedCoplanarity(Cluster[] pair) {
-		// Define the x- and y-coordinates of the clusters as well as
-		// calorimeter center.
-		final double ORIGIN_X = 42.52;
-		double x[] = { pair[0].getPosition()[0], pair[1].getPosition()[0] };
-		double y[] = { pair[0].getPosition()[1], pair[1].getPosition()[1] };
-		
+            return;
+        }
+        
+        if(event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
+            // Get the list of tracks.
+            List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
+            
+            // Plot the time stamps of all tracks.
+            for(ReconstructedParticle track : trackList) {
+                if(track.getClusters().size() != 0) {
+                    Cluster cluster = track.getClusters().get(0);
+                    timePlot.fill(cluster.getCalorimeterHits().get(0).getTime());
+                }
+            }
+            
+            if(verbose) {
+                System.out.println(trackList.size() + " tracks found.");
+                for(ReconstructedParticle track : trackList) {
+                    System.out.printf("Track :: Q = %4.1f; E = %6.3f%n",
+                            track.getCharge(), track.getEnergy());
+                }
+            }
+            
+            // Populate the all cluster plots.
+            List<Cluster> topClusters = new ArrayList<Cluster>();
+            List<Cluster> botClusters = new ArrayList<Cluster>();
+            List<Cluster> clusters = event.get(Cluster.class, "EcalClusters");
+            for(Cluster cluster : clusters) {
+                allPlots.addCluster(cluster);
+                if(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) { topClusters.add(cluster); }
+                else { botClusters.add(cluster); }
+            }
+            
+            // Make cluster pairs.
+            List<Cluster[]> clusterPairs = new ArrayList<Cluster[]>();
+            for(Cluster topCluster : topClusters) {
+                for(Cluster botCluster : botClusters) {
+                    clusterPairs.add(new Cluster[] { topCluster, botCluster });
+                }
+            }
+            
+            // Populate the all cluster pair plots.
+            for(Cluster[] pair : clusterPairs) {
+                allPlots.addClusterPair(pair);
+            }
+            
+            // Check each of the event-type conditions.
+            boolean isMøller = false;
+            boolean isTrident = false;
+            boolean isElastic = false;
+            
+            // Produce all possible pairs of tracks.
+            List<ReconstructedParticle[]> pairList = getTrackPairs(trackList);
+            
+            // Check the Møller condition. A Møller event is expected
+            // to have two tracks, both negative, with a net energy
+            // within a certain band of the beam energy.
+            møllerTrackLoop:
+            for(ReconstructedParticle[] pair : pairList) {
+                // If trackless events are to be excluded, then require
+                // that each "track" have a real track.
+                if(excludeNoTrackEvents && (pair[0].getTracks().isEmpty() || pair[1].getTracks().isEmpty())) {
+                    continue møllerTrackLoop;
+                }
+                
+                // Both tracks are required to be negatively charged.
+                if(pair[0].getCharge() >= 0 || pair[1].getCharge() >= 0) {
+                    continue møllerTrackLoop;
+                }
+                
+                // Both tracks must have clusters associated with them.
+                Cluster[] trackClusters = new Cluster[2];
+                for(int i = 0; i < 2; i++) {
+                    // Disallow tracks with no associated clusters.
+                    if(pair[i].getClusters().size() == 0) {
+                        continue møllerTrackLoop;
+                    }
+                    
+                    // Store the first cluster associated with the track.
+                    trackClusters[i] = pair[i].getClusters().get(0);
+                }
+                
+                // Require that the track clusters be within a certain
+                // time window of one another.
+                CalorimeterHit[] seeds = new CalorimeterHit[2];
+                seeds[0] = trackClusters[0].getCalorimeterHits().get(0);
+                seeds[1] = trackClusters[1].getCalorimeterHits().get(0);
+                timeCoincidencePlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
+                if(Math.abs(trackClusters[0].getCalorimeterHits().get(0).getTime() - trackClusters[1].getCalorimeterHits().get(0).getTime()) > timeCoincidenceCut) {
+                    continue møllerTrackLoop;
+                }
+                
+                // Require both tracks to occur within the range of
+                // 36.5 and 49 ns.
+                if(seeds[0].getTime() < 36.5 || seeds[0].getTime() > 49) {
+                    continue møllerTrackLoop;
+                } if(seeds[1].getTime() < 36.5 || seeds[1].getTime() > 49) {
+                    continue møllerTrackLoop;
+                }
+                
+                // No track may have an energy that exceeds 900 MeV.
+                if(pair[0].getMomentum().magnitude() >= 0.900 || pair[1].getMomentum().magnitude() >= 0.900) {
+                    continue møllerTrackLoop;
+                }
+                
+                // Get the energy sum.
+                double sum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
+                
+                // "Møller-like" track pairs must have energies within
+                // an allowed energy range.
+                if(sum < 0.800 || sum > 1.500) {
+                    continue møllerTrackLoop;
+                }
+                
+                //timeCoincidenceAllCutsPlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
+                
+                // Note that this is a Møller event.
+                isMøller = true;
+                
+                // Populate the Møller plots.
+                energyPlot[MØLLER].fill(sum);
+                møllerPlots.addClusterPair(trackClusters);
+                electronPlot[MØLLER].fill(pair[0].getMomentum().magnitude());
+                electronPlot[MØLLER].fill(pair[1].getMomentum().magnitude());
+                energy2DPlot[MØLLER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+            }
+            
+            // Check the elastic condition. Elastic events should be
+            // negatively and have an energy approximately equal to
+            // the beam energy.
+            elasticTrackLoop:
+            for(ReconstructedParticle track : trackList) {
+                // If trackless events are to be excluded, then require
+                // that the "track" has a real track.
+                if(excludeNoTrackEvents && track.getTracks().isEmpty()) {
+                    continue elasticTrackLoop;
+                }
+                
+                // Check the elastic condition.
+                if(track.getCharge() < 0 && track.getMomentum().magnitude() >= 0.900) {
+                    isElastic = true;
+                    energyPlot[ELASTIC].fill(track.getMomentum().magnitude());
+                    if(!track.getClusters().isEmpty()) {
+                        elasticPlots.addCluster(track.getClusters().get(0));
+                    }
+                }
+            }
+            
+            // Check the trident condition. Tridents are events that
+            // contain both one positive and one negative track.
+            tridentTrackLoop:
+            for(ReconstructedParticle[] pair : pairList) {
+                // If trackless events are to be excluded, then require
+                // that each "track" have a real track.
+                if(pair[0].getTracks().isEmpty() || pair[1].getTracks().isEmpty()) {
+                    continue tridentTrackLoop;
+                }
+                
+                // Require that all tridents consist of a positive and
+                // negative pair.
+                boolean isPosNeg = (pair[0].getCharge() < 0 && pair[1].getCharge() > 0) || (pair[0].getCharge() > 0 && pair[1].getCharge() < 0);
+                if(!isPosNeg) { continue tridentTrackLoop; }
+                
+                // Both tracks must have clusters associated with them.
+                Cluster[] trackClusters = new Cluster[pair.length];
+                for(int i = 0; i < pair.length; i++) {
+                    // Disallow tracks with no associated clusters.
+                    if(pair[i].getClusters().size() == 0) {
+                        continue tridentTrackLoop;
+                    }
+                    
+                    // Store the first cluster associated with the track.
+                    trackClusters[i] = pair[i].getClusters().get(0);
+                }
+                
+                // Make sure that the clusters are not the same.
+                if(trackClusters[0] == trackClusters[1]) {
+                    continue tridentTrackLoop;
+                }
+                
+                // Require that tridents also be a top/bottom pair.
+                boolean isTopBot = (TriggerModule.getClusterYIndex(trackClusters[0]) > 0 && TriggerModule.getClusterYIndex(trackClusters[1]) < 0)
+                        || (TriggerModule.getClusterYIndex(trackClusters[0]) < 0 && TriggerModule.getClusterYIndex(trackClusters[1]) > 0);
+                if(!isTopBot) {
+                    continue tridentTrackLoop;
+                }
+                
+                // Require that the track clusters be within a certain
+                // time window of one another.
+                CalorimeterHit[] seeds = new CalorimeterHit[2];
+                seeds[0] = trackClusters[0].getCalorimeterHits().get(0);
+                seeds[1] = trackClusters[1].getCalorimeterHits().get(0);
+                timeCoincidencePlot.fill(Math.abs(seeds[0].getTime() - seeds[1].getTime()));
+                if(Math.abs(trackClusters[0].getCalorimeterHits().get(0).getTime() - trackClusters[1].getCalorimeterHits().get(0).getTime()) > timeCoincidenceCut) {
+                    continue tridentTrackLoop;
+                }
+                
+                // Require that the energy of the electron is below
+                // 900 MeV.
+                boolean electronNotElastic = (pair[0].getCharge() < 0 && pair[0].getMomentum().magnitude() < 0.900)
+                        || (pair[1].getCharge() < 0 && pair[1].getMomentum().magnitude() < 0.900);
+                if(!electronNotElastic) {
+                    continue tridentTrackLoop;
+                }
+                
+                // If all tests are passed, this is a trident. Note
+                // this and populate the trident plots.
+                isTrident = true;
+                tridentPlots.addClusterPair(trackClusters);
+                if(pair[0].getCharge() > 0) {
+                    positronPlot.fill(pair[1].getMomentum().magnitude());
+                    electronPlot[TRIDENT].fill(pair[0].getMomentum().magnitude());
+                } else {
+                    positronPlot.fill(pair[0].getMomentum().magnitude());
+                    electronPlot[TRIDENT].fill(pair[1].getMomentum().magnitude());
+                }
+                energyPlot[TRIDENT].fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
+                energy2DPlot[TRIDENT].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+                
+                // Track which clusters have already been added to the
+                // singles plot so that there are no repeats.
+                Set<Cluster> plotSet = new HashSet<Cluster>();
+                Set<Cluster> plotFiducial = new HashSet<Cluster>();
+                
+                // Fill the all pairs plots.
+                double pairEnergy = trackClusters[0].getEnergy() + trackClusters[1].getEnergy();
+                trEnergySumAll.fill(pairEnergy);
+                trEnergySum2DAll.fill(trackClusters[1].getEnergy(), trackClusters[0].getEnergy());
+                trTimeCoincidenceAll.fill(RafoAnalysis.getTimeConicidence(trackClusters));
+                trSumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(trackClusters));
+                trSumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(trackClusters));
+                trInvariantMassAll.fill(RafoAnalysis.getInvariantMass(pair));
+                
+                // Fill the singles plots.
+                if(!plotSet.contains(trackClusters[0])) {
+                    plotSet.add(trackClusters[0]);
+                    trTimeEnergyAll.fill(trackClusters[0].getEnergy(), TriggerModule.getClusterTime(trackClusters[0]));
+                } if(!plotSet.contains(trackClusters[1])) {
+                    plotSet.add(trackClusters[1]);
+                    trTimeEnergyAll.fill(trackClusters[1].getEnergy(), TriggerModule.getClusterTime(trackClusters[1]));
+                }
+                
+                // Fill the fiducial plots if appropriate.
+                if(inFiducialRegion(trackClusters[0]) && inFiducialRegion(trackClusters[1])) {
+                    trEnergySumFiducial.fill(pairEnergy);
+                    trEnergySum2DFiducial.fill(trackClusters[1].getEnergy(), trackClusters[0].getEnergy());
+                    trTimeCoincidenceFiducial.fill(RafoAnalysis.getTimeConicidence(trackClusters));
+                    trSumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(trackClusters));
+                    trSumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(trackClusters));
+                    trInvariantMassFiducial.fill(RafoAnalysis.getInvariantMass(pair));
+                }
+                
+                // Fill the singles fiducial plots if appropriate.
+                if(!plotFiducial.contains(trackClusters[0]) && inFiducialRegion(trackClusters[0])) {
+                    plotFiducial.add(trackClusters[0]);
+                    trTimeEnergyFiducial.fill(trackClusters[0].getEnergy(), TriggerModule.getClusterTime(trackClusters[0]));
+                } if(!plotFiducial.contains(trackClusters[1]) && inFiducialRegion(trackClusters[1])) {
+                    plotFiducial.add(trackClusters[1]);
+                    trTimeEnergyFiducial.fill(trackClusters[1].getEnergy(), TriggerModule.getClusterTime(trackClusters[1]));
+                }
+            }
+            
+            if(verbose) {
+                System.out.printf("\tMøller  :: %b%n", isMøller);
+                System.out.printf("\tTrident :: %b%n", isTrident);
+                System.out.printf("\tElastic :: %b%n", isElastic);
+                System.out.println();
+            }
+            
+            // Get the TI bits.
+            String bitString = null;
+            TIData tiBank = null;
+            List<GenericObject> bankList = event.get(GenericObject.class, bankCollectionName);
+            for(GenericObject obj : bankList) {
+                if(AbstractIntData.getTag(obj) == TIData.BANK_TAG) {
+                    tiBank = new TIData(obj);
+                    bitString = getBitString(tiBank.isPulserTrigger(), tiBank.isSingle0Trigger(),
+                            tiBank.isSingle1Trigger(), tiBank.isPair0Trigger(), tiBank.isPair1Trigger());
+                    
+                    if(tiBank.isPair1Trigger()) {
+                        pair1Events++;
+                    } else if(tiBank.isPair0Trigger()) {
+                        pair0Events++;
+                    } else if(tiBank.isSingle1Trigger()) {
+                        singles1Events++;
+                    } else if(tiBank.isSingle0Trigger()) {
+                        singles0Events++;
+                    } else if(tiBank.isPulserTrigger()) {
+                        pulserEvents++;
+                    }
+                }
+            }
+            if(bitString == null) {
+                System.out.println("No TI data found!!");
+            }
+            
+            // Get the number of charged tracks in the event.
+            int tracks = 0;
+            int posTracks = 0;
+            int negTracks = 0;
+            for(ReconstructedParticle track : trackList) {
+                if(track.getCharge() != 0 && tiBank.isPulserTrigger()) {
+                    if(excludeNoTrackEvents && !track.getTracks().isEmpty()) {
+                        tracks++;
+                        if(track.getCharge() > 0) { posTracks++; }
+                        else { negTracks++; }
+                    } else {
+                        tracks++;
+                        if(track.getCharge() > 0) { posTracks++; }
+                        else { negTracks++; }
+                    }
+                }
+            }
+            
+            // Populate the "all tracks" plots.
+            posTrackCount.fill(posTracks);
+            negTrackCount.fill(negTracks);
+            chargedTrackCount.fill(tracks);
+            
+            // Add the result to the appropriate plots and increment
+            // the appropriate trigger bit combination.
+            if(isMøller) {
+                møllerEvents++;
+                chargedTracksPlot[MØLLER].fill(tracks);
+                clusterCountPlot[MØLLER].fill(clusters.size());
+                
+                Integer val = møllerBitMap.get(bitString);
+                if(val == null) { møllerBitMap.put(bitString, 1); }
+                else { møllerBitMap.put(bitString, val + 1); }
+            } else if(isTrident) {
+                tridentEvents++;
+                chargedTracksPlot[TRIDENT].fill(tracks);
+                clusterCountPlot[TRIDENT].fill(clusters.size());
+                
+                Integer val = tridentBitMap.get(bitString);
+                if(val == null) { tridentBitMap.put(bitString, 1); }
+                else { tridentBitMap.put(bitString, val + 1); }
+            } else if(isElastic) {
+                elasticEvents++;
+                chargedTracksPlot[ELASTIC].fill(tracks);
+                clusterCountPlot[ELASTIC].fill(clusters.size());
+                
+                Integer val = elasticBitMap.get(bitString);
+                if(val == null) { elasticBitMap.put(bitString, 1); }
+                else { elasticBitMap.put(bitString, val + 1); }
+            }
+            totalEvents++;
+        }
+    }
+    
+    private static final double getCalculatedCoplanarity(Cluster[] pair) {
+        // Define the x- and y-coordinates of the clusters as well as
+        // calorimeter center.
+        final double ORIGIN_X = 42.52;
+        double x[] = { pair[0].getPosition()[0], pair[1].getPosition()[0] };
+        double y[] = { pair[0].getPosition()[1], pair[1].getPosition()[1] };
+        
         // Get the cluster angles.
         double[] clusterAngle = new double[2];
         for(int i = 0; i < 2; i++) {
-        	clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
-        	if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
+            clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
+            if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
         }
         
         // Calculate the coplanarity cut value.
         double clusterDiff = clusterAngle[0] - clusterAngle[1];
         return clusterDiff > 0 ? clusterDiff : clusterDiff + 360;
-	}
-	
-	public void setTimeCoincidenceCut(double value) {
-		timeCoincidenceCut = value;
-	}
-	
-	public void setExcludeNoTrackEvents(boolean state) {
-		excludeNoTrackEvents = state;
-	}
-	
-	public void setSkipBadSVT(boolean state) {
-		skipBadSVT = state;
-	}
-	
-	private static final boolean inFiducialRegion(Cluster cluster) {
-		// Get the x and y indices for the cluster.
-		int ix   = TriggerModule.getClusterXIndex(cluster);
-		int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
-		int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
-		
-		// Check if the cluster is on the top or the bottom of the
-		// calorimeter, as defined by |y| == 5. This is an edge cluster
-		// and is not in the fiducial region.
-		if(absy == 5) {
-			return false;
-		}
-		
-		// Check if the cluster is on the extreme left or right side
-		// of the calorimeter, as defined by |x| == 23. This is also
-		// and edge cluster is not in the fiducial region.
-		if(absx == 23) {
-			return false;
-		}
-		
-		// Check if the cluster is along the beam gap, as defined by
-		// |y| == 1. This is an internal edge cluster and is not in the
-		// fiducial region.
-		if(absy == 1) {
-			return false;
-		}
-		
-		// Lastly, check if the cluster falls along the beam hole, as
-		// defined by clusters with -11 <= x <= -1 and |y| == 2. This
-		// is not the fiducial region.
-		if(absy == 2 && ix <= -1 && ix >= -11) {
-			return false;
-		}
-		
-		// If all checks fail, the cluster is in the fiducial region.
-		return true;
-	}
-	
-	private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> trackList) {
-		// Create an empty list for the pairs.
-		List<ReconstructedParticle[]> pairs = new ArrayList<ReconstructedParticle[]>();
-		
-		// Add all possible pairs of tracks.
-		for(int i = 0; i < trackList.size(); i++) {
-			for(int j = i + 1; j < trackList.size(); j++) {
-				pairs.add(new ReconstructedParticle[] { trackList.get(i), trackList.get(j) });
-			}
-		}
-		
-		// Return the list of tracks.
-		return pairs;
-	}
+    }
+    
+    public void setTimeCoincidenceCut(double value) {
+        timeCoincidenceCut = value;
+    }
+    
+    public void setExcludeNoTrackEvents(boolean state) {
+        excludeNoTrackEvents = state;
+    }
+    
+    public void setSkipBadSVT(boolean state) {
+        skipBadSVT = state;
+    }
+    
+    private static final boolean inFiducialRegion(Cluster cluster) {
+        // Get the x and y indices for the cluster.
+        int ix   = TriggerModule.getClusterXIndex(cluster);
+        int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
+        int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
+        
+        // Check if the cluster is on the top or the bottom of the
+        // calorimeter, as defined by |y| == 5. This is an edge cluster
+        // and is not in the fiducial region.
+        if(absy == 5) {
+            return false;
+        }
+        
+        // Check if the cluster is on the extreme left or right side
+        // of the calorimeter, as defined by |x| == 23. This is also
+        // and edge cluster is not in the fiducial region.
+        if(absx == 23) {
+            return false;
+        }
+        
+        // Check if the cluster is along the beam gap, as defined by
+        // |y| == 1. This is an internal edge cluster and is not in the
+        // fiducial region.
+        if(absy == 1) {
+            return false;
+        }
+        
+        // Lastly, check if the cluster falls along the beam hole, as
+        // defined by clusters with -11 <= x <= -1 and |y| == 2. This
+        // is not the fiducial region.
+        if(absy == 2 && ix <= -1 && ix >= -11) {
+            return false;
+        }
+        
+        // If all checks fail, the cluster is in the fiducial region.
+        return true;
+    }
+    
+    private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> trackList) {
+        // Create an empty list for the pairs.
+        List<ReconstructedParticle[]> pairs = new ArrayList<ReconstructedParticle[]>();
+        
+        // Add all possible pairs of tracks.
+        for(int i = 0; i < trackList.size(); i++) {
+            for(int j = i + 1; j < trackList.size(); j++) {
+                pairs.add(new ReconstructedParticle[] { trackList.get(i), trackList.get(j) });
+            }
+        }
+        
+        // Return the list of tracks.
+        return pairs;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/MTETriggerPlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/MTETriggerPlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/MTETriggerPlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -15,164 +15,164 @@
 
 
 public class MTETriggerPlotsFormatter {
-	public static void main(String[] args) throws IllegalArgumentException, IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "5772-ana.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Define the 1D trigger plot names for Møllers and tridents.
-		String[] plotNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
-				"Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
-		String[] displayNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
-				"Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
-		String[] xAxisNames1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)",
-				"Coplanarity (Degrees)", "Energy Difference (GeV)", "Energy Slope (GeV)", "Energy Sum (GeV)" };
-		String yAxisName1D = "Count";
-		
-		// Define the 2D trigger plot names for Møllers and tridents.
-		String[] plotNames2D = { "Cluster Seed", "Pair Energy Sum 2D" };
-		String[] displayNames2D = { "Cluster Seed Distribution", "2D Energy Sum" };
-		String[] xAxisNames2D = { "x-Index", "Second Cluster Energy (GeV)" };
-		String[] yAxisNames2D = { "y-Index", "First Cluster Energy (GeV)" };
-		
-		// Define the 1D trigger plot names for elastics.
-		String[] plotNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
-		String[] displayNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
-		String[] xAxisNamesElastic1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)" };
-		String yAxisNameElastic1D = "Count";
-		
-		// Define the 2D trigger plot names for elastics.
-		String[] plotNamesElastic2D = { "Cluster Seed" };
-		String[] displayNamesElastic2D = { "Cluster Seed Distribution" };
-		String[] xAxisNamesElastic2D = { "x-Index" };
-		String[] yAxisNamesElastic2D = { "y-Index" };
-		
-		// Define the Møller, trident, and elastic prefixes.
-		String allPrefix = "All Trigger Plots/Pair Plots/";
-		String møllerPrefix = "Møller Trigger Plots/Pair Plots/";
-		String tridentPrefix = "Trident Trigger Plots/Pair Plots/";
-		String elasticPrefix = "Elastic Trigger Plots/Singles Plots/";
-		String allSinglesPrefix = "All Trigger Plots/Singles Plots/";
-		
-		// Define the plot type prefix.
-		String allTypeName = "All Pairs - ";
-		String møllerTypeName = "Møller - ";
-		String tridentTypeName = "Trident - ";
-		String elasticTypeName = "Elastic - ";
-		String allSinglesTypeName = "All Singles - ";
-		
-		// Define the plot type colors.
-		ColorStyle allColor = PlotsFormatter.ColorStyle.GREY;
-		ColorStyle møllerColor = PlotsFormatter.ColorStyle.MS_BLUE;
-		ColorStyle tridentColor = PlotsFormatter.ColorStyle.MS_ORANGE;
-		ColorStyle elasticColor = PlotsFormatter.ColorStyle.MS_GREEN;
-		
-		// Create a plot formatting module.
-		PlotFormatModule module = new PlotFormatModule();
-		
-		// Get the histograms and add them to the module. Start with the
-		// trident and Møller plots.
-		for(int i = 0; i < plotNames1D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram1D allPlot = (IHistogram1D) tree.find(allPrefix + plotNames1D[i]);
-			IHistogram1D møllerPlot = (IHistogram1D) tree.find(møllerPrefix + plotNames1D[i]);
-			IHistogram1D tridentPlot = (IHistogram1D) tree.find(tridentPrefix + plotNames1D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNames1D[i], yAxisName1D, allTypeName + displayNames1D[i]);
-			FormattedPlot1D møllerFormattedPlot = new FormattedPlot1D(møllerPlot, møllerColor, xAxisNames1D[i], yAxisName1D, møllerTypeName + displayNames1D[i]);
-			FormattedPlot1D tridentFormattedPlot = new FormattedPlot1D(tridentPlot, tridentColor, xAxisNames1D[i], yAxisName1D, tridentTypeName + displayNames1D[i]);
-			
-			// Add them to the module.
-			module.addPlot1D(allFormattedPlot);
-			module.addPlot1D(møllerFormattedPlot);
-			module.addPlot1D(tridentFormattedPlot);
-		}
-		for(int i = 0; i < plotNames2D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNames2D[i]);
-			IHistogram2D møllerPlot = (IHistogram2D) tree.find(møllerPrefix + plotNames2D[i]);
-			IHistogram2D tridentPlot = (IHistogram2D) tree.find(tridentPrefix + plotNames2D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], allTypeName + displayNames2D[i]);
-			FormattedPlot2D møllerFormattedPlot = new FormattedPlot2D(møllerPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], møllerTypeName + displayNames2D[i]);
-			FormattedPlot2D tridentFormattedPlot = new FormattedPlot2D(tridentPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], tridentTypeName + displayNames2D[i]);
-			
-			// Add them to the module.
-			module.addPlot2D(allFormattedPlot);
-			module.addPlot2D(møllerFormattedPlot);
-			module.addPlot2D(tridentFormattedPlot);
-		}
-		
-		// Get the histograms for the elastic plots and add them to the module.
-		for(int i = 0; i < plotNamesElastic1D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram1D allPlot = (IHistogram1D) tree.find(allSinglesPrefix + plotNames1D[i]);
-			IHistogram1D elasticPlot = (IHistogram1D) tree.find(elasticPrefix + plotNames1D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
-					allSinglesTypeName + displayNamesElastic1D[i]);
-			FormattedPlot1D elasticFormattedPlot = new FormattedPlot1D(elasticPlot, elasticColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
-					elasticTypeName + displayNamesElastic1D[i]);
-			
-			// Add them to the module.
-			module.addPlot1D(allFormattedPlot);
-			module.addPlot1D(elasticFormattedPlot);
-		}
-		for(int i = 0; i < plotNamesElastic2D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNamesElastic2D[i]);
-			IHistogram2D elasticPlot = (IHistogram2D) tree.find(møllerPrefix + plotNamesElastic2D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
-					allSinglesTypeName + plotNames2D[i]);
-			FormattedPlot2D elasticFormattedPlot = new FormattedPlot2D(elasticPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
-					elasticTypeName + displayNamesElastic2D[i]);
-			
-			// Add them to the module.
-			module.addPlot2D(allFormattedPlot);
-			module.addPlot2D(elasticFormattedPlot);
-		}
-		
-		// Add the MTE plots to the module.
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution"), elasticColor,
-				"Momentum (GeV)", "Count", "Elastic - Momentum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks"), elasticColor,
-				"Tracks", "Count", "Elastic - Tracks in Event"));
-		
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution"), møllerColor,
-				"Momentum Sum (GeV)", "Count", "Møller - Momentum Sum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution"), møllerColor,
-				"Momentum (GeV)", "Count", "Møller - Momentum (Electron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)"), møllerColor,
-				"Time (ns)", "Count", "Møller - Time Coincidence"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks"), møllerColor,
-				"Tracks", "Count", "Møller - Tracks in Event"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution"), false,
-				"First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Møller - 2D Momentum Sum"));
-		
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution"), tridentColor,
-				"Momentum Sum (GeV)", "Count", "Trident - Momentum Sum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution"), tridentColor,
-				"Momentum (GeV)", "Count", "Trident - Momentum (Electron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Positron Energy Distribution"), tridentColor,
-				"Momentum (GeV)", "Count", "Trident - Momentum (Positron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks"), tridentColor,
-				"Tracks", "Count", "Trident - Tracks in Event"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution"), false,
-				"First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Trident - 2D Momentum Sum"));
-		
-		// Display the plots.
-		module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\TestPrint\\");
-	}
+    public static void main(String[] args) throws IllegalArgumentException, IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "5772-ana.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Define the 1D trigger plot names for Møllers and tridents.
+        String[] plotNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
+                "Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
+        String[] displayNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
+                "Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
+        String[] xAxisNames1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)",
+                "Coplanarity (Degrees)", "Energy Difference (GeV)", "Energy Slope (GeV)", "Energy Sum (GeV)" };
+        String yAxisName1D = "Count";
+        
+        // Define the 2D trigger plot names for Møllers and tridents.
+        String[] plotNames2D = { "Cluster Seed", "Pair Energy Sum 2D" };
+        String[] displayNames2D = { "Cluster Seed Distribution", "2D Energy Sum" };
+        String[] xAxisNames2D = { "x-Index", "Second Cluster Energy (GeV)" };
+        String[] yAxisNames2D = { "y-Index", "First Cluster Energy (GeV)" };
+        
+        // Define the 1D trigger plot names for elastics.
+        String[] plotNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
+        String[] displayNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
+        String[] xAxisNamesElastic1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)" };
+        String yAxisNameElastic1D = "Count";
+        
+        // Define the 2D trigger plot names for elastics.
+        String[] plotNamesElastic2D = { "Cluster Seed" };
+        String[] displayNamesElastic2D = { "Cluster Seed Distribution" };
+        String[] xAxisNamesElastic2D = { "x-Index" };
+        String[] yAxisNamesElastic2D = { "y-Index" };
+        
+        // Define the Møller, trident, and elastic prefixes.
+        String allPrefix = "All Trigger Plots/Pair Plots/";
+        String møllerPrefix = "Møller Trigger Plots/Pair Plots/";
+        String tridentPrefix = "Trident Trigger Plots/Pair Plots/";
+        String elasticPrefix = "Elastic Trigger Plots/Singles Plots/";
+        String allSinglesPrefix = "All Trigger Plots/Singles Plots/";
+        
+        // Define the plot type prefix.
+        String allTypeName = "All Pairs - ";
+        String møllerTypeName = "Møller - ";
+        String tridentTypeName = "Trident - ";
+        String elasticTypeName = "Elastic - ";
+        String allSinglesTypeName = "All Singles - ";
+        
+        // Define the plot type colors.
+        ColorStyle allColor = PlotsFormatter.ColorStyle.GREY;
+        ColorStyle møllerColor = PlotsFormatter.ColorStyle.MS_BLUE;
+        ColorStyle tridentColor = PlotsFormatter.ColorStyle.MS_ORANGE;
+        ColorStyle elasticColor = PlotsFormatter.ColorStyle.MS_GREEN;
+        
+        // Create a plot formatting module.
+        PlotFormatModule module = new PlotFormatModule();
+        
+        // Get the histograms and add them to the module. Start with the
+        // trident and Møller plots.
+        for(int i = 0; i < plotNames1D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram1D allPlot = (IHistogram1D) tree.find(allPrefix + plotNames1D[i]);
+            IHistogram1D møllerPlot = (IHistogram1D) tree.find(møllerPrefix + plotNames1D[i]);
+            IHistogram1D tridentPlot = (IHistogram1D) tree.find(tridentPrefix + plotNames1D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNames1D[i], yAxisName1D, allTypeName + displayNames1D[i]);
+            FormattedPlot1D møllerFormattedPlot = new FormattedPlot1D(møllerPlot, møllerColor, xAxisNames1D[i], yAxisName1D, møllerTypeName + displayNames1D[i]);
+            FormattedPlot1D tridentFormattedPlot = new FormattedPlot1D(tridentPlot, tridentColor, xAxisNames1D[i], yAxisName1D, tridentTypeName + displayNames1D[i]);
+            
+            // Add them to the module.
+            module.addPlot1D(allFormattedPlot);
+            module.addPlot1D(møllerFormattedPlot);
+            module.addPlot1D(tridentFormattedPlot);
+        }
+        for(int i = 0; i < plotNames2D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNames2D[i]);
+            IHistogram2D møllerPlot = (IHistogram2D) tree.find(møllerPrefix + plotNames2D[i]);
+            IHistogram2D tridentPlot = (IHistogram2D) tree.find(tridentPrefix + plotNames2D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], allTypeName + displayNames2D[i]);
+            FormattedPlot2D møllerFormattedPlot = new FormattedPlot2D(møllerPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], møllerTypeName + displayNames2D[i]);
+            FormattedPlot2D tridentFormattedPlot = new FormattedPlot2D(tridentPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], tridentTypeName + displayNames2D[i]);
+            
+            // Add them to the module.
+            module.addPlot2D(allFormattedPlot);
+            module.addPlot2D(møllerFormattedPlot);
+            module.addPlot2D(tridentFormattedPlot);
+        }
+        
+        // Get the histograms for the elastic plots and add them to the module.
+        for(int i = 0; i < plotNamesElastic1D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram1D allPlot = (IHistogram1D) tree.find(allSinglesPrefix + plotNames1D[i]);
+            IHistogram1D elasticPlot = (IHistogram1D) tree.find(elasticPrefix + plotNames1D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
+                    allSinglesTypeName + displayNamesElastic1D[i]);
+            FormattedPlot1D elasticFormattedPlot = new FormattedPlot1D(elasticPlot, elasticColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
+                    elasticTypeName + displayNamesElastic1D[i]);
+            
+            // Add them to the module.
+            module.addPlot1D(allFormattedPlot);
+            module.addPlot1D(elasticFormattedPlot);
+        }
+        for(int i = 0; i < plotNamesElastic2D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNamesElastic2D[i]);
+            IHistogram2D elasticPlot = (IHistogram2D) tree.find(møllerPrefix + plotNamesElastic2D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
+                    allSinglesTypeName + plotNames2D[i]);
+            FormattedPlot2D elasticFormattedPlot = new FormattedPlot2D(elasticPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
+                    elasticTypeName + displayNamesElastic2D[i]);
+            
+            // Add them to the module.
+            module.addPlot2D(allFormattedPlot);
+            module.addPlot2D(elasticFormattedPlot);
+        }
+        
+        // Add the MTE plots to the module.
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution"), elasticColor,
+                "Momentum (GeV)", "Count", "Elastic - Momentum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks"), elasticColor,
+                "Tracks", "Count", "Elastic - Tracks in Event"));
+        
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution"), møllerColor,
+                "Momentum Sum (GeV)", "Count", "Møller - Momentum Sum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution"), møllerColor,
+                "Momentum (GeV)", "Count", "Møller - Momentum (Electron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)"), møllerColor,
+                "Time (ns)", "Count", "Møller - Time Coincidence"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks"), møllerColor,
+                "Tracks", "Count", "Møller - Tracks in Event"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution"), false,
+                "First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Møller - 2D Momentum Sum"));
+        
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution"), tridentColor,
+                "Momentum Sum (GeV)", "Count", "Trident - Momentum Sum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution"), tridentColor,
+                "Momentum (GeV)", "Count", "Trident - Momentum (Electron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Positron Energy Distribution"), tridentColor,
+                "Momentum (GeV)", "Count", "Trident - Momentum (Positron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks"), tridentColor,
+                "Tracks", "Count", "Trident - Tracks in Event"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution"), false,
+                "First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Trident - 2D Momentum Sum"));
+        
+        // Display the plots.
+        module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\TestPrint\\");
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/ParticleMCAnalysisDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/ParticleMCAnalysisDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/ParticleMCAnalysisDriver.java	Wed Mar  9 11:43:24 2016
@@ -13,136 +13,136 @@
 import org.lcsim.util.aida.AIDA;
 
 public class ParticleMCAnalysisDriver extends Driver {
-	// Store collection names.
-	private String particleCollectionName = "MCParticle";
-	
-	// Declare plots.
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D chargedTracksPlot = aida.histogram1D("MC Analysis/Event Tracks", 10, -0.5, 9.5);
-	private IHistogram1D allPlot = aida.histogram1D("MC Analysis/Electron Energy Distribution", 110, 0, 1.1);
-	private IHistogram1D electronPlot = aida.histogram1D("MC Analysis/Electron Energy Distribution", 110, 0, 1.1);
-	private IHistogram1D positronPlot = aida.histogram1D("MC Analysis/Positron Energy Distribution", 110, 0, 1.1);
-	private IHistogram1D momentumXPlot = aida.histogram1D("MC Analysis/Particle x-Momentum Distribution", 110, 0.0, 1.1);
-	private IHistogram1D momentumYPlot = aida.histogram1D("MC Analysis/Particle y-Momentum Distribution", 110, 0.0, 1.1);
-	private IHistogram1D momentumZPlot = aida.histogram1D("MC Analysis/Particle z-Momentum Distribution", 110, 0.0, 1.1);
-	private IHistogram1D epAnglePlot = aida.histogram1D("MC Analysis/Positron\\Electron Pair Angle Distribution", 90, 0, 180);
-	private IHistogram1D eeAnglePlot = aida.histogram1D("MC Analysis/Electron\\Electron Pair Angle Distribution", 90, 0, 180);
-	private IHistogram1D epMomentumSumPlot = aida.histogram1D("MC Analysis/Positron\\Electron Momentum Sum Distribution", 220, 0, 2.2);
-	private IHistogram1D eeMomentumSumPlot = aida.histogram1D("MC Analysis/Electron\\Electron Momentum Sum Distribution", 220, 0, 2.2);
-	private IHistogram2D momentumPlot = aida.histogram2D("MC Analysis/Particle Momentum Distribution", 100, 0.0, 0.40, 110, 0.0, 0.40);
-	private IHistogram2D epMomentumSum2DPlot = aida.histogram2D("MC Analysis/Positron\\Electron 2D Momentum Distribution", 55, 0, 1.1, 55, 0, 1.1);
-	private IHistogram2D eeMomentumSum2DPlot = aida.histogram2D("MC Analysis/Electron\\Electron 2D Momentum Distribution", 55, 0, 1.1, 55, 0, 1.1);
-	
-	@Override
-	public void process(EventHeader event) {
-		// Skip the event if there is no Monte Carlo collection.
-		if(!event.hasCollection(MCParticle.class, particleCollectionName)) {
-			return;
-		}
-		
-		// Get the list of Monte Carlo particles.
-		List<MCParticle> particleList = event.get(MCParticle.class, particleCollectionName);
-		
-		// Track the positive and negative particles.
-		List<MCParticle> electronList = new ArrayList<MCParticle>();
-		List<MCParticle> positronList = new ArrayList<MCParticle>();
-		
-		// Count the number of particles in the event.
-		int chargedParticles = 0;
-		
-		// Iterate through the particles.
-		for(MCParticle particle : particleList) {
-			// Look at only t = 0 particles.
-			if(particle.getProductionTime() == 0) {
-				// Plot the x/y momentum of each particle.
-				momentumPlot.fill(particle.getMomentum().x(), particle.getMomentum().y());
-				
-				// If the particle is charged, increment the charged
-				// particle count.
-				if(particle.getCharge() > 0) {
-					chargedParticles++;
-				}
-				
-				// Get the particle momentum in each direction.
-				momentumXPlot.fill(particle.getMomentum().x());
-				momentumYPlot.fill(particle.getMomentum().y());
-				momentumZPlot.fill(particle.getMomentum().z());
-				
-				// Populate the general momentum plot.
-				allPlot.fill(particle.getMomentum().magnitude());
-				momentumPlot.fill(particle.getMomentum().x(), particle.getMomentum().y());
-				
-				// Store each particle based on its PID and populate
-				// the appropriate plot.
-				if(particle.getPDGID() == 11) {
-					electronList.add(particle);
-					electronPlot.fill(particle.getMomentum().magnitude());
-				} else if(particle.getPDGID() == -11) {
-					positronList.add(particle);
-					positronPlot.fill(particle.getMomentum().magnitude());
-				}
-			}
-		}
-		
-		// Populate the charged particles plot.
-		chargedTracksPlot.fill(chargedParticles);
-		
-		// Form all electron/positron pairs.
-		List<MCParticle[]> epPairList = new ArrayList<MCParticle[]>();
-		for(MCParticle electron : electronList) {
-			for(MCParticle positron : positronList) {
-				epPairList.add(new MCParticle[] { electron, positron });
-			}
-		}
-		
-		// Populate the positron/electron pair plots.
-		for(MCParticle[] pair : epPairList) {
-			epAnglePlot.fill(getVectorAngle(pair[0].getMomentum(), pair[1].getMomentum()));
-			epMomentumSumPlot.fill(getVectorSum(pair[0].getMomentum(), pair[1].getMomentum()));
-			epMomentumSum2DPlot.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-		}
-		
-		// Form all electron/electron pairs.
-		List<MCParticle[]> eePairList = new ArrayList<MCParticle[]>();
-		for(int i = 0; i < electronList.size(); i++) {
-			for(int j = i + 1; j < electronList.size(); j++) {
-				eePairList.add(new MCParticle[] { electronList.get(i), electronList.get(j) });
-			}
-		}
-		
-		// Populate the electron/electron pair plots.
-		for(MCParticle[] pair : eePairList) {
-			eeAnglePlot.fill(getVectorAngle(pair[0].getMomentum(), pair[1].getMomentum()));
-			eeMomentumSumPlot.fill(getVectorSum(pair[0].getMomentum(), pair[1].getMomentum()));
-			eeMomentumSum2DPlot.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-		}
-	}
-	
-	private static final double getVectorSum(Hep3Vector v1, Hep3Vector v2) {
-		// Calculate the sum of the sum of the vector components, squared.
-		double sum = 0;
-		for(int i = 0; i < 3; i++) {
-			double elementSum = v1.v()[i] + v2.v()[i];
-			sum += (elementSum * elementSum);
-		}
-		
-		// Return the square root of the sum.
-		return Math.sqrt(sum);
-	}
-	
-	private static final double getVectorAngle(Hep3Vector v1, Hep3Vector v2) {
-		// The vector angle is defined as Acos[(v1 · v2) / (‖v1‖ × ‖v2‖)]
-		return Math.acos(getDotProduct(v1, v2) / (v1.magnitude() * v2.magnitude())) / Math.PI * 180.0;
-	}
-	
-	private static final double getDotProduct(Hep3Vector v1, Hep3Vector v2) {
-		// Calculate the sum of the vector element products.
-		int product = 0;
-		for(int i = 0; i < 3; i++) {
-			product += (v1.v()[i] * v2.v()[i]);
-		}
-		
-		// Return the result.
-		return product;
-	}
+    // Store collection names.
+    private String particleCollectionName = "MCParticle";
+    
+    // Declare plots.
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D chargedTracksPlot = aida.histogram1D("MC Analysis/Event Tracks", 10, -0.5, 9.5);
+    private IHistogram1D allPlot = aida.histogram1D("MC Analysis/Electron Energy Distribution", 110, 0, 1.1);
+    private IHistogram1D electronPlot = aida.histogram1D("MC Analysis/Electron Energy Distribution", 110, 0, 1.1);
+    private IHistogram1D positronPlot = aida.histogram1D("MC Analysis/Positron Energy Distribution", 110, 0, 1.1);
+    private IHistogram1D momentumXPlot = aida.histogram1D("MC Analysis/Particle x-Momentum Distribution", 110, 0.0, 1.1);
+    private IHistogram1D momentumYPlot = aida.histogram1D("MC Analysis/Particle y-Momentum Distribution", 110, 0.0, 1.1);
+    private IHistogram1D momentumZPlot = aida.histogram1D("MC Analysis/Particle z-Momentum Distribution", 110, 0.0, 1.1);
+    private IHistogram1D epAnglePlot = aida.histogram1D("MC Analysis/Positron\\Electron Pair Angle Distribution", 90, 0, 180);
+    private IHistogram1D eeAnglePlot = aida.histogram1D("MC Analysis/Electron\\Electron Pair Angle Distribution", 90, 0, 180);
+    private IHistogram1D epMomentumSumPlot = aida.histogram1D("MC Analysis/Positron\\Electron Momentum Sum Distribution", 220, 0, 2.2);
+    private IHistogram1D eeMomentumSumPlot = aida.histogram1D("MC Analysis/Electron\\Electron Momentum Sum Distribution", 220, 0, 2.2);
+    private IHistogram2D momentumPlot = aida.histogram2D("MC Analysis/Particle Momentum Distribution", 100, 0.0, 0.40, 110, 0.0, 0.40);
+    private IHistogram2D epMomentumSum2DPlot = aida.histogram2D("MC Analysis/Positron\\Electron 2D Momentum Distribution", 55, 0, 1.1, 55, 0, 1.1);
+    private IHistogram2D eeMomentumSum2DPlot = aida.histogram2D("MC Analysis/Electron\\Electron 2D Momentum Distribution", 55, 0, 1.1, 55, 0, 1.1);
+    
+    @Override
+    public void process(EventHeader event) {
+        // Skip the event if there is no Monte Carlo collection.
+        if(!event.hasCollection(MCParticle.class, particleCollectionName)) {
+            return;
+        }
+        
+        // Get the list of Monte Carlo particles.
+        List<MCParticle> particleList = event.get(MCParticle.class, particleCollectionName);
+        
+        // Track the positive and negative particles.
+        List<MCParticle> electronList = new ArrayList<MCParticle>();
+        List<MCParticle> positronList = new ArrayList<MCParticle>();
+        
+        // Count the number of particles in the event.
+        int chargedParticles = 0;
+        
+        // Iterate through the particles.
+        for(MCParticle particle : particleList) {
+            // Look at only t = 0 particles.
+            if(particle.getProductionTime() == 0) {
+                // Plot the x/y momentum of each particle.
+                momentumPlot.fill(particle.getMomentum().x(), particle.getMomentum().y());
+                
+                // If the particle is charged, increment the charged
+                // particle count.
+                if(particle.getCharge() > 0) {
+                    chargedParticles++;
+                }
+                
+                // Get the particle momentum in each direction.
+                momentumXPlot.fill(particle.getMomentum().x());
+                momentumYPlot.fill(particle.getMomentum().y());
+                momentumZPlot.fill(particle.getMomentum().z());
+                
+                // Populate the general momentum plot.
+                allPlot.fill(particle.getMomentum().magnitude());
+                momentumPlot.fill(particle.getMomentum().x(), particle.getMomentum().y());
+                
+                // Store each particle based on its PID and populate
+                // the appropriate plot.
+                if(particle.getPDGID() == 11) {
+                    electronList.add(particle);
+                    electronPlot.fill(particle.getMomentum().magnitude());
+                } else if(particle.getPDGID() == -11) {
+                    positronList.add(particle);
+                    positronPlot.fill(particle.getMomentum().magnitude());
+                }
+            }
+        }
+        
+        // Populate the charged particles plot.
+        chargedTracksPlot.fill(chargedParticles);
+        
+        // Form all electron/positron pairs.
+        List<MCParticle[]> epPairList = new ArrayList<MCParticle[]>();
+        for(MCParticle electron : electronList) {
+            for(MCParticle positron : positronList) {
+                epPairList.add(new MCParticle[] { electron, positron });
+            }
+        }
+        
+        // Populate the positron/electron pair plots.
+        for(MCParticle[] pair : epPairList) {
+            epAnglePlot.fill(getVectorAngle(pair[0].getMomentum(), pair[1].getMomentum()));
+            epMomentumSumPlot.fill(getVectorSum(pair[0].getMomentum(), pair[1].getMomentum()));
+            epMomentumSum2DPlot.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+        }
+        
+        // Form all electron/electron pairs.
+        List<MCParticle[]> eePairList = new ArrayList<MCParticle[]>();
+        for(int i = 0; i < electronList.size(); i++) {
+            for(int j = i + 1; j < electronList.size(); j++) {
+                eePairList.add(new MCParticle[] { electronList.get(i), electronList.get(j) });
+            }
+        }
+        
+        // Populate the electron/electron pair plots.
+        for(MCParticle[] pair : eePairList) {
+            eeAnglePlot.fill(getVectorAngle(pair[0].getMomentum(), pair[1].getMomentum()));
+            eeMomentumSumPlot.fill(getVectorSum(pair[0].getMomentum(), pair[1].getMomentum()));
+            eeMomentumSum2DPlot.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+        }
+    }
+    
+    private static final double getVectorSum(Hep3Vector v1, Hep3Vector v2) {
+        // Calculate the sum of the sum of the vector components, squared.
+        double sum = 0;
+        for(int i = 0; i < 3; i++) {
+            double elementSum = v1.v()[i] + v2.v()[i];
+            sum += (elementSum * elementSum);
+        }
+        
+        // Return the square root of the sum.
+        return Math.sqrt(sum);
+    }
+    
+    private static final double getVectorAngle(Hep3Vector v1, Hep3Vector v2) {
+        // The vector angle is defined as Acos[(v1 · v2) / (‖v1‖ × ‖v2‖)]
+        return Math.acos(getDotProduct(v1, v2) / (v1.magnitude() * v2.magnitude())) / Math.PI * 180.0;
+    }
+    
+    private static final double getDotProduct(Hep3Vector v1, Hep3Vector v2) {
+        // Calculate the sum of the vector element products.
+        int product = 0;
+        for(int i = 0; i < 3; i++) {
+            product += (v1.v()[i] * v2.v()[i]);
+        }
+        
+        // Return the result.
+        return product;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/PlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/PlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/PlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -8,120 +8,120 @@
 import java.awt.Font;
 
 public class PlotsFormatter {
-	// Define plot fonts.
-	public static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 30);
-	public static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  35);
-	public static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  45);
-	
-	// Defines the color style options for plot data.
-	public static enum ColorStyle {
-		 MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
-		  MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
-		MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
-		    RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
-		  FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
-		    TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
-		    BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
-		  PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
-		
-		private final Color fillColor;
-		private final Color lineColor;
-		
-		private ColorStyle(Color fillColor, Color lineColor) {
-			this.fillColor = fillColor;
-			this.lineColor = lineColor;
-		}
-		
-		public Color getFillColor() { return fillColor; }
-		
-		public Color getLineColor() { return lineColor; }
-	};
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	public static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the names of each plot on in the region.
-		String[] dataNames = region.getAllDataNames();
-		
-		// Check whether this is an overlay plot. Overlay plots contain
-		// more than one data name.
-		boolean overlay = (dataNames.length > 1 ? true : false);
-		
-		// Iterate over each plot in the region.
-		for(int i = 0; i < dataNames.length; i++) {
-			// Set the overlay style if needed.
-			if(overlay) {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with no fill. The color is set by the "color" argument.
-				fillStyle.setHistogramFill(false);
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarLineColor(color[i].getFillColor());
-				
-				// Set the legend text style.
-				region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
-			}
-			
-			// Otherwise, set the fill style for a single plot.
-			else {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with a fill color. The colors are defined by the
-				// "color" argument.
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarColor(color[i].getFillColor());
-				fillStyle.setHistogramBarLineColor(color[i].getLineColor());
-			}
-			
-			// Set the statistics box style.
-			region.getPlot().getStats().setVisible(true);
-			region.getPlot().getStats().setFont(BASIC_FONT);
-			
-			// Set the title font.
-			region.getPlot().getTitleObject().setFont(TITLE_FONT);
-			
-			// Set the axis tick-mark fonts.
-			region.getPlot().getXAxis().setFont(BASIC_FONT);
-			region.getPlot().getYAxis().setFont(BASIC_FONT);
-			region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-			region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 */
-	public static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
-		// Get the fill style object. 2D plots should never be overlay
-		// plots, so there should only ever be one data name.
-		JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		
-		// Set the fill style for a two-dimensional plot.
-		if(logarithmic) { fillStyle.setLogZ(true); }
-		fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
-		fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
-		
-		// Make the statistics box invisible.
-		region.getPlot().getStats().setVisible(false);
-		
-		// Set the general plot font (which is also the z-axis font).
-		region.getPlot().setFont(BASIC_FONT);
-		
-		// Set the title font.
-		region.getPlot().getTitleObject().setFont(TITLE_FONT);
-		
-		// Set the axis tick-mark fonts.
-		region.getPlot().getXAxis().setFont(BASIC_FONT);
-		region.getPlot().getYAxis().setFont(BASIC_FONT);
-		region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-		region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-	}
+    // Define plot fonts.
+    public static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 30);
+    public static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  35);
+    public static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  45);
+    
+    // Defines the color style options for plot data.
+    public static enum ColorStyle {
+         MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
+          MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
+        MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
+            RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
+          FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
+            TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
+            BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
+          PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
+        
+        private final Color fillColor;
+        private final Color lineColor;
+        
+        private ColorStyle(Color fillColor, Color lineColor) {
+            this.fillColor = fillColor;
+            this.lineColor = lineColor;
+        }
+        
+        public Color getFillColor() { return fillColor; }
+        
+        public Color getLineColor() { return lineColor; }
+    };
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    public static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the names of each plot on in the region.
+        String[] dataNames = region.getAllDataNames();
+        
+        // Check whether this is an overlay plot. Overlay plots contain
+        // more than one data name.
+        boolean overlay = (dataNames.length > 1 ? true : false);
+        
+        // Iterate over each plot in the region.
+        for(int i = 0; i < dataNames.length; i++) {
+            // Set the overlay style if needed.
+            if(overlay) {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with no fill. The color is set by the "color" argument.
+                fillStyle.setHistogramFill(false);
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarLineColor(color[i].getFillColor());
+                
+                // Set the legend text style.
+                region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
+            }
+            
+            // Otherwise, set the fill style for a single plot.
+            else {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with a fill color. The colors are defined by the
+                // "color" argument.
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarColor(color[i].getFillColor());
+                fillStyle.setHistogramBarLineColor(color[i].getLineColor());
+            }
+            
+            // Set the statistics box style.
+            region.getPlot().getStats().setVisible(true);
+            region.getPlot().getStats().setFont(BASIC_FONT);
+            
+            // Set the title font.
+            region.getPlot().getTitleObject().setFont(TITLE_FONT);
+            
+            // Set the axis tick-mark fonts.
+            region.getPlot().getXAxis().setFont(BASIC_FONT);
+            region.getPlot().getYAxis().setFont(BASIC_FONT);
+            region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+            region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     */
+    public static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
+        // Get the fill style object. 2D plots should never be overlay
+        // plots, so there should only ever be one data name.
+        JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        
+        // Set the fill style for a two-dimensional plot.
+        if(logarithmic) { fillStyle.setLogZ(true); }
+        fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
+        fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
+        
+        // Make the statistics box invisible.
+        region.getPlot().getStats().setVisible(false);
+        
+        // Set the general plot font (which is also the z-axis font).
+        region.getPlot().setFont(BASIC_FONT);
+        
+        // Set the title font.
+        region.getPlot().getTitleObject().setFont(TITLE_FONT);
+        
+        // Set the axis tick-mark fonts.
+        region.getPlot().getXAxis().setFont(BASIC_FONT);
+        region.getPlot().getYAxis().setFont(BASIC_FONT);
+        region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+        region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/RafoAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/RafoAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/RafoAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -16,431 +16,431 @@
 import org.lcsim.util.aida.AIDA;
 
 public class RafoAnalysis extends Driver {
-	private boolean useGoodSVT = false;
-	private String clusterCollectionName = "EcalClustersCorr";
-	private String particleCollectionName = "FinalStateParticles";
-	
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D t0TimeCoincidenceAll          = aida.histogram1D("Tier 0/Time Coincidence",                    300, -15.0, 15.0);
-	private IHistogram1D t0TimeCoincidenceFiducial     = aida.histogram1D("Tier 0/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
-	private IHistogram1D t0EnergySumAll                = aida.histogram1D("Tier 0/Energy Sum",                          300,   0.0,  1.5);
-	private IHistogram1D t0EnergySumFiducial           = aida.histogram1D("Tier 0/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
-	private IHistogram1D t0InvariantMassAll            = aida.histogram1D("Tier 0/Invariant Mass",                     2200,   0.0,  1.1);
-	private IHistogram2D t0EnergySum2DAll              = aida.histogram2D("Tier 0/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t0EnergySum2DFiducial         = aida.histogram2D("Tier 0/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t0SumCoplanarityAll           = aida.histogram2D("Tier 0/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t0SumCoplanarityFiducial      = aida.histogram2D("Tier 0/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t0SumCoplanarityCalcAll       = aida.histogram2D("Tier 0/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t0SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 0/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t0TimeEnergyAll               = aida.histogram2D("Tier 0/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100,   0, 100);
-	private IHistogram2D t0TimeEnergyFiducial          = aida.histogram2D("Tier 0/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100,   0, 100);
-	
-	private IHistogram1D t1TimeCoincidenceAll          = aida.histogram1D("Tier 1/Time Coincidence",                    300, -15.0, 15.0);
-	private IHistogram1D t1TimeCoincidenceFiducial     = aida.histogram1D("Tier 1/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
-	private IHistogram1D t1EnergySumAll                = aida.histogram1D("Tier 1/Energy Sum",                          300,   0.0,  1.5);
-	private IHistogram1D t1EnergySumFiducial           = aida.histogram1D("Tier 1/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
-	private IHistogram1D t1InvariantMassAll            = aida.histogram1D("Tier 1/Invariant Mass",                     2200,   0.0,  1.1);
-	private IHistogram2D t1EnergySum2DAll              = aida.histogram2D("Tier 1/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t1EnergySum2DFiducial         = aida.histogram2D("Tier 1/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t1SumCoplanarityAll           = aida.histogram2D("Tier 1/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t1SumCoplanarityFiducial      = aida.histogram2D("Tier 1/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t1SumCoplanarityCalcAll       = aida.histogram2D("Tier 1/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t1SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 1/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t1TimeEnergyAll               = aida.histogram2D("Tier 1/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100, 0, 100);
-	private IHistogram2D t1TimeEnergyFiducial          = aida.histogram2D("Tier 1/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100, 0, 100);
-	
-	private IHistogram1D t2TimeCoincidenceAll          = aida.histogram1D("Tier 2/Time Coincidence",                    300, -15.0, 15.0);
-	private IHistogram1D t2TimeCoincidenceFiducial     = aida.histogram1D("Tier 2/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
-	private IHistogram1D t2EnergySumAll                = aida.histogram1D("Tier 2/Energy Sum",                          300,   0.0,  1.5);
-	private IHistogram1D t2EnergySumFiducial           = aida.histogram1D("Tier 2/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
-	private IHistogram1D t2InvariantMassAll            = aida.histogram1D("Tier 2/Invariant Mass",                     2200,   0.0,  1.1);
-	private IHistogram2D t2EnergySum2DAll              = aida.histogram2D("Tier 2/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t2EnergySum2DFiducial         = aida.histogram2D("Tier 2/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
-	private IHistogram2D t2SumCoplanarityAll           = aida.histogram2D("Tier 2/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t2SumCoplanarityFiducial      = aida.histogram2D("Tier 2/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
-	private IHistogram2D t2SumCoplanarityCalcAll       = aida.histogram2D("Tier 2/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t2SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 2/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
-	private IHistogram2D t2TimeEnergyAll               = aida.histogram2D("Tier 2/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100,   0, 100);
-	private IHistogram2D t2TimeEnergyFiducial          = aida.histogram2D("Tier 2/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100,   0, 100);
-	
-	private int t0Events = 0;
-	private int t1Events = 0;
-	private int t2Events = 0;
-	
-	@Override
-	public void endOfData() {
-		System.out.printf("Tier 0 Events: %d%n", t0Events);
-		System.out.printf("Tier 1 Events: %d%n", t1Events);
-		System.out.printf("Tier 2 Events: %d%n", t2Events);
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Check whether the SVT was active in this event.
-		final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
-		boolean svtGood = true;
+    private boolean useGoodSVT = false;
+    private String clusterCollectionName = "EcalClustersCorr";
+    private String particleCollectionName = "FinalStateParticles";
+    
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D t0TimeCoincidenceAll          = aida.histogram1D("Tier 0/Time Coincidence",                    300, -15.0, 15.0);
+    private IHistogram1D t0TimeCoincidenceFiducial     = aida.histogram1D("Tier 0/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
+    private IHistogram1D t0EnergySumAll                = aida.histogram1D("Tier 0/Energy Sum",                          300,   0.0,  1.5);
+    private IHistogram1D t0EnergySumFiducial           = aida.histogram1D("Tier 0/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
+    private IHistogram1D t0InvariantMassAll            = aida.histogram1D("Tier 0/Invariant Mass",                     2200,   0.0,  1.1);
+    private IHistogram2D t0EnergySum2DAll              = aida.histogram2D("Tier 0/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t0EnergySum2DFiducial         = aida.histogram2D("Tier 0/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t0SumCoplanarityAll           = aida.histogram2D("Tier 0/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t0SumCoplanarityFiducial      = aida.histogram2D("Tier 0/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t0SumCoplanarityCalcAll       = aida.histogram2D("Tier 0/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t0SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 0/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t0TimeEnergyAll               = aida.histogram2D("Tier 0/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100,   0, 100);
+    private IHistogram2D t0TimeEnergyFiducial          = aida.histogram2D("Tier 0/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100,   0, 100);
+    
+    private IHistogram1D t1TimeCoincidenceAll          = aida.histogram1D("Tier 1/Time Coincidence",                    300, -15.0, 15.0);
+    private IHistogram1D t1TimeCoincidenceFiducial     = aida.histogram1D("Tier 1/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
+    private IHistogram1D t1EnergySumAll                = aida.histogram1D("Tier 1/Energy Sum",                          300,   0.0,  1.5);
+    private IHistogram1D t1EnergySumFiducial           = aida.histogram1D("Tier 1/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
+    private IHistogram1D t1InvariantMassAll            = aida.histogram1D("Tier 1/Invariant Mass",                     2200,   0.0,  1.1);
+    private IHistogram2D t1EnergySum2DAll              = aida.histogram2D("Tier 1/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t1EnergySum2DFiducial         = aida.histogram2D("Tier 1/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t1SumCoplanarityAll           = aida.histogram2D("Tier 1/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t1SumCoplanarityFiducial      = aida.histogram2D("Tier 1/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t1SumCoplanarityCalcAll       = aida.histogram2D("Tier 1/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t1SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 1/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t1TimeEnergyAll               = aida.histogram2D("Tier 1/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100, 0, 100);
+    private IHistogram2D t1TimeEnergyFiducial          = aida.histogram2D("Tier 1/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100, 0, 100);
+    
+    private IHistogram1D t2TimeCoincidenceAll          = aida.histogram1D("Tier 2/Time Coincidence",                    300, -15.0, 15.0);
+    private IHistogram1D t2TimeCoincidenceFiducial     = aida.histogram1D("Tier 2/Time Coincidence (Fiducial Region)",  300, -15.0, 15.0);
+    private IHistogram1D t2EnergySumAll                = aida.histogram1D("Tier 2/Energy Sum",                          300,   0.0,  1.5);
+    private IHistogram1D t2EnergySumFiducial           = aida.histogram1D("Tier 2/Energy Sum (Fiducial Region)",        300,   0.0,  1.5);
+    private IHistogram1D t2InvariantMassAll            = aida.histogram1D("Tier 2/Invariant Mass",                     2200,   0.0,  1.1);
+    private IHistogram2D t2EnergySum2DAll              = aida.histogram2D("Tier 2/Top Cluster Energy vs. Bottom Cluster Energy",                   300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t2EnergySum2DFiducial         = aida.histogram2D("Tier 2/Top Cluster Energy vs. Bottom Cluster Energy (Fiducial Region)", 300, 0, 1.5, 300,   0, 1.5);
+    private IHistogram2D t2SumCoplanarityAll           = aida.histogram2D("Tier 2/Hardware Coplanarity vs. Energy Sum",                            300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t2SumCoplanarityFiducial      = aida.histogram2D("Tier 2/Hardware Coplanarity vs. Energy Sum (Fiducial Region)",          300, 0, 1.5, 115,   0, 230);
+    private IHistogram2D t2SumCoplanarityCalcAll       = aida.histogram2D("Tier 2/Calculated Coplanarity vs. Energy Sum",                          300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t2SumCoplanarityCalcFiducial  = aida.histogram2D("Tier 2/Calculated Coplanarity vs. Energy Sum (Fiducial Region)",        300, 0, 1.5, 115, 130, 230);
+    private IHistogram2D t2TimeEnergyAll               = aida.histogram2D("Tier 2/Cluster Time vs. Cluster Energy",                                300, 0, 1.5, 100,   0, 100);
+    private IHistogram2D t2TimeEnergyFiducial          = aida.histogram2D("Tier 2/Cluster Time vs. Cluster Energy (Fiducial Region)",              300, 0, 1.5, 100,   0, 100);
+    
+    private int t0Events = 0;
+    private int t1Events = 0;
+    private int t2Events = 0;
+    
+    @Override
+    public void endOfData() {
+        System.out.printf("Tier 0 Events: %d%n", t0Events);
+        System.out.printf("Tier 1 Events: %d%n", t1Events);
+        System.out.printf("Tier 2 Events: %d%n", t2Events);
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Check whether the SVT was active in this event.
+        final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
+        boolean svtGood = true;
         for(int i = 0; i < flagNames.length; i++) {
             int[] flag = event.getIntegerParameters().get(flagNames[i]);
             if(flag == null || flag[0] == 0) {
                 svtGood = false;
             }
         }
-		
+        
         // If the SVT is not properly running, skip the event.
         if(!svtGood && useGoodSVT) { return; }
         
-		// Get the list of particles, if it exists.
-		List<ReconstructedParticle> trackList = null;
-		if(event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
-			trackList = event.get(ReconstructedParticle.class, particleCollectionName);
-		}
-		
-		// Get the list of clusters, if it exists.
-		List<Cluster> clusterList = null;
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			clusterList = event.get(Cluster.class, clusterCollectionName);
-		}
-		
-		// Make sure that the cluster and track lists both exist.
-		if(clusterList == null || trackList == null) {
-			return;
-		}
-		
-		// Perform tier 1 analysis. This requires that there be at
-		// least one top/bottom cluster pair with a time difference
-		// of less then 4 ns.
-		double t1TimeThreshold = 1.5;
-		
-		// Get a list of cluster pairs.
-		List<Cluster[]> pairList = getClusterPairs(clusterList);
-		
-		// Iterate over the cluster pairs.
-		boolean t1Passed = false;
-		t1ClusterLoop:
-		for(Cluster[] pair : pairList) {
-			// Check that the time difference for the cluster pair
-			// meets the time cut.
-			if(TriggerModule.getValueTimeCoincidence(pair) <= t1TimeThreshold) {
-				// Note that the tier 1 analysis condition passed.
-				t1Passed = true;
-				
-				// Break from the loop.
-				break t1ClusterLoop;
-			}
-		}
-		
-		// Perform the additional checks for tier 2 analysis. This
-		// requires that there be at least one top/bottom track pair
-		// and that one track be positive and the other be negative.
-		
-		// Get a list of top and bottom track pairs.
-		List<ReconstructedParticle[]> trackPairList = getTrackPairs(trackList);
-		
-		// Check that at least one top/bottom track has one negative and
-		// one positive track.
-		boolean t2Passed = false;
-		t2TrackLoop:
-		for(ReconstructedParticle[] pair : trackPairList) {
-			if((pair[0].getCharge() > 0 && pair[1].getCharge() < 0) || (pair[0].getCharge() < 0 && pair[1].getCharge() > 0)) {
-				t2Passed = true;
-				break t2TrackLoop;
-			}
-		}
-		
-		// Populate the tier 0 analysis plot.
-		if(true) {
-			// Increment the number of tier 1 events found.
-			t0Events++;
-			
-			// Track which clusters have already been added to the
-			// singles plot so that there are no repeats.
-			Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
-			Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
-			
-			for(ReconstructedParticle[] pair : trackPairList) {
-				t0InvariantMassAll.fill(getInvariantMass(pair));
-			}
-			
-			for(Cluster[] pair : pairList) {
-				// Fill the all pairs plots.
-				double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
-				t0EnergySumAll.fill(pairEnergy);
-				t0EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
-				t0TimeCoincidenceAll.fill(getTimeConicidence(pair));
-				t0SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
-				t0SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				
-				// Fill the singles plots.
-				if(!plotSet.contains(pair[0])) {
-					plotSet.add(pair[0]);
-					t0TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotSet.contains(pair[1])) {
-					plotSet.add(pair[1]);
-					t0TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-				
-				// Fill the fiducial plots if appropriate.
-				if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
-					t0EnergySumFiducial.fill(pairEnergy);
-					t0EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
-					t0TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
-					t0SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
-					t0SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				}
-				
-				// Fill the singles fiducial plots if appropriate.
-				if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
-					plotFiducial.add(pair[0]);
-					t0TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
-					plotFiducial.add(pair[1]);
-					t0TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-			}
-		}
-		
-		// Populate the tier 1 analysis plots, if the conditions were met.
-		if(t1Passed) {
-			// Increment the number of tier 1 events found.
-			t1Events++;
-			
-			// Track which clusters have already been added to the
-			// singles plot so that there are no repeats.
-			Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
-			Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
-			
-			for(ReconstructedParticle[] pair : trackPairList) {
-				t1InvariantMassAll.fill(getInvariantMass(pair));
-			}
-			
-			for(Cluster[] pair : pairList) {
-				// Only include clusters that pass the time coincidence.
-				if(TriggerModule.getValueTimeCoincidence(pair) > t1TimeThreshold) {
-					continue;
-				}
-				
-				// Fill the all pairs plots.
-				double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
-				t1EnergySumAll.fill(pairEnergy);
-				t1EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
-				t1TimeCoincidenceAll.fill(getTimeConicidence(pair));
-				t1SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
-				t1SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				
-				// Fill the singles plots.
-				if(!plotSet.contains(pair[0])) {
-					plotSet.add(pair[0]);
-					t1TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotSet.contains(pair[1])) {
-					plotSet.add(pair[1]);
-					t1TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-				
-				// Fill the fiducial plots if appropriate.
-				if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
-					t1EnergySumFiducial.fill(pairEnergy);
-					t1EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
-					t1TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
-					t1SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
-					t1SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				}
-				
-				// Fill the singles fiducial plots if appropriate.
-				if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
-					plotFiducial.add(pair[0]);
-					t1TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
-					plotFiducial.add(pair[1]);
-					t1TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-			}
-		}
-		
-		// Populate the tier 2 analysis plots, if the conditions were met.
-		if(t1Passed && t2Passed) {
-			// Increment the number of tier 2 events found.
-			t2Events++;
-			
-			// Track which clusters have already been added to the
-			// singles plot so that there are no repeats.
-			Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
-			Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
-			
-			for(ReconstructedParticle[] pair : trackPairList) {
-				t2InvariantMassAll.fill(getInvariantMass(pair));
-			}
-			
-			for(Cluster[] pair : pairList) {
-				// Only include clusters that pass the time coincidence.
-				if(TriggerModule.getValueTimeCoincidence(pair) > t1TimeThreshold) {
-					continue;
-				}
-				
-				// Fill the all pairs plots.
-				double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
-				t2EnergySumAll.fill(pairEnergy);
-				t2EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
-				t2TimeCoincidenceAll.fill(getTimeConicidence(pair));
-				t2SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
-				t2SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				
-				// Fill the singles plots.
-				if(!plotSet.contains(pair[0])) {
-					plotSet.add(pair[0]);
-					t2TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotSet.contains(pair[1])) {
-					plotSet.add(pair[1]);
-					t2TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-				
-				// Fill the fiducial plots if appropriate.
-				if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
-					t2EnergySumFiducial.fill(pairEnergy);
-					t2EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
-					t2TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
-					t2SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
-					t2SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
-				}
-				
-				// Fill the singles fiducial plots if appropriate.
-				if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
-					plotFiducial.add(pair[0]);
-					t2TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
-				} if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
-					plotFiducial.add(pair[1]);
-					t2TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
-				}
-			}
-		}
-	}
-	
-	public static final double getInvariantMass(ReconstructedParticle[] pair) {
-		// Get energy.
-		double[] energy = new double[2];
-		final double electronMassSquared = Math.pow(0.00051099891, 2);
-		energy[0] = Math.sqrt(pair[0].getMomentum().magnitudeSquared() + electronMassSquared);
-		energy[1] = Math.sqrt(pair[1].getMomentum().magnitudeSquared() + electronMassSquared);
-		
-		// Calculate the invariant mass.
-		return Math.sqrt(Math.pow(energy[0] + energy[1], 2) - Math.pow(pair[0].getMomentum().x() + pair[1].getMomentum().x(), 2)
-				+ Math.pow(pair[0].getMomentum().y() + pair[1].getMomentum().y(), 2) + Math.pow(pair[0].getMomentum().z() + pair[1].getMomentum().z(), 2));
-	}
-	
-	public static final double getCalculatedCoplanarity(Cluster[] pair) {
-		// Define the x- and y-coordinates of the clusters as well as
-		// calorimeter center.
-		final double ORIGIN_X = 42.52;
-		double x[] = { pair[0].getPosition()[0], pair[1].getPosition()[0] };
-		double y[] = { pair[0].getPosition()[1], pair[1].getPosition()[1] };
-		
+        // Get the list of particles, if it exists.
+        List<ReconstructedParticle> trackList = null;
+        if(event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
+            trackList = event.get(ReconstructedParticle.class, particleCollectionName);
+        }
+        
+        // Get the list of clusters, if it exists.
+        List<Cluster> clusterList = null;
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            clusterList = event.get(Cluster.class, clusterCollectionName);
+        }
+        
+        // Make sure that the cluster and track lists both exist.
+        if(clusterList == null || trackList == null) {
+            return;
+        }
+        
+        // Perform tier 1 analysis. This requires that there be at
+        // least one top/bottom cluster pair with a time difference
+        // of less then 4 ns.
+        double t1TimeThreshold = 1.5;
+        
+        // Get a list of cluster pairs.
+        List<Cluster[]> pairList = getClusterPairs(clusterList);
+        
+        // Iterate over the cluster pairs.
+        boolean t1Passed = false;
+        t1ClusterLoop:
+        for(Cluster[] pair : pairList) {
+            // Check that the time difference for the cluster pair
+            // meets the time cut.
+            if(TriggerModule.getValueTimeCoincidence(pair) <= t1TimeThreshold) {
+                // Note that the tier 1 analysis condition passed.
+                t1Passed = true;
+                
+                // Break from the loop.
+                break t1ClusterLoop;
+            }
+        }
+        
+        // Perform the additional checks for tier 2 analysis. This
+        // requires that there be at least one top/bottom track pair
+        // and that one track be positive and the other be negative.
+        
+        // Get a list of top and bottom track pairs.
+        List<ReconstructedParticle[]> trackPairList = getTrackPairs(trackList);
+        
+        // Check that at least one top/bottom track has one negative and
+        // one positive track.
+        boolean t2Passed = false;
+        t2TrackLoop:
+        for(ReconstructedParticle[] pair : trackPairList) {
+            if((pair[0].getCharge() > 0 && pair[1].getCharge() < 0) || (pair[0].getCharge() < 0 && pair[1].getCharge() > 0)) {
+                t2Passed = true;
+                break t2TrackLoop;
+            }
+        }
+        
+        // Populate the tier 0 analysis plot.
+        if(true) {
+            // Increment the number of tier 1 events found.
+            t0Events++;
+            
+            // Track which clusters have already been added to the
+            // singles plot so that there are no repeats.
+            Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
+            Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
+            
+            for(ReconstructedParticle[] pair : trackPairList) {
+                t0InvariantMassAll.fill(getInvariantMass(pair));
+            }
+            
+            for(Cluster[] pair : pairList) {
+                // Fill the all pairs plots.
+                double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
+                t0EnergySumAll.fill(pairEnergy);
+                t0EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                t0TimeCoincidenceAll.fill(getTimeConicidence(pair));
+                t0SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                t0SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                
+                // Fill the singles plots.
+                if(!plotSet.contains(pair[0])) {
+                    plotSet.add(pair[0]);
+                    t0TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotSet.contains(pair[1])) {
+                    plotSet.add(pair[1]);
+                    t0TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+                
+                // Fill the fiducial plots if appropriate.
+                if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
+                    t0EnergySumFiducial.fill(pairEnergy);
+                    t0EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                    t0TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
+                    t0SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                    t0SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                }
+                
+                // Fill the singles fiducial plots if appropriate.
+                if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
+                    plotFiducial.add(pair[0]);
+                    t0TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
+                    plotFiducial.add(pair[1]);
+                    t0TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+            }
+        }
+        
+        // Populate the tier 1 analysis plots, if the conditions were met.
+        if(t1Passed) {
+            // Increment the number of tier 1 events found.
+            t1Events++;
+            
+            // Track which clusters have already been added to the
+            // singles plot so that there are no repeats.
+            Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
+            Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
+            
+            for(ReconstructedParticle[] pair : trackPairList) {
+                t1InvariantMassAll.fill(getInvariantMass(pair));
+            }
+            
+            for(Cluster[] pair : pairList) {
+                // Only include clusters that pass the time coincidence.
+                if(TriggerModule.getValueTimeCoincidence(pair) > t1TimeThreshold) {
+                    continue;
+                }
+                
+                // Fill the all pairs plots.
+                double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
+                t1EnergySumAll.fill(pairEnergy);
+                t1EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                t1TimeCoincidenceAll.fill(getTimeConicidence(pair));
+                t1SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                t1SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                
+                // Fill the singles plots.
+                if(!plotSet.contains(pair[0])) {
+                    plotSet.add(pair[0]);
+                    t1TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotSet.contains(pair[1])) {
+                    plotSet.add(pair[1]);
+                    t1TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+                
+                // Fill the fiducial plots if appropriate.
+                if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
+                    t1EnergySumFiducial.fill(pairEnergy);
+                    t1EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                    t1TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
+                    t1SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                    t1SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                }
+                
+                // Fill the singles fiducial plots if appropriate.
+                if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
+                    plotFiducial.add(pair[0]);
+                    t1TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
+                    plotFiducial.add(pair[1]);
+                    t1TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+            }
+        }
+        
+        // Populate the tier 2 analysis plots, if the conditions were met.
+        if(t1Passed && t2Passed) {
+            // Increment the number of tier 2 events found.
+            t2Events++;
+            
+            // Track which clusters have already been added to the
+            // singles plot so that there are no repeats.
+            Set<Cluster> plotSet = new HashSet<Cluster>(clusterList.size());
+            Set<Cluster> plotFiducial = new HashSet<Cluster>(clusterList.size());
+            
+            for(ReconstructedParticle[] pair : trackPairList) {
+                t2InvariantMassAll.fill(getInvariantMass(pair));
+            }
+            
+            for(Cluster[] pair : pairList) {
+                // Only include clusters that pass the time coincidence.
+                if(TriggerModule.getValueTimeCoincidence(pair) > t1TimeThreshold) {
+                    continue;
+                }
+                
+                // Fill the all pairs plots.
+                double pairEnergy = pair[0].getEnergy() + pair[1].getEnergy();
+                t2EnergySumAll.fill(pairEnergy);
+                t2EnergySum2DAll.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                t2TimeCoincidenceAll.fill(getTimeConicidence(pair));
+                t2SumCoplanarityCalcAll.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                t2SumCoplanarityAll.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                
+                // Fill the singles plots.
+                if(!plotSet.contains(pair[0])) {
+                    plotSet.add(pair[0]);
+                    t2TimeEnergyAll.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotSet.contains(pair[1])) {
+                    plotSet.add(pair[1]);
+                    t2TimeEnergyAll.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+                
+                // Fill the fiducial plots if appropriate.
+                if(inFiducialRegion(pair[0]) && inFiducialRegion(pair[1])) {
+                    t2EnergySumFiducial.fill(pairEnergy);
+                    t2EnergySum2DFiducial.fill(pair[1].getEnergy(), pair[0].getEnergy());
+                    t2TimeCoincidenceFiducial.fill(getTimeConicidence(pair));
+                    t2SumCoplanarityCalcFiducial.fill(pairEnergy, getCalculatedCoplanarity(pair));
+                    t2SumCoplanarityFiducial.fill(pairEnergy, TriggerModule.getValueCoplanarity(pair));
+                }
+                
+                // Fill the singles fiducial plots if appropriate.
+                if(!plotFiducial.contains(pair[0]) && inFiducialRegion(pair[0])) {
+                    plotFiducial.add(pair[0]);
+                    t2TimeEnergyFiducial.fill(pair[0].getEnergy(), TriggerModule.getClusterTime(pair[0]));
+                } if(!plotFiducial.contains(pair[1]) && inFiducialRegion(pair[1])) {
+                    plotFiducial.add(pair[1]);
+                    t2TimeEnergyFiducial.fill(pair[1].getEnergy(), TriggerModule.getClusterTime(pair[1]));
+                }
+            }
+        }
+    }
+    
+    public static final double getInvariantMass(ReconstructedParticle[] pair) {
+        // Get energy.
+        double[] energy = new double[2];
+        final double electronMassSquared = Math.pow(0.00051099891, 2);
+        energy[0] = Math.sqrt(pair[0].getMomentum().magnitudeSquared() + electronMassSquared);
+        energy[1] = Math.sqrt(pair[1].getMomentum().magnitudeSquared() + electronMassSquared);
+        
+        // Calculate the invariant mass.
+        return Math.sqrt(Math.pow(energy[0] + energy[1], 2) - Math.pow(pair[0].getMomentum().x() + pair[1].getMomentum().x(), 2)
+                + Math.pow(pair[0].getMomentum().y() + pair[1].getMomentum().y(), 2) + Math.pow(pair[0].getMomentum().z() + pair[1].getMomentum().z(), 2));
+    }
+    
+    public static final double getCalculatedCoplanarity(Cluster[] pair) {
+        // Define the x- and y-coordinates of the clusters as well as
+        // calorimeter center.
+        final double ORIGIN_X = 42.52;
+        double x[] = { pair[0].getPosition()[0], pair[1].getPosition()[0] };
+        double y[] = { pair[0].getPosition()[1], pair[1].getPosition()[1] };
+        
         // Get the cluster angles.
         double[] clusterAngle = new double[2];
         for(int i = 0; i < 2; i++) {
-        	clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
-        	if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
+            clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
+            if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
         }
         
         // Calculate the coplanarity cut value.
         double clusterDiff = clusterAngle[0] - clusterAngle[1];
         return clusterDiff > 0 ? clusterDiff : clusterDiff + 360;
-	}
-	
-	private static final boolean inFiducialRegion(Cluster cluster) {
-		// Get the x and y indices for the cluster.
-		int ix   = TriggerModule.getClusterXIndex(cluster);
-		int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
-		int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
-		
-		// Check if the cluster is on the top or the bottom of the
-		// calorimeter, as defined by |y| == 5. This is an edge cluster
-		// and is not in the fiducial region.
-		if(absy == 5) {
-			return false;
-		}
-		
-		// Check if the cluster is on the extreme left or right side
-		// of the calorimeter, as defined by |x| == 23. This is also
-		// and edge cluster is not in the fiducial region.
-		if(absx == 23) {
-			return false;
-		}
-		
-		// Check if the cluster is along the beam gap, as defined by
-		// |y| == 1. This is an internal edge cluster and is not in the
-		// fiducial region.
-		if(absy == 1) {
-			return false;
-		}
-		
-		// Lastly, check if the cluster falls along the beam hole, as
-		// defined by clusters with -11 <= x <= -1 and |y| == 2. This
-		// is not the fiducial region.
-		if(absy == 2 && ix <= -1 && ix >= -11) {
-			return false;
-		}
-		
-		// If all checks fail, the cluster is in the fiducial region.
-		return true;
-	}
-	
-	private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> tracks) {
-		// Separate the tracks into top and bottom tracks.
-		List<ReconstructedParticle> topList = new ArrayList<ReconstructedParticle>();
-		List<ReconstructedParticle> botList = new ArrayList<ReconstructedParticle>();
-		for(ReconstructedParticle track : tracks) {
-			// Make sure that the track actually contains tracks.
-			if(track.getTracks().size() > 0) {
-				// Use the tan(Λ) to differentiate "top" and "bottom"
-				// tracks from one another.
-				if(track.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) {
-					topList.add(track);
-				} else {
-					botList.add(track);
-				}
-			}
-		}
-		
-		// Form all permutations of top and bottom tracks.
-		List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
-		for(ReconstructedParticle topTrack : topList) {
-			for(ReconstructedParticle botTrack : botList) {
-				pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
-			}
-		}
-		
-		// Return the resulting cluster pairs.
-		return pairList;
-	}
-	
-	private static final List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
-		// Separate the clusters into top and bottom clusters.
-		List<Cluster> topList = new ArrayList<Cluster>();
-		List<Cluster> botList = new ArrayList<Cluster>();
-		for(Cluster cluster : clusters) {
-			if(TriggerModule.getClusterYIndex(cluster) > 0) {
-				topList.add(cluster);
-			} else {
-				botList.add(cluster);
-			}
-		}
-		
-		// Form all permutations of top and bottom clusters.
-		List<Cluster[]> pairList = new ArrayList<Cluster[]>();
-		for(Cluster topCluster : topList) {
-			for(Cluster botCluster : botList) {
-				pairList.add(new Cluster[] { topCluster, botCluster });
-			}
-		}
-		
-		// Return the resulting cluster pairs.
-		return pairList;
-	}
-	
-	public static final double getTimeConicidence(Cluster[] pair) {
-		return TriggerModule.getClusterSeedHit(pair[1]).getTime() - TriggerModule.getClusterSeedHit(pair[0]).getTime();
-	}
-	
-	public void setUseGoodSVT(boolean state) {
-		useGoodSVT = state;
-	}
+    }
+    
+    private static final boolean inFiducialRegion(Cluster cluster) {
+        // Get the x and y indices for the cluster.
+        int ix   = TriggerModule.getClusterXIndex(cluster);
+        int absx = Math.abs(TriggerModule.getClusterXIndex(cluster));
+        int absy = Math.abs(TriggerModule.getClusterYIndex(cluster));
+        
+        // Check if the cluster is on the top or the bottom of the
+        // calorimeter, as defined by |y| == 5. This is an edge cluster
+        // and is not in the fiducial region.
+        if(absy == 5) {
+            return false;
+        }
+        
+        // Check if the cluster is on the extreme left or right side
+        // of the calorimeter, as defined by |x| == 23. This is also
+        // and edge cluster is not in the fiducial region.
+        if(absx == 23) {
+            return false;
+        }
+        
+        // Check if the cluster is along the beam gap, as defined by
+        // |y| == 1. This is an internal edge cluster and is not in the
+        // fiducial region.
+        if(absy == 1) {
+            return false;
+        }
+        
+        // Lastly, check if the cluster falls along the beam hole, as
+        // defined by clusters with -11 <= x <= -1 and |y| == 2. This
+        // is not the fiducial region.
+        if(absy == 2 && ix <= -1 && ix >= -11) {
+            return false;
+        }
+        
+        // If all checks fail, the cluster is in the fiducial region.
+        return true;
+    }
+    
+    private static final List<ReconstructedParticle[]> getTrackPairs(List<ReconstructedParticle> tracks) {
+        // Separate the tracks into top and bottom tracks.
+        List<ReconstructedParticle> topList = new ArrayList<ReconstructedParticle>();
+        List<ReconstructedParticle> botList = new ArrayList<ReconstructedParticle>();
+        for(ReconstructedParticle track : tracks) {
+            // Make sure that the track actually contains tracks.
+            if(track.getTracks().size() > 0) {
+                // Use the tan(Λ) to differentiate "top" and "bottom"
+                // tracks from one another.
+                if(track.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) {
+                    topList.add(track);
+                } else {
+                    botList.add(track);
+                }
+            }
+        }
+        
+        // Form all permutations of top and bottom tracks.
+        List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
+        for(ReconstructedParticle topTrack : topList) {
+            for(ReconstructedParticle botTrack : botList) {
+                pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
+            }
+        }
+        
+        // Return the resulting cluster pairs.
+        return pairList;
+    }
+    
+    private static final List<Cluster[]> getClusterPairs(List<Cluster> clusters) {
+        // Separate the clusters into top and bottom clusters.
+        List<Cluster> topList = new ArrayList<Cluster>();
+        List<Cluster> botList = new ArrayList<Cluster>();
+        for(Cluster cluster : clusters) {
+            if(TriggerModule.getClusterYIndex(cluster) > 0) {
+                topList.add(cluster);
+            } else {
+                botList.add(cluster);
+            }
+        }
+        
+        // Form all permutations of top and bottom clusters.
+        List<Cluster[]> pairList = new ArrayList<Cluster[]>();
+        for(Cluster topCluster : topList) {
+            for(Cluster botCluster : botList) {
+                pairList.add(new Cluster[] { topCluster, botCluster });
+            }
+        }
+        
+        // Return the resulting cluster pairs.
+        return pairList;
+    }
+    
+    public static final double getTimeConicidence(Cluster[] pair) {
+        return TriggerModule.getClusterSeedHit(pair[1]).getTime() - TriggerModule.getClusterSeedHit(pair[0]).getTime();
+    }
+    
+    public void setUseGoodSVT(boolean state) {
+        useGoodSVT = state;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/TridentTrackDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/TridentTrackDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/TridentTrackDriver.java	Wed Mar  9 11:43:24 2016
@@ -15,229 +15,229 @@
 import org.lcsim.util.aida.AIDA;
 
 public class TridentTrackDriver extends Driver {
-	private String finalStateCollectionName = "FinalStateParticles";
-	private String candidateCollectionName = "UnconstrainedV0Candidates";
-	
-	private int tracksCandidate = 0;
-	private int tracksFinalState = 0;
-	private int tracksCandidateCluster = 0;
-	private int tracksFinalStateCluster = 0;
-	
-	private static final int ANY_CLUSTER = 0;
-	private static final int HAS_CLUSTER = 1;
-	
-	private AIDA aida = AIDA.defaultInstance();
-	private IHistogram1D[] tracks = new IHistogram1D[2];
-	private IHistogram1D[] posTracks = new IHistogram1D[2];
-	private IHistogram1D[] negTracks = new IHistogram1D[2];
-	private IHistogram1D[] posMomentum = new IHistogram1D[2];
-	private IHistogram1D[] negMomentum = new IHistogram1D[2];
-	private IHistogram1D[] energySum = new IHistogram1D[2];
-	private IHistogram1D[] energyMomentumDiff = new IHistogram1D[2];
-	private IHistogram1D[] momentumSum = new IHistogram1D[2];
-	private IHistogram1D[] invariantMass = new IHistogram1D[2];
-	private IHistogram2D[] energySum2D = new IHistogram2D[2];
-	private IHistogram2D[] momentumSum2D = new IHistogram2D[2];
-	private IHistogram2D[] position = new IHistogram2D[2];
-	
-	@Override
-	public void startOfData() {
-		// Instantiate the "any cluster status" plots.
-		tracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (All)", 7, -0.5, 6.5);
-		posTracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (Positive)", 7, -0.5, 6.5);
-		negTracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (Negative)", 7, -0.5, 6.5);
-		posMomentum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum (Positive)", 110, 0, 1.1);
-		negMomentum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum (Negative)", 110, 0, 1.1);
-		energySum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Energy Sum", 55, 0, 2.2);
-		momentumSum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum Sum", 55, 0, 2.2);
-		energyMomentumDiff[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Energy-Momentum Difference", 55, 0, 2.2);
-		invariantMass[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Invariant Mass", 240, 0.000, 0.120);
-		energySum2D[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/2D Energy Sum", 55, 0, 1.1, 55, 0, 1.1);
-		momentumSum2D[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/2D Momentum Sum", 55, 0, 1.1, 55, 0, 1.1);
-		position[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/Track Cluster Position", 46, -23, 23, 11, -5.5, 5.5);
-		
-		// Instantiate the "has a cluster" plots.
-		tracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (All)", 7, -0.5, 6.5);
-		posTracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (Positive)", 7, -0.5, 6.5);
-		negTracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (Negative)", 7, -0.5, 6.5);
-		posMomentum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum (Positive)", 110, 0, 1.1);
-		negMomentum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum (Negative)", 110, 0, 1.1);
-		energySum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Energy Sum", 55, 0, 2.2);
-		momentumSum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum Sum", 55, 0, 2.2);
-		energyMomentumDiff[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Energy-Momentum Difference", 55, 0, 2.2);
-		invariantMass[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Invariant Mass", 240, 0.000, 0.120);
-		energySum2D[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/2D Energy Sum", 55, 0, 1.1, 55, 0, 1.1);
-		momentumSum2D[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/2D Momentum Sum", 55, 0, 1.1, 55, 0, 1.1);
-		position[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/Track Cluster Position", 46, -23, 23, 11, -5.5, 5.5);
-	}
-	
-	@Override
-	public void endOfData() {
-		System.out.printf("Tracks (Candidate)           :: %d%n", tracksCandidate);
-		System.out.printf("Tracks (Final State)         :: %d%n", tracksFinalState);
-		System.out.printf("Cluster Tracks (Candidate)   :: %d%n", tracksCandidateCluster);
-		System.out.printf("Cluster Tracks (Final State) :: %d%n", tracksFinalStateCluster);
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Check for final state particles.
-		if(event.hasCollection(ReconstructedParticle.class, finalStateCollectionName)) {
-			// Get the final state particles.
-			List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, finalStateCollectionName);
-			
-			// Store the positive and negative tracks.
-			List<ReconstructedParticle> allTrackList = new ArrayList<ReconstructedParticle>();
-			List<ReconstructedParticle> posTrackList = new ArrayList<ReconstructedParticle>();
-			List<ReconstructedParticle> negTrackList = new ArrayList<ReconstructedParticle>();
-			
-			// Store the same tracks, but limited to those with clusters.
-			List<ReconstructedParticle> allClusterTrackList = new ArrayList<ReconstructedParticle>();
-			List<ReconstructedParticle> posClusterTrackList = new ArrayList<ReconstructedParticle>();
-			List<ReconstructedParticle> negClusterTrackList = new ArrayList<ReconstructedParticle>();
-			
-			// Iterate over the tracks and populate the lists.
-			for(ReconstructedParticle track : trackList) {
-				// Skip instances with no raw tracks.
-				if(track.getTracks().size() == 0) { continue; }
-				
-				// Add the cluster to the all track list.
-				allTrackList.add(track);
-				
-				// Track the number of cluster tracks.
-				tracksFinalState++;
-				if(!track.getClusters().isEmpty()) {
-					tracksFinalStateCluster++;
-				}
-				
-				// Process the track position plots.
-				Hep3Vector trackPosAtEcal = TrackUtils.extrapolateTrack(track.getTracks().get(0), 1394.5);
-				position[ANY_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
-				
-				// Process the tracks based on charge.
-				if(track.getCharge() > 0) {
-					// Increment the counters and populate the momentum plots.
-					posTrackList.add(track);
-					posMomentum[ANY_CLUSTER].fill(track.getMomentum().magnitude());
-					
-					// Repeat for the "has clusters" plots if necessary.
-					if(track.getClusters().size() > 0) {
-						// Increment the counters and populate the
-						// momentum plot.
-						posClusterTrackList.add(track);
-						allClusterTrackList.add(track);
-						posMomentum[HAS_CLUSTER].fill(track.getMomentum().magnitude());
-						
-						// Populate the cluster position plot.
-						//int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-						//int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-						position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
-					}
-				} else if(track.getCharge() < 0) {
-					// Increment the counters and populate the momentum plots.
-					negTrackList.add(track);
-					negMomentum[ANY_CLUSTER].fill(track.getMomentum().magnitude());
-					
-					// Repeat for the "has clusters" plots if necessary.
-					if(track.getClusters().size() > 0) {
-						// Increment the counters and populate the
-						// momentum plot.
-						negClusterTrackList.add(track);
-						allClusterTrackList.add(track);
-						negMomentum[HAS_CLUSTER].fill(track.getMomentum().magnitude());
-						
-						// Populate the cluster position plot.
-						//int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-						//int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-						position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
-					}
-				} else {
-					if(track.getClusters().size() > 0) {
-						// Increment the counter.
-						allClusterTrackList.add(track);
-						
-						// Populate the cluster position plot.
-						//int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-						//int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
-						position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
-					}
-				}
-			}
-			
-			// Populate the tracks per event plots.
-			tracks[ANY_CLUSTER].fill(allTrackList.size());
-			tracks[HAS_CLUSTER].fill(allClusterTrackList.size());
-			posTracks[ANY_CLUSTER].fill(posTrackList.size());
-			posTracks[HAS_CLUSTER].fill(posClusterTrackList.size());
-			negTracks[ANY_CLUSTER].fill(negTrackList.size());
-			negTracks[HAS_CLUSTER].fill(negClusterTrackList.size());
-			
-			/// Store track pairs.
-			List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
-			List<ReconstructedParticle[]> pairClusterList = new ArrayList<ReconstructedParticle[]>();
-			
-			// Form track pairs for all tracks.
-			for(ReconstructedParticle posTrack : posTrackList) {
-				for(ReconstructedParticle negTrack : negTrackList) {
-					pairList.add(new ReconstructedParticle[] { posTrack, negTrack });
-				}
-			}
-			
-			// Form track pairs for cluster tracks.
-			for(ReconstructedParticle posTrack : posClusterTrackList) {
-				for(ReconstructedParticle negTrack : negClusterTrackList) {
-					pairClusterList.add(new ReconstructedParticle[] { posTrack, negTrack });
-				}
-			}
-			
-			// Populate the track pair plots.
-			for(ReconstructedParticle[] pair : pairList) {
-				Hep3Vector pSum = new BasicHep3Vector(
-						pair[0].getMomentum().x() + pair[1].getMomentum().x(),
-						pair[0].getMomentum().y() + pair[1].getMomentum().y(),
-						pair[0].getMomentum().z() + pair[1].getMomentum().z());
-				
-				energySum[ANY_CLUSTER].fill(pair[0].getEnergy() + pair[1].getEnergy());
-				momentumSum[ANY_CLUSTER].fill(pSum.magnitude());
-				energySum2D[ANY_CLUSTER].fill(pair[0].getEnergy(), pair[1].getEnergy());
-				momentumSum2D[ANY_CLUSTER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-				energyMomentumDiff[ANY_CLUSTER].fill(Math.abs((pair[0].getEnergy() + pair[1].getEnergy()) - pSum.magnitude()));
-			}
-			
-			// Populate the cluster track pair plots.
-			for(ReconstructedParticle[] pair : pairClusterList) {
-				Hep3Vector pSum = new BasicHep3Vector(
-						pair[0].getMomentum().x() + pair[1].getMomentum().x(),
-						pair[0].getMomentum().y() + pair[1].getMomentum().y(),
-						pair[0].getMomentum().z() + pair[1].getMomentum().z());
-				
-				energySum[HAS_CLUSTER].fill(pair[0].getEnergy() + pair[1].getEnergy());
-				momentumSum[HAS_CLUSTER].fill(pSum.magnitude());
-				energySum2D[HAS_CLUSTER].fill(pair[0].getEnergy(), pair[1].getEnergy());
-				momentumSum2D[HAS_CLUSTER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-				energyMomentumDiff[HAS_CLUSTER].fill(Math.abs((pair[0].getEnergy() + pair[1].getEnergy()) - pSum.magnitude()));
-			}
-		}
-		
-		// Check for V0 candidates.
-		if(event.hasCollection(ReconstructedParticle.class, candidateCollectionName)) {
-			// Get the candidate particles.
-			List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, candidateCollectionName);
-			
-			// Increment the counter.
-			tracksCandidate += trackList.size();
-			
-			// Increment the counter for cluster tracks.
-			for(ReconstructedParticle track : trackList) {
-				// Populate the invariant mass plot.
-				invariantMass[ANY_CLUSTER].fill(track.getMass());
-				
-				// Check for a cluster track.
-				if(track.getClusters().size() > 0) {
-					tracksCandidateCluster++;
-					invariantMass[HAS_CLUSTER].fill(track.getMass());
-				}
-			}
-		}
-	}
+    private String finalStateCollectionName = "FinalStateParticles";
+    private String candidateCollectionName = "UnconstrainedV0Candidates";
+    
+    private int tracksCandidate = 0;
+    private int tracksFinalState = 0;
+    private int tracksCandidateCluster = 0;
+    private int tracksFinalStateCluster = 0;
+    
+    private static final int ANY_CLUSTER = 0;
+    private static final int HAS_CLUSTER = 1;
+    
+    private AIDA aida = AIDA.defaultInstance();
+    private IHistogram1D[] tracks = new IHistogram1D[2];
+    private IHistogram1D[] posTracks = new IHistogram1D[2];
+    private IHistogram1D[] negTracks = new IHistogram1D[2];
+    private IHistogram1D[] posMomentum = new IHistogram1D[2];
+    private IHistogram1D[] negMomentum = new IHistogram1D[2];
+    private IHistogram1D[] energySum = new IHistogram1D[2];
+    private IHistogram1D[] energyMomentumDiff = new IHistogram1D[2];
+    private IHistogram1D[] momentumSum = new IHistogram1D[2];
+    private IHistogram1D[] invariantMass = new IHistogram1D[2];
+    private IHistogram2D[] energySum2D = new IHistogram2D[2];
+    private IHistogram2D[] momentumSum2D = new IHistogram2D[2];
+    private IHistogram2D[] position = new IHistogram2D[2];
+    
+    @Override
+    public void startOfData() {
+        // Instantiate the "any cluster status" plots.
+        tracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (All)", 7, -0.5, 6.5);
+        posTracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (Positive)", 7, -0.5, 6.5);
+        negTracks[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Tracks in Event (Negative)", 7, -0.5, 6.5);
+        posMomentum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum (Positive)", 110, 0, 1.1);
+        negMomentum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum (Negative)", 110, 0, 1.1);
+        energySum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Energy Sum", 55, 0, 2.2);
+        momentumSum[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Momentum Sum", 55, 0, 2.2);
+        energyMomentumDiff[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Energy-Momentum Difference", 55, 0, 2.2);
+        invariantMass[ANY_CLUSTER] = aida.histogram1D("Trident Analysis/All/Invariant Mass", 240, 0.000, 0.120);
+        energySum2D[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/2D Energy Sum", 55, 0, 1.1, 55, 0, 1.1);
+        momentumSum2D[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/2D Momentum Sum", 55, 0, 1.1, 55, 0, 1.1);
+        position[ANY_CLUSTER] = aida.histogram2D("Trident Analysis/All/Track Cluster Position", 46, -23, 23, 11, -5.5, 5.5);
+        
+        // Instantiate the "has a cluster" plots.
+        tracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (All)", 7, -0.5, 6.5);
+        posTracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (Positive)", 7, -0.5, 6.5);
+        negTracks[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Tracks in Event (Negative)", 7, -0.5, 6.5);
+        posMomentum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum (Positive)", 110, 0, 1.1);
+        negMomentum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum (Negative)", 110, 0, 1.1);
+        energySum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Energy Sum", 55, 0, 2.2);
+        momentumSum[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Momentum Sum", 55, 0, 2.2);
+        energyMomentumDiff[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Energy-Momentum Difference", 55, 0, 2.2);
+        invariantMass[HAS_CLUSTER] = aida.histogram1D("Trident Analysis/Cluster/Invariant Mass", 240, 0.000, 0.120);
+        energySum2D[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/2D Energy Sum", 55, 0, 1.1, 55, 0, 1.1);
+        momentumSum2D[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/2D Momentum Sum", 55, 0, 1.1, 55, 0, 1.1);
+        position[HAS_CLUSTER] = aida.histogram2D("Trident Analysis/Cluster/Track Cluster Position", 46, -23, 23, 11, -5.5, 5.5);
+    }
+    
+    @Override
+    public void endOfData() {
+        System.out.printf("Tracks (Candidate)           :: %d%n", tracksCandidate);
+        System.out.printf("Tracks (Final State)         :: %d%n", tracksFinalState);
+        System.out.printf("Cluster Tracks (Candidate)   :: %d%n", tracksCandidateCluster);
+        System.out.printf("Cluster Tracks (Final State) :: %d%n", tracksFinalStateCluster);
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Check for final state particles.
+        if(event.hasCollection(ReconstructedParticle.class, finalStateCollectionName)) {
+            // Get the final state particles.
+            List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, finalStateCollectionName);
+            
+            // Store the positive and negative tracks.
+            List<ReconstructedParticle> allTrackList = new ArrayList<ReconstructedParticle>();
+            List<ReconstructedParticle> posTrackList = new ArrayList<ReconstructedParticle>();
+            List<ReconstructedParticle> negTrackList = new ArrayList<ReconstructedParticle>();
+            
+            // Store the same tracks, but limited to those with clusters.
+            List<ReconstructedParticle> allClusterTrackList = new ArrayList<ReconstructedParticle>();
+            List<ReconstructedParticle> posClusterTrackList = new ArrayList<ReconstructedParticle>();
+            List<ReconstructedParticle> negClusterTrackList = new ArrayList<ReconstructedParticle>();
+            
+            // Iterate over the tracks and populate the lists.
+            for(ReconstructedParticle track : trackList) {
+                // Skip instances with no raw tracks.
+                if(track.getTracks().size() == 0) { continue; }
+                
+                // Add the cluster to the all track list.
+                allTrackList.add(track);
+                
+                // Track the number of cluster tracks.
+                tracksFinalState++;
+                if(!track.getClusters().isEmpty()) {
+                    tracksFinalStateCluster++;
+                }
+                
+                // Process the track position plots.
+                Hep3Vector trackPosAtEcal = TrackUtils.extrapolateTrack(track.getTracks().get(0), 1394.5);
+                position[ANY_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
+                
+                // Process the tracks based on charge.
+                if(track.getCharge() > 0) {
+                    // Increment the counters and populate the momentum plots.
+                    posTrackList.add(track);
+                    posMomentum[ANY_CLUSTER].fill(track.getMomentum().magnitude());
+                    
+                    // Repeat for the "has clusters" plots if necessary.
+                    if(track.getClusters().size() > 0) {
+                        // Increment the counters and populate the
+                        // momentum plot.
+                        posClusterTrackList.add(track);
+                        allClusterTrackList.add(track);
+                        posMomentum[HAS_CLUSTER].fill(track.getMomentum().magnitude());
+                        
+                        // Populate the cluster position plot.
+                        //int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                        //int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+                        position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
+                    }
+                } else if(track.getCharge() < 0) {
+                    // Increment the counters and populate the momentum plots.
+                    negTrackList.add(track);
+                    negMomentum[ANY_CLUSTER].fill(track.getMomentum().magnitude());
+                    
+                    // Repeat for the "has clusters" plots if necessary.
+                    if(track.getClusters().size() > 0) {
+                        // Increment the counters and populate the
+                        // momentum plot.
+                        negClusterTrackList.add(track);
+                        allClusterTrackList.add(track);
+                        negMomentum[HAS_CLUSTER].fill(track.getMomentum().magnitude());
+                        
+                        // Populate the cluster position plot.
+                        //int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                        //int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+                        position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
+                    }
+                } else {
+                    if(track.getClusters().size() > 0) {
+                        // Increment the counter.
+                        allClusterTrackList.add(track);
+                        
+                        // Populate the cluster position plot.
+                        //int ix = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                        //int iy = track.getClusters().get(0).getCalorimeterHits().get(0).getIdentifierFieldValue("iy");
+                        position[HAS_CLUSTER].fill(trackPosAtEcal.x(), trackPosAtEcal.y());
+                    }
+                }
+            }
+            
+            // Populate the tracks per event plots.
+            tracks[ANY_CLUSTER].fill(allTrackList.size());
+            tracks[HAS_CLUSTER].fill(allClusterTrackList.size());
+            posTracks[ANY_CLUSTER].fill(posTrackList.size());
+            posTracks[HAS_CLUSTER].fill(posClusterTrackList.size());
+            negTracks[ANY_CLUSTER].fill(negTrackList.size());
+            negTracks[HAS_CLUSTER].fill(negClusterTrackList.size());
+            
+            /// Store track pairs.
+            List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
+            List<ReconstructedParticle[]> pairClusterList = new ArrayList<ReconstructedParticle[]>();
+            
+            // Form track pairs for all tracks.
+            for(ReconstructedParticle posTrack : posTrackList) {
+                for(ReconstructedParticle negTrack : negTrackList) {
+                    pairList.add(new ReconstructedParticle[] { posTrack, negTrack });
+                }
+            }
+            
+            // Form track pairs for cluster tracks.
+            for(ReconstructedParticle posTrack : posClusterTrackList) {
+                for(ReconstructedParticle negTrack : negClusterTrackList) {
+                    pairClusterList.add(new ReconstructedParticle[] { posTrack, negTrack });
+                }
+            }
+            
+            // Populate the track pair plots.
+            for(ReconstructedParticle[] pair : pairList) {
+                Hep3Vector pSum = new BasicHep3Vector(
+                        pair[0].getMomentum().x() + pair[1].getMomentum().x(),
+                        pair[0].getMomentum().y() + pair[1].getMomentum().y(),
+                        pair[0].getMomentum().z() + pair[1].getMomentum().z());
+                
+                energySum[ANY_CLUSTER].fill(pair[0].getEnergy() + pair[1].getEnergy());
+                momentumSum[ANY_CLUSTER].fill(pSum.magnitude());
+                energySum2D[ANY_CLUSTER].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                momentumSum2D[ANY_CLUSTER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+                energyMomentumDiff[ANY_CLUSTER].fill(Math.abs((pair[0].getEnergy() + pair[1].getEnergy()) - pSum.magnitude()));
+            }
+            
+            // Populate the cluster track pair plots.
+            for(ReconstructedParticle[] pair : pairClusterList) {
+                Hep3Vector pSum = new BasicHep3Vector(
+                        pair[0].getMomentum().x() + pair[1].getMomentum().x(),
+                        pair[0].getMomentum().y() + pair[1].getMomentum().y(),
+                        pair[0].getMomentum().z() + pair[1].getMomentum().z());
+                
+                energySum[HAS_CLUSTER].fill(pair[0].getEnergy() + pair[1].getEnergy());
+                momentumSum[HAS_CLUSTER].fill(pSum.magnitude());
+                energySum2D[HAS_CLUSTER].fill(pair[0].getEnergy(), pair[1].getEnergy());
+                momentumSum2D[HAS_CLUSTER].fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+                energyMomentumDiff[HAS_CLUSTER].fill(Math.abs((pair[0].getEnergy() + pair[1].getEnergy()) - pSum.magnitude()));
+            }
+        }
+        
+        // Check for V0 candidates.
+        if(event.hasCollection(ReconstructedParticle.class, candidateCollectionName)) {
+            // Get the candidate particles.
+            List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, candidateCollectionName);
+            
+            // Increment the counter.
+            tracksCandidate += trackList.size();
+            
+            // Increment the counter for cluster tracks.
+            for(ReconstructedParticle track : trackList) {
+                // Populate the invariant mass plot.
+                invariantMass[ANY_CLUSTER].fill(track.getMass());
+                
+                // Check for a cluster track.
+                if(track.getClusters().size() > 0) {
+                    tracksCandidateCluster++;
+                    invariantMass[HAS_CLUSTER].fill(track.getMass());
+                }
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerPlotsModule.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerPlotsModule.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerPlotsModule.java	Wed Mar  9 11:43:24 2016
@@ -8,8 +8,8 @@
 import org.lcsim.util.aida.AIDA;
 
 public class TriggerPlotsModule {
-	// Define plots.
-	private AIDA aida = AIDA.defaultInstance();
+    // Define plots.
+    private AIDA aida = AIDA.defaultInstance();
     private IHistogram1D singleSeedEnergy;
     private IHistogram1D singleHitCount;
     private IHistogram1D singleTotalEnergy;
@@ -25,43 +25,43 @@
     private IHistogram2D pairDistribution;
     private IHistogram2D pairEnergySum2D;
     
-	public TriggerPlotsModule(String moduleName) {
-		singleSeedEnergy     = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Seed Energy",  176,   0.0,   1.1);
-		singleHitCount       = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Hit Count",      9,   0.5,   9.5);
-		singleTotalEnergy    = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Total Energy", 176,   0.0,   1.1);
-		singleDistribution   = aida.histogram2D(moduleName + " Trigger Plots/Singles Plots/Cluster Seed",          46, -23.0,  23.0,  11, -5.5, 5.5);
-		pairSeedEnergy       = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Seed Energy",     176,   0.0,   1.1);
-		pairHitCount         = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Hit Count",         9,   0.5,   9.5);
-		pairTotalEnergy      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Total Energy",    176,   0.0,   1.1);
-		pairEnergySum        = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Sum",         176,   0.0,   2.2);
-		pairEnergyDifference = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Difference",  176,   0.0,   1.1);
-		pairCoplanarity      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Coplanarity",        180,   0.0, 180.0);
-		pairEnergySlope      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Slope",       200,   0.0,   3.0);
-		pairDistribution     = aida.histogram2D(moduleName + " Trigger Plots/Pair Plots/Cluster Seed",             46, -23.0,  23.0,  11, -5.5, 5.5);
-		pairEnergySum2D      = aida.histogram2D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Sum 2D",      110,   0.0,   1.1, 110,  0.0, 1.1);
-	}
-	
-	public void addCluster(Cluster cluster) {
-		singleSeedEnergy.fill(TriggerModule.getValueClusterSeedEnergy(cluster));
-		singleHitCount.fill(TriggerModule.getValueClusterHitCount(cluster));
-		singleTotalEnergy.fill(TriggerModule.getValueClusterTotalEnergy(cluster));
-		singleDistribution.fill(TriggerModule.getClusterXIndex(cluster), TriggerModule.getClusterYIndex(cluster));
-	}
-	
-	public void addClusterPair(Cluster[] pair) {
-		// Populate the singles plots.
-		for(Cluster cluster : pair) {
-			pairSeedEnergy.fill(TriggerModule.getValueClusterSeedEnergy(cluster));
-			pairHitCount.fill(TriggerModule.getValueClusterHitCount(cluster));
-			pairTotalEnergy.fill(TriggerModule.getValueClusterTotalEnergy(cluster));
-			pairDistribution.fill(TriggerModule.getClusterXIndex(cluster), TriggerModule.getClusterYIndex(cluster));
-		}
-		
-		// Populate the pair plots.
-		pairEnergySum.fill(TriggerModule.getValueEnergySum(pair));
-		pairEnergyDifference.fill(TriggerModule.getValueEnergyDifference(pair));
-		pairCoplanarity.fill(TriggerModule.getValueCoplanarity(pair));
-		pairEnergySlope.fill(TriggerModule.getValueEnergySlope(pair, 0.0055));
-		pairEnergySum2D.fill(TriggerModule.getValueClusterTotalEnergy(pair[0]), TriggerModule.getValueClusterTotalEnergy(pair[1]));
-	}
+    public TriggerPlotsModule(String moduleName) {
+        singleSeedEnergy     = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Seed Energy",  176,   0.0,   1.1);
+        singleHitCount       = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Hit Count",      9,   0.5,   9.5);
+        singleTotalEnergy    = aida.histogram1D(moduleName + " Trigger Plots/Singles Plots/Cluster Total Energy", 176,   0.0,   1.1);
+        singleDistribution   = aida.histogram2D(moduleName + " Trigger Plots/Singles Plots/Cluster Seed",          46, -23.0,  23.0,  11, -5.5, 5.5);
+        pairSeedEnergy       = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Seed Energy",     176,   0.0,   1.1);
+        pairHitCount         = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Hit Count",         9,   0.5,   9.5);
+        pairTotalEnergy      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Cluster Total Energy",    176,   0.0,   1.1);
+        pairEnergySum        = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Sum",         176,   0.0,   2.2);
+        pairEnergyDifference = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Difference",  176,   0.0,   1.1);
+        pairCoplanarity      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Coplanarity",        180,   0.0, 180.0);
+        pairEnergySlope      = aida.histogram1D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Slope",       200,   0.0,   3.0);
+        pairDistribution     = aida.histogram2D(moduleName + " Trigger Plots/Pair Plots/Cluster Seed",             46, -23.0,  23.0,  11, -5.5, 5.5);
+        pairEnergySum2D      = aida.histogram2D(moduleName + " Trigger Plots/Pair Plots/Pair Energy Sum 2D",      110,   0.0,   1.1, 110,  0.0, 1.1);
+    }
+    
+    public void addCluster(Cluster cluster) {
+        singleSeedEnergy.fill(TriggerModule.getValueClusterSeedEnergy(cluster));
+        singleHitCount.fill(TriggerModule.getValueClusterHitCount(cluster));
+        singleTotalEnergy.fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+        singleDistribution.fill(TriggerModule.getClusterXIndex(cluster), TriggerModule.getClusterYIndex(cluster));
+    }
+    
+    public void addClusterPair(Cluster[] pair) {
+        // Populate the singles plots.
+        for(Cluster cluster : pair) {
+            pairSeedEnergy.fill(TriggerModule.getValueClusterSeedEnergy(cluster));
+            pairHitCount.fill(TriggerModule.getValueClusterHitCount(cluster));
+            pairTotalEnergy.fill(TriggerModule.getValueClusterTotalEnergy(cluster));
+            pairDistribution.fill(TriggerModule.getClusterXIndex(cluster), TriggerModule.getClusterYIndex(cluster));
+        }
+        
+        // Populate the pair plots.
+        pairEnergySum.fill(TriggerModule.getValueEnergySum(pair));
+        pairEnergyDifference.fill(TriggerModule.getValueEnergyDifference(pair));
+        pairCoplanarity.fill(TriggerModule.getValueCoplanarity(pair));
+        pairEnergySlope.fill(TriggerModule.getValueEnergySlope(pair, 0.0055));
+        pairEnergySum2D.fill(TriggerModule.getValueClusterTotalEnergy(pair[0]), TriggerModule.getValueClusterTotalEnergy(pair[1]));
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerProcessAnalysisDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerProcessAnalysisDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/TriggerProcessAnalysisDriver.java	Wed Mar  9 11:43:24 2016
@@ -21,768 +21,768 @@
 import org.lcsim.util.aida.AIDA;
 
 public class TriggerProcessAnalysisDriver extends Driver {
-	private int eventsProcessed = 0;
-	private int møllersProcessed = 0;
-	private boolean checkSVT = false;
-	private int tridentsProcessed = 0;
-	private int gblMøllersProcessed = 0;
-	private int gblTridentsProcessed = 0;
-	private double timeCoincidence = 2.5;
-	private double elasticThreshold = 0.800;
-	private double møllerLowerRange = 0.900;
-	private double møllerUpperRange = 1.200;
-	private AIDA aida = AIDA.defaultInstance();
-	private boolean checkTriggerTimeWindow = false;
-	private String clusterCollectionName = "EcalClustersCorr";
-	private String particleCollectionName = "FinalStateParticles";
-	
-	// Define trident cluster-track matched condition plots.
-	private IHistogram1D trctmInvariantMass = aida.histogram1D("Tridents CTMatched/Invariant Mass", 140, 0.0, 0.070);
-	private IHistogram1D trctmInstancesInEvent = aida.histogram1D("Tridents CTMatched/Instances in Event", 9, 0.5, 9.5);
-	private IHistogram1D trctmEnergySum1D = aida.histogram1D("Tridents CTMatched/Cluster Energy Sum", 150, 0.000, 1.500);
-	private IHistogram1D trctmMomentumSum1D = aida.histogram1D("Tridents CTMatched/Track Momentum Sum", 150, 0.000, 1.500);
-	private IHistogram1D trctmElectronEnergy = aida.histogram1D("Tridents CTMatched/Electron Cluster Energy", 150, 0.000, 1.500);
-	private IHistogram1D trctmElectronMomentum = aida.histogram1D("Tridents CTMatched/Electron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram1D trctmPositronEnergy = aida.histogram1D("Tridents CTMatched/Positron Cluster Energy", 150, 0.000, 1.500);
-	private IHistogram1D trctmPositronMomentum = aida.histogram1D("Tridents CTMatched/Positron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram1D trctmTimeCoincidence = aida.histogram1D("Tridents CTMatched/Time Coincidence", 100, -4, 4);
-	private IHistogram2D trctmClusterPosition = aida.histogram2D("Tridents CTMatched/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
-	private IHistogram2D trctmEnergySum2D = aida.histogram2D("Tridents CTMatched/Cluster Energy Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D trctmTrackPosition = aida.histogram2D("Tridents CTMatched/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
-	private IHistogram2D trctmMomentumSum2D = aida.histogram2D("Tridents CTMatched/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D trctmESumCoplanarity = aida.histogram2D("Tridents CTMatched/Cluster Energy Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	private IHistogram2D trctmPSumCoplanarity = aida.histogram2D("Tridents CTMatched/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	
-	// Define the Møller cluster-track matched condition plots.
-	private IHistogram1D møctmInvariantMass = aida.histogram1D("Møller CTMatched/Invariant Mass", 140, 0.0, 0.070);
-	private IHistogram1D møctmInstancesInEvent = aida.histogram1D("Møller CTMatched/Instances in Event", 9, 0.5, 9.5);
-	private IHistogram1D møctmEnergySum1D = aida.histogram1D("Møller CTMatched/Cluster Energy Sum", 150, 0.000, 1.500);
-	private IHistogram1D møctmMomentumSum1D = aida.histogram1D("Møller CTMatched/Track Momentum Sum", 150, 0.000, 1.500);
-	private IHistogram1D møctmElectronEnergy = aida.histogram1D("Møller CTMatched/Electron Cluster Energy", 150, 0.000, 1.500);
-	private IHistogram1D møctmElectronMomentum = aida.histogram1D("Møller CTMatched/Electron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram1D møctmTimeCoincidence = aida.histogram1D("Møller CTMatched/Time Coincidence", 100, -4, 4);
-	private IHistogram2D møctmClusterPosition = aida.histogram2D("Møller CTMatched/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
-	private IHistogram2D møctmEnergySum2D = aida.histogram2D("Møller CTMatched/Cluster Energy Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D møctmTrackPosition = aida.histogram2D("Møller CTMatched/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
-	private IHistogram2D møctmMomentumSum2D = aida.histogram2D("Møller CTMatched/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D møctmESumCoplanarity = aida.histogram2D("Møller CTMatched/Cluster Energy Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	private IHistogram2D møctmPSumCoplanarity = aida.histogram2D("Møller CTMatched/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	
-	// Define the Møller track-only condition plots.
-	private IHistogram1D møgblTimeCoincidence = aida.histogram1D("Møller Track-Only/Time Coincidence", 100, -4, 4);
-	private IHistogram1D møgblInvariantMass = aida.histogram1D("Møller Track-Only/Invariant Mass", 140, 0.0, 0.070);
-	private IHistogram1D møgblInstancesInEvent = aida.histogram1D("Møller Track-Only/Instances in Event", 9, 0.5, 9.5);
-	private IHistogram1D møgblMomentumSum1D = aida.histogram1D("Møller Track-Only/Track Momentum Sum", 150, 0.000, 1.500);
-	private IHistogram1D møgblElectronMomentum = aida.histogram1D("Møller Track-Only/Electron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram2D møgblTrackPosition = aida.histogram2D("Møller Track-Only/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
-	private IHistogram2D møgblMomentumSum2D = aida.histogram2D("Møller Track-Only/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D møgblPSumCoplanarity = aida.histogram2D("Møller Track-Only/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	
-	// Define the GBL trident condition plots.
-	private IHistogram1D trgblInvariantMass = aida.histogram1D("Tridents Track-Only/Invariant Mass", 140, 0.0, 0.070);
-	private IHistogram1D trgblInstancesInEvent = aida.histogram1D("Tridents Track-Only/Instances in Event", 9, 0.5, 9.5);
-	private IHistogram1D trgblMomentumSum1D = aida.histogram1D("Tridents Track-Only/Track Momentum Sum", 150, 0.000, 1.500);
-	private IHistogram1D trgblElectronMomentum = aida.histogram1D("Tridents Track-Only/Electron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram1D trgblPositronMomentum = aida.histogram1D("Tridents Track-Only/Positron Track Momentum", 150, 0.000, 1.500);
-	private IHistogram1D trgblTimeCoincidence = aida.histogram1D("Tridents Track-Only/Time Coincidence", 100, -4, 4);
-	private IHistogram2D trgblTrackPosition = aida.histogram2D("Tridents Track-Only/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
-	private IHistogram2D trgblMomentumSum2D = aida.histogram2D("Tridents Track-Only/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
-	private IHistogram2D trgblPSumCoplanarity = aida.histogram2D("Tridents Track-Only/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
-	
-	@Override
-	public void endOfData() {
-		// Calculate the scaling factor for Hertz.
-		double scale = 19000.0 / eventsProcessed;
-		
-		System.out.println("Processed " + eventsProcessed + " events.");
-		System.out.println("Processed " + møllersProcessed + " Møller events");
-		System.out.println("\tAcceptance :: " + (100.0 * møllersProcessed / eventsProcessed) + "%");
-		System.out.println("\tRate       :: " + (møllersProcessed * scale) + " Hz");
-		
-		System.out.println("Processed " + tridentsProcessed + " trident events");
-		System.out.println("\tAcceptance :: " + (100.0 * tridentsProcessed / eventsProcessed) + "%");
-		System.out.println("\tRate       :: " + (tridentsProcessed * scale) + " Hz");
-		
-		System.out.println("Processed " + gblMøllersProcessed + " track-only Møller events");
-		System.out.println("\tAcceptance :: " + (100.0 * gblMøllersProcessed / eventsProcessed) + "%");
-		System.out.println("\tRate       :: " + (gblMøllersProcessed * scale) + " Hz");
-		
-		System.out.println("Processed " + gblTridentsProcessed + " Rafo trident events");
-		System.out.println("\tAcceptance :: " + (100.0 * gblTridentsProcessed / eventsProcessed) + "%");
-		System.out.println("\tRate       :: " + (gblTridentsProcessed * scale) + " Hz");
-	}
-	
-	@Override
-	public void process(EventHeader event) {
-		// Check whether the SVT was active in this event and, if so,
-		// skip it. This can be disabled through the steering file for
-		// Monte Carlo data, where the "SVT" is always active.
-		if(checkSVT) {
-			final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
-			boolean svtGood = true;
-	        for(int i = 0; i < flagNames.length; i++) {
-	            int[] flag = event.getIntegerParameters().get(flagNames[i]);
-	            if(flag == null || flag[0] == 0) {
-	                svtGood = false;
-	            }
-	        }
-	        if(!svtGood) { return; }
-		}
+    private int eventsProcessed = 0;
+    private int møllersProcessed = 0;
+    private boolean checkSVT = false;
+    private int tridentsProcessed = 0;
+    private int gblMøllersProcessed = 0;
+    private int gblTridentsProcessed = 0;
+    private double timeCoincidence = 2.5;
+    private double elasticThreshold = 0.800;
+    private double møllerLowerRange = 0.900;
+    private double møllerUpperRange = 1.200;
+    private AIDA aida = AIDA.defaultInstance();
+    private boolean checkTriggerTimeWindow = false;
+    private String clusterCollectionName = "EcalClustersCorr";
+    private String particleCollectionName = "FinalStateParticles";
+    
+    // Define trident cluster-track matched condition plots.
+    private IHistogram1D trctmInvariantMass = aida.histogram1D("Tridents CTMatched/Invariant Mass", 140, 0.0, 0.070);
+    private IHistogram1D trctmInstancesInEvent = aida.histogram1D("Tridents CTMatched/Instances in Event", 9, 0.5, 9.5);
+    private IHistogram1D trctmEnergySum1D = aida.histogram1D("Tridents CTMatched/Cluster Energy Sum", 150, 0.000, 1.500);
+    private IHistogram1D trctmMomentumSum1D = aida.histogram1D("Tridents CTMatched/Track Momentum Sum", 150, 0.000, 1.500);
+    private IHistogram1D trctmElectronEnergy = aida.histogram1D("Tridents CTMatched/Electron Cluster Energy", 150, 0.000, 1.500);
+    private IHistogram1D trctmElectronMomentum = aida.histogram1D("Tridents CTMatched/Electron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram1D trctmPositronEnergy = aida.histogram1D("Tridents CTMatched/Positron Cluster Energy", 150, 0.000, 1.500);
+    private IHistogram1D trctmPositronMomentum = aida.histogram1D("Tridents CTMatched/Positron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram1D trctmTimeCoincidence = aida.histogram1D("Tridents CTMatched/Time Coincidence", 100, -4, 4);
+    private IHistogram2D trctmClusterPosition = aida.histogram2D("Tridents CTMatched/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram2D trctmEnergySum2D = aida.histogram2D("Tridents CTMatched/Cluster Energy Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D trctmTrackPosition = aida.histogram2D("Tridents CTMatched/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
+    private IHistogram2D trctmMomentumSum2D = aida.histogram2D("Tridents CTMatched/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D trctmESumCoplanarity = aida.histogram2D("Tridents CTMatched/Cluster Energy Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    private IHistogram2D trctmPSumCoplanarity = aida.histogram2D("Tridents CTMatched/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    
+    // Define the Møller cluster-track matched condition plots.
+    private IHistogram1D møctmInvariantMass = aida.histogram1D("Møller CTMatched/Invariant Mass", 140, 0.0, 0.070);
+    private IHistogram1D møctmInstancesInEvent = aida.histogram1D("Møller CTMatched/Instances in Event", 9, 0.5, 9.5);
+    private IHistogram1D møctmEnergySum1D = aida.histogram1D("Møller CTMatched/Cluster Energy Sum", 150, 0.000, 1.500);
+    private IHistogram1D møctmMomentumSum1D = aida.histogram1D("Møller CTMatched/Track Momentum Sum", 150, 0.000, 1.500);
+    private IHistogram1D møctmElectronEnergy = aida.histogram1D("Møller CTMatched/Electron Cluster Energy", 150, 0.000, 1.500);
+    private IHistogram1D møctmElectronMomentum = aida.histogram1D("Møller CTMatched/Electron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram1D møctmTimeCoincidence = aida.histogram1D("Møller CTMatched/Time Coincidence", 100, -4, 4);
+    private IHistogram2D møctmClusterPosition = aida.histogram2D("Møller CTMatched/Cluster Seed Position", 46, -23, 23, 11, -5.5, 5.5);
+    private IHistogram2D møctmEnergySum2D = aida.histogram2D("Møller CTMatched/Cluster Energy Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D møctmTrackPosition = aida.histogram2D("Møller CTMatched/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
+    private IHistogram2D møctmMomentumSum2D = aida.histogram2D("Møller CTMatched/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D møctmESumCoplanarity = aida.histogram2D("Møller CTMatched/Cluster Energy Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    private IHistogram2D møctmPSumCoplanarity = aida.histogram2D("Møller CTMatched/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    
+    // Define the Møller track-only condition plots.
+    private IHistogram1D møgblTimeCoincidence = aida.histogram1D("Møller Track-Only/Time Coincidence", 100, -4, 4);
+    private IHistogram1D møgblInvariantMass = aida.histogram1D("Møller Track-Only/Invariant Mass", 140, 0.0, 0.070);
+    private IHistogram1D møgblInstancesInEvent = aida.histogram1D("Møller Track-Only/Instances in Event", 9, 0.5, 9.5);
+    private IHistogram1D møgblMomentumSum1D = aida.histogram1D("Møller Track-Only/Track Momentum Sum", 150, 0.000, 1.500);
+    private IHistogram1D møgblElectronMomentum = aida.histogram1D("Møller Track-Only/Electron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram2D møgblTrackPosition = aida.histogram2D("Møller Track-Only/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
+    private IHistogram2D møgblMomentumSum2D = aida.histogram2D("Møller Track-Only/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D møgblPSumCoplanarity = aida.histogram2D("Møller Track-Only/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    
+    // Define the GBL trident condition plots.
+    private IHistogram1D trgblInvariantMass = aida.histogram1D("Tridents Track-Only/Invariant Mass", 140, 0.0, 0.070);
+    private IHistogram1D trgblInstancesInEvent = aida.histogram1D("Tridents Track-Only/Instances in Event", 9, 0.5, 9.5);
+    private IHistogram1D trgblMomentumSum1D = aida.histogram1D("Tridents Track-Only/Track Momentum Sum", 150, 0.000, 1.500);
+    private IHistogram1D trgblElectronMomentum = aida.histogram1D("Tridents Track-Only/Electron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram1D trgblPositronMomentum = aida.histogram1D("Tridents Track-Only/Positron Track Momentum", 150, 0.000, 1.500);
+    private IHistogram1D trgblTimeCoincidence = aida.histogram1D("Tridents Track-Only/Time Coincidence", 100, -4, 4);
+    private IHistogram2D trgblTrackPosition = aida.histogram2D("Tridents Track-Only/Extrapolated Track Position", 200, -400, 400, 55, -110, 110);
+    private IHistogram2D trgblMomentumSum2D = aida.histogram2D("Tridents Track-Only/Track Momentum Sum 2D", 300, 0.000, 1.500, 300, 0.000, 1.500);
+    private IHistogram2D trgblPSumCoplanarity = aida.histogram2D("Tridents Track-Only/Track Momentum Sum vs. Coplanarity", 300, 0.000, 1.500, 360, 0, 360);
+    
+    @Override
+    public void endOfData() {
+        // Calculate the scaling factor for Hertz.
+        double scale = 19000.0 / eventsProcessed;
+        
+        System.out.println("Processed " + eventsProcessed + " events.");
+        System.out.println("Processed " + møllersProcessed + " Møller events");
+        System.out.println("\tAcceptance :: " + (100.0 * møllersProcessed / eventsProcessed) + "%");
+        System.out.println("\tRate       :: " + (møllersProcessed * scale) + " Hz");
+        
+        System.out.println("Processed " + tridentsProcessed + " trident events");
+        System.out.println("\tAcceptance :: " + (100.0 * tridentsProcessed / eventsProcessed) + "%");
+        System.out.println("\tRate       :: " + (tridentsProcessed * scale) + " Hz");
+        
+        System.out.println("Processed " + gblMøllersProcessed + " track-only Møller events");
+        System.out.println("\tAcceptance :: " + (100.0 * gblMøllersProcessed / eventsProcessed) + "%");
+        System.out.println("\tRate       :: " + (gblMøllersProcessed * scale) + " Hz");
+        
+        System.out.println("Processed " + gblTridentsProcessed + " Rafo trident events");
+        System.out.println("\tAcceptance :: " + (100.0 * gblTridentsProcessed / eventsProcessed) + "%");
+        System.out.println("\tRate       :: " + (gblTridentsProcessed * scale) + " Hz");
+    }
+    
+    @Override
+    public void process(EventHeader event) {
+        // Check whether the SVT was active in this event and, if so,
+        // skip it. This can be disabled through the steering file for
+        // Monte Carlo data, where the "SVT" is always active.
+        if(checkSVT) {
+            final String[] flagNames = { "svt_bias_good", "svt_burstmode_noise_good", "svt_position_good" };
+            boolean svtGood = true;
+            for(int i = 0; i < flagNames.length; i++) {
+                int[] flag = event.getIntegerParameters().get(flagNames[i]);
+                if(flag == null || flag[0] == 0) {
+                    svtGood = false;
+                }
+            }
+            if(!svtGood) { return; }
+        }
         
         // Track the number of events with good SVT.
         eventsProcessed++;
         
-		// Check if the event has a collection of tracks. If it exists,
+        // Check if the event has a collection of tracks. If it exists,
         // extract it. Otherwise, skip the event.
-		if(!event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
-			return;
-		}
-		List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
-		
-		// Check if the event has a collection of clusters. If it
-		// exists, extract it. Otherwise, skip the event.
-		if(!event.hasCollection(Cluster.class, clusterCollectionName)) {
-			return;
-		}
-		List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-		
-		// Get cluster-track matched top/bottom pairs.
-		List<ReconstructedParticle[]> gblMatchedPairs = getTopBottomTracksGBL(trackList);
-		List<ReconstructedParticle[]> ctMatchedPairs  = getTopBottomTracksCTMatched(trackList);
-		
-		System.out.println("CTM Pairs :: " + ctMatchedPairs.size());
-		System.out.println("GBL Pairs :: " + gblMatchedPairs.size());
-		
-		// Get the trident and Møller tracks for the matched track
-		// and cluster pair condition sets.
-		List<ReconstructedParticle[]> møllers     = getMøllerTracksCTMatched(ctMatchedPairs);
-		List<ReconstructedParticle[]> møllersGBL  = getMøllerTracksGBL(gblMatchedPairs, event);
-		List<ReconstructedParticle[]> tridents    = getTridentTracksCTMatched(ctMatchedPairs);
-		List<ReconstructedParticle[]> tridentsGBL = getTridentClustersGBL(gblMatchedPairs, TriggerModule.getTopBottomPairs(clusterList, Cluster.class), event);
-		
-		// Track how many events had tridents and Møllers.
-		if(!møllers.isEmpty()) { møllersProcessed++; }
-		if(!tridents.isEmpty()) { tridentsProcessed++; }
-		if(!møllersGBL.isEmpty()) { gblMøllersProcessed++; }
-		if(!tridentsGBL.isEmpty()) { gblTridentsProcessed++; }
-		
-		// Produce Møller cluster-track matched plots.
-		møctmInstancesInEvent.fill(møllers.size());
-		for(ReconstructedParticle[] pair : møllers) {
-			// Get the track clusters.
-			Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			
-			// Populate the cluster plots.
-			møctmElectronEnergy.fill(trackClusters[0].getEnergy());
-			møctmElectronEnergy.fill(trackClusters[1].getEnergy());
-			møctmEnergySum1D.fill(TriggerModule.getValueEnergySum(trackClusters));
-			møctmEnergySum2D.fill(trackClusters[0].getEnergy(), trackClusters[1].getEnergy());
-			møctmESumCoplanarity.fill(TriggerModule.getValueEnergySum(trackClusters), getCalculatedCoplanarity(trackClusters));
-			møctmTimeCoincidence.fill(TriggerModule.getClusterTime(trackClusters[0]) - TriggerModule.getClusterTime(trackClusters[1]));
-			møctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[0]), TriggerModule.getClusterYIndex(trackClusters[0]));
-			møctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[1]), TriggerModule.getClusterYIndex(trackClusters[1]));
-			
-			// Populate the momentum plots.
-			møctmInvariantMass.fill(getInvariantMass(pair));
-			møctmElectronMomentum.fill(pair[0].getMomentum().magnitude());
-			møctmElectronMomentum.fill(pair[1].getMomentum().magnitude());
-			møctmMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
-			møctmMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-			møctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
-			møctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
-			møctmPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
-					getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
-		}
-		
-		// Produce trident cluster-track matched plots.
-		trctmInstancesInEvent.fill(tridents.size());
-		for(ReconstructedParticle[] pair : tridents) {
-			// Get the electron and positron tracks.
-			ReconstructedParticle electronTrack = pair[pair[0].getCharge() < 0 ? 0 : 1];
-			ReconstructedParticle positronTrack = pair[pair[0].getCharge() > 0 ? 0 : 1];
-			
-			// Get the track clusters.
-			Cluster electronCluster = electronTrack.getClusters().get(0);
-			Cluster positronCluster = positronTrack.getClusters().get(0);
-			Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			
-			// Populate the cluster plots.
-			trctmElectronEnergy.fill(electronCluster.getEnergy());
-			trctmPositronEnergy.fill(positronCluster.getEnergy());
-			trctmEnergySum2D.fill(pair[0].getEnergy(), pair[1].getEnergy());
-			trctmEnergySum1D.fill(TriggerModule.getValueEnergySum(trackClusters));
-			trctmESumCoplanarity.fill(TriggerModule.getValueEnergySum(trackClusters), getCalculatedCoplanarity(trackClusters));
-			trctmTimeCoincidence.fill(TriggerModule.getClusterTime(trackClusters[0]) - TriggerModule.getClusterTime(trackClusters[1]));
-			trctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[0]), TriggerModule.getClusterYIndex(trackClusters[0]));
-			trctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[1]), TriggerModule.getClusterYIndex(trackClusters[1]));
-			
-			// Populate the momentum plots.
-			trctmInvariantMass.fill(getInvariantMass(pair));
-			trctmElectronMomentum.fill(electronTrack.getMomentum().magnitude());
-			trctmPositronMomentum.fill(positronTrack.getMomentum().magnitude());
-			trctmMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
-			trctmMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-			trctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
-			trctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
-			trctmPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
-					getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
-		}
-		
-		// Produce the Møller track-only plots.
-		møgblInstancesInEvent.fill(møllersGBL.size());
-		RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
-		RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
-		for(ReconstructedParticle pair[] : møllersGBL) {
-			// Get the tracks and track times.
-			Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
-			double times[] = {
-					TrackUtils.getTrackTime(tracks[0], hitToStrips, hitToRotated),
-					TrackUtils.getTrackTime(tracks[1], hitToStrips, hitToRotated)	
-			};
-			
-			// Fill the plots.
-			møgblTimeCoincidence.fill(times[0] - times[1]);
-			møgblInvariantMass.fill(getInvariantMass(pair));
-			møgblElectronMomentum.fill(pair[0].getMomentum().magnitude());
-			møgblElectronMomentum.fill(pair[1].getMomentum().magnitude());
-			møgblMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
-			møgblMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-			møgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
-			møgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
-			møgblPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
-					getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
-		}
-		
-		// Produce track-only trident plots.
-		trgblInstancesInEvent.fill(tridentsGBL.size());
-		for(ReconstructedParticle[] pair : tridentsGBL) {
-			// Get the tracks and track times.
-			Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
-			double times[] = {
-					TrackUtils.getTrackTime(tracks[0], hitToStrips, hitToRotated),
-					TrackUtils.getTrackTime(tracks[1], hitToStrips, hitToRotated)	
-			};
-			
-			// Get the positron and the electron.
-			ReconstructedParticle positron = pair[0].getCharge() > 0 ? pair[0] : pair[1];
-			ReconstructedParticle electron = pair[0].getCharge() < 0 ? pair[0] : pair[1];
-			
-			// Fill the plots.
-			trgblTimeCoincidence.fill(times[0] - times[1]);
-			trgblInvariantMass.fill(getInvariantMass(pair));
-			trgblElectronMomentum.fill(electron.getMomentum().magnitude());
-			trgblPositronMomentum.fill(positron.getMomentum().magnitude());
-			trgblMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
-			trgblMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
-			trgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
-			trgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
-			trgblPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
-					getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
-		}
-	}
-	
-	public void setCheckSVT(boolean state) {
-		checkSVT = state;
-	}
-	
-	public void setCheckTriggerTimeWindow(boolean state) {
-		checkTriggerTimeWindow = state;
-	}
-	
-	/**
-	 * Gets a list of all possible GBL top/bottom track pairs. These
-	 * tracks are not guaranteed to have a matched cluster.
-	 * @param trackList - A list of all possible tracks.
-	 * @return Returns a list of track pairs.
-	 */
-	private static final List<ReconstructedParticle[]> getTopBottomTracksGBL(List<ReconstructedParticle> trackList) {
-		// Separate the tracks into top and bottom tracks based on
-		// the value of tan(Λ). Use only GBL tracks to avoid track
-		// duplication.
-		List<ReconstructedParticle> topTracks = new ArrayList<ReconstructedParticle>();
-		List<ReconstructedParticle> botTracks = new ArrayList<ReconstructedParticle>();
-		trackLoop:
-		for(ReconstructedParticle track : trackList) {
-			// Require that the ReconstructedParticle contain an actual
-			// Track object.
-			if(track.getTracks().isEmpty()) {
-				continue trackLoop;
-			}
-			
-			// Ignore tracks that are not GBL tracks.
-			if(!TrackType.isGBL(track.getType())) {
-				continue trackLoop;
-			}
-			
-			// If the above tests pass, the ReconstructedParticle has
-			// a track and is also a GBL track. Separate it into either
-			// a top or a bottom track based on its tan(Λ) value.
-			if(track.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) {
-				topTracks.add(track);
-			} else {
-				botTracks.add(track);
-			}
-		}
-		
-		// Form all top/bottom pairs with the unique tracks.
-		List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
-		for(ReconstructedParticle topTrack : topTracks) {
-			for(ReconstructedParticle botTrack : botTracks) {
-				pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
-			}
-		}
-		
-		// Return the result.
-		return pairList;
-	}
-	
-	/**
-	 * Produces pairs of tracks. The track pairs are required to be
-	 * matched to a cluster and the associated clusters must form a
-	 * top/bottom pair. If more than one track points to the same
-	 * cluster, only the first track is retained.
-	 * @param trackList - A list of all tracks.
-	 * @return Returns a list of track pairs meeting the aforementioned
-	 * conditions.
-	 */
-	private static final List<ReconstructedParticle[]> getTopBottomTracksCTMatched(List<ReconstructedParticle> trackList) {
-		// Track clusters that have already been seen to prevent clusters
-		// that have duplicate tracks from reappearing.
-		Set<Cluster> clusterSet = new HashSet<Cluster>();
-		
-		// Separate the tracks into top and bottom tracks based on
-		// the track cluster. Filter out tracks with no clusters.
-		List<ReconstructedParticle> topTracks = new ArrayList<ReconstructedParticle>();
-		List<ReconstructedParticle> botTracks = new ArrayList<ReconstructedParticle>();
-		trackLoop:
-		for(ReconstructedParticle track : trackList) {
-			// Check if the track has a cluster. If not, skip it.
-			if(track.getClusters().isEmpty()) {
-				continue trackLoop;
-			}
-			
-			// If the track doesn't have actual tracks, skip it.
-			if(track.getTracks().isEmpty()) {
-				continue trackLoop;
-			}
-			
-			// Check if the track cluster has already seen.
-			Cluster trackCluster = track.getClusters().get(0);
-			if(clusterSet.contains(trackCluster)) {
-				continue trackLoop;
-			}
-			
-			// If the track has a unique cluster, add it to the proper
-			// list based on the cluster y-index.
-			clusterSet.add(trackCluster);
-			if(TriggerModule.getClusterYIndex(trackCluster) > 0) {
-				topTracks.add(track);
-			} else {
-				botTracks.add(track);
-			}
-		}
-		
-		// Form all top/bottom pairs with the unique tracks.
-		List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
-		for(ReconstructedParticle topTrack : topTracks) {
-			for(ReconstructedParticle botTrack : botTracks) {
-				pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
-			}
-		}
-		
-		// Return the result.
-		return pairList;
-	}
-	
-	private final List<ReconstructedParticle[]> getTridentClustersGBL(List<ReconstructedParticle[]> pairList, List<Cluster[]> clusterList, EventHeader event) {
-		// Store the set of track pairs that meet the trident condition.
-		List<ReconstructedParticle[]> tridentTracks = new ArrayList<ReconstructedParticle[]>();
-		
-		// Extract track relational tables from the event object.
-		RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
-		RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
-		
-		// Tracks will not be considered for trident analysis unless there
-		// is at least one top/bottom cluster pair within the time window.
-		boolean passesClusterCondition = false;
-		tridentClusterLoop:
-		for(Cluster[] pair : clusterList) {
-			// Ignore clusters that are too far apart temporally.
-			if(TriggerModule.getValueTimeCoincidence(pair) > timeCoincidence) {
-				continue tridentClusterLoop;
-			}
-			
-			// Require that the cluster pair be top/bottom.
-			boolean hasTop = TriggerModule.getClusterYIndex(pair[0]) > 0 || TriggerModule.getClusterYIndex(pair[1]) > 0;
-			boolean hasBot = TriggerModule.getClusterYIndex(pair[0]) < 0 || TriggerModule.getClusterYIndex(pair[1]) < 0;
-			if(!hasTop || !hasBot) {
-				continue tridentClusterLoop;
-			}
-			
-			// If the cluster passes, mark that it has done so and skip
-			// the rest. Only one pair need pass.
-			passesClusterCondition = true;
-			break tridentClusterLoop;
-		}
-		
-		// If no cluster pair passed the cluster condition, no tracks
-		// are allowed to pass either.
-		if(!passesClusterCondition) {
-			return tridentTracks;
-		}
-		
-		// Next, check the track pair list. A track pair must have a
-		// positive and a negative track and must also be within the
-		// time coincidence window.
-		tridentTrackLoop:
-		for(ReconstructedParticle[] pair : pairList) {
-			// Check that there is at least one positive and one negative
-			// track in the pair.
-			boolean hasPositive = pair[0].getCharge() > 0 || pair[1].getCharge() > 0;
-			boolean hasNegative = pair[0].getCharge() < 0 || pair[1].getCharge() < 0;
-			if(!hasPositive || !hasNegative) {
-				break tridentTrackLoop;
-			}
-			
-			// Check that the track pair passes the time cut.
-			double times[] = {
-				TrackUtils.getTrackTime(pair[0].getTracks().get(0), hitToStrips, hitToRotated),
-				TrackUtils.getTrackTime(pair[1].getTracks().get(0), hitToStrips, hitToRotated)	
-			};
-			
-			if(Math.abs(times[0] - times[1]) > timeCoincidence) {
-				continue tridentTrackLoop;
-			}
-			
-			// Require that the negative track have less than the
-			// elastic threshold momentum to exclude elastic electrons.
-			if(pair[0].getCharge() < 0 && pair[0].getMomentum().magnitude() > elasticThreshold
-					|| pair[1].getCharge() < 0 && pair[1].getMomentum().magnitude() > elasticThreshold) {
-				continue tridentTrackLoop;
-			}
-			
-			// If the track passes both, it is considered a trident pair.
-			tridentTracks.add(pair);
-		}
-		
-		// Return the resultant pairs.
-		return tridentTracks;
-	}
-	
-	/**
-	 * Gets a list track pairs that meet the trident condition defined
-	 * using tracks with matched calorimeter clusters. A pair meets the
-	 * cluster/track matched trident condition is it meets the following:
-	 * <ul><li>Both tracks have matched clusters.</li>
-	 * <li>Has one positive track.</li>
-	 * <li>Has one negative track.</li>
-	 * <li>Clusters have a time coincidence of 2.5 ns or less.</li>
-	 * <li>The electron momentum is below 900 MeV.</li></ul>
-	 * @param pairList - A <code>List</code> collection of parameterized
-	 * type <code>ReconstructedParticle[]</code> containing all valid
-	 * top/bottom pairs of tracks with matched clusters. These will be
-	 * tested to see if they meet the process criteria.
-	 * @return Returns a list containing pairs of tracks that meet the
-	 * trident condition.
-	 */
-	private final List<ReconstructedParticle[]> getTridentTracksCTMatched(List<ReconstructedParticle[]> pairList) {
-		// Store the set of track pairs that meet the trident condition.
-		List<ReconstructedParticle[]> tridentTracks = new ArrayList<ReconstructedParticle[]>();
-		
-		// Loop over the filtered pair list and apply the trident
-		// condition test.
-		tridentLoop:
-		for(ReconstructedParticle[] pair : pairList) {
-			// There must be one positive and one negative track.
-			ReconstructedParticle electron = null;
-			ReconstructedParticle positron = null;
-			if(pair[0].getCharge() > 0) { positron = pair[0]; }
-			else if(pair[1].getCharge() > 0) { positron = pair[1]; }
-			if(pair[0].getCharge() < 0) { electron = pair[0]; }
-			else if(pair[1].getCharge() < 0) { electron = pair[1]; }
-			if(electron == null || positron == null) {
-				continue tridentLoop;
-			}
-			
-			// Make sure that the clusters are not the same. This should
-			// not actually ever be possible...
-			if(pair[0].getClusters().get(0) == pair[1].getClusters().get(0)) {
-				continue tridentLoop;
-			}
-			
-			// The clusters must within a limited time window.
-			/*
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			if(TriggerModule.getValueTimeCoincidence(trackClusters) > timeCoincidence) {
-				continue tridentLoop;
-			}
-			*/
-			
-			// The clusters must be coincidental within an energy
-			// dependent coincidence window.
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			if(!isCoincidental(trackClusters)) {
-				continue tridentLoop;
-			}
-			
-			// Require that the electron in the pair have an energy
-			// below the elastic threshold to exclude elastic electrons.
-			if(electron.getMomentum().magnitude() >= elasticThreshold) {
-				continue tridentLoop;
-			}
-			
-			// Require that all clusters occur within the trigger time
-			// window to exclude accidentals.
-			if(checkTriggerTimeWindow) {
-				if(!inTriggerWindow(trackClusters[0]) || !inTriggerWindow(trackClusters[1])) {
-					continue tridentLoop;
-				}
-			}
-			
-			// If all the above conditions are met, the pair is to be
-			// considered a trident pair. Add it to the list.
-			tridentTracks.add(pair);
-		}
-		
-		// Return the list of pairs that passed the condition.
-		return tridentTracks;
-	}
-	
-	private final List<ReconstructedParticle[]> getMøllerTracksGBL(List<ReconstructedParticle[]> pairList, EventHeader event) {
-		// Store the set of track pairs that meet the Møller condition.
-		List<ReconstructedParticle[]> møllerTracks = new ArrayList<ReconstructedParticle[]>();
-		
-		// Extract track relational tables from the event object.
-		RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
-		RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
-		
-		// Loop over the filtered pair list and apply the Møller
-		// condition test.
-		møllerLoop:
-		for(ReconstructedParticle[] pair : pairList) {
-			// Both tracks must be negatively charged.
-			if(pair[0].getCharge() > 0 || pair[1].getCharge() > 0) {
-				continue møllerLoop;
-			}
-			
-			// The clusters must within a limited time window.
-			double times[] = {
-				TrackUtils.getTrackTime(pair[0].getTracks().get(0), hitToStrips, hitToRotated),
-				TrackUtils.getTrackTime(pair[1].getTracks().get(0), hitToStrips, hitToRotated)	
-			};
-			
-			if(Math.abs(times[0] - times[1]) > timeCoincidence) {
-				continue møllerLoop;
-			}
-			
-			// Require that the electrons in the pair have energies
-			// below the elastic threshold to exclude said electrons.
-			if(pair[0].getMomentum().magnitude() > elasticThreshold || pair[1].getMomentum().magnitude() > elasticThreshold) {
-				continue møllerLoop;
-			}
-			
-			// Require that the energy of the pair be within a range
-			// that is sufficiently "Møller-like."
-			double momentumSum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
-			if(momentumSum < møllerLowerRange || momentumSum > møllerUpperRange) {
-				continue møllerLoop;
-			}
-			
-			// If all the above conditions are met, the pair is to be
-			// considered a trident pair. Add it to the list.
-			møllerTracks.add(pair);
-		}
-		
-		// Return the list of pairs that passed the condition.
-		return møllerTracks;
-	}
-	
-	/**
-	 * Gets a list track pairs that meet the Møller condition defined
-	 * using tracks with matched calorimeter clusters. A pair meets the
-	 * cluster/track matched Møller condition is it meets the following:
-	 * <ul><li>Both tracks have matched clusters.</li>
-	 * <li>Both tracks are negative.</li>
-	 * <li>Clusters have a time coincidence of 2.5 ns or less.</li>
-	 * <li>The electron momenta are below 900 MeV.</li>
-	 * <li>The momentum sum of the tracks is in the range <code>800 MeV
-	 * ≤ p1 + p2 ≤ 1500 MeV</li></ul>
-	 * @param pairList - A <code>List</code> collection of parameterized
-	 * type <code>ReconstructedParticle[]</code> containing all valid
-	 * top/bottom pairs of tracks with matched clusters. These will be
-	 * tested to see if they meet the process criteria.
-	 * @return Returns a list containing pairs of tracks that meet the
-	 * Møller condition.
-	 */
-	private final List<ReconstructedParticle[]> getMøllerTracksCTMatched(List<ReconstructedParticle[]> pairList) {
-		// Store the set of track pairs that meet the Møller condition.
-		List<ReconstructedParticle[]> møllerTracks = new ArrayList<ReconstructedParticle[]>();
-		
-		// Loop over the filtered pair list and apply the Møller
-		// condition test.
-		møllerLoop:
-		for(ReconstructedParticle[] pair : pairList) {
-			// Both tracks must be negatively charged.
-			if(pair[0].getCharge() > 0 || pair[1].getCharge() > 0) {
-				continue møllerLoop;
-			}
-			
-			// The clusters must within a limited time window.
-			/*
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			if(TriggerModule.getValueTimeCoincidence(trackClusters) > timeCoincidence) {
-				continue møllerLoop;
-			}
-			*/
-			
-			// The clusters must be coincidental within an energy
-			// dependent coincidence window.
-			Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
-			if(!isCoincidental(trackClusters)) {
-				continue møllerLoop;
-			}
-			
-			// Require that the electrons in the pair have energies
-			// below the elastic threshold to exclude said electrons.
-			if(pair[0].getMomentum().magnitude() > elasticThreshold || pair[1].getMomentum().magnitude() > elasticThreshold) {
-				continue møllerLoop;
-			}
-			
-			// Require that the energy of the pair be within a range
-			// that is sufficiently "Møller-like."
-			double momentumSum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
-			if(momentumSum < møllerLowerRange || momentumSum > møllerUpperRange) {
-				continue møllerLoop;
-			}
-			
-			// Require that all clusters occur within the trigger time
-			// window to exclude accidentals.
-			if(checkTriggerTimeWindow) {
-				if(!inTriggerWindow(trackClusters[0]) || !inTriggerWindow(trackClusters[1])) {
-					continue møllerLoop;
-				}
-			}
-			
-			// If all the above conditions are met, the pair is to be
-			// considered a trident pair. Add it to the list.
-			møllerTracks.add(pair);
-		}
-		
-		// Return the list of pairs that passed the condition.
-		return møllerTracks;
-	}
-	
-	/**
-	 * Calculates the approximate invariant mass for a pair of tracks
-	 * from their momentum. This assumes that the particles are either
-	 * electrons or positrons, and thusly have a sufficiently small
-	 * mass term that it can be safely excluded.
-	 * @param pair - The track pair for which to calculate the invariant
-	 * mass.
-	 * @return Returns the approximate invariant mass in units of GeV.
-	 */
-	private static final double getInvariantMass(ReconstructedParticle[] pair) {
-		// Get the momentum squared.
-		double p2 = Math.pow(pair[0].getMomentum().magnitude() + pair[1].getMomentum().magnitude(), 2);
-		
-		// Get the remaining terms.
-		double xPro = pair[0].getMomentum().x() + pair[1].getMomentum().x();
-		double yPro = pair[0].getMomentum().y() + pair[1].getMomentum().y();
-		double zPro = pair[0].getMomentum().z() + pair[1].getMomentum().z();
-		
-		// Calculate the invariant mass.
-		return Math.sqrt(p2 - Math.pow(xPro, 2) - Math.pow(yPro, 2) - Math.pow(zPro, 2));
-	}
-	
-	/**
-	 * Calculates the coplanarity angle between two points, specified
-	 * by a double array. The array must be of the format (x, y, z).
-	 * @param position - The first position array.
-	 * @param otherPosition - The second position array.
-	 * @return Returns the coplanarity angle between the points in units
-	 * of degrees.
-	 */
-	private static final double getCalculatedCoplanarity(double[] position, double[] otherPosition) {
-		// Define the x- and y-coordinates of the clusters as well as
-		// calorimeter center.
-		final double ORIGIN_X = 42.52;
-		double x[] = { position[0], otherPosition[0] };
-		double y[] = { position[1], otherPosition[1] };
-		
+        if(!event.hasCollection(ReconstructedParticle.class, particleCollectionName)) {
+            return;
+        }
+        List<ReconstructedParticle> trackList = event.get(ReconstructedParticle.class, particleCollectionName);
+        
+        // Check if the event has a collection of clusters. If it
+        // exists, extract it. Otherwise, skip the event.
+        if(!event.hasCollection(Cluster.class, clusterCollectionName)) {
+            return;
+        }
+        List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+        
+        // Get cluster-track matched top/bottom pairs.
+        List<ReconstructedParticle[]> gblMatchedPairs = getTopBottomTracksGBL(trackList);
+        List<ReconstructedParticle[]> ctMatchedPairs  = getTopBottomTracksCTMatched(trackList);
+        
+        System.out.println("CTM Pairs :: " + ctMatchedPairs.size());
+        System.out.println("GBL Pairs :: " + gblMatchedPairs.size());
+        
+        // Get the trident and Møller tracks for the matched track
+        // and cluster pair condition sets.
+        List<ReconstructedParticle[]> møllers     = getMøllerTracksCTMatched(ctMatchedPairs);
+        List<ReconstructedParticle[]> møllersGBL  = getMøllerTracksGBL(gblMatchedPairs, event);
+        List<ReconstructedParticle[]> tridents    = getTridentTracksCTMatched(ctMatchedPairs);
+        List<ReconstructedParticle[]> tridentsGBL = getTridentClustersGBL(gblMatchedPairs, TriggerModule.getTopBottomPairs(clusterList, Cluster.class), event);
+        
+        // Track how many events had tridents and Møllers.
+        if(!møllers.isEmpty()) { møllersProcessed++; }
+        if(!tridents.isEmpty()) { tridentsProcessed++; }
+        if(!møllersGBL.isEmpty()) { gblMøllersProcessed++; }
+        if(!tridentsGBL.isEmpty()) { gblTridentsProcessed++; }
+        
+        // Produce Møller cluster-track matched plots.
+        møctmInstancesInEvent.fill(møllers.size());
+        for(ReconstructedParticle[] pair : møllers) {
+            // Get the track clusters.
+            Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            
+            // Populate the cluster plots.
+            møctmElectronEnergy.fill(trackClusters[0].getEnergy());
+            møctmElectronEnergy.fill(trackClusters[1].getEnergy());
+            møctmEnergySum1D.fill(TriggerModule.getValueEnergySum(trackClusters));
+            møctmEnergySum2D.fill(trackClusters[0].getEnergy(), trackClusters[1].getEnergy());
+            møctmESumCoplanarity.fill(TriggerModule.getValueEnergySum(trackClusters), getCalculatedCoplanarity(trackClusters));
+            møctmTimeCoincidence.fill(TriggerModule.getClusterTime(trackClusters[0]) - TriggerModule.getClusterTime(trackClusters[1]));
+            møctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[0]), TriggerModule.getClusterYIndex(trackClusters[0]));
+            møctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[1]), TriggerModule.getClusterYIndex(trackClusters[1]));
+            
+            // Populate the momentum plots.
+            møctmInvariantMass.fill(getInvariantMass(pair));
+            møctmElectronMomentum.fill(pair[0].getMomentum().magnitude());
+            møctmElectronMomentum.fill(pair[1].getMomentum().magnitude());
+            møctmMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
+            møctmMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+            møctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
+            møctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
+            møctmPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
+                    getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
+        }
+        
+        // Produce trident cluster-track matched plots.
+        trctmInstancesInEvent.fill(tridents.size());
+        for(ReconstructedParticle[] pair : tridents) {
+            // Get the electron and positron tracks.
+            ReconstructedParticle electronTrack = pair[pair[0].getCharge() < 0 ? 0 : 1];
+            ReconstructedParticle positronTrack = pair[pair[0].getCharge() > 0 ? 0 : 1];
+            
+            // Get the track clusters.
+            Cluster electronCluster = electronTrack.getClusters().get(0);
+            Cluster positronCluster = positronTrack.getClusters().get(0);
+            Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            
+            // Populate the cluster plots.
+            trctmElectronEnergy.fill(electronCluster.getEnergy());
+            trctmPositronEnergy.fill(positronCluster.getEnergy());
+            trctmEnergySum2D.fill(pair[0].getEnergy(), pair[1].getEnergy());
+            trctmEnergySum1D.fill(TriggerModule.getValueEnergySum(trackClusters));
+            trctmESumCoplanarity.fill(TriggerModule.getValueEnergySum(trackClusters), getCalculatedCoplanarity(trackClusters));
+            trctmTimeCoincidence.fill(TriggerModule.getClusterTime(trackClusters[0]) - TriggerModule.getClusterTime(trackClusters[1]));
+            trctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[0]), TriggerModule.getClusterYIndex(trackClusters[0]));
+            trctmClusterPosition.fill(TriggerModule.getClusterXIndex(trackClusters[1]), TriggerModule.getClusterYIndex(trackClusters[1]));
+            
+            // Populate the momentum plots.
+            trctmInvariantMass.fill(getInvariantMass(pair));
+            trctmElectronMomentum.fill(electronTrack.getMomentum().magnitude());
+            trctmPositronMomentum.fill(positronTrack.getMomentum().magnitude());
+            trctmMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
+            trctmMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+            trctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
+            trctmTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
+            trctmPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
+                    getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
+        }
+        
+        // Produce the Møller track-only plots.
+        møgblInstancesInEvent.fill(møllersGBL.size());
+        RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
+        RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
+        for(ReconstructedParticle pair[] : møllersGBL) {
+            // Get the tracks and track times.
+            Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
+            double times[] = {
+                    TrackUtils.getTrackTime(tracks[0], hitToStrips, hitToRotated),
+                    TrackUtils.getTrackTime(tracks[1], hitToStrips, hitToRotated)   
+            };
+            
+            // Fill the plots.
+            møgblTimeCoincidence.fill(times[0] - times[1]);
+            møgblInvariantMass.fill(getInvariantMass(pair));
+            møgblElectronMomentum.fill(pair[0].getMomentum().magnitude());
+            møgblElectronMomentum.fill(pair[1].getMomentum().magnitude());
+            møgblMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
+            møgblMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+            møgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
+            møgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
+            møgblPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
+                    getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
+        }
+        
+        // Produce track-only trident plots.
+        trgblInstancesInEvent.fill(tridentsGBL.size());
+        for(ReconstructedParticle[] pair : tridentsGBL) {
+            // Get the tracks and track times.
+            Track[] tracks = { pair[0].getTracks().get(0), pair[1].getTracks().get(0) };
+            double times[] = {
+                    TrackUtils.getTrackTime(tracks[0], hitToStrips, hitToRotated),
+                    TrackUtils.getTrackTime(tracks[1], hitToStrips, hitToRotated)   
+            };
+            
+            // Get the positron and the electron.
+            ReconstructedParticle positron = pair[0].getCharge() > 0 ? pair[0] : pair[1];
+            ReconstructedParticle electron = pair[0].getCharge() < 0 ? pair[0] : pair[1];
+            
+            // Fill the plots.
+            trgblTimeCoincidence.fill(times[0] - times[1]);
+            trgblInvariantMass.fill(getInvariantMass(pair));
+            trgblElectronMomentum.fill(electron.getMomentum().magnitude());
+            trgblPositronMomentum.fill(positron.getMomentum().magnitude());
+            trgblMomentumSum1D.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude());
+            trgblMomentumSum2D.fill(pair[0].getMomentum().magnitude(), pair[1].getMomentum().magnitude());
+            trgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[0]).x(), TrackUtils.getTrackPositionAtEcal(tracks[0]).y());
+            trgblTrackPosition.fill(TrackUtils.getTrackPositionAtEcal(tracks[1]).x(), TrackUtils.getTrackPositionAtEcal(tracks[1]).y());
+            trgblPSumCoplanarity.fill(VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude(),
+                    getCalculatedCoplanarity(new Track[] { pair[0].getTracks().get(0), pair[1].getTracks().get(0) }));
+        }
+    }
+    
+    public void setCheckSVT(boolean state) {
+        checkSVT = state;
+    }
+    
+    public void setCheckTriggerTimeWindow(boolean state) {
+        checkTriggerTimeWindow = state;
+    }
+    
+    /**
+     * Gets a list of all possible GBL top/bottom track pairs. These
+     * tracks are not guaranteed to have a matched cluster.
+     * @param trackList - A list of all possible tracks.
+     * @return Returns a list of track pairs.
+     */
+    private static final List<ReconstructedParticle[]> getTopBottomTracksGBL(List<ReconstructedParticle> trackList) {
+        // Separate the tracks into top and bottom tracks based on
+        // the value of tan(Λ). Use only GBL tracks to avoid track
+        // duplication.
+        List<ReconstructedParticle> topTracks = new ArrayList<ReconstructedParticle>();
+        List<ReconstructedParticle> botTracks = new ArrayList<ReconstructedParticle>();
+        trackLoop:
+        for(ReconstructedParticle track : trackList) {
+            // Require that the ReconstructedParticle contain an actual
+            // Track object.
+            if(track.getTracks().isEmpty()) {
+                continue trackLoop;
+            }
+            
+            // Ignore tracks that are not GBL tracks.
+            if(!TrackType.isGBL(track.getType())) {
+                continue trackLoop;
+            }
+            
+            // If the above tests pass, the ReconstructedParticle has
+            // a track and is also a GBL track. Separate it into either
+            // a top or a bottom track based on its tan(Λ) value.
+            if(track.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) {
+                topTracks.add(track);
+            } else {
+                botTracks.add(track);
+            }
+        }
+        
+        // Form all top/bottom pairs with the unique tracks.
+        List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
+        for(ReconstructedParticle topTrack : topTracks) {
+            for(ReconstructedParticle botTrack : botTracks) {
+                pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
+            }
+        }
+        
+        // Return the result.
+        return pairList;
+    }
+    
+    /**
+     * Produces pairs of tracks. The track pairs are required to be
+     * matched to a cluster and the associated clusters must form a
+     * top/bottom pair. If more than one track points to the same
+     * cluster, only the first track is retained.
+     * @param trackList - A list of all tracks.
+     * @return Returns a list of track pairs meeting the aforementioned
+     * conditions.
+     */
+    private static final List<ReconstructedParticle[]> getTopBottomTracksCTMatched(List<ReconstructedParticle> trackList) {
+        // Track clusters that have already been seen to prevent clusters
+        // that have duplicate tracks from reappearing.
+        Set<Cluster> clusterSet = new HashSet<Cluster>();
+        
+        // Separate the tracks into top and bottom tracks based on
+        // the track cluster. Filter out tracks with no clusters.
+        List<ReconstructedParticle> topTracks = new ArrayList<ReconstructedParticle>();
+        List<ReconstructedParticle> botTracks = new ArrayList<ReconstructedParticle>();
+        trackLoop:
+        for(ReconstructedParticle track : trackList) {
+            // Check if the track has a cluster. If not, skip it.
+            if(track.getClusters().isEmpty()) {
+                continue trackLoop;
+            }
+            
+            // If the track doesn't have actual tracks, skip it.
+            if(track.getTracks().isEmpty()) {
+                continue trackLoop;
+            }
+            
+            // Check if the track cluster has already seen.
+            Cluster trackCluster = track.getClusters().get(0);
+            if(clusterSet.contains(trackCluster)) {
+                continue trackLoop;
+            }
+            
+            // If the track has a unique cluster, add it to the proper
+            // list based on the cluster y-index.
+            clusterSet.add(trackCluster);
+            if(TriggerModule.getClusterYIndex(trackCluster) > 0) {
+                topTracks.add(track);
+            } else {
+                botTracks.add(track);
+            }
+        }
+        
+        // Form all top/bottom pairs with the unique tracks.
+        List<ReconstructedParticle[]> pairList = new ArrayList<ReconstructedParticle[]>();
+        for(ReconstructedParticle topTrack : topTracks) {
+            for(ReconstructedParticle botTrack : botTracks) {
+                pairList.add(new ReconstructedParticle[] { topTrack, botTrack });
+            }
+        }
+        
+        // Return the result.
+        return pairList;
+    }
+    
+    private final List<ReconstructedParticle[]> getTridentClustersGBL(List<ReconstructedParticle[]> pairList, List<Cluster[]> clusterList, EventHeader event) {
+        // Store the set of track pairs that meet the trident condition.
+        List<ReconstructedParticle[]> tridentTracks = new ArrayList<ReconstructedParticle[]>();
+        
+        // Extract track relational tables from the event object.
+        RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
+        RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
+        
+        // Tracks will not be considered for trident analysis unless there
+        // is at least one top/bottom cluster pair within the time window.
+        boolean passesClusterCondition = false;
+        tridentClusterLoop:
+        for(Cluster[] pair : clusterList) {
+            // Ignore clusters that are too far apart temporally.
+            if(TriggerModule.getValueTimeCoincidence(pair) > timeCoincidence) {
+                continue tridentClusterLoop;
+            }
+            
+            // Require that the cluster pair be top/bottom.
+            boolean hasTop = TriggerModule.getClusterYIndex(pair[0]) > 0 || TriggerModule.getClusterYIndex(pair[1]) > 0;
+            boolean hasBot = TriggerModule.getClusterYIndex(pair[0]) < 0 || TriggerModule.getClusterYIndex(pair[1]) < 0;
+            if(!hasTop || !hasBot) {
+                continue tridentClusterLoop;
+            }
+            
+            // If the cluster passes, mark that it has done so and skip
+            // the rest. Only one pair need pass.
+            passesClusterCondition = true;
+            break tridentClusterLoop;
+        }
+        
+        // If no cluster pair passed the cluster condition, no tracks
+        // are allowed to pass either.
+        if(!passesClusterCondition) {
+            return tridentTracks;
+        }
+        
+        // Next, check the track pair list. A track pair must have a
+        // positive and a negative track and must also be within the
+        // time coincidence window.
+        tridentTrackLoop:
+        for(ReconstructedParticle[] pair : pairList) {
+            // Check that there is at least one positive and one negative
+            // track in the pair.
+            boolean hasPositive = pair[0].getCharge() > 0 || pair[1].getCharge() > 0;
+            boolean hasNegative = pair[0].getCharge() < 0 || pair[1].getCharge() < 0;
+            if(!hasPositive || !hasNegative) {
+                break tridentTrackLoop;
+            }
+            
+            // Check that the track pair passes the time cut.
+            double times[] = {
+                TrackUtils.getTrackTime(pair[0].getTracks().get(0), hitToStrips, hitToRotated),
+                TrackUtils.getTrackTime(pair[1].getTracks().get(0), hitToStrips, hitToRotated)  
+            };
+            
+            if(Math.abs(times[0] - times[1]) > timeCoincidence) {
+                continue tridentTrackLoop;
+            }
+            
+            // Require that the negative track have less than the
+            // elastic threshold momentum to exclude elastic electrons.
+            if(pair[0].getCharge() < 0 && pair[0].getMomentum().magnitude() > elasticThreshold
+                    || pair[1].getCharge() < 0 && pair[1].getMomentum().magnitude() > elasticThreshold) {
+                continue tridentTrackLoop;
+            }
+            
+            // If the track passes both, it is considered a trident pair.
+            tridentTracks.add(pair);
+        }
+        
+        // Return the resultant pairs.
+        return tridentTracks;
+    }
+    
+    /**
+     * Gets a list track pairs that meet the trident condition defined
+     * using tracks with matched calorimeter clusters. A pair meets the
+     * cluster/track matched trident condition is it meets the following:
+     * <ul><li>Both tracks have matched clusters.</li>
+     * <li>Has one positive track.</li>
+     * <li>Has one negative track.</li>
+     * <li>Clusters have a time coincidence of 2.5 ns or less.</li>
+     * <li>The electron momentum is below 900 MeV.</li></ul>
+     * @param pairList - A <code>List</code> collection of parameterized
+     * type <code>ReconstructedParticle[]</code> containing all valid
+     * top/bottom pairs of tracks with matched clusters. These will be
+     * tested to see if they meet the process criteria.
+     * @return Returns a list containing pairs of tracks that meet the
+     * trident condition.
+     */
+    private final List<ReconstructedParticle[]> getTridentTracksCTMatched(List<ReconstructedParticle[]> pairList) {
+        // Store the set of track pairs that meet the trident condition.
+        List<ReconstructedParticle[]> tridentTracks = new ArrayList<ReconstructedParticle[]>();
+        
+        // Loop over the filtered pair list and apply the trident
+        // condition test.
+        tridentLoop:
+        for(ReconstructedParticle[] pair : pairList) {
+            // There must be one positive and one negative track.
+            ReconstructedParticle electron = null;
+            ReconstructedParticle positron = null;
+            if(pair[0].getCharge() > 0) { positron = pair[0]; }
+            else if(pair[1].getCharge() > 0) { positron = pair[1]; }
+            if(pair[0].getCharge() < 0) { electron = pair[0]; }
+            else if(pair[1].getCharge() < 0) { electron = pair[1]; }
+            if(electron == null || positron == null) {
+                continue tridentLoop;
+            }
+            
+            // Make sure that the clusters are not the same. This should
+            // not actually ever be possible...
+            if(pair[0].getClusters().get(0) == pair[1].getClusters().get(0)) {
+                continue tridentLoop;
+            }
+            
+            // The clusters must within a limited time window.
+            /*
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            if(TriggerModule.getValueTimeCoincidence(trackClusters) > timeCoincidence) {
+                continue tridentLoop;
+            }
+            */
+            
+            // The clusters must be coincidental within an energy
+            // dependent coincidence window.
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            if(!isCoincidental(trackClusters)) {
+                continue tridentLoop;
+            }
+            
+            // Require that the electron in the pair have an energy
+            // below the elastic threshold to exclude elastic electrons.
+            if(electron.getMomentum().magnitude() >= elasticThreshold) {
+                continue tridentLoop;
+            }
+            
+            // Require that all clusters occur within the trigger time
+            // window to exclude accidentals.
+            if(checkTriggerTimeWindow) {
+                if(!inTriggerWindow(trackClusters[0]) || !inTriggerWindow(trackClusters[1])) {
+                    continue tridentLoop;
+                }
+            }
+            
+            // If all the above conditions are met, the pair is to be
+            // considered a trident pair. Add it to the list.
+            tridentTracks.add(pair);
+        }
+        
+        // Return the list of pairs that passed the condition.
+        return tridentTracks;
+    }
+    
+    private final List<ReconstructedParticle[]> getMøllerTracksGBL(List<ReconstructedParticle[]> pairList, EventHeader event) {
+        // Store the set of track pairs that meet the Møller condition.
+        List<ReconstructedParticle[]> møllerTracks = new ArrayList<ReconstructedParticle[]>();
+        
+        // Extract track relational tables from the event object.
+        RelationalTable<?, ?> hitToStrips = TrackUtils.getHitToStripsTable(event);
+        RelationalTable<?, ?> hitToRotated = TrackUtils.getHitToRotatedTable(event);
+        
+        // Loop over the filtered pair list and apply the Møller
+        // condition test.
+        møllerLoop:
+        for(ReconstructedParticle[] pair : pairList) {
+            // Both tracks must be negatively charged.
+            if(pair[0].getCharge() > 0 || pair[1].getCharge() > 0) {
+                continue møllerLoop;
+            }
+            
+            // The clusters must within a limited time window.
+            double times[] = {
+                TrackUtils.getTrackTime(pair[0].getTracks().get(0), hitToStrips, hitToRotated),
+                TrackUtils.getTrackTime(pair[1].getTracks().get(0), hitToStrips, hitToRotated)  
+            };
+            
+            if(Math.abs(times[0] - times[1]) > timeCoincidence) {
+                continue møllerLoop;
+            }
+            
+            // Require that the electrons in the pair have energies
+            // below the elastic threshold to exclude said electrons.
+            if(pair[0].getMomentum().magnitude() > elasticThreshold || pair[1].getMomentum().magnitude() > elasticThreshold) {
+                continue møllerLoop;
+            }
+            
+            // Require that the energy of the pair be within a range
+            // that is sufficiently "Møller-like."
+            double momentumSum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
+            if(momentumSum < møllerLowerRange || momentumSum > møllerUpperRange) {
+                continue møllerLoop;
+            }
+            
+            // If all the above conditions are met, the pair is to be
+            // considered a trident pair. Add it to the list.
+            møllerTracks.add(pair);
+        }
+        
+        // Return the list of pairs that passed the condition.
+        return møllerTracks;
+    }
+    
+    /**
+     * Gets a list track pairs that meet the Møller condition defined
+     * using tracks with matched calorimeter clusters. A pair meets the
+     * cluster/track matched Møller condition is it meets the following:
+     * <ul><li>Both tracks have matched clusters.</li>
+     * <li>Both tracks are negative.</li>
+     * <li>Clusters have a time coincidence of 2.5 ns or less.</li>
+     * <li>The electron momenta are below 900 MeV.</li>
+     * <li>The momentum sum of the tracks is in the range <code>800 MeV
+     * ≤ p1 + p2 ≤ 1500 MeV</li></ul>
+     * @param pairList - A <code>List</code> collection of parameterized
+     * type <code>ReconstructedParticle[]</code> containing all valid
+     * top/bottom pairs of tracks with matched clusters. These will be
+     * tested to see if they meet the process criteria.
+     * @return Returns a list containing pairs of tracks that meet the
+     * Møller condition.
+     */
+    private final List<ReconstructedParticle[]> getMøllerTracksCTMatched(List<ReconstructedParticle[]> pairList) {
+        // Store the set of track pairs that meet the Møller condition.
+        List<ReconstructedParticle[]> møllerTracks = new ArrayList<ReconstructedParticle[]>();
+        
+        // Loop over the filtered pair list and apply the Møller
+        // condition test.
+        møllerLoop:
+        for(ReconstructedParticle[] pair : pairList) {
+            // Both tracks must be negatively charged.
+            if(pair[0].getCharge() > 0 || pair[1].getCharge() > 0) {
+                continue møllerLoop;
+            }
+            
+            // The clusters must within a limited time window.
+            /*
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            if(TriggerModule.getValueTimeCoincidence(trackClusters) > timeCoincidence) {
+                continue møllerLoop;
+            }
+            */
+            
+            // The clusters must be coincidental within an energy
+            // dependent coincidence window.
+            Cluster[] trackClusters = { pair[0].getClusters().get(0), pair[1].getClusters().get(0) };
+            if(!isCoincidental(trackClusters)) {
+                continue møllerLoop;
+            }
+            
+            // Require that the electrons in the pair have energies
+            // below the elastic threshold to exclude said electrons.
+            if(pair[0].getMomentum().magnitude() > elasticThreshold || pair[1].getMomentum().magnitude() > elasticThreshold) {
+                continue møllerLoop;
+            }
+            
+            // Require that the energy of the pair be within a range
+            // that is sufficiently "Møller-like."
+            double momentumSum = VecOp.add(pair[0].getMomentum(), pair[1].getMomentum()).magnitude();
+            if(momentumSum < møllerLowerRange || momentumSum > møllerUpperRange) {
+                continue møllerLoop;
+            }
+            
+            // Require that all clusters occur within the trigger time
+            // window to exclude accidentals.
+            if(checkTriggerTimeWindow) {
+                if(!inTriggerWindow(trackClusters[0]) || !inTriggerWindow(trackClusters[1])) {
+                    continue møllerLoop;
+                }
+            }
+            
+            // If all the above conditions are met, the pair is to be
+            // considered a trident pair. Add it to the list.
+            møllerTracks.add(pair);
+        }
+        
+        // Return the list of pairs that passed the condition.
+        return møllerTracks;
+    }
+    
+    /**
+     * Calculates the approximate invariant mass for a pair of tracks
+     * from their momentum. This assumes that the particles are either
+     * electrons or positrons, and thusly have a sufficiently small
+     * mass term that it can be safely excluded.
+     * @param pair - The track pair for which to calculate the invariant
+     * mass.
+     * @return Returns the approximate invariant mass in units of GeV.
+     */
+    private static final double getInvariantMass(ReconstructedParticle[] pair) {
+        // Get the momentum squared.
+        double p2 = Math.pow(pair[0].getMomentum().magnitude() + pair[1].getMomentum().magnitude(), 2);
+        
+        // Get the remaining terms.
+        double xPro = pair[0].getMomentum().x() + pair[1].getMomentum().x();
+        double yPro = pair[0].getMomentum().y() + pair[1].getMomentum().y();
+        double zPro = pair[0].getMomentum().z() + pair[1].getMomentum().z();
+        
+        // Calculate the invariant mass.
+        return Math.sqrt(p2 - Math.pow(xPro, 2) - Math.pow(yPro, 2) - Math.pow(zPro, 2));
+    }
+    
+    /**
+     * Calculates the coplanarity angle between two points, specified
+     * by a double array. The array must be of the format (x, y, z).
+     * @param position - The first position array.
+     * @param otherPosition - The second position array.
+     * @return Returns the coplanarity angle between the points in units
+     * of degrees.
+     */
+    private static final double getCalculatedCoplanarity(double[] position, double[] otherPosition) {
+        // Define the x- and y-coordinates of the clusters as well as
+        // calorimeter center.
+        final double ORIGIN_X = 42.52;
+        double x[] = { position[0], otherPosition[0] };
+        double y[] = { position[1], otherPosition[1] };
+        
         // Get the cluster angles.
         double[] clusterAngle = new double[2];
         for(int i = 0; i < 2; i++) {
-        	clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
-        	if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
+            clusterAngle[i] = Math.atan2(y[i], x[i] - ORIGIN_X) * 180 / Math.PI;
+            if(clusterAngle[i] <= 0) { clusterAngle[i] += 360; }
         }
         
         // Calculate the coplanarity cut value.
         double clusterDiff = clusterAngle[0] - clusterAngle[1];
         return clusterDiff > 0 ? clusterDiff : clusterDiff + 360;
-	}
-	
-	/**
-	 * Calculates the coplanarity angle of a pair of clusters.
-	 * @param pair - The pair of clusters for which to calculate the
-	 * coplanarity angle.
-	 * @return Returns the coplanarity angle between the two clusters
-	 * in degrees.
-	 */
-	private static final double getCalculatedCoplanarity(Cluster[] pair) {
-		return getCalculatedCoplanarity(pair[0].getPosition(), pair[1].getPosition());
-	}
-	
-	/**
-	 * Calculates the coplanarity angle of a pair of tracks. The track
-	 * is extrapolated to the calorimeter face and its position there
-	 * used for the arguments in the calculation.
-	 * @param pair - The pair of tracks for which to calculate the
-	 * coplanarity angle.
-	 * @return Returns the coplanarity angle between the two tracks
-	 * in degrees.
-	 */
-	private static final double getCalculatedCoplanarity(Track[] pair) {
-		return getCalculatedCoplanarity(TrackUtils.getTrackPositionAtEcal(pair[0]).v(), TrackUtils.getTrackPositionAtEcal(pair[1]).v());
-	}
-	
-	private static final boolean inTriggerWindow(Cluster cluster) {
-		// Get the cluster time.
-		double clusterTime = TriggerModule.getClusterTime(cluster);
-		
-		// Check that it is within the allowed bounds.
-		return (35 <= clusterTime && clusterTime <= 50);
-	}
-	
-	private static final boolean isCoincidental(Cluster[] pair) {
-		// Get the energy sum and the time coincidence.
-		double energySum = pair[0].getEnergy() + pair[1].getEnergy();
-		double timeCoincidence = TriggerModule.getValueTimeCoincidence(pair);
-		
-		// Get the upper and lower bounds of the allowed range.
-		double mean = getTimeDependenceMean(energySum);
-		double threeSigma = 3.0 * getTimeDependenceSigma(energySum);
-		double lowerBound = mean - threeSigma;
-		double upperBound = mean + threeSigma;
-		
-		// Perform the time coincidence check.
-		return (lowerBound <= timeCoincidence && timeCoincidence <= upperBound);
-	}
-	
-	private static final double getTimeDependenceMean(double energySum) {
-		// Define the fit parameters.
-		double[] param = { 0.289337, -2.81998, 9.03475, -12.93, 8.71476, -2.26969 };
-		
-		// Calculate the mean.
-		return param[0] + energySum * (param[1] + energySum * (param[2] + energySum * (param[3] + energySum * (param[4] + energySum * (param[5])))));
-	}
-	
-	private static final double getTimeDependenceSigma(double energySum) {
-		// Define the fit parameters.
-		double[] param = { 4.3987, -24.2371, 68.9567, -98.2586, 67.562, -17.8987 };
-		
-		// Calculate the standard deviation.
-		return param[0] + energySum * (param[1] + energySum * (param[2] + energySum * (param[3] + energySum * (param[4] + energySum * (param[5])))));
-	}
+    }
+    
+    /**
+     * Calculates the coplanarity angle of a pair of clusters.
+     * @param pair - The pair of clusters for which to calculate the
+     * coplanarity angle.
+     * @return Returns the coplanarity angle between the two clusters
+     * in degrees.
+     */
+    private static final double getCalculatedCoplanarity(Cluster[] pair) {
+        return getCalculatedCoplanarity(pair[0].getPosition(), pair[1].getPosition());
+    }
+    
+    /**
+     * Calculates the coplanarity angle of a pair of tracks. The track
+     * is extrapolated to the calorimeter face and its position there
+     * used for the arguments in the calculation.
+     * @param pair - The pair of tracks for which to calculate the
+     * coplanarity angle.
+     * @return Returns the coplanarity angle between the two tracks
+     * in degrees.
+     */
+    private static final double getCalculatedCoplanarity(Track[] pair) {
+        return getCalculatedCoplanarity(TrackUtils.getTrackPositionAtEcal(pair[0]).v(), TrackUtils.getTrackPositionAtEcal(pair[1]).v());
+    }
+    
+    private static final boolean inTriggerWindow(Cluster cluster) {
+        // Get the cluster time.
+        double clusterTime = TriggerModule.getClusterTime(cluster);
+        
+        // Check that it is within the allowed bounds.
+        return (35 <= clusterTime && clusterTime <= 50);
+    }
+    
+    private static final boolean isCoincidental(Cluster[] pair) {
+        // Get the energy sum and the time coincidence.
+        double energySum = pair[0].getEnergy() + pair[1].getEnergy();
+        double timeCoincidence = TriggerModule.getValueTimeCoincidence(pair);
+        
+        // Get the upper and lower bounds of the allowed range.
+        double mean = getTimeDependenceMean(energySum);
+        double threeSigma = 3.0 * getTimeDependenceSigma(energySum);
+        double lowerBound = mean - threeSigma;
+        double upperBound = mean + threeSigma;
+        
+        // Perform the time coincidence check.
+        return (lowerBound <= timeCoincidence && timeCoincidence <= upperBound);
+    }
+    
+    private static final double getTimeDependenceMean(double energySum) {
+        // Define the fit parameters.
+        double[] param = { 0.289337, -2.81998, 9.03475, -12.93, 8.71476, -2.26969 };
+        
+        // Calculate the mean.
+        return param[0] + energySum * (param[1] + energySum * (param[2] + energySum * (param[3] + energySum * (param[4] + energySum * (param[5])))));
+    }
+    
+    private static final double getTimeDependenceSigma(double energySum) {
+        // Define the fit parameters.
+        double[] param = { 4.3987, -24.2371, 68.9567, -98.2586, 67.562, -17.8987 };
+        
+        // Calculate the standard deviation.
+        return param[0] + energySum * (param[1] + energySum * (param[2] + energySum * (param[3] + energySum * (param[4] + energySum * (param[5])))));
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/AddPlots.java	Wed Mar  9 11:43:24 2016
@@ -14,241 +14,241 @@
 import hep.aida.ITree;
 
 public class AddPlots {
-	
-	public static void main(String[] args) throws IllegalArgumentException, IOException {
-		// Define the root directory for the plots.
-		String rootDir = null;
-		
-		// Get the option identifier from the command arguments.
-		boolean isHelp = false;
-		boolean isFileList = false;
-		boolean isDirectory = false;
-		if(args.length > 0) {
-			if(args[0].compareTo("-h") == 0) { isHelp = true; }
-			else if(args[0].compareTo("-f") == 0) { isFileList = true; }
-			else if(args[0].compareTo("-d") == 0) { isDirectory = true; }
-		} else {
-			System.err.println("Insufficient arguments. See \"AddPlots -h\"");
-			System.exit(1);
-		}
-		
-		// Process the command line argument.
-		List<File> plotFiles = new ArrayList<File>();
-		if(isHelp) {
-			System.out.println("Usage:");
-			System.out.println("\tAddPlots -d [PLOT_DIRECTORY]");
-			System.out.println("\tAddPlots -f [PLOT_FILE] [PLOT_FILE] ...");
-			System.exit(0);
-		} else if(isDirectory) {
-			// Make sure that a directory is specified.
-			if(args.length < 2) {
-				System.err.println("Insufficient arguments. Must specify at least two files.");
-				System.exit(1);
-			}
-			
-			// Get the plot directory from the second argument.
-			File plotDirectory = new File(args[1]);
-			
-			// Verify that it exists and is a directory.
-			if(!plotDirectory.exists()) {
-				System.err.println("File path does not exist.");
-				System.exit(1);
-			} if(!plotDirectory.isDirectory()) {
-				System.err.println("Indicated path must be a directory.");
-				System.exit(1);
-			}
-			
-			// Store the root directory.
-			rootDir = plotDirectory.getAbsolutePath() + "/";
-			
-			// Extract the AIDA files from the directory.
-			for(File file : plotDirectory.listFiles()) {
-				System.out.println(file.getName());
-				int indexOfExtension = file.getName().lastIndexOf('.');
-				if(indexOfExtension == -1) { continue; }
-				if(file.getName().substring(indexOfExtension).compareToIgnoreCase(".aida") == 0) {
-					plotFiles.add(file);
-				}
-			}
-			
-			// Debug status print.
-			System.out.println("Processing plots in directory \"" + plotDirectory.getAbsolutePath() + "\"");
-		} else if(isFileList) {
-			// Make sure that at least one file was specified.
-			if(args.length < 3) {
-				System.err.println("Insufficient arguments. Must specify at least two files.");
-				System.exit(1);
-			}
-			
-			// Get the root directory.
-			rootDir = System.getProperty("user.dir") + "/";
-			
-			// Create and verify the specified files.
-			for(int i = 1; i < args.length; i++) {
-				// Create the file object and make sure that it exists.
-				File file = new File(args[i]);
-				if(!file.exists()) {
-					System.err.println("Specified file does not exist: " + args[i]);
-					System.exit(1);
-				}
-				
-				// Add it to the file list.
-				plotFiles.add(file);
-			}
-		} else {
-			System.err.println("Option \"" + args[0] + "\" is not recognized.");
-			System.exit(1);
-		}
-		
-		// Make sure that there are actually files.
-		if(plotFiles.isEmpty()) {
-			System.err.println("No AIDA files found!");
-			System.exit(1);
-		}
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFiles.get(0).getAbsolutePath());
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Get the histograms names.
-		List<String> objectNameList = getTreeFiles(tree);
-		
-		// Separate the plots into 1D and 2D plots and extract their
-		// bin sizes and other properties.
-		List<Integer> xBins1D = new ArrayList<Integer>();
-		List<Double> xBins1DMin = new ArrayList<Double>();
-		List<Double> xBins1DMax = new ArrayList<Double>();
-		List<Integer> xBins2D = new ArrayList<Integer>();
-		List<Double> xBins2DMin = new ArrayList<Double>();
-		List<Double> xBins2DMax = new ArrayList<Double>();
-		List<Integer> yBins2D = new ArrayList<Integer>();
-		List<Double> yBins2DMin = new ArrayList<Double>();
-		List<Double> yBins2DMax = new ArrayList<Double>();
-		List<String> histogramNames1D = new ArrayList<String>();
-		List<String> histogramNames2D = new ArrayList<String>();
-		for(String objectName : objectNameList) {
-			// Get the object.
-			IManagedObject object = tree.find(objectName);
-			
-			// If it is a 1D histogram, process it.
-			if(object instanceof IHistogram1D) {
-				// Add the object to the 1D histogram list.
-				histogramNames1D.add(objectName);
-				
-				// Get the bin size.
-				IHistogram1D plot = (IHistogram1D) object;
-				xBins1D.add(plot.axis().bins());
-				xBins1DMin.add(plot.axis().lowerEdge());
-				xBins1DMax.add(plot.axis().upperEdge());
-			}
-			
-			// If it is a 1D histogram, process it.
-			else if(object instanceof IHistogram2D) {
-				// Add the object to the 2D histogram list.
-				histogramNames2D.add(objectName);
-				
-				// Get the bin size.
-				IHistogram2D plot = (IHistogram2D) object;
-				xBins2D.add(plot.xAxis().bins());
-				xBins2DMin.add(plot.xAxis().lowerEdge());
-				xBins2DMax.add(plot.xAxis().upperEdge());
-				yBins2D.add(plot.yAxis().bins());
-				yBins2DMin.add(plot.yAxis().lowerEdge());
-				yBins2DMax.add(plot.yAxis().upperEdge());
-			}
-		}
-		
-		// Create plots corresponding to each of the plot objects.
-		AIDA aida = AIDA.defaultInstance();
-		List<IHistogram1D> histograms1D = new ArrayList<IHistogram1D>(histogramNames1D.size());
-		List<IHistogram2D> histograms2D = new ArrayList<IHistogram2D>(histogramNames2D.size());
-		for(int i = 0; i < histogramNames1D.size(); i++) {
-			IHistogram1D histogram = aida.histogram1D(histogramNames1D.get(i), xBins1D.get(i), xBins1DMin.get(i), xBins1DMax.get(i));
-			histograms1D.add(histogram);
-		}
-		for(int i = 0; i < histogramNames2D.size(); i++) {
-			IHistogram2D histogram = aida.histogram2D(histogramNames2D.get(i), xBins2D.get(i), xBins2DMin.get(i), xBins2DMax.get(i), yBins2D.get(i), yBins2DMin.get(i), yBins2DMax.get(i));
-			histograms2D.add(histogram);
-		}
-		
-		// Iterate over each file and add their entries to the compiled
-		// plots.
-		for(File file : plotFiles) {
-			// Open the file.
-			ITree fileTree = af.createTreeFactory().create(file.getAbsolutePath());
-			
-			// For each plot, get the equivalent plot from the file
-			// and add each bin entry to the compiled plot.
-			for(int i = 0; i < histogramNames1D.size(); i++) {
-				// Get the histogram object.
-				IHistogram1D histogram = (IHistogram1D) fileTree.find(histogramNames1D.get(i));
-				
-				// Iterate over the bins.
-				for(int x = 0; x < xBins1D.get(i); x++) {
-					// Get the entries in this bin and the bin average.
-					int entries = histogram.binEntries(x);
-					double average = histogram.binMean(x);
-					
-					// Add the entries to the compiled plot.
-					for(int j = 0; j < entries; j++) {
-						histograms1D.get(i).fill(average);
-					}
-				}
-			}
-			for(int i = 0; i < histogramNames2D.size(); i++) {
-				// Get the histogram object.
-				IHistogram2D histogram = (IHistogram2D) fileTree.find(histogramNames2D.get(i));
-				
-				// Iterate over the bins.
-				for(int x = 0; x < xBins2D.get(i); x++) {
-					for(int y = 0; y < yBins2D.get(i); y++) {
-						// Get the entries in this bin and the bin average.
-						int entries = histogram.binEntries(x, y);
-						double averageX = histogram.binMeanX(x, y);
-						double averageY = histogram.binMeanY(x, y);
-						
-						// Add the entries to the compiled plot.
-						for(int j = 0; j < entries; j++) {
-							histograms2D.get(i).fill(averageX, averageY);
-						}
-					}
-				}
-			}
-		}
-		
-		// Save the compiled plots to a new file.
-		aida.saveAs(rootDir + "compiled-plots.aida");
-		System.out.println("Plots written to path " + rootDir + "compiled-plots.aida");
-	}
-	
-	private static final List<String> getTreeFiles(ITree tree) {
-		return getTreeFiles(tree, "/");
-	}
-	
-	private static final List<String> getTreeFiles(ITree tree, String rootDir) {
-		// Make a list to contain the plot names.
-		List<String> list = new ArrayList<String>();
-		
-		// Iterate over the objects at the indicated directory of the tree.
-		String objectNames[] = tree.listObjectNames(rootDir);
-		for(String objectName : objectNames) {
-			// Convert the object name to a char array and check the
-			// last character. Directories end in '/'.
-			char[] plotChars = objectName.toCharArray();
-			
-			// If the object is a directory, process any objects inside
-			// of it as well.
-			if(plotChars[plotChars.length - 1] == '/') {
-				List<String> dirList = getTreeFiles(tree, objectName);
-				list.addAll(dirList);
-			}
-			
-			// Otherwise, just add the object to the list.
-			else { list.add(objectName); }
-		}
-		
-		// Return the compiled list.
-		return list;
-	}
+    
+    public static void main(String[] args) throws IllegalArgumentException, IOException {
+        // Define the root directory for the plots.
+        String rootDir = null;
+        
+        // Get the option identifier from the command arguments.
+        boolean isHelp = false;
+        boolean isFileList = false;
+        boolean isDirectory = false;
+        if(args.length > 0) {
+            if(args[0].compareTo("-h") == 0) { isHelp = true; }
+            else if(args[0].compareTo("-f") == 0) { isFileList = true; }
+            else if(args[0].compareTo("-d") == 0) { isDirectory = true; }
+        } else {
+            System.err.println("Insufficient arguments. See \"AddPlots -h\"");
+            System.exit(1);
+        }
+        
+        // Process the command line argument.
+        List<File> plotFiles = new ArrayList<File>();
+        if(isHelp) {
+            System.out.println("Usage:");
+            System.out.println("\tAddPlots -d [PLOT_DIRECTORY]");
+            System.out.println("\tAddPlots -f [PLOT_FILE] [PLOT_FILE] ...");
+            System.exit(0);
+        } else if(isDirectory) {
+            // Make sure that a directory is specified.
+            if(args.length < 2) {
+                System.err.println("Insufficient arguments. Must specify at least two files.");
+                System.exit(1);
+            }
+            
+            // Get the plot directory from the second argument.
+            File plotDirectory = new File(args[1]);
+            
+            // Verify that it exists and is a directory.
+            if(!plotDirectory.exists()) {
+                System.err.println("File path does not exist.");
+                System.exit(1);
+            } if(!plotDirectory.isDirectory()) {
+                System.err.println("Indicated path must be a directory.");
+                System.exit(1);
+            }
+            
+            // Store the root directory.
+            rootDir = plotDirectory.getAbsolutePath() + "/";
+            
+            // Extract the AIDA files from the directory.
+            for(File file : plotDirectory.listFiles()) {
+                System.out.println(file.getName());
+                int indexOfExtension = file.getName().lastIndexOf('.');
+                if(indexOfExtension == -1) { continue; }
+                if(file.getName().substring(indexOfExtension).compareToIgnoreCase(".aida") == 0) {
+                    plotFiles.add(file);
+                }
+            }
+            
+            // Debug status print.
+            System.out.println("Processing plots in directory \"" + plotDirectory.getAbsolutePath() + "\"");
+        } else if(isFileList) {
+            // Make sure that at least one file was specified.
+            if(args.length < 3) {
+                System.err.println("Insufficient arguments. Must specify at least two files.");
+                System.exit(1);
+            }
+            
+            // Get the root directory.
+            rootDir = System.getProperty("user.dir") + "/";
+            
+            // Create and verify the specified files.
+            for(int i = 1; i < args.length; i++) {
+                // Create the file object and make sure that it exists.
+                File file = new File(args[i]);
+                if(!file.exists()) {
+                    System.err.println("Specified file does not exist: " + args[i]);
+                    System.exit(1);
+                }
+                
+                // Add it to the file list.
+                plotFiles.add(file);
+            }
+        } else {
+            System.err.println("Option \"" + args[0] + "\" is not recognized.");
+            System.exit(1);
+        }
+        
+        // Make sure that there are actually files.
+        if(plotFiles.isEmpty()) {
+            System.err.println("No AIDA files found!");
+            System.exit(1);
+        }
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFiles.get(0).getAbsolutePath());
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Get the histograms names.
+        List<String> objectNameList = getTreeFiles(tree);
+        
+        // Separate the plots into 1D and 2D plots and extract their
+        // bin sizes and other properties.
+        List<Integer> xBins1D = new ArrayList<Integer>();
+        List<Double> xBins1DMin = new ArrayList<Double>();
+        List<Double> xBins1DMax = new ArrayList<Double>();
+        List<Integer> xBins2D = new ArrayList<Integer>();
+        List<Double> xBins2DMin = new ArrayList<Double>();
+        List<Double> xBins2DMax = new ArrayList<Double>();
+        List<Integer> yBins2D = new ArrayList<Integer>();
+        List<Double> yBins2DMin = new ArrayList<Double>();
+        List<Double> yBins2DMax = new ArrayList<Double>();
+        List<String> histogramNames1D = new ArrayList<String>();
+        List<String> histogramNames2D = new ArrayList<String>();
+        for(String objectName : objectNameList) {
+            // Get the object.
+            IManagedObject object = tree.find(objectName);
+            
+            // If it is a 1D histogram, process it.
+            if(object instanceof IHistogram1D) {
+                // Add the object to the 1D histogram list.
+                histogramNames1D.add(objectName);
+                
+                // Get the bin size.
+                IHistogram1D plot = (IHistogram1D) object;
+                xBins1D.add(plot.axis().bins());
+                xBins1DMin.add(plot.axis().lowerEdge());
+                xBins1DMax.add(plot.axis().upperEdge());
+            }
+            
+            // If it is a 1D histogram, process it.
+            else if(object instanceof IHistogram2D) {
+                // Add the object to the 2D histogram list.
+                histogramNames2D.add(objectName);
+                
+                // Get the bin size.
+                IHistogram2D plot = (IHistogram2D) object;
+                xBins2D.add(plot.xAxis().bins());
+                xBins2DMin.add(plot.xAxis().lowerEdge());
+                xBins2DMax.add(plot.xAxis().upperEdge());
+                yBins2D.add(plot.yAxis().bins());
+                yBins2DMin.add(plot.yAxis().lowerEdge());
+                yBins2DMax.add(plot.yAxis().upperEdge());
+            }
+        }
+        
+        // Create plots corresponding to each of the plot objects.
+        AIDA aida = AIDA.defaultInstance();
+        List<IHistogram1D> histograms1D = new ArrayList<IHistogram1D>(histogramNames1D.size());
+        List<IHistogram2D> histograms2D = new ArrayList<IHistogram2D>(histogramNames2D.size());
+        for(int i = 0; i < histogramNames1D.size(); i++) {
+            IHistogram1D histogram = aida.histogram1D(histogramNames1D.get(i), xBins1D.get(i), xBins1DMin.get(i), xBins1DMax.get(i));
+            histograms1D.add(histogram);
+        }
+        for(int i = 0; i < histogramNames2D.size(); i++) {
+            IHistogram2D histogram = aida.histogram2D(histogramNames2D.get(i), xBins2D.get(i), xBins2DMin.get(i), xBins2DMax.get(i), yBins2D.get(i), yBins2DMin.get(i), yBins2DMax.get(i));
+            histograms2D.add(histogram);
+        }
+        
+        // Iterate over each file and add their entries to the compiled
+        // plots.
+        for(File file : plotFiles) {
+            // Open the file.
+            ITree fileTree = af.createTreeFactory().create(file.getAbsolutePath());
+            
+            // For each plot, get the equivalent plot from the file
+            // and add each bin entry to the compiled plot.
+            for(int i = 0; i < histogramNames1D.size(); i++) {
+                // Get the histogram object.
+                IHistogram1D histogram = (IHistogram1D) fileTree.find(histogramNames1D.get(i));
+                
+                // Iterate over the bins.
+                for(int x = 0; x < xBins1D.get(i); x++) {
+                    // Get the entries in this bin and the bin average.
+                    int entries = histogram.binEntries(x);
+                    double average = histogram.binMean(x);
+                    
+                    // Add the entries to the compiled plot.
+                    for(int j = 0; j < entries; j++) {
+                        histograms1D.get(i).fill(average);
+                    }
+                }
+            }
+            for(int i = 0; i < histogramNames2D.size(); i++) {
+                // Get the histogram object.
+                IHistogram2D histogram = (IHistogram2D) fileTree.find(histogramNames2D.get(i));
+                
+                // Iterate over the bins.
+                for(int x = 0; x < xBins2D.get(i); x++) {
+                    for(int y = 0; y < yBins2D.get(i); y++) {
+                        // Get the entries in this bin and the bin average.
+                        int entries = histogram.binEntries(x, y);
+                        double averageX = histogram.binMeanX(x, y);
+                        double averageY = histogram.binMeanY(x, y);
+                        
+                        // Add the entries to the compiled plot.
+                        for(int j = 0; j < entries; j++) {
+                            histograms2D.get(i).fill(averageX, averageY);
+                        }
+                    }
+                }
+            }
+        }
+        
+        // Save the compiled plots to a new file.
+        aida.saveAs(rootDir + "compiled-plots.aida");
+        System.out.println("Plots written to path " + rootDir + "compiled-plots.aida");
+    }
+    
+    private static final List<String> getTreeFiles(ITree tree) {
+        return getTreeFiles(tree, "/");
+    }
+    
+    private static final List<String> getTreeFiles(ITree tree, String rootDir) {
+        // Make a list to contain the plot names.
+        List<String> list = new ArrayList<String>();
+        
+        // Iterate over the objects at the indicated directory of the tree.
+        String objectNames[] = tree.listObjectNames(rootDir);
+        for(String objectName : objectNames) {
+            // Convert the object name to a char array and check the
+            // last character. Directories end in '/'.
+            char[] plotChars = objectName.toCharArray();
+            
+            // If the object is a directory, process any objects inside
+            // of it as well.
+            if(plotChars[plotChars.length - 1] == '/') {
+                List<String> dirList = getTreeFiles(tree, objectName);
+                list.addAll(dirList);
+            }
+            
+            // Otherwise, just add the object to the list.
+            else { list.add(objectName); }
+        }
+        
+        // Return the compiled list.
+        return list;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot.java	Wed Mar  9 11:43:24 2016
@@ -1,25 +1,25 @@
 package org.hps.users.kmccarty.plots;
 
 public abstract class FormattedPlot {
-	private final String xAxis;
-	private final String yAxis;
-	private final String plotName;
-	
-	public FormattedPlot(String xAxis, String yAxis, String plotName) {
-		this.xAxis = xAxis;
-		this.yAxis = yAxis;
-		this.plotName = plotName;
-	}
-	
-	public String getPlotName() {
-		return plotName;
-	}
-	
-	public String getXAxisName() {
-		return xAxis;
-	}
-	
-	public String getYAxisName() {
-		return yAxis;
-	}
+    private final String xAxis;
+    private final String yAxis;
+    private final String plotName;
+    
+    public FormattedPlot(String xAxis, String yAxis, String plotName) {
+        this.xAxis = xAxis;
+        this.yAxis = yAxis;
+        this.plotName = plotName;
+    }
+    
+    public String getPlotName() {
+        return plotName;
+    }
+    
+    public String getXAxisName() {
+        return xAxis;
+    }
+    
+    public String getYAxisName() {
+        return yAxis;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot1D.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot1D.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot1D.java	Wed Mar  9 11:43:24 2016
@@ -5,37 +5,37 @@
 import hep.aida.IHistogram1D;
 
 public class FormattedPlot1D extends FormattedPlot {
-	private final ColorStyle style;
-	private final IHistogram1D plot;
-	private final double axisRange;
-	
-	public FormattedPlot1D(IHistogram1D plot, ColorStyle style, String xAxis, String yAxis, String plotName) {
-		super(xAxis, yAxis, plotName);
-		this.plot = plot;
-		this.style = style;
-		this.axisRange = -1;
-	}
-	
-	public FormattedPlot1D(IHistogram1D plot, ColorStyle style, String xAxis, String yAxis, String plotName, double axisRange) {
-		super(xAxis, yAxis, plotName);
-		this.plot = plot;
-		this.style = style;
-		this.axisRange = axisRange;
-	}
-	
-	public IHistogram1D getPlot() {
-		return plot;
-	}
-	
-	public ColorStyle getColorStyle() {
-		return style;
-	}
-	
-	public boolean definesAxisRange() {
-		return axisRange != -1;
-	}
-	
-	public double getAxisRange() {
-		return axisRange;
-	}
+    private final ColorStyle style;
+    private final IHistogram1D plot;
+    private final double axisRange;
+    
+    public FormattedPlot1D(IHistogram1D plot, ColorStyle style, String xAxis, String yAxis, String plotName) {
+        super(xAxis, yAxis, plotName);
+        this.plot = plot;
+        this.style = style;
+        this.axisRange = -1;
+    }
+    
+    public FormattedPlot1D(IHistogram1D plot, ColorStyle style, String xAxis, String yAxis, String plotName, double axisRange) {
+        super(xAxis, yAxis, plotName);
+        this.plot = plot;
+        this.style = style;
+        this.axisRange = axisRange;
+    }
+    
+    public IHistogram1D getPlot() {
+        return plot;
+    }
+    
+    public ColorStyle getColorStyle() {
+        return style;
+    }
+    
+    public boolean definesAxisRange() {
+        return axisRange != -1;
+    }
+    
+    public double getAxisRange() {
+        return axisRange;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot2D.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot2D.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/FormattedPlot2D.java	Wed Mar  9 11:43:24 2016
@@ -3,48 +3,48 @@
 import hep.aida.IHistogram2D;
 
 public class FormattedPlot2D extends FormattedPlot {
-	private final IHistogram2D plot;
-	private final boolean logarithmic;
-	private final double xAxisRange;
-	private final double yAxisRange;
-	
-	public FormattedPlot2D(IHistogram2D plot, boolean logarithmic, String xAxis, String yAxis, String plotName) {
-		super(xAxis, yAxis, plotName);
-		this.plot = plot;
-		this.xAxisRange = -1;
-		this.yAxisRange = -1;
-		this.logarithmic = logarithmic;
-	}
-	
-	public FormattedPlot2D(IHistogram2D plot, boolean logarithmic, String xAxis, String yAxis, String plotName, double xAxisRange, double yAxisRange) {
-		super(xAxis, yAxis, plotName);
-		this.plot = plot;
-		this.xAxisRange = xAxisRange;
-		this.yAxisRange = yAxisRange;
-		this.logarithmic = logarithmic;
-	}
-	
-	public IHistogram2D getPlot() {
-		return plot;
-	}
-	
-	public boolean isLogarithmic() {
-		return logarithmic;
-	}
-	
-	public boolean definesXAxisRange() {
-		return xAxisRange != -1;
-	}
-	
-	public boolean definesYAxisRange() {
-		return yAxisRange != -1;
-	}
-	
-	public double getXAxisRange() {
-		return xAxisRange;
-	}
-	
-	public double getYAxisRange() {
-		return yAxisRange;
-	}
+    private final IHistogram2D plot;
+    private final boolean logarithmic;
+    private final double xAxisRange;
+    private final double yAxisRange;
+    
+    public FormattedPlot2D(IHistogram2D plot, boolean logarithmic, String xAxis, String yAxis, String plotName) {
+        super(xAxis, yAxis, plotName);
+        this.plot = plot;
+        this.xAxisRange = -1;
+        this.yAxisRange = -1;
+        this.logarithmic = logarithmic;
+    }
+    
+    public FormattedPlot2D(IHistogram2D plot, boolean logarithmic, String xAxis, String yAxis, String plotName, double xAxisRange, double yAxisRange) {
+        super(xAxis, yAxis, plotName);
+        this.plot = plot;
+        this.xAxisRange = xAxisRange;
+        this.yAxisRange = yAxisRange;
+        this.logarithmic = logarithmic;
+    }
+    
+    public IHistogram2D getPlot() {
+        return plot;
+    }
+    
+    public boolean isLogarithmic() {
+        return logarithmic;
+    }
+    
+    public boolean definesXAxisRange() {
+        return xAxisRange != -1;
+    }
+    
+    public boolean definesYAxisRange() {
+        return yAxisRange != -1;
+    }
+    
+    public double getXAxisRange() {
+        return xAxisRange;
+    }
+    
+    public double getYAxisRange() {
+        return yAxisRange;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotFormatModule.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotFormatModule.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotFormatModule.java	Wed Mar  9 11:43:24 2016
@@ -17,189 +17,189 @@
 import java.util.List;
 
 public class PlotFormatModule {
-	private String width = "2000";
-	private String height = "1200";
-	private List<FormattedPlot1D> formattedPlots1D = new ArrayList<FormattedPlot1D>();
-	private List<FormattedPlot2D> formattedPlots2D = new ArrayList<FormattedPlot2D>();
-	
-	public void addPlot1D(FormattedPlot1D plot) {
-		formattedPlots1D.add(plot);
-	}
-	
-	public void addPlot2D(FormattedPlot2D plot) {
-		formattedPlots2D.add(plot);
-	}
-	
-	public void setDisplayHeight(int height) {
-		this.height = "" + height;
-	}
-	
-	public void setDisplayWidth(int width) {
-		this.width = "" + width;
-	}
-	
-	public void displayPlots() {
-		try { processPlots(null); }
-		catch (IOException e) { e.printStackTrace(); }
-	}
-	
-	public void savePlots(String filePath) throws IOException {
-		processPlots(filePath);
-	}
-	
-	private void processPlots(String filePath) throws IOException {
-		// Create a plotter factory.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IPlotterFactory plotterFactory = af.createPlotterFactory();
-		
-		// Format and display the 1D plots.
-		for(FormattedPlot1D formattedPlot : formattedPlots1D) {
-			// Get the plot.
-			IHistogram1D plot = formattedPlot.getPlot();
-			
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(plot.title());
-			plotter.createRegions(1);
-			plotter.region(0).plot(plot);
-			
-			// Set the axis range.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			if(formattedPlot.definesAxisRange()) {
-				region.getPlot().getXAxis().setMax(formattedPlot.getAxisRange());
-			}
-			
-			// Format the axis labels.
-			region.getPlot().setTitle(formattedPlot.getPlotName());
-			region.getPlot().getXAxis().setLabel(formattedPlot.getXAxisName());
-			region.getPlot().getYAxis().setLabel(formattedPlot.getYAxisName());
-			
-			// Format the fonts and general plot presentation.
-			PlotsFormatter.setDefault1DStyle(region, new ColorStyle[] { formattedPlot.getColorStyle() });
-			
-			// Set the plotter dimensions.
-			plotter.setParameter("plotterWidth", width);
-			plotter.setParameter("plotterHeight", height);
-			
-			// If the file path is null, display the plots. Otherwise,
-			// save them to the destination folder.
-			if(filePath == null) { plotter.show(); }
-			else {
-				File plotFile = new File(filePath + formattedPlot.getPlotName() + ".png");
-				if(plotFile.exists()) { plotFile.delete(); }
-				plotter.writeToFile(filePath + formattedPlot.getPlotName() + ".png");
-				System.out.printf("Saved plot \"%s\" to path: %s%n", formattedPlot.getPlotName(), filePath + formattedPlot.getPlotName() + ".png");
-			}
-		}
-		
-		// Format and display the 2D plots.
-		for(FormattedPlot2D formattedPlot : formattedPlots2D) {
-			// Get the plot.
-			IHistogram2D plot = formattedPlot.getPlot();
-			
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(formattedPlot.getPlotName());
-			plotter.createRegions(1);
-			plotter.region(0).plot(plot);
-			
-			// Set the axis range.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			if(formattedPlot.definesXAxisRange()) {
-				region.getPlot().getXAxis().setMax(formattedPlot.getXAxisRange());
-			} if(formattedPlot.definesYAxisRange()) {
-				region.getPlot().getYAxis().setMax(formattedPlot.getYAxisRange());
-			}
-			
-			// Format the axis labels.
-			region.getPlot().setTitle(formattedPlot.getPlotName());
-			region.getPlot().getXAxis().setLabel(formattedPlot.getXAxisName());
-			region.getPlot().getYAxis().setLabel(formattedPlot.getYAxisName());
-			
-			// Format the fonts and general plot presentation.
-			PlotsFormatter.setDefault2DStyle(region, formattedPlot.isLogarithmic());
-			
-			// Set the plotter dimensions.
-			plotter.setParameter("plotterWidth", width);
-			plotter.setParameter("plotterHeight", height);
-			
-			// If the file path is null, display the plots. Otherwise,
-			// save them to the destination folder.
-			if(filePath == null) { plotter.show(); }
-			else {
-				File plotFile = new File(filePath + formattedPlot.getPlotName() + ".png");
-				if(plotFile.exists()) { plotFile.delete(); }
-				plotter.writeToFile(filePath + formattedPlot.getPlotName() + ".png");
-				System.out.printf("Saved plot \"%s\" to path: %s%n", formattedPlot.getPlotName(), filePath + formattedPlot.getPlotName() + ".png");
-			}
-		}
-	}
-	
-	public void exportPlots(String filePath) throws IOException {
-		// Export the 1D plots in a text format.
-		for(FormattedPlot1D plot : formattedPlots1D) {
-			exportPlot(filePath, plot);
-		}
-		
-		// Export the 2D plots in a text format.
-		for(FormattedPlot2D plot : formattedPlots2D) {
-			exportPlot(filePath, plot);
-		}
-	}
-	
-	private static final void exportPlot(String filePath, FormattedPlot plot) throws IOException {
-		// Check if this is a one or two dimensional plot.
-		boolean is1D = plot instanceof FormattedPlot1D;
-		
-		// Create a file object for the plot.
-		String plotPath = filePath + plot.getPlotName() + (is1D ? ".aida1D" : ".aida2D");
-		File datFile = new File(plotPath);
-		
-		// If the plot file already exists, delete it.
-		if(datFile.exists()) { datFile.delete(); }
-		
-		// Create a new file for the plot to occupy.
-		datFile.createNewFile();
-		
-		// Get the textual form of the plot.
-		String plotText = null;
-		if(is1D) { plotText = toTextFormat(((FormattedPlot1D) plot).getPlot()); }
-		else { plotText = toTextFormat(((FormattedPlot2D) plot).getPlot()); }
-		
-		// Write the plot text to the file.
-		BufferedWriter writer = new BufferedWriter(new FileWriter(datFile));
-		writer.write(plotText);
-		writer.close();
-		
-		// Note that the file was written.
-		System.out.printf("Plot \"%s\" was exported to path: %s%n", plot.getPlotName(), plotPath);
-	}
-	
-	private static final String toTextFormat(IHistogram1D plot) {
-		// Create a buffer to hold the converted plot.
-		StringBuffer buffer = new StringBuffer();
-		
-		// Iterate over the bins and output the plot in the format of
-		// "[BIN_MEAN] [BIN_VALUE]" with a tab delimiter.
-		for(int bin = 0; bin < plot.axis().bins(); bin++) {
-			buffer.append(String.format("%f\t%f%n", plot.binMean(bin), plot.binHeight(bin)));
-		}
-		
-		// Return the converted file.
-		return buffer.toString();
-	}
-	
-	private static final String toTextFormat(IHistogram2D plot) {
-		// Create a buffer to hold the converted plot.
-		StringBuffer buffer = new StringBuffer();
-		
-		// Iterate over the bins and output the plot in the format of
-		// "[X_BIN_MEAN] [Y_BIN_MEAN] [BIN_VALUE]" with a tab delimiter.
-		for(int xBin = 0; xBin < plot.xAxis().bins(); xBin++) {
-			for(int yBin = 0; yBin < plot.yAxis().bins(); yBin++) {
-				buffer.append(String.format("%f\t%f\t%f%n", plot.binMeanX(xBin, yBin), plot.binMeanY(xBin, yBin), plot.binHeight(xBin, yBin)));
-			}
-		}
-		
-		// Return the converted file.
-		return buffer.toString();
-	}
+    private String width = "2000";
+    private String height = "1200";
+    private List<FormattedPlot1D> formattedPlots1D = new ArrayList<FormattedPlot1D>();
+    private List<FormattedPlot2D> formattedPlots2D = new ArrayList<FormattedPlot2D>();
+    
+    public void addPlot1D(FormattedPlot1D plot) {
+        formattedPlots1D.add(plot);
+    }
+    
+    public void addPlot2D(FormattedPlot2D plot) {
+        formattedPlots2D.add(plot);
+    }
+    
+    public void setDisplayHeight(int height) {
+        this.height = "" + height;
+    }
+    
+    public void setDisplayWidth(int width) {
+        this.width = "" + width;
+    }
+    
+    public void displayPlots() {
+        try { processPlots(null); }
+        catch (IOException e) { e.printStackTrace(); }
+    }
+    
+    public void savePlots(String filePath) throws IOException {
+        processPlots(filePath);
+    }
+    
+    private void processPlots(String filePath) throws IOException {
+        // Create a plotter factory.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IPlotterFactory plotterFactory = af.createPlotterFactory();
+        
+        // Format and display the 1D plots.
+        for(FormattedPlot1D formattedPlot : formattedPlots1D) {
+            // Get the plot.
+            IHistogram1D plot = formattedPlot.getPlot();
+            
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(plot.title());
+            plotter.createRegions(1);
+            plotter.region(0).plot(plot);
+            
+            // Set the axis range.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            if(formattedPlot.definesAxisRange()) {
+                region.getPlot().getXAxis().setMax(formattedPlot.getAxisRange());
+            }
+            
+            // Format the axis labels.
+            region.getPlot().setTitle(formattedPlot.getPlotName());
+            region.getPlot().getXAxis().setLabel(formattedPlot.getXAxisName());
+            region.getPlot().getYAxis().setLabel(formattedPlot.getYAxisName());
+            
+            // Format the fonts and general plot presentation.
+            PlotsFormatter.setDefault1DStyle(region, new ColorStyle[] { formattedPlot.getColorStyle() });
+            
+            // Set the plotter dimensions.
+            plotter.setParameter("plotterWidth", width);
+            plotter.setParameter("plotterHeight", height);
+            
+            // If the file path is null, display the plots. Otherwise,
+            // save them to the destination folder.
+            if(filePath == null) { plotter.show(); }
+            else {
+                File plotFile = new File(filePath + formattedPlot.getPlotName() + ".png");
+                if(plotFile.exists()) { plotFile.delete(); }
+                plotter.writeToFile(filePath + formattedPlot.getPlotName() + ".png");
+                System.out.printf("Saved plot \"%s\" to path: %s%n", formattedPlot.getPlotName(), filePath + formattedPlot.getPlotName() + ".png");
+            }
+        }
+        
+        // Format and display the 2D plots.
+        for(FormattedPlot2D formattedPlot : formattedPlots2D) {
+            // Get the plot.
+            IHistogram2D plot = formattedPlot.getPlot();
+            
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(formattedPlot.getPlotName());
+            plotter.createRegions(1);
+            plotter.region(0).plot(plot);
+            
+            // Set the axis range.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            if(formattedPlot.definesXAxisRange()) {
+                region.getPlot().getXAxis().setMax(formattedPlot.getXAxisRange());
+            } if(formattedPlot.definesYAxisRange()) {
+                region.getPlot().getYAxis().setMax(formattedPlot.getYAxisRange());
+            }
+            
+            // Format the axis labels.
+            region.getPlot().setTitle(formattedPlot.getPlotName());
+            region.getPlot().getXAxis().setLabel(formattedPlot.getXAxisName());
+            region.getPlot().getYAxis().setLabel(formattedPlot.getYAxisName());
+            
+            // Format the fonts and general plot presentation.
+            PlotsFormatter.setDefault2DStyle(region, formattedPlot.isLogarithmic());
+            
+            // Set the plotter dimensions.
+            plotter.setParameter("plotterWidth", width);
+            plotter.setParameter("plotterHeight", height);
+            
+            // If the file path is null, display the plots. Otherwise,
+            // save them to the destination folder.
+            if(filePath == null) { plotter.show(); }
+            else {
+                File plotFile = new File(filePath + formattedPlot.getPlotName() + ".png");
+                if(plotFile.exists()) { plotFile.delete(); }
+                plotter.writeToFile(filePath + formattedPlot.getPlotName() + ".png");
+                System.out.printf("Saved plot \"%s\" to path: %s%n", formattedPlot.getPlotName(), filePath + formattedPlot.getPlotName() + ".png");
+            }
+        }
+    }
+    
+    public void exportPlots(String filePath) throws IOException {
+        // Export the 1D plots in a text format.
+        for(FormattedPlot1D plot : formattedPlots1D) {
+            exportPlot(filePath, plot);
+        }
+        
+        // Export the 2D plots in a text format.
+        for(FormattedPlot2D plot : formattedPlots2D) {
+            exportPlot(filePath, plot);
+        }
+    }
+    
+    private static final void exportPlot(String filePath, FormattedPlot plot) throws IOException {
+        // Check if this is a one or two dimensional plot.
+        boolean is1D = plot instanceof FormattedPlot1D;
+        
+        // Create a file object for the plot.
+        String plotPath = filePath + plot.getPlotName() + (is1D ? ".aida1D" : ".aida2D");
+        File datFile = new File(plotPath);
+        
+        // If the plot file already exists, delete it.
+        if(datFile.exists()) { datFile.delete(); }
+        
+        // Create a new file for the plot to occupy.
+        datFile.createNewFile();
+        
+        // Get the textual form of the plot.
+        String plotText = null;
+        if(is1D) { plotText = toTextFormat(((FormattedPlot1D) plot).getPlot()); }
+        else { plotText = toTextFormat(((FormattedPlot2D) plot).getPlot()); }
+        
+        // Write the plot text to the file.
+        BufferedWriter writer = new BufferedWriter(new FileWriter(datFile));
+        writer.write(plotText);
+        writer.close();
+        
+        // Note that the file was written.
+        System.out.printf("Plot \"%s\" was exported to path: %s%n", plot.getPlotName(), plotPath);
+    }
+    
+    private static final String toTextFormat(IHistogram1D plot) {
+        // Create a buffer to hold the converted plot.
+        StringBuffer buffer = new StringBuffer();
+        
+        // Iterate over the bins and output the plot in the format of
+        // "[BIN_MEAN] [BIN_VALUE]" with a tab delimiter.
+        for(int bin = 0; bin < plot.axis().bins(); bin++) {
+            buffer.append(String.format("%f\t%f%n", plot.binMean(bin), plot.binHeight(bin)));
+        }
+        
+        // Return the converted file.
+        return buffer.toString();
+    }
+    
+    private static final String toTextFormat(IHistogram2D plot) {
+        // Create a buffer to hold the converted plot.
+        StringBuffer buffer = new StringBuffer();
+        
+        // Iterate over the bins and output the plot in the format of
+        // "[X_BIN_MEAN] [Y_BIN_MEAN] [BIN_VALUE]" with a tab delimiter.
+        for(int xBin = 0; xBin < plot.xAxis().bins(); xBin++) {
+            for(int yBin = 0; yBin < plot.yAxis().bins(); yBin++) {
+                buffer.append(String.format("%f\t%f\t%f%n", plot.binMeanX(xBin, yBin), plot.binMeanY(xBin, yBin), plot.binHeight(xBin, yBin)));
+            }
+        }
+        
+        // Return the converted file.
+        return buffer.toString();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/PlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -8,120 +8,120 @@
 import java.awt.Font;
 
 public class PlotsFormatter {
-	// Define plot fonts.
-	public static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 30);
-	public static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  35);
-	public static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  45);
-	
-	// Defines the color style options for plot data.
-	public static enum ColorStyle {
-		 MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
-		  MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
-		MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
-		    RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
-		  FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
-		    TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
-		    BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
-		  PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
-		
-		private final Color fillColor;
-		private final Color lineColor;
-		
-		private ColorStyle(Color fillColor, Color lineColor) {
-			this.fillColor = fillColor;
-			this.lineColor = lineColor;
-		}
-		
-		public Color getFillColor() { return fillColor; }
-		
-		public Color getLineColor() { return lineColor; }
-	};
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	public static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the names of each plot on in the region.
-		String[] dataNames = region.getAllDataNames();
-		
-		// Check whether this is an overlay plot. Overlay plots contain
-		// more than one data name.
-		boolean overlay = (dataNames.length > 1 ? true : false);
-		
-		// Iterate over each plot in the region.
-		for(int i = 0; i < dataNames.length; i++) {
-			// Set the overlay style if needed.
-			if(overlay) {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with no fill. The color is set by the "color" argument.
-				fillStyle.setHistogramFill(false);
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarLineColor(color[i].getFillColor());
-				
-				// Set the legend text style.
-				region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
-			}
-			
-			// Otherwise, set the fill style for a single plot.
-			else {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with a fill color. The colors are defined by the
-				// "color" argument.
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarColor(color[i].getFillColor());
-				fillStyle.setHistogramBarLineColor(color[i].getLineColor());
-			}
-			
-			// Set the statistics box style.
-			region.getPlot().getStats().setVisible(true);
-			region.getPlot().getStats().setFont(BASIC_FONT);
-			
-			// Set the title font.
-			region.getPlot().getTitleObject().setFont(TITLE_FONT);
-			
-			// Set the axis tick-mark fonts.
-			region.getPlot().getXAxis().setFont(BASIC_FONT);
-			region.getPlot().getYAxis().setFont(BASIC_FONT);
-			region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-			region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 */
-	public static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
-		// Get the fill style object. 2D plots should never be overlay
-		// plots, so there should only ever be one data name.
-		JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		
-		// Set the fill style for a two-dimensional plot.
-		if(logarithmic) { fillStyle.setLogZ(true); }
-		fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
-		fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
-		
-		// Make the statistics box invisible.
-		region.getPlot().getStats().setVisible(false);
-		
-		// Set the general plot font (which is also the z-axis font).
-		region.getPlot().setFont(BASIC_FONT);
-		
-		// Set the title font.
-		region.getPlot().getTitleObject().setFont(TITLE_FONT);
-		
-		// Set the axis tick-mark fonts.
-		region.getPlot().getXAxis().setFont(BASIC_FONT);
-		region.getPlot().getYAxis().setFont(BASIC_FONT);
-		region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-		region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-	}
+    // Define plot fonts.
+    public static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 30);
+    public static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  35);
+    public static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  45);
+    
+    // Defines the color style options for plot data.
+    public static enum ColorStyle {
+         MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
+          MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
+        MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
+            RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
+          FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
+            TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
+            BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
+          PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
+        
+        private final Color fillColor;
+        private final Color lineColor;
+        
+        private ColorStyle(Color fillColor, Color lineColor) {
+            this.fillColor = fillColor;
+            this.lineColor = lineColor;
+        }
+        
+        public Color getFillColor() { return fillColor; }
+        
+        public Color getLineColor() { return lineColor; }
+    };
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    public static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the names of each plot on in the region.
+        String[] dataNames = region.getAllDataNames();
+        
+        // Check whether this is an overlay plot. Overlay plots contain
+        // more than one data name.
+        boolean overlay = (dataNames.length > 1 ? true : false);
+        
+        // Iterate over each plot in the region.
+        for(int i = 0; i < dataNames.length; i++) {
+            // Set the overlay style if needed.
+            if(overlay) {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with no fill. The color is set by the "color" argument.
+                fillStyle.setHistogramFill(false);
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarLineColor(color[i].getFillColor());
+                
+                // Set the legend text style.
+                region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
+            }
+            
+            // Otherwise, set the fill style for a single plot.
+            else {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with a fill color. The colors are defined by the
+                // "color" argument.
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarColor(color[i].getFillColor());
+                fillStyle.setHistogramBarLineColor(color[i].getLineColor());
+            }
+            
+            // Set the statistics box style.
+            region.getPlot().getStats().setVisible(true);
+            region.getPlot().getStats().setFont(BASIC_FONT);
+            
+            // Set the title font.
+            region.getPlot().getTitleObject().setFont(TITLE_FONT);
+            
+            // Set the axis tick-mark fonts.
+            region.getPlot().getXAxis().setFont(BASIC_FONT);
+            region.getPlot().getYAxis().setFont(BASIC_FONT);
+            region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+            region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     */
+    public static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
+        // Get the fill style object. 2D plots should never be overlay
+        // plots, so there should only ever be one data name.
+        JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        
+        // Set the fill style for a two-dimensional plot.
+        if(logarithmic) { fillStyle.setLogZ(true); }
+        fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
+        fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
+        
+        // Make the statistics box invisible.
+        region.getPlot().getStats().setVisible(false);
+        
+        // Set the general plot font (which is also the z-axis font).
+        region.getPlot().setFont(BASIC_FONT);
+        
+        // Set the title font.
+        region.getPlot().getTitleObject().setFont(TITLE_FONT);
+        
+        // Set the axis tick-mark fonts.
+        region.getPlot().getXAxis().setFont(BASIC_FONT);
+        region.getPlot().getYAxis().setFont(BASIC_FONT);
+        region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+        region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/InvariantMassPlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/InvariantMassPlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/InvariantMassPlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -19,317 +19,317 @@
 import hep.aida.ref.plotter.PlotterRegion;
 
 public class InvariantMassPlotsFormatter {
-	// Define plot fonts.
-	private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
-	private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
-	private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
-	
-	// Defines the color style options for plot data.
-	private enum ColorStyle {
-		 MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
-		  MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
-		MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
-		    RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
-		  FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
-		    TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
-		    BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
-		  PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
-		
-		private final Color fillColor;
-		private final Color lineColor;
-		
-		private ColorStyle(Color fillColor, Color lineColor) {
-			this.fillColor = fillColor;
-			this.lineColor = lineColor;
-		}
-		
-		public Color getFillColor() { return fillColor; }
-		
-		public Color getLineColor() { return lineColor; }
-	};
-		
-	/**
-	 * Loads all plots in a file and formats them according to the
-	 * indicated style.
-	 * @param args - Unused default executable parameter.
-	 * @throws IOException Occurs if there is an issue opening the file.
-	 */
-	public static void main(String[] args) throws IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String[] plotFile = {
-				rootDir + "temp.aida"
-		};
-		
-		// Define the run numbers for each file.
-		String[] runNumber = { "1 Hits", "2 Hits" };
-		
-		// Define the scaling factors for each plot.
-		double scaleFactor = 13.254;
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree[] tree = new ITree[plotFile.length];
-		for(int i = 0; i < plotFile.length; i++) {
-			tree[i] = af.createTreeFactory().create(plotFile[i]);
-			if(tree[i] == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		}
-		
-		// Get the histograms.
-		IHistogram1D[] invariantMassPlots = new IHistogram1D[3];
-		invariantMassPlots[0] = (IHistogram1D) tree[0].find("Trident Analysis/Particle Invariant Mass (1 Hit)");
-		invariantMassPlots[1] = (IHistogram1D) tree[0].find("Trident Analysis/Particle Invariant Mass (2 Hit)");
-		IHistogram1D electronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Electron Energy");
-		IHistogram1D positronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Positron Energy");
-		IHistogram1D energySumPlot = (IHistogram1D) tree[0].find("Trident Analysis/Energy Sum Distribution");
-		IHistogram2D energySum2DPlot = (IHistogram2D) tree[0].find("Trident Analysis/2D Energy Distribution");
-		IHistogram1D tridentElectronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Trident Electron Energy");
-		IHistogram1D tridentPositronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Trident Positron Energy");
-		
-		// Define the plot titles and arrays.
-		IHistogram[] plots = { electronEnergyPlot, positronEnergyPlot, energySumPlot, tridentElectronEnergyPlot, tridentPositronEnergyPlot };
-		String[] titles = { "Electron Energy", "Positron Energy", "Energy Sum", "Trident Electron Energy", "Trident Positron Energy" };
-		String[] xTitles = { "Energy (GeV)", "Energy (GeV)", "Energy Sum (GeV)", "Energy (GeV)", "Energy (GeV)" };
-		
-		// Re-bin the histograms to have 5-times larger bins. First,
-		// get the bin count and upper and lower bounds of the plot.
-		int bins = invariantMassPlots[0].axis().bins();
-		double low = invariantMassPlots[0].axis().binLowerEdge(0);
-		double high = invariantMassPlots[0].axis().binUpperEdge(invariantMassPlots[0].axis().bins() - 1);
-		
-		// Create new plots with the larger bin sizes.
-		AIDA aida = AIDA.defaultInstance();
-		IHistogram1D[] newPlot = new IHistogram1D[2];
-		newPlot[0] = aida.histogram1D("Particle Invariant Mass (1 Hit)", bins / 5, low, high);
-		newPlot[1] = aida.histogram1D("Particle Invariant Mass (2 Hit)", bins / 5, low, high);
-		
-		// Populate the new plots with the data from the old ones.
-		for(int j = 0; j < 2; j++) {
-			for(int i = 0; i < bins; i++) {
-				int entries = invariantMassPlots[j].binEntries(i);
-				double center = invariantMassPlots[j].axis().binCenter(i);
-				for(int k = 0; k < entries; k++) {
-					newPlot[j].fill(center);
-				}
-			}
-		}
-		
-		// Replace the old plots.
-		invariantMassPlots = newPlot;
-		
-		// Create a plotter factory.
-		IPlotterFactory plotterFactory = af.createPlotterFactory();
-		
-		// Format and display the basic histograms.
-		for(int i = 0; i < plots.length; i++) {
-			// Scale the histogram by the appropriate scaling factor.
-			plots[i].scale(1.0 / scaleFactor);
-			
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(titles[i]);
-			plotter.createRegions(1);
-			plotter.region(0).plot(plots[i]);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle(titles[i]);
-			region.getPlot().getXAxis().setLabel(xTitles[i]);
-			region.getPlot().getYAxis().setLabel("Rate (Hz)");
-			
-			// Format the fonts and general plot presentation.
-			setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Format and display the 2D histogram.
-		energySum2DPlot.scale(1.0 / scaleFactor);
-		IPlotter plotter2D = plotterFactory.create("2D Energy Sum");
-		plotter2D.createRegions(1);
-		plotter2D.region(0).plot(energySum2DPlot);
-		
-		// Format the axis labels.
-		PlotterRegion region2D = (PlotterRegion) plotter2D.region(0);
-		region2D.getPlot().setTitle("2D Energy Sum");
-		region2D.getPlot().getXAxis().setLabel("Electron Energy (GeV)");
-		region2D.getPlot().getYAxis().setLabel("Positron Energy (GeV)");
-		
-		// Format the fonts and general plot presentation.
-		setDefault2DStyle(region2D, false);
-		
-		// Show the plot.
-		plotter2D.setParameter("plotterWidth", "2000");
-		plotter2D.setParameter("plotterHeight", "1200");
-		plotter2D.show();
-		
-		// Format and display the histograms.
-		for(int i = 0; i < 2; i++) {
-			// Scale the histogram by the appropriate scaling factor.
-			invariantMassPlots[i].scale(1.0 / scaleFactor);
-			
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create("Particle Invariant Mass (" + runNumber[i] + ")");
-			plotter.createRegions(1);
-			plotter.region(0).plot(invariantMassPlots[i]);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle("Particle Invariant Mass (" + runNumber[i] + ")");
-			region.getPlot().getXAxis().setLabel("Invariant Mass (GeV)");
-			region.getPlot().getYAxis().setLabel("Rate (Hz)");
-			
-			// Format the fonts and general plot presentation.
-			setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Note which plot is the numerator and which is the denominator.
-		int numerator   = 0;
-		int denominator = 1;
-		
-		// Create a new histogram to display the ratios of the rates.
-		IHistogram1D ratioPlot = AIDA.defaultInstance().histogram1D("Invariant Mass Ratio (" + runNumber[numerator] + " / "
-				+ runNumber[denominator] + ")", invariantMassPlots[0].axis().bins(),
-				invariantMassPlots[0].axis().lowerEdge(), invariantMassPlots[0].axis().upperEdge());
-		
-		// Iterate over each bin.
-		for(int bin = 0; bin < invariantMassPlots[0].axis().bins(); bin++) {
-			// Calculate the ratio.
-			double ratio = invariantMassPlots[numerator].binHeight(bin) / invariantMassPlots[denominator].binHeight(bin);
-			
-			// If the ratio is either not a number of infinite, skip
-			// this bin.
-			if(Double.isNaN(ratio) || Double.isInfinite(ratio)) { continue; }
-			
-			// Populate the ratio plot bin.
-			ratioPlot.fill(invariantMassPlots[0].axis().binCenter(bin), ratio);
-		}
-		
-		// Create a plotter and plotting region for the plot.
-		IPlotter plotter = plotterFactory.create("Invariant Mass Ratio (5411 / 5554)");
-		plotter.createRegions(1);
-		plotter.region(0).plot(ratioPlot);
-		
-		// Format the axis labels.
-		PlotterRegion region = (PlotterRegion) plotter.region(0);
-		region.getPlot().setTitle("Invariant Mass Ratio (" + runNumber[numerator] + " / " + runNumber[denominator] + ")");
-		region.getPlot().getXAxis().setLabel("Invariant Mass (GeV)");
-		region.getPlot().getXAxis().setMin(0.010);
-		region.getPlot().getXAxis().setMax(0.060);
-		region.getPlot().getYAxis().setLabel("Ratio");
-		
-		// Format the fonts and general plot presentation.
-		setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-		
-		// Disable the error bars.
-		JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		fillStyle.setShowErrorBars(false);
-		
-		// Show the plot.
-		plotter.setParameter("plotterWidth", "2000");
-		plotter.setParameter("plotterHeight", "1200");
-		plotter.show();
-		
-		// Close the trees.
-		for(int i = 0; i < plotFile.length; i++) {
-			tree[i].close();
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the names of each plot on in the region.
-		String[] dataNames = region.getAllDataNames();
-		
-		// Check whether this is an overlay plot. Overlay plots contain
-		// more than one data name.
-		boolean overlay = (dataNames.length > 1 ? true : false);
-		
-		// Iterate over each plot in the region.
-		for(int i = 0; i < dataNames.length; i++) {
-			// Set the overlay style if needed.
-			if(overlay) {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with no fill. The color is set by the "color" argument.
-				fillStyle.setHistogramFill(false);
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarLineColor(color[i].getFillColor());
-				
-				// Set the legend text style.
-				region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
-			}
-			
-			// Otherwise, set the fill style for a single plot.
-			else {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with a fill color. The colors are defined by the
-				// "color" argument.
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarColor(color[i].getFillColor());
-				fillStyle.setHistogramBarLineColor(color[i].getLineColor());
-			}
-			
-			// Set the statistics box style.
-			region.getPlot().getStats().setVisible(true);
-			region.getPlot().getStats().setFont(BASIC_FONT);
-			
-			// Set the title font.
-			region.getPlot().getTitleObject().setFont(TITLE_FONT);
-			
-			// Set the axis tick-mark fonts.
-			region.getPlot().getXAxis().setFont(BASIC_FONT);
-			region.getPlot().getYAxis().setFont(BASIC_FONT);
-			region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-			region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 */
-	private static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
-		// Get the fill style object. 2D plots should never be overlay
-		// plots, so there should only ever be one data name.
-		JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		
-		// Set the fill style for a two-dimensional plot.
-		if(logarithmic) { fillStyle.setLogZ(true); }
-		fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
-		fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
-		
-		// Make the statistics box invisible.
-		region.getPlot().getStats().setVisible(false);
-		
-		// Set the general plot font (which is also the z-axis font).
-		region.getPlot().setFont(BASIC_FONT);
-		
-		// Set the title font.
-		region.getPlot().getTitleObject().setFont(TITLE_FONT);
-		
-		// Set the axis tick-mark fonts.
-		region.getPlot().getXAxis().setFont(BASIC_FONT);
-		region.getPlot().getYAxis().setFont(BASIC_FONT);
-		region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-		region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-	}
+    // Define plot fonts.
+    private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
+    private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
+    private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
+    
+    // Defines the color style options for plot data.
+    private enum ColorStyle {
+         MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
+          MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
+        MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
+            RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
+          FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
+            TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
+            BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
+          PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
+        
+        private final Color fillColor;
+        private final Color lineColor;
+        
+        private ColorStyle(Color fillColor, Color lineColor) {
+            this.fillColor = fillColor;
+            this.lineColor = lineColor;
+        }
+        
+        public Color getFillColor() { return fillColor; }
+        
+        public Color getLineColor() { return lineColor; }
+    };
+        
+    /**
+     * Loads all plots in a file and formats them according to the
+     * indicated style.
+     * @param args - Unused default executable parameter.
+     * @throws IOException Occurs if there is an issue opening the file.
+     */
+    public static void main(String[] args) throws IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String[] plotFile = {
+                rootDir + "temp.aida"
+        };
+        
+        // Define the run numbers for each file.
+        String[] runNumber = { "1 Hits", "2 Hits" };
+        
+        // Define the scaling factors for each plot.
+        double scaleFactor = 13.254;
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree[] tree = new ITree[plotFile.length];
+        for(int i = 0; i < plotFile.length; i++) {
+            tree[i] = af.createTreeFactory().create(plotFile[i]);
+            if(tree[i] == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        }
+        
+        // Get the histograms.
+        IHistogram1D[] invariantMassPlots = new IHistogram1D[3];
+        invariantMassPlots[0] = (IHistogram1D) tree[0].find("Trident Analysis/Particle Invariant Mass (1 Hit)");
+        invariantMassPlots[1] = (IHistogram1D) tree[0].find("Trident Analysis/Particle Invariant Mass (2 Hit)");
+        IHistogram1D electronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Electron Energy");
+        IHistogram1D positronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Positron Energy");
+        IHistogram1D energySumPlot = (IHistogram1D) tree[0].find("Trident Analysis/Energy Sum Distribution");
+        IHistogram2D energySum2DPlot = (IHistogram2D) tree[0].find("Trident Analysis/2D Energy Distribution");
+        IHistogram1D tridentElectronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Trident Electron Energy");
+        IHistogram1D tridentPositronEnergyPlot = (IHistogram1D) tree[0].find("Trident Analysis/Trident Positron Energy");
+        
+        // Define the plot titles and arrays.
+        IHistogram[] plots = { electronEnergyPlot, positronEnergyPlot, energySumPlot, tridentElectronEnergyPlot, tridentPositronEnergyPlot };
+        String[] titles = { "Electron Energy", "Positron Energy", "Energy Sum", "Trident Electron Energy", "Trident Positron Energy" };
+        String[] xTitles = { "Energy (GeV)", "Energy (GeV)", "Energy Sum (GeV)", "Energy (GeV)", "Energy (GeV)" };
+        
+        // Re-bin the histograms to have 5-times larger bins. First,
+        // get the bin count and upper and lower bounds of the plot.
+        int bins = invariantMassPlots[0].axis().bins();
+        double low = invariantMassPlots[0].axis().binLowerEdge(0);
+        double high = invariantMassPlots[0].axis().binUpperEdge(invariantMassPlots[0].axis().bins() - 1);
+        
+        // Create new plots with the larger bin sizes.
+        AIDA aida = AIDA.defaultInstance();
+        IHistogram1D[] newPlot = new IHistogram1D[2];
+        newPlot[0] = aida.histogram1D("Particle Invariant Mass (1 Hit)", bins / 5, low, high);
+        newPlot[1] = aida.histogram1D("Particle Invariant Mass (2 Hit)", bins / 5, low, high);
+        
+        // Populate the new plots with the data from the old ones.
+        for(int j = 0; j < 2; j++) {
+            for(int i = 0; i < bins; i++) {
+                int entries = invariantMassPlots[j].binEntries(i);
+                double center = invariantMassPlots[j].axis().binCenter(i);
+                for(int k = 0; k < entries; k++) {
+                    newPlot[j].fill(center);
+                }
+            }
+        }
+        
+        // Replace the old plots.
+        invariantMassPlots = newPlot;
+        
+        // Create a plotter factory.
+        IPlotterFactory plotterFactory = af.createPlotterFactory();
+        
+        // Format and display the basic histograms.
+        for(int i = 0; i < plots.length; i++) {
+            // Scale the histogram by the appropriate scaling factor.
+            plots[i].scale(1.0 / scaleFactor);
+            
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(titles[i]);
+            plotter.createRegions(1);
+            plotter.region(0).plot(plots[i]);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle(titles[i]);
+            region.getPlot().getXAxis().setLabel(xTitles[i]);
+            region.getPlot().getYAxis().setLabel("Rate (Hz)");
+            
+            // Format the fonts and general plot presentation.
+            setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Format and display the 2D histogram.
+        energySum2DPlot.scale(1.0 / scaleFactor);
+        IPlotter plotter2D = plotterFactory.create("2D Energy Sum");
+        plotter2D.createRegions(1);
+        plotter2D.region(0).plot(energySum2DPlot);
+        
+        // Format the axis labels.
+        PlotterRegion region2D = (PlotterRegion) plotter2D.region(0);
+        region2D.getPlot().setTitle("2D Energy Sum");
+        region2D.getPlot().getXAxis().setLabel("Electron Energy (GeV)");
+        region2D.getPlot().getYAxis().setLabel("Positron Energy (GeV)");
+        
+        // Format the fonts and general plot presentation.
+        setDefault2DStyle(region2D, false);
+        
+        // Show the plot.
+        plotter2D.setParameter("plotterWidth", "2000");
+        plotter2D.setParameter("plotterHeight", "1200");
+        plotter2D.show();
+        
+        // Format and display the histograms.
+        for(int i = 0; i < 2; i++) {
+            // Scale the histogram by the appropriate scaling factor.
+            invariantMassPlots[i].scale(1.0 / scaleFactor);
+            
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create("Particle Invariant Mass (" + runNumber[i] + ")");
+            plotter.createRegions(1);
+            plotter.region(0).plot(invariantMassPlots[i]);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle("Particle Invariant Mass (" + runNumber[i] + ")");
+            region.getPlot().getXAxis().setLabel("Invariant Mass (GeV)");
+            region.getPlot().getYAxis().setLabel("Rate (Hz)");
+            
+            // Format the fonts and general plot presentation.
+            setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Note which plot is the numerator and which is the denominator.
+        int numerator   = 0;
+        int denominator = 1;
+        
+        // Create a new histogram to display the ratios of the rates.
+        IHistogram1D ratioPlot = AIDA.defaultInstance().histogram1D("Invariant Mass Ratio (" + runNumber[numerator] + " / "
+                + runNumber[denominator] + ")", invariantMassPlots[0].axis().bins(),
+                invariantMassPlots[0].axis().lowerEdge(), invariantMassPlots[0].axis().upperEdge());
+        
+        // Iterate over each bin.
+        for(int bin = 0; bin < invariantMassPlots[0].axis().bins(); bin++) {
+            // Calculate the ratio.
+            double ratio = invariantMassPlots[numerator].binHeight(bin) / invariantMassPlots[denominator].binHeight(bin);
+            
+            // If the ratio is either not a number of infinite, skip
+            // this bin.
+            if(Double.isNaN(ratio) || Double.isInfinite(ratio)) { continue; }
+            
+            // Populate the ratio plot bin.
+            ratioPlot.fill(invariantMassPlots[0].axis().binCenter(bin), ratio);
+        }
+        
+        // Create a plotter and plotting region for the plot.
+        IPlotter plotter = plotterFactory.create("Invariant Mass Ratio (5411 / 5554)");
+        plotter.createRegions(1);
+        plotter.region(0).plot(ratioPlot);
+        
+        // Format the axis labels.
+        PlotterRegion region = (PlotterRegion) plotter.region(0);
+        region.getPlot().setTitle("Invariant Mass Ratio (" + runNumber[numerator] + " / " + runNumber[denominator] + ")");
+        region.getPlot().getXAxis().setLabel("Invariant Mass (GeV)");
+        region.getPlot().getXAxis().setMin(0.010);
+        region.getPlot().getXAxis().setMax(0.060);
+        region.getPlot().getYAxis().setLabel("Ratio");
+        
+        // Format the fonts and general plot presentation.
+        setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+        
+        // Disable the error bars.
+        JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        fillStyle.setShowErrorBars(false);
+        
+        // Show the plot.
+        plotter.setParameter("plotterWidth", "2000");
+        plotter.setParameter("plotterHeight", "1200");
+        plotter.show();
+        
+        // Close the trees.
+        for(int i = 0; i < plotFile.length; i++) {
+            tree[i].close();
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the names of each plot on in the region.
+        String[] dataNames = region.getAllDataNames();
+        
+        // Check whether this is an overlay plot. Overlay plots contain
+        // more than one data name.
+        boolean overlay = (dataNames.length > 1 ? true : false);
+        
+        // Iterate over each plot in the region.
+        for(int i = 0; i < dataNames.length; i++) {
+            // Set the overlay style if needed.
+            if(overlay) {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with no fill. The color is set by the "color" argument.
+                fillStyle.setHistogramFill(false);
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarLineColor(color[i].getFillColor());
+                
+                // Set the legend text style.
+                region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
+            }
+            
+            // Otherwise, set the fill style for a single plot.
+            else {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with a fill color. The colors are defined by the
+                // "color" argument.
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarColor(color[i].getFillColor());
+                fillStyle.setHistogramBarLineColor(color[i].getLineColor());
+            }
+            
+            // Set the statistics box style.
+            region.getPlot().getStats().setVisible(true);
+            region.getPlot().getStats().setFont(BASIC_FONT);
+            
+            // Set the title font.
+            region.getPlot().getTitleObject().setFont(TITLE_FONT);
+            
+            // Set the axis tick-mark fonts.
+            region.getPlot().getXAxis().setFont(BASIC_FONT);
+            region.getPlot().getYAxis().setFont(BASIC_FONT);
+            region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+            region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     */
+    private static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
+        // Get the fill style object. 2D plots should never be overlay
+        // plots, so there should only ever be one data name.
+        JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        
+        // Set the fill style for a two-dimensional plot.
+        if(logarithmic) { fillStyle.setLogZ(true); }
+        fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
+        fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
+        
+        // Make the statistics box invisible.
+        region.getPlot().getStats().setVisible(false);
+        
+        // Set the general plot font (which is also the z-axis font).
+        region.getPlot().setFont(BASIC_FONT);
+        
+        // Set the title font.
+        region.getPlot().getTitleObject().setFont(TITLE_FONT);
+        
+        // Set the axis tick-mark fonts.
+        region.getPlot().getXAxis().setFont(BASIC_FONT);
+        region.getPlot().getYAxis().setFont(BASIC_FONT);
+        region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+        region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTEPlotFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTEPlotFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTEPlotFormatter.java	Wed Mar  9 11:43:24 2016
@@ -19,308 +19,308 @@
 import hep.aida.ref.plotter.PlotterRegion;
 
 public class MTEPlotFormatter {
-	// Define plot fonts.
-	private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
-	private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
-	private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
-	
-	// Defines the color style options for plot data.
-	private enum ColorStyle {
-		 MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
-		  MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
-		MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
-		    RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
-		  FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
-		    TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
-		    BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
-		  PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
-		
-		private final Color fillColor;
-		private final Color lineColor;
-		
-		private ColorStyle(Color fillColor, Color lineColor) {
-			this.fillColor = fillColor;
-			this.lineColor = lineColor;
-		}
-		
-		public Color getFillColor() { return fillColor; }
-		
-		public Color getLineColor() { return lineColor; }
-	};
-		
-	/**
-	 * Loads all plots in a file and formats them according to the
-	 * indicated style.
-	 * @param args - Unused default executable parameter.
-	 * @throws IOException Occurs if there is an issue opening the file.
-	 */
-	public static void main(String[] args) throws IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "temp.aida";
-		
-		// Define the scaling factors for each plot.
-		double scaleFactor = 1;
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Define index references for each event type.
-		int MOLLER  = 0;
-		int TRIDENT = 1;
-		int ELASTIC = 2;
-		
-		// Get the histograms.
-		IHistogram1D[] trackCountPlots = new IHistogram1D[3];
-		trackCountPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks");
-		trackCountPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks");
-		trackCountPlots[ELASTIC] = (IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks");
-		
-		IHistogram1D[] energyPlots = new IHistogram1D[3];
-		energyPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution");
-		energyPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution");
-		energyPlots[ELASTIC] = (IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution");
-		
-		IHistogram1D[] energySumPlots = new IHistogram1D[2];
-		energySumPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution");
-		energySumPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution");
-		
-		IHistogram2D[] energy2DPlots = new IHistogram2D[2];
-		energy2DPlots[MOLLER]  = (IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution");
-		energy2DPlots[TRIDENT] = (IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution");
-		
-		// Create a plotter factory.
-		IPlotterFactory plotterFactory = af.createPlotterFactory();
-		
-		// Format the track count plots.
-		for(IHistogram1D trackCountPlot : trackCountPlots) {
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(trackCountPlot.title());
-			plotter.createRegions(1);
-			plotter.region(0).plot(trackCountPlot);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle(trackCountPlot.title());
-			region.getPlot().getXAxis().setLabel("Number of Tracks");
-			region.getPlot().getYAxis().setLabel("Count");
-			
-			// Format the fonts and general plot presentation.
-			setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Format the electron energy plots.
-		for(IHistogram1D energyPlot : energyPlots) {
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(energyPlot.title());
-			plotter.createRegions(1);
-			plotter.region(0).plot(energyPlot);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle(energyPlot.title());
-			region.getPlot().getXAxis().setLabel("Track Energy (GeV)");
-			region.getPlot().getYAxis().setLabel("Count");
-			
-			// Format the fonts and general plot presentation.
-			setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Format the energy sum plots.
-		for(IHistogram1D energySumPlot : energySumPlots) {
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(energySumPlot.title());
-			plotter.createRegions(1);
-			plotter.region(0).plot(energySumPlot);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle(energySumPlot.title());
-			region.getPlot().getXAxis().setLabel("Track Energy (GeV)");
-			region.getPlot().getYAxis().setLabel("Count");
-			
-			// Format the fonts and general plot presentation.
-			setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Format the 2D energy sum plots.
-		for(IHistogram2D energy2DPlot : energy2DPlots) {
-			// Create a plotter and plotting region for the plot.
-			IPlotter plotter = plotterFactory.create(energy2DPlot.title());
-			plotter.createRegions(1);
-			plotter.region(0).plot(energy2DPlot);
-			
-			// Format the axis labels.
-			PlotterRegion region = (PlotterRegion) plotter.region(0);
-			region.getPlot().setTitle(energy2DPlot.title());
-			region.getPlot().getXAxis().setLabel("First Track Energy (GeV)");
-			region.getPlot().getYAxis().setLabel("Second Track Energy (GeV)");
-			
-			
-			// Format the fonts and general plot presentation.
-			setDefault2DStyle(region, false);
-			
-			// Show the plot.
-			plotter.setParameter("plotterWidth", "2000");
-			plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Disable the error bars.
-		//JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		//fillStyle.setShowErrorBars(false);
-		
-		// Close the tree.
-		tree.close();
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the names of each plot on in the region.
-		String[] dataNames = region.getAllDataNames();
-		
-		// Check whether this is an overlay plot. Overlay plots contain
-		// more than one data name.
-		boolean overlay = (dataNames.length > 1 ? true : false);
-		
-		// Iterate over each plot in the region.
-		for(int i = 0; i < dataNames.length; i++) {
-			// Set the overlay style if needed.
-			if(overlay) {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with no fill. The color is set by the "color" argument.
-				fillStyle.setHistogramFill(false);
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarLineColor(color[i].getFillColor());
-				
-				// Set the legend text style.
-				region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
-			}
-			
-			// Otherwise, set the fill style for a single plot.
-			else {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with a fill color. The colors are defined by the
-				// "color" argument.
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarColor(color[i].getFillColor());
-				fillStyle.setHistogramBarLineColor(color[i].getLineColor());
-			}
-			
-			// Set the statistics box style.
-			region.getPlot().getStats().setVisible(true);
-			region.getPlot().getStats().setFont(BASIC_FONT);
-			
-			// Set the title font.
-			region.getPlot().getTitleObject().setFont(TITLE_FONT);
-			
-			// Set the axis tick-mark fonts.
-			region.getPlot().getXAxis().setFont(BASIC_FONT);
-			region.getPlot().getYAxis().setFont(BASIC_FONT);
-			region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-			region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 */
-	private static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
-		// Get the fill style object. 2D plots should never be overlay
-		// plots, so there should only ever be one data name.
-		JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		
-		// Set the fill style for a two-dimensional plot.
-		if(logarithmic) { fillStyle.setLogZ(true); }
-		fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
-		fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
-		
-		// Make the statistics box invisible.
-		region.getPlot().getStats().setVisible(false);
-		
-		// Set the general plot font (which is also the z-axis font).
-		region.getPlot().setFont(BASIC_FONT);
-		
-		// Set the title font.
-		region.getPlot().getTitleObject().setFont(TITLE_FONT);
-		
-		// Set the axis tick-mark fonts.
-		region.getPlot().getXAxis().setFont(BASIC_FONT);
-		region.getPlot().getYAxis().setFont(BASIC_FONT);
-		region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-		region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-	}
-	
-	/**
-	 * Recursive method that gets all object names from a tree that
-	 * are not directories. Method should not be called directly, but
-	 * rather called only through the <code>getHistograms(ITree)</code>
-	 * method.
-	 * @param tree - The tree from which to obtain the object names.
-	 * @param directory - The directory in which to search for objects.
-	 * @param list - The list in which to place the objects.
-	 * @return Returns the <code>List</code> collection that was given
-	 * as an argument.
-	 */
-	private static final List<String> getHistograms(ITree tree, String directory, List<String> list) {
-		// Get the list of objects in the directory.
-		String[] treeObjects = tree.listObjectNames(directory);
-		
-		// Print the objects.
-		for(String objectName : treeObjects) {
-			// Check if the object is a directory.
-			boolean isDirectory = isDirectory(objectName);
-			
-			// If the object is a directory, get the histograms from it.
-			if(isDirectory) {
-				getHistograms(tree, objectName, list);
-			}
-			
-			// If the object is a plot, add it to the list.
-			else { list.add(objectName); }
-		}
-		
-		// Return the list.
-		return list;
-	}
-	
-	/**
-	 * Checks whether a tree object is a directory.
-	 * @param object - The object to check.
-	 * @return Returns <code>true</code> if the object is a directory
-	 * and <code>false</code> otherwise.
-	 */
-	private static final boolean isDirectory(String object) {
-		return (object.toCharArray()[object.length() - 1] == '/');
-	}
+    // Define plot fonts.
+    private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
+    private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
+    private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
+    
+    // Defines the color style options for plot data.
+    private enum ColorStyle {
+         MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
+          MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
+        MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
+            RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
+          FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
+            TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
+            BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
+          PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
+        
+        private final Color fillColor;
+        private final Color lineColor;
+        
+        private ColorStyle(Color fillColor, Color lineColor) {
+            this.fillColor = fillColor;
+            this.lineColor = lineColor;
+        }
+        
+        public Color getFillColor() { return fillColor; }
+        
+        public Color getLineColor() { return lineColor; }
+    };
+        
+    /**
+     * Loads all plots in a file and formats them according to the
+     * indicated style.
+     * @param args - Unused default executable parameter.
+     * @throws IOException Occurs if there is an issue opening the file.
+     */
+    public static void main(String[] args) throws IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "temp.aida";
+        
+        // Define the scaling factors for each plot.
+        double scaleFactor = 1;
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Define index references for each event type.
+        int MOLLER  = 0;
+        int TRIDENT = 1;
+        int ELASTIC = 2;
+        
+        // Get the histograms.
+        IHistogram1D[] trackCountPlots = new IHistogram1D[3];
+        trackCountPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks");
+        trackCountPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks");
+        trackCountPlots[ELASTIC] = (IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks");
+        
+        IHistogram1D[] energyPlots = new IHistogram1D[3];
+        energyPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution");
+        energyPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution");
+        energyPlots[ELASTIC] = (IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution");
+        
+        IHistogram1D[] energySumPlots = new IHistogram1D[2];
+        energySumPlots[MOLLER]  = (IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution");
+        energySumPlots[TRIDENT] = (IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution");
+        
+        IHistogram2D[] energy2DPlots = new IHistogram2D[2];
+        energy2DPlots[MOLLER]  = (IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution");
+        energy2DPlots[TRIDENT] = (IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution");
+        
+        // Create a plotter factory.
+        IPlotterFactory plotterFactory = af.createPlotterFactory();
+        
+        // Format the track count plots.
+        for(IHistogram1D trackCountPlot : trackCountPlots) {
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(trackCountPlot.title());
+            plotter.createRegions(1);
+            plotter.region(0).plot(trackCountPlot);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle(trackCountPlot.title());
+            region.getPlot().getXAxis().setLabel("Number of Tracks");
+            region.getPlot().getYAxis().setLabel("Count");
+            
+            // Format the fonts and general plot presentation.
+            setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Format the electron energy plots.
+        for(IHistogram1D energyPlot : energyPlots) {
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(energyPlot.title());
+            plotter.createRegions(1);
+            plotter.region(0).plot(energyPlot);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle(energyPlot.title());
+            region.getPlot().getXAxis().setLabel("Track Energy (GeV)");
+            region.getPlot().getYAxis().setLabel("Count");
+            
+            // Format the fonts and general plot presentation.
+            setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Format the energy sum plots.
+        for(IHistogram1D energySumPlot : energySumPlots) {
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(energySumPlot.title());
+            plotter.createRegions(1);
+            plotter.region(0).plot(energySumPlot);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle(energySumPlot.title());
+            region.getPlot().getXAxis().setLabel("Track Energy (GeV)");
+            region.getPlot().getYAxis().setLabel("Count");
+            
+            // Format the fonts and general plot presentation.
+            setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Format the 2D energy sum plots.
+        for(IHistogram2D energy2DPlot : energy2DPlots) {
+            // Create a plotter and plotting region for the plot.
+            IPlotter plotter = plotterFactory.create(energy2DPlot.title());
+            plotter.createRegions(1);
+            plotter.region(0).plot(energy2DPlot);
+            
+            // Format the axis labels.
+            PlotterRegion region = (PlotterRegion) plotter.region(0);
+            region.getPlot().setTitle(energy2DPlot.title());
+            region.getPlot().getXAxis().setLabel("First Track Energy (GeV)");
+            region.getPlot().getYAxis().setLabel("Second Track Energy (GeV)");
+            
+            
+            // Format the fonts and general plot presentation.
+            setDefault2DStyle(region, false);
+            
+            // Show the plot.
+            plotter.setParameter("plotterWidth", "2000");
+            plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Disable the error bars.
+        //JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        //fillStyle.setShowErrorBars(false);
+        
+        // Close the tree.
+        tree.close();
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the names of each plot on in the region.
+        String[] dataNames = region.getAllDataNames();
+        
+        // Check whether this is an overlay plot. Overlay plots contain
+        // more than one data name.
+        boolean overlay = (dataNames.length > 1 ? true : false);
+        
+        // Iterate over each plot in the region.
+        for(int i = 0; i < dataNames.length; i++) {
+            // Set the overlay style if needed.
+            if(overlay) {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with no fill. The color is set by the "color" argument.
+                fillStyle.setHistogramFill(false);
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarLineColor(color[i].getFillColor());
+                
+                // Set the legend text style.
+                region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
+            }
+            
+            // Otherwise, set the fill style for a single plot.
+            else {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with a fill color. The colors are defined by the
+                // "color" argument.
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarColor(color[i].getFillColor());
+                fillStyle.setHistogramBarLineColor(color[i].getLineColor());
+            }
+            
+            // Set the statistics box style.
+            region.getPlot().getStats().setVisible(true);
+            region.getPlot().getStats().setFont(BASIC_FONT);
+            
+            // Set the title font.
+            region.getPlot().getTitleObject().setFont(TITLE_FONT);
+            
+            // Set the axis tick-mark fonts.
+            region.getPlot().getXAxis().setFont(BASIC_FONT);
+            region.getPlot().getYAxis().setFont(BASIC_FONT);
+            region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+            region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     */
+    private static final void setDefault2DStyle(PlotterRegion region, boolean logarithmic) {
+        // Get the fill style object. 2D plots should never be overlay
+        // plots, so there should only ever be one data name.
+        JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        
+        // Set the fill style for a two-dimensional plot.
+        if(logarithmic) { fillStyle.setLogZ(true); }
+        fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
+        fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
+        
+        // Make the statistics box invisible.
+        region.getPlot().getStats().setVisible(false);
+        
+        // Set the general plot font (which is also the z-axis font).
+        region.getPlot().setFont(BASIC_FONT);
+        
+        // Set the title font.
+        region.getPlot().getTitleObject().setFont(TITLE_FONT);
+        
+        // Set the axis tick-mark fonts.
+        region.getPlot().getXAxis().setFont(BASIC_FONT);
+        region.getPlot().getYAxis().setFont(BASIC_FONT);
+        region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+        region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+    }
+    
+    /**
+     * Recursive method that gets all object names from a tree that
+     * are not directories. Method should not be called directly, but
+     * rather called only through the <code>getHistograms(ITree)</code>
+     * method.
+     * @param tree - The tree from which to obtain the object names.
+     * @param directory - The directory in which to search for objects.
+     * @param list - The list in which to place the objects.
+     * @return Returns the <code>List</code> collection that was given
+     * as an argument.
+     */
+    private static final List<String> getHistograms(ITree tree, String directory, List<String> list) {
+        // Get the list of objects in the directory.
+        String[] treeObjects = tree.listObjectNames(directory);
+        
+        // Print the objects.
+        for(String objectName : treeObjects) {
+            // Check if the object is a directory.
+            boolean isDirectory = isDirectory(objectName);
+            
+            // If the object is a directory, get the histograms from it.
+            if(isDirectory) {
+                getHistograms(tree, objectName, list);
+            }
+            
+            // If the object is a plot, add it to the list.
+            else { list.add(objectName); }
+        }
+        
+        // Return the list.
+        return list;
+    }
+    
+    /**
+     * Checks whether a tree object is a directory.
+     * @param object - The object to check.
+     * @return Returns <code>true</code> if the object is a directory
+     * and <code>false</code> otherwise.
+     */
+    private static final boolean isDirectory(String object) {
+        return (object.toCharArray()[object.length() - 1] == '/');
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTETriggerPlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTETriggerPlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/MTETriggerPlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -15,164 +15,164 @@
 
 
 public class MTETriggerPlotsFormatter {
-	public static void main(String[] args) throws IllegalArgumentException, IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "5772-ana.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Define the 1D trigger plot names for Møllers and tridents.
-		String[] plotNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
-				"Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
-		String[] displayNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
-				"Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
-		String[] xAxisNames1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)",
-				"Coplanarity (Degrees)", "Energy Difference (GeV)", "Energy Slope (GeV)", "Energy Sum (GeV)" };
-		String yAxisName1D = "Count";
-		
-		// Define the 2D trigger plot names for Møllers and tridents.
-		String[] plotNames2D = { "Cluster Seed", "Pair Energy Sum 2D" };
-		String[] displayNames2D = { "Cluster Seed Distribution", "2D Energy Sum" };
-		String[] xAxisNames2D = { "x-Index", "Second Cluster Energy (GeV)" };
-		String[] yAxisNames2D = { "y-Index", "First Cluster Energy (GeV)" };
-		
-		// Define the 1D trigger plot names for elastics.
-		String[] plotNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
-		String[] displayNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
-		String[] xAxisNamesElastic1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)" };
-		String yAxisNameElastic1D = "Count";
-		
-		// Define the 2D trigger plot names for elastics.
-		String[] plotNamesElastic2D = { "Cluster Seed" };
-		String[] displayNamesElastic2D = { "Cluster Seed Distribution" };
-		String[] xAxisNamesElastic2D = { "x-Index" };
-		String[] yAxisNamesElastic2D = { "y-Index" };
-		
-		// Define the Møller, trident, and elastic prefixes.
-		String allPrefix = "All Trigger Plots/Pair Plots/";
-		String møllerPrefix = "Møller Trigger Plots/Pair Plots/";
-		String tridentPrefix = "Trident Trigger Plots/Pair Plots/";
-		String elasticPrefix = "Elastic Trigger Plots/Singles Plots/";
-		String allSinglesPrefix = "All Trigger Plots/Singles Plots/";
-		
-		// Define the plot type prefix.
-		String allTypeName = "All Pairs - ";
-		String møllerTypeName = "Møller - ";
-		String tridentTypeName = "Trident - ";
-		String elasticTypeName = "Elastic - ";
-		String allSinglesTypeName = "All Singles - ";
-		
-		// Define the plot type colors.
-		ColorStyle allColor = PlotsFormatter.ColorStyle.GREY;
-		ColorStyle møllerColor = PlotsFormatter.ColorStyle.MS_BLUE;
-		ColorStyle tridentColor = PlotsFormatter.ColorStyle.MS_ORANGE;
-		ColorStyle elasticColor = PlotsFormatter.ColorStyle.MS_GREEN;
-		
-		// Create a plot formatting module.
-		PlotFormatModule module = new PlotFormatModule();
-		
-		// Get the histograms and add them to the module. Start with the
-		// trident and Møller plots.
-		for(int i = 0; i < plotNames1D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram1D allPlot = (IHistogram1D) tree.find(allPrefix + plotNames1D[i]);
-			IHistogram1D møllerPlot = (IHistogram1D) tree.find(møllerPrefix + plotNames1D[i]);
-			IHistogram1D tridentPlot = (IHistogram1D) tree.find(tridentPrefix + plotNames1D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNames1D[i], yAxisName1D, allTypeName + displayNames1D[i]);
-			FormattedPlot1D møllerFormattedPlot = new FormattedPlot1D(møllerPlot, møllerColor, xAxisNames1D[i], yAxisName1D, møllerTypeName + displayNames1D[i]);
-			FormattedPlot1D tridentFormattedPlot = new FormattedPlot1D(tridentPlot, tridentColor, xAxisNames1D[i], yAxisName1D, tridentTypeName + displayNames1D[i]);
-			
-			// Add them to the module.
-			module.addPlot1D(allFormattedPlot);
-			module.addPlot1D(møllerFormattedPlot);
-			module.addPlot1D(tridentFormattedPlot);
-		}
-		for(int i = 0; i < plotNames2D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNames2D[i]);
-			IHistogram2D møllerPlot = (IHistogram2D) tree.find(møllerPrefix + plotNames2D[i]);
-			IHistogram2D tridentPlot = (IHistogram2D) tree.find(tridentPrefix + plotNames2D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], allTypeName + displayNames2D[i]);
-			FormattedPlot2D møllerFormattedPlot = new FormattedPlot2D(møllerPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], møllerTypeName + displayNames2D[i]);
-			FormattedPlot2D tridentFormattedPlot = new FormattedPlot2D(tridentPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], tridentTypeName + displayNames2D[i]);
-			
-			// Add them to the module.
-			module.addPlot2D(allFormattedPlot);
-			module.addPlot2D(møllerFormattedPlot);
-			module.addPlot2D(tridentFormattedPlot);
-		}
-		
-		// Get the histograms for the elastic plots and add them to the module.
-		for(int i = 0; i < plotNamesElastic1D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram1D allPlot = (IHistogram1D) tree.find(allSinglesPrefix + plotNames1D[i]);
-			IHistogram1D elasticPlot = (IHistogram1D) tree.find(elasticPrefix + plotNames1D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
-					allSinglesTypeName + displayNamesElastic1D[i]);
-			FormattedPlot1D elasticFormattedPlot = new FormattedPlot1D(elasticPlot, elasticColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
-					elasticTypeName + displayNamesElastic1D[i]);
-			
-			// Add them to the module.
-			module.addPlot1D(allFormattedPlot);
-			module.addPlot1D(elasticFormattedPlot);
-		}
-		for(int i = 0; i < plotNamesElastic2D.length; i++) {
-			// Get the Møller and trident plots.
-			IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNamesElastic2D[i]);
-			IHistogram2D elasticPlot = (IHistogram2D) tree.find(møllerPrefix + plotNamesElastic2D[i]);
-			
-			// Make a formatted plot for each.
-			FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
-					allSinglesTypeName + plotNames2D[i]);
-			FormattedPlot2D elasticFormattedPlot = new FormattedPlot2D(elasticPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
-					elasticTypeName + displayNamesElastic2D[i]);
-			
-			// Add them to the module.
-			module.addPlot2D(allFormattedPlot);
-			module.addPlot2D(elasticFormattedPlot);
-		}
-		
-		// Add the MTE plots to the module.
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution"), elasticColor,
-				"Momentum (GeV)", "Count", "Elastic - Momentum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks"), elasticColor,
-				"Tracks", "Count", "Elastic - Tracks in Event"));
-		
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution"), møllerColor,
-				"Momentum Sum (GeV)", "Count", "Møller - Momentum Sum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution"), møllerColor,
-				"Momentum (GeV)", "Count", "Møller - Momentum (Electron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)"), møllerColor,
-				"Time (ns)", "Count", "Møller - Time Coincidence"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks"), møllerColor,
-				"Tracks", "Count", "Møller - Tracks in Event"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution"), false,
-				"First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Møller - 2D Momentum Sum"));
-		
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution"), tridentColor,
-				"Momentum Sum (GeV)", "Count", "Trident - Momentum Sum"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution"), tridentColor,
-				"Momentum (GeV)", "Count", "Trident - Momentum (Electron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Positron Energy Distribution"), tridentColor,
-				"Momentum (GeV)", "Count", "Trident - Momentum (Positron)"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks"), tridentColor,
-				"Tracks", "Count", "Trident - Tracks in Event"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution"), false,
-				"First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Trident - 2D Momentum Sum"));
-		
-		// Display the plots.
-		module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\TestPrint\\");
-	}
+    public static void main(String[] args) throws IllegalArgumentException, IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "5772-ana.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Define the 1D trigger plot names for Møllers and tridents.
+        String[] plotNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
+                "Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
+        String[] displayNames1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy",
+                "Pair Coplanarity", "Pair Energy Difference", "Pair Energy Slope", "Pair Energy Sum" };
+        String[] xAxisNames1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)",
+                "Coplanarity (Degrees)", "Energy Difference (GeV)", "Energy Slope (GeV)", "Energy Sum (GeV)" };
+        String yAxisName1D = "Count";
+        
+        // Define the 2D trigger plot names for Møllers and tridents.
+        String[] plotNames2D = { "Cluster Seed", "Pair Energy Sum 2D" };
+        String[] displayNames2D = { "Cluster Seed Distribution", "2D Energy Sum" };
+        String[] xAxisNames2D = { "x-Index", "Second Cluster Energy (GeV)" };
+        String[] yAxisNames2D = { "y-Index", "First Cluster Energy (GeV)" };
+        
+        // Define the 1D trigger plot names for elastics.
+        String[] plotNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
+        String[] displayNamesElastic1D = { "Cluster Hit Count", "Cluster Seed Energy", "Cluster Total Energy" };
+        String[] xAxisNamesElastic1D = { "Hit Count", "Seed Energy (GeV)", "Total Energy (GeV)" };
+        String yAxisNameElastic1D = "Count";
+        
+        // Define the 2D trigger plot names for elastics.
+        String[] plotNamesElastic2D = { "Cluster Seed" };
+        String[] displayNamesElastic2D = { "Cluster Seed Distribution" };
+        String[] xAxisNamesElastic2D = { "x-Index" };
+        String[] yAxisNamesElastic2D = { "y-Index" };
+        
+        // Define the Møller, trident, and elastic prefixes.
+        String allPrefix = "All Trigger Plots/Pair Plots/";
+        String møllerPrefix = "Møller Trigger Plots/Pair Plots/";
+        String tridentPrefix = "Trident Trigger Plots/Pair Plots/";
+        String elasticPrefix = "Elastic Trigger Plots/Singles Plots/";
+        String allSinglesPrefix = "All Trigger Plots/Singles Plots/";
+        
+        // Define the plot type prefix.
+        String allTypeName = "All Pairs - ";
+        String møllerTypeName = "Møller - ";
+        String tridentTypeName = "Trident - ";
+        String elasticTypeName = "Elastic - ";
+        String allSinglesTypeName = "All Singles - ";
+        
+        // Define the plot type colors.
+        ColorStyle allColor = PlotsFormatter.ColorStyle.GREY;
+        ColorStyle møllerColor = PlotsFormatter.ColorStyle.MS_BLUE;
+        ColorStyle tridentColor = PlotsFormatter.ColorStyle.MS_ORANGE;
+        ColorStyle elasticColor = PlotsFormatter.ColorStyle.MS_GREEN;
+        
+        // Create a plot formatting module.
+        PlotFormatModule module = new PlotFormatModule();
+        
+        // Get the histograms and add them to the module. Start with the
+        // trident and Møller plots.
+        for(int i = 0; i < plotNames1D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram1D allPlot = (IHistogram1D) tree.find(allPrefix + plotNames1D[i]);
+            IHistogram1D møllerPlot = (IHistogram1D) tree.find(møllerPrefix + plotNames1D[i]);
+            IHistogram1D tridentPlot = (IHistogram1D) tree.find(tridentPrefix + plotNames1D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNames1D[i], yAxisName1D, allTypeName + displayNames1D[i]);
+            FormattedPlot1D møllerFormattedPlot = new FormattedPlot1D(møllerPlot, møllerColor, xAxisNames1D[i], yAxisName1D, møllerTypeName + displayNames1D[i]);
+            FormattedPlot1D tridentFormattedPlot = new FormattedPlot1D(tridentPlot, tridentColor, xAxisNames1D[i], yAxisName1D, tridentTypeName + displayNames1D[i]);
+            
+            // Add them to the module.
+            module.addPlot1D(allFormattedPlot);
+            module.addPlot1D(møllerFormattedPlot);
+            module.addPlot1D(tridentFormattedPlot);
+        }
+        for(int i = 0; i < plotNames2D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNames2D[i]);
+            IHistogram2D møllerPlot = (IHistogram2D) tree.find(møllerPrefix + plotNames2D[i]);
+            IHistogram2D tridentPlot = (IHistogram2D) tree.find(tridentPrefix + plotNames2D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], allTypeName + displayNames2D[i]);
+            FormattedPlot2D møllerFormattedPlot = new FormattedPlot2D(møllerPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], møllerTypeName + displayNames2D[i]);
+            FormattedPlot2D tridentFormattedPlot = new FormattedPlot2D(tridentPlot, i == 0 ? true : false, xAxisNames2D[i], yAxisNames2D[i], tridentTypeName + displayNames2D[i]);
+            
+            // Add them to the module.
+            module.addPlot2D(allFormattedPlot);
+            module.addPlot2D(møllerFormattedPlot);
+            module.addPlot2D(tridentFormattedPlot);
+        }
+        
+        // Get the histograms for the elastic plots and add them to the module.
+        for(int i = 0; i < plotNamesElastic1D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram1D allPlot = (IHistogram1D) tree.find(allSinglesPrefix + plotNames1D[i]);
+            IHistogram1D elasticPlot = (IHistogram1D) tree.find(elasticPrefix + plotNames1D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot1D allFormattedPlot = new FormattedPlot1D(allPlot, allColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
+                    allSinglesTypeName + displayNamesElastic1D[i]);
+            FormattedPlot1D elasticFormattedPlot = new FormattedPlot1D(elasticPlot, elasticColor, xAxisNamesElastic1D[i], yAxisNameElastic1D,
+                    elasticTypeName + displayNamesElastic1D[i]);
+            
+            // Add them to the module.
+            module.addPlot1D(allFormattedPlot);
+            module.addPlot1D(elasticFormattedPlot);
+        }
+        for(int i = 0; i < plotNamesElastic2D.length; i++) {
+            // Get the Møller and trident plots.
+            IHistogram2D allPlot = (IHistogram2D) tree.find(allPrefix + plotNamesElastic2D[i]);
+            IHistogram2D elasticPlot = (IHistogram2D) tree.find(møllerPrefix + plotNamesElastic2D[i]);
+            
+            // Make a formatted plot for each.
+            FormattedPlot2D allFormattedPlot = new FormattedPlot2D(allPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
+                    allSinglesTypeName + plotNames2D[i]);
+            FormattedPlot2D elasticFormattedPlot = new FormattedPlot2D(elasticPlot, i == 0 ? true : false, xAxisNamesElastic2D[i], yAxisNamesElastic2D[i],
+                    elasticTypeName + displayNamesElastic2D[i]);
+            
+            // Add them to the module.
+            module.addPlot2D(allFormattedPlot);
+            module.addPlot2D(elasticFormattedPlot);
+        }
+        
+        // Add the MTE plots to the module.
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Energy Distribution"), elasticColor,
+                "Momentum (GeV)", "Count", "Elastic - Momentum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Elastic Event Tracks"), elasticColor,
+                "Tracks", "Count", "Elastic - Tracks in Event"));
+        
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Energy Sum Distribution"), møllerColor,
+                "Momentum Sum (GeV)", "Count", "Møller - Momentum Sum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Electron Energy Distribution"), møllerColor,
+                "Momentum (GeV)", "Count", "Møller - Momentum (Electron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Time Coincidence Distribution (All Møller Cuts)"), møllerColor,
+                "Time (ns)", "Count", "Møller - Time Coincidence"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Møller Event Tracks"), møllerColor,
+                "Tracks", "Count", "Møller - Tracks in Event"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Møller 2D Energy Distribution"), false,
+                "First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Møller - 2D Momentum Sum"));
+        
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Energy Sum Distribution"), tridentColor,
+                "Momentum Sum (GeV)", "Count", "Trident - Momentum Sum"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Electron Energy Distribution"), tridentColor,
+                "Momentum (GeV)", "Count", "Trident - Momentum (Electron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Positron Energy Distribution"), tridentColor,
+                "Momentum (GeV)", "Count", "Trident - Momentum (Positron)"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MTE Analysis/Trident Event Tracks"), tridentColor,
+                "Tracks", "Count", "Trident - Tracks in Event"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MTE Analysis/Trident 2D Energy Distribution"), false,
+                "First Track Momentum (GeV)", "Second Track Momentum (GeV)", "Trident - 2D Momentum Sum"));
+        
+        // Display the plots.
+        module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\TestPrint\\");
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/ParticleMCAnalysisPlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/ParticleMCAnalysisPlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/ParticleMCAnalysisPlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -13,43 +13,43 @@
 import org.hps.users.kmccarty.plots.PlotsFormatter.ColorStyle;
 
 public class ParticleMCAnalysisPlotsFormatter {
-	public static void main(String[] args) throws IllegalArgumentException, IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "moller-mc-out_triggerPlots.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Create a plot formatting module.
-		PlotFormatModule module = new PlotFormatModule();
-		
-		// Define the plot color.
-		ColorStyle plotColor = ColorStyle.MS_BLUE;
-		
-		// Define the plots to be read.
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron Energy Distribution"),
-				plotColor, "Electron Energy (GeV)", "Count", "Electron Energy Distribution"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron\\Electron Momentum Sum Distribution"),
-				plotColor, "Momentum Sum (GeV)", "Count", "Momentum Sum Distribution"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron\\Electron Pair Angle Distribution"),
-				plotColor, "Momentum Sum (GeV)", "Count", "Pair Angle Distribution"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle x-Momentum Distribution"),
-				plotColor, "Momentum (GeV)", "Count", "Particle x-Momentum Distribution"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle y-Momentum Distribution"),
-				plotColor, "Momentum (GeV)", "Count", "Particle y-Momentum Distribution"));
-		module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle z-Momentum Distribution"),
-				plotColor, "Momentum (GeV)", "Count", "Particle z-Momentum Distribution"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MC Analysis/Electron\\Electron 2D Momentum Distribution"),
-				true, "Particle 1 Momentum (GeV)", "Particle 2 Momentum (GeV)", "2D Momentum Sum Distribution"));
-		module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MC Analysis/Particle Momentum Distribution"),
-				true, "px (GeV)", "py (GeV)", "Particle x/y Momentum Distribution"));
-		
-		// Display the plots.
-		module.displayPlots();
-	}
+    public static void main(String[] args) throws IllegalArgumentException, IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "moller-mc-out_triggerPlots.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Create a plot formatting module.
+        PlotFormatModule module = new PlotFormatModule();
+        
+        // Define the plot color.
+        ColorStyle plotColor = ColorStyle.MS_BLUE;
+        
+        // Define the plots to be read.
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron Energy Distribution"),
+                plotColor, "Electron Energy (GeV)", "Count", "Electron Energy Distribution"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron\\Electron Momentum Sum Distribution"),
+                plotColor, "Momentum Sum (GeV)", "Count", "Momentum Sum Distribution"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Electron\\Electron Pair Angle Distribution"),
+                plotColor, "Momentum Sum (GeV)", "Count", "Pair Angle Distribution"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle x-Momentum Distribution"),
+                plotColor, "Momentum (GeV)", "Count", "Particle x-Momentum Distribution"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle y-Momentum Distribution"),
+                plotColor, "Momentum (GeV)", "Count", "Particle y-Momentum Distribution"));
+        module.addPlot1D(new FormattedPlot1D((IHistogram1D) tree.find("MC Analysis/Particle z-Momentum Distribution"),
+                plotColor, "Momentum (GeV)", "Count", "Particle z-Momentum Distribution"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MC Analysis/Electron\\Electron 2D Momentum Distribution"),
+                true, "Particle 1 Momentum (GeV)", "Particle 2 Momentum (GeV)", "2D Momentum Sum Distribution"));
+        module.addPlot2D(new FormattedPlot2D((IHistogram2D) tree.find("MC Analysis/Particle Momentum Distribution"),
+                true, "px (GeV)", "py (GeV)", "Particle x/y Momentum Distribution"));
+        
+        // Display the plots.
+        module.displayPlots();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java	Wed Mar  9 11:43:24 2016
@@ -13,101 +13,101 @@
 import hep.aida.ITree;
 
 public class RafoTridentFormatter {
-	/**
-	 * Loads all plots in a file and formats them according to the
-	 * indicated style.
-	 * @param args - Unused default executable parameter.
-	 * @throws IOException Occurs if there is an issue opening the file.
-	 */
-	public static void main(String[] args) throws IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "mte-out.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Declare the histogram names.
-		String energySumName = "Energy Sum";
-		String timeCoincidenceName = "Time Coincidence";
-		String timeEnergy2DName = "Cluster Time vs. Cluster Energy";
-		String hCoplanaritySum2DName = "Hardware Coplanarity vs. Energy Sum";
-		String coplanaritySum2DName = "Calculated Coplanarity vs. Energy Sum";
-		String energySum2DName = "Top Cluster Energy vs. Bottom Cluster Energy";
-		String fiducial = " (Fiducial Region)";
-		
-		// Get the histograms.
-		IHistogram1D[] energySum = {
-				(IHistogram1D) tree.find("Trident/" + energySumName),
-				(IHistogram1D) tree.find("Trident/" + energySumName + fiducial)
-		};
-		IHistogram1D[] timeCoincidence = {
-				(IHistogram1D) tree.find("Trident/" + timeCoincidenceName),
-				(IHistogram1D) tree.find("Trident/" + timeCoincidenceName + fiducial)
-		};
-		IHistogram2D[] coplanaritySum = {
-				(IHistogram2D) tree.find("Trident/" + coplanaritySum2DName),
-				(IHistogram2D) tree.find("Trident/" + coplanaritySum2DName + fiducial)
-		};
-		IHistogram2D[] hcoplanaritySum = {
-				(IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName),
-				(IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName + fiducial)
-		};
-		IHistogram2D[] energySum2D = {
-				(IHistogram2D) tree.find("Trident/" + energySum2DName),
-				(IHistogram2D) tree.find("Trident/" + energySum2DName + fiducial)
-		};
-		IHistogram2D[] timeEnergy = {
-				(IHistogram2D) tree.find("Trident/" + timeEnergy2DName),
-				(IHistogram2D) tree.find("Trident/" + timeEnergy2DName + fiducial)
-		};
-		
-		// Define the scaling factors for each plot.
-		double scaleFactor = 19000.0 / 9736969.0;
-		
-		// Define the plot titles and arrays for 1D plots.
-		IHistogram1D[][] plots = { energySum, timeCoincidence  };
-		String titles[] = { energySumName, timeCoincidenceName, coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
-		String[] xTitles = { "Energy (GeV)", "Time Difference (ns)" };
-		String yTitle = "Rate (Hz)";
-		
-		// Define the plot titles and arrays for 2D plots.
-		IHistogram2D[][] plots2D = { coplanaritySum, hcoplanaritySum, energySum2D, timeEnergy };
-		String[] titles2D = { coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
-		String[] xTitles2D = { "Coplanarity (Degrees)", "Coplanarity (Degrees)", "Top Cluster Energy (GeV)", "Time Coincidence (ns)" };
-		String[] yTitles2D = { "Energy Sum (GeV)", "Energy Sum (GeV)", "Bottom Cluster Energy (GeV)", "Energy Sum (GeV)" };
-		String zTitle2D = "Rate (Hz)";
-		
-		// Create a plot formatting module.
-		PlotFormatModule module = new PlotFormatModule();
-		
-		// Define the plot color.
-		ColorStyle plotColor = ColorStyle.MS_BLUE;
-		
-		// Define the plots to be read.
-		for(int i = 0; i < plots.length; i++) {
-			plots[i][0].scale(scaleFactor);
-			plots[i][1].scale(scaleFactor);
-			module.addPlot1D(new FormattedPlot1D(plots[i][0], plotColor, xTitles[i], yTitle, titles[i]));
-			module.addPlot1D(new FormattedPlot1D(plots[i][1], plotColor, xTitles[i],  yTitle, titles[i] + fiducial));
-		}
-		for(int i = 0; i < plots2D.length; i++) {
-			plots2D[i][0].scale(scaleFactor);
-			plots2D[i][1].scale(scaleFactor);
-			module.addPlot2D(new FormattedPlot2D(plots2D[i][0], false, xTitles2D[i], yTitles2D[i], titles2D[i]));
-			module.addPlot2D(new FormattedPlot2D(plots2D[i][1], false, xTitles2D[i], yTitles2D[i], titles2D[i] + fiducial));
-		}
-		
-		// Display the plots.
-		//module.displayPlots();
-		module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
-		module.exportPlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
-		
-		// Close the tree.
-		tree.close();
-	}
+    /**
+     * Loads all plots in a file and formats them according to the
+     * indicated style.
+     * @param args - Unused default executable parameter.
+     * @throws IOException Occurs if there is an issue opening the file.
+     */
+    public static void main(String[] args) throws IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "mte-out.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Declare the histogram names.
+        String energySumName = "Energy Sum";
+        String timeCoincidenceName = "Time Coincidence";
+        String timeEnergy2DName = "Cluster Time vs. Cluster Energy";
+        String hCoplanaritySum2DName = "Hardware Coplanarity vs. Energy Sum";
+        String coplanaritySum2DName = "Calculated Coplanarity vs. Energy Sum";
+        String energySum2DName = "Top Cluster Energy vs. Bottom Cluster Energy";
+        String fiducial = " (Fiducial Region)";
+        
+        // Get the histograms.
+        IHistogram1D[] energySum = {
+                (IHistogram1D) tree.find("Trident/" + energySumName),
+                (IHistogram1D) tree.find("Trident/" + energySumName + fiducial)
+        };
+        IHistogram1D[] timeCoincidence = {
+                (IHistogram1D) tree.find("Trident/" + timeCoincidenceName),
+                (IHistogram1D) tree.find("Trident/" + timeCoincidenceName + fiducial)
+        };
+        IHistogram2D[] coplanaritySum = {
+                (IHistogram2D) tree.find("Trident/" + coplanaritySum2DName),
+                (IHistogram2D) tree.find("Trident/" + coplanaritySum2DName + fiducial)
+        };
+        IHistogram2D[] hcoplanaritySum = {
+                (IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName),
+                (IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName + fiducial)
+        };
+        IHistogram2D[] energySum2D = {
+                (IHistogram2D) tree.find("Trident/" + energySum2DName),
+                (IHistogram2D) tree.find("Trident/" + energySum2DName + fiducial)
+        };
+        IHistogram2D[] timeEnergy = {
+                (IHistogram2D) tree.find("Trident/" + timeEnergy2DName),
+                (IHistogram2D) tree.find("Trident/" + timeEnergy2DName + fiducial)
+        };
+        
+        // Define the scaling factors for each plot.
+        double scaleFactor = 19000.0 / 9736969.0;
+        
+        // Define the plot titles and arrays for 1D plots.
+        IHistogram1D[][] plots = { energySum, timeCoincidence  };
+        String titles[] = { energySumName, timeCoincidenceName, coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
+        String[] xTitles = { "Energy (GeV)", "Time Difference (ns)" };
+        String yTitle = "Rate (Hz)";
+        
+        // Define the plot titles and arrays for 2D plots.
+        IHistogram2D[][] plots2D = { coplanaritySum, hcoplanaritySum, energySum2D, timeEnergy };
+        String[] titles2D = { coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
+        String[] xTitles2D = { "Coplanarity (Degrees)", "Coplanarity (Degrees)", "Top Cluster Energy (GeV)", "Time Coincidence (ns)" };
+        String[] yTitles2D = { "Energy Sum (GeV)", "Energy Sum (GeV)", "Bottom Cluster Energy (GeV)", "Energy Sum (GeV)" };
+        String zTitle2D = "Rate (Hz)";
+        
+        // Create a plot formatting module.
+        PlotFormatModule module = new PlotFormatModule();
+        
+        // Define the plot color.
+        ColorStyle plotColor = ColorStyle.MS_BLUE;
+        
+        // Define the plots to be read.
+        for(int i = 0; i < plots.length; i++) {
+            plots[i][0].scale(scaleFactor);
+            plots[i][1].scale(scaleFactor);
+            module.addPlot1D(new FormattedPlot1D(plots[i][0], plotColor, xTitles[i], yTitle, titles[i]));
+            module.addPlot1D(new FormattedPlot1D(plots[i][1], plotColor, xTitles[i],  yTitle, titles[i] + fiducial));
+        }
+        for(int i = 0; i < plots2D.length; i++) {
+            plots2D[i][0].scale(scaleFactor);
+            plots2D[i][1].scale(scaleFactor);
+            module.addPlot2D(new FormattedPlot2D(plots2D[i][0], false, xTitles2D[i], yTitles2D[i], titles2D[i]));
+            module.addPlot2D(new FormattedPlot2D(plots2D[i][1], false, xTitles2D[i], yTitles2D[i], titles2D[i] + fiducial));
+        }
+        
+        // Display the plots.
+        //module.displayPlots();
+        module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
+        module.exportPlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
+        
+        // Close the tree.
+        tree.close();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/SingleTriggerPlotsFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/SingleTriggerPlotsFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/SingleTriggerPlotsFormatter.java	Wed Mar  9 11:43:24 2016
@@ -13,151 +13,151 @@
 import hep.aida.ITree;
 
 public class SingleTriggerPlotsFormatter {
-	
-	public static void main(String[] args) throws IllegalArgumentException, IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "trident-readout-full.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Define plots variables.
-		int UNCUT     = 0;
-		int TRIGGERED = 1;
-		String[] plotsDir = { "NoCuts/", "PassedAll/" };
-		int PLOT_HIT_COUNT      = 0;
-		int PLOT_SEED_ENERGY    = 1;
-		int PLOT_CLUSTER_ENERGY = 2;
-		int PLOT_COPLANARITY    = 3;
-		int PLOT_ENERGY_SUM     = 4;
-		int PLOT_ENERGY_DIFF    = 5;
-		int PLOT_ENERGY_SLOPE   = 6;
-		int PLOT_SEED_DIST      = 0;
-		int PLOT_ENERGY_SUM_2D  = 1;
-		
-		// Define the internal plot names.
-		String[] plotNameInternal1D = new String[7];
-		String[] plotNameInternal2D = new String[2];
-		plotNameInternal1D[PLOT_HIT_COUNT]      = "Cluster Hit Count";
-		plotNameInternal1D[PLOT_SEED_ENERGY]    = "Cluster Seed Energy";
-		plotNameInternal1D[PLOT_CLUSTER_ENERGY] = "Cluster Total Energy";
-		plotNameInternal1D[PLOT_COPLANARITY]    = "Pair Coplanarity";
-		plotNameInternal1D[PLOT_ENERGY_SUM]     = "Pair Energy Sum";
-		plotNameInternal1D[PLOT_ENERGY_DIFF]    = "Pair Energy Difference";
-		plotNameInternal1D[PLOT_ENERGY_SLOPE]   = "Pair Energy Slope";
-		plotNameInternal2D[PLOT_SEED_DIST]      = "Cluster Seed";
-		plotNameInternal2D[PLOT_ENERGY_SUM_2D]  = "Pair Energy Sum 2D";
-		
-		// Define the plot display names.
-		String[] plotName1D = new String[7];
-		String[] plotName2D = new String[2];
-		for(int j = 0; j < plotNameInternal1D.length; j++) {
-			plotName1D[j] = plotNameInternal1D[j];
-		}
-		for(int j = 0; j < plotNameInternal2D.length; j++) {
-			plotName2D[j] = plotNameInternal2D[j];
-		}
-		plotName1D[PLOT_ENERGY_SUM]    = "1D Pair Energy Sum";
-		plotName2D[PLOT_SEED_DIST]     = "Cluster Seed Distribution";
-		plotName2D[PLOT_ENERGY_SUM_2D] = "2D Pair Energy Sum";
-		
-		String[] xTitles1D = new String[plotName1D.length];
-		String[] xTitles2D = new String[plotName2D.length];
-		xTitles1D[PLOT_HIT_COUNT]      = "Hit Count";
-		xTitles1D[PLOT_SEED_ENERGY]    = "Seed Energy (GeV)";
-		xTitles1D[PLOT_CLUSTER_ENERGY] = "Cluster Energy (GeV)";
-		xTitles1D[PLOT_COPLANARITY]    = "Coplanarity Angle (Degrees)";
-		xTitles1D[PLOT_ENERGY_SUM]     = "Energy Sum (GeV)";
-		xTitles1D[PLOT_ENERGY_DIFF]    = "Energy Difference (GeV)";
-		xTitles1D[PLOT_ENERGY_SLOPE]   = "Energy Slope (GeV)";
-		xTitles2D[PLOT_SEED_DIST]      = "x-Index";
-		xTitles2D[PLOT_ENERGY_SUM_2D]  = "First Cluster Energy (GeV)";
-		String yTitle1D = "Count";
-		String[] yTitles2D = new String[plotName2D.length];
-		yTitles2D[PLOT_SEED_DIST]      = "y-Index";
-		yTitles2D[PLOT_ENERGY_SUM_2D]  = "Second Cluster Energy (GeV)";
-		
-		// Define axis ranges.
-		double[] axisRanges1D = new double[plotName1D.length];
-		axisRanges1D[PLOT_HIT_COUNT]      = -1;
-		axisRanges1D[PLOT_SEED_ENERGY]    = 1.1;
-		axisRanges1D[PLOT_CLUSTER_ENERGY] = 1.1;
-		axisRanges1D[PLOT_COPLANARITY]    = 180;
-		axisRanges1D[PLOT_ENERGY_SUM]     = 2.2;
-		axisRanges1D[PLOT_ENERGY_DIFF]    = 1.1;
-		axisRanges1D[PLOT_ENERGY_SLOPE]   = 2.4;
-		double[] xAxisRanges2D = new double[plotName2D.length];
-		double[] yAxisRanges2D = new double[plotName2D.length];
-		xAxisRanges2D[PLOT_SEED_DIST]      = -1;
-		xAxisRanges2D[PLOT_ENERGY_SUM_2D]  = 1.1;
-		yAxisRanges2D[PLOT_SEED_DIST]      = -1;
-		yAxisRanges2D[PLOT_ENERGY_SUM_2D]  = 1.1;
-		
-		// Define the plot names.
-		String[][] plotLocations1D = new String[plotsDir.length][plotNameInternal1D.length];
-		String[][] plotLocations2D = new String[plotsDir.length][plotNameInternal2D.length];
-		for(int i = 0; i < plotsDir.length; i++) {
-			for(int j = 0; j < plotNameInternal1D.length; j++) {
-				plotLocations1D[i][j] = plotsDir[i] + plotNameInternal1D[j];
-			}
-		}
-		for(int i = 0; i < plotsDir.length; i++) {
-			for(int j = 0; j < plotNameInternal2D.length; j++) {
-				plotLocations2D[i][j] = plotsDir[i] + plotNameInternal2D[j];
-			}
-		}
-		
-		// Create a plot formatting module.
-		PlotFormatModule module = new PlotFormatModule();
-		
-		// Load the plot objects.
-		for(int i = 0; i < plotName1D.length; i++) {
-			// Get the uncut and triggered plots.
-			IHistogram1D uncutPlot = (IHistogram1D) tree.find(plotLocations1D[UNCUT][i]);
-			IHistogram1D triggeredPlot = (IHistogram1D) tree.find(plotLocations1D[TRIGGERED][i] + " (Passed All Cuts)");
-			
-			// Make a formatted plot for each.
-			FormattedPlot1D uncutFormattedPlot;
-			FormattedPlot1D triggeredFormattedPlot;
-			if(axisRanges1D[i] != -1) {
-				uncutFormattedPlot = new FormattedPlot1D(uncutPlot, PlotsFormatter.ColorStyle.GREY, xTitles1D[i], yTitle1D, plotName1D[i] + " (No Cuts)", axisRanges1D[i]);
-				triggeredFormattedPlot = new FormattedPlot1D(triggeredPlot, PlotsFormatter.ColorStyle.MS_GREEN, xTitles1D[i], yTitle1D, plotName1D[i] + " (Triggered)", axisRanges1D[i]);
-			} else {
-				uncutFormattedPlot = new FormattedPlot1D(uncutPlot, PlotsFormatter.ColorStyle.GREY, xTitles1D[i], yTitle1D, plotName1D[i] + " (No Cuts)");
-				triggeredFormattedPlot = new FormattedPlot1D(triggeredPlot, PlotsFormatter.ColorStyle.MS_GREEN, xTitles1D[i], yTitle1D, plotName1D[i] + " (Triggered)");
-			}
-			
-			// Add the plots to the module.
-			module.addPlot1D(uncutFormattedPlot);
-			module.addPlot1D(triggeredFormattedPlot);
-		}
-		for(int i = 0; i < plotName2D.length; i++) {
-			// Get the uncut and triggered plots.
-			IHistogram2D uncutPlot = (IHistogram2D) tree.find(plotLocations2D[UNCUT][i]);
-			IHistogram2D triggeredPlot = (IHistogram2D) tree.find(plotLocations2D[TRIGGERED][i] + " (Passed All Cuts)");
-			
-			// Make a formatted plot for each.
-			FormattedPlot2D uncutFormattedPlot;
-			FormattedPlot2D triggeredFormattedPlot;
-			if(xAxisRanges2D[i] != -1) {
-				uncutFormattedPlot = new FormattedPlot2D(uncutPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (No Cuts)", xAxisRanges2D[i], yAxisRanges2D[i]);
-				triggeredFormattedPlot = new FormattedPlot2D(triggeredPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (Triggered)", xAxisRanges2D[i], yAxisRanges2D[i]);
-			} else {
-				uncutFormattedPlot = new FormattedPlot2D(uncutPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (No Cuts)");
-				triggeredFormattedPlot = new FormattedPlot2D(triggeredPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (Triggered)");
-			}
-			
-			// Add the plots to the module.
-			module.addPlot2D(uncutFormattedPlot);
-			module.addPlot2D(triggeredFormattedPlot);
-		}
-		
-		// Save the plots.
-		module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\MonteCarlo\\Trident\\Trigger\\");
-	}
+    
+    public static void main(String[] args) throws IllegalArgumentException, IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "trident-readout-full.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Define plots variables.
+        int UNCUT     = 0;
+        int TRIGGERED = 1;
+        String[] plotsDir = { "NoCuts/", "PassedAll/" };
+        int PLOT_HIT_COUNT      = 0;
+        int PLOT_SEED_ENERGY    = 1;
+        int PLOT_CLUSTER_ENERGY = 2;
+        int PLOT_COPLANARITY    = 3;
+        int PLOT_ENERGY_SUM     = 4;
+        int PLOT_ENERGY_DIFF    = 5;
+        int PLOT_ENERGY_SLOPE   = 6;
+        int PLOT_SEED_DIST      = 0;
+        int PLOT_ENERGY_SUM_2D  = 1;
+        
+        // Define the internal plot names.
+        String[] plotNameInternal1D = new String[7];
+        String[] plotNameInternal2D = new String[2];
+        plotNameInternal1D[PLOT_HIT_COUNT]      = "Cluster Hit Count";
+        plotNameInternal1D[PLOT_SEED_ENERGY]    = "Cluster Seed Energy";
+        plotNameInternal1D[PLOT_CLUSTER_ENERGY] = "Cluster Total Energy";
+        plotNameInternal1D[PLOT_COPLANARITY]    = "Pair Coplanarity";
+        plotNameInternal1D[PLOT_ENERGY_SUM]     = "Pair Energy Sum";
+        plotNameInternal1D[PLOT_ENERGY_DIFF]    = "Pair Energy Difference";
+        plotNameInternal1D[PLOT_ENERGY_SLOPE]   = "Pair Energy Slope";
+        plotNameInternal2D[PLOT_SEED_DIST]      = "Cluster Seed";
+        plotNameInternal2D[PLOT_ENERGY_SUM_2D]  = "Pair Energy Sum 2D";
+        
+        // Define the plot display names.
+        String[] plotName1D = new String[7];
+        String[] plotName2D = new String[2];
+        for(int j = 0; j < plotNameInternal1D.length; j++) {
+            plotName1D[j] = plotNameInternal1D[j];
+        }
+        for(int j = 0; j < plotNameInternal2D.length; j++) {
+            plotName2D[j] = plotNameInternal2D[j];
+        }
+        plotName1D[PLOT_ENERGY_SUM]    = "1D Pair Energy Sum";
+        plotName2D[PLOT_SEED_DIST]     = "Cluster Seed Distribution";
+        plotName2D[PLOT_ENERGY_SUM_2D] = "2D Pair Energy Sum";
+        
+        String[] xTitles1D = new String[plotName1D.length];
+        String[] xTitles2D = new String[plotName2D.length];
+        xTitles1D[PLOT_HIT_COUNT]      = "Hit Count";
+        xTitles1D[PLOT_SEED_ENERGY]    = "Seed Energy (GeV)";
+        xTitles1D[PLOT_CLUSTER_ENERGY] = "Cluster Energy (GeV)";
+        xTitles1D[PLOT_COPLANARITY]    = "Coplanarity Angle (Degrees)";
+        xTitles1D[PLOT_ENERGY_SUM]     = "Energy Sum (GeV)";
+        xTitles1D[PLOT_ENERGY_DIFF]    = "Energy Difference (GeV)";
+        xTitles1D[PLOT_ENERGY_SLOPE]   = "Energy Slope (GeV)";
+        xTitles2D[PLOT_SEED_DIST]      = "x-Index";
+        xTitles2D[PLOT_ENERGY_SUM_2D]  = "First Cluster Energy (GeV)";
+        String yTitle1D = "Count";
+        String[] yTitles2D = new String[plotName2D.length];
+        yTitles2D[PLOT_SEED_DIST]      = "y-Index";
+        yTitles2D[PLOT_ENERGY_SUM_2D]  = "Second Cluster Energy (GeV)";
+        
+        // Define axis ranges.
+        double[] axisRanges1D = new double[plotName1D.length];
+        axisRanges1D[PLOT_HIT_COUNT]      = -1;
+        axisRanges1D[PLOT_SEED_ENERGY]    = 1.1;
+        axisRanges1D[PLOT_CLUSTER_ENERGY] = 1.1;
+        axisRanges1D[PLOT_COPLANARITY]    = 180;
+        axisRanges1D[PLOT_ENERGY_SUM]     = 2.2;
+        axisRanges1D[PLOT_ENERGY_DIFF]    = 1.1;
+        axisRanges1D[PLOT_ENERGY_SLOPE]   = 2.4;
+        double[] xAxisRanges2D = new double[plotName2D.length];
+        double[] yAxisRanges2D = new double[plotName2D.length];
+        xAxisRanges2D[PLOT_SEED_DIST]      = -1;
+        xAxisRanges2D[PLOT_ENERGY_SUM_2D]  = 1.1;
+        yAxisRanges2D[PLOT_SEED_DIST]      = -1;
+        yAxisRanges2D[PLOT_ENERGY_SUM_2D]  = 1.1;
+        
+        // Define the plot names.
+        String[][] plotLocations1D = new String[plotsDir.length][plotNameInternal1D.length];
+        String[][] plotLocations2D = new String[plotsDir.length][plotNameInternal2D.length];
+        for(int i = 0; i < plotsDir.length; i++) {
+            for(int j = 0; j < plotNameInternal1D.length; j++) {
+                plotLocations1D[i][j] = plotsDir[i] + plotNameInternal1D[j];
+            }
+        }
+        for(int i = 0; i < plotsDir.length; i++) {
+            for(int j = 0; j < plotNameInternal2D.length; j++) {
+                plotLocations2D[i][j] = plotsDir[i] + plotNameInternal2D[j];
+            }
+        }
+        
+        // Create a plot formatting module.
+        PlotFormatModule module = new PlotFormatModule();
+        
+        // Load the plot objects.
+        for(int i = 0; i < plotName1D.length; i++) {
+            // Get the uncut and triggered plots.
+            IHistogram1D uncutPlot = (IHistogram1D) tree.find(plotLocations1D[UNCUT][i]);
+            IHistogram1D triggeredPlot = (IHistogram1D) tree.find(plotLocations1D[TRIGGERED][i] + " (Passed All Cuts)");
+            
+            // Make a formatted plot for each.
+            FormattedPlot1D uncutFormattedPlot;
+            FormattedPlot1D triggeredFormattedPlot;
+            if(axisRanges1D[i] != -1) {
+                uncutFormattedPlot = new FormattedPlot1D(uncutPlot, PlotsFormatter.ColorStyle.GREY, xTitles1D[i], yTitle1D, plotName1D[i] + " (No Cuts)", axisRanges1D[i]);
+                triggeredFormattedPlot = new FormattedPlot1D(triggeredPlot, PlotsFormatter.ColorStyle.MS_GREEN, xTitles1D[i], yTitle1D, plotName1D[i] + " (Triggered)", axisRanges1D[i]);
+            } else {
+                uncutFormattedPlot = new FormattedPlot1D(uncutPlot, PlotsFormatter.ColorStyle.GREY, xTitles1D[i], yTitle1D, plotName1D[i] + " (No Cuts)");
+                triggeredFormattedPlot = new FormattedPlot1D(triggeredPlot, PlotsFormatter.ColorStyle.MS_GREEN, xTitles1D[i], yTitle1D, plotName1D[i] + " (Triggered)");
+            }
+            
+            // Add the plots to the module.
+            module.addPlot1D(uncutFormattedPlot);
+            module.addPlot1D(triggeredFormattedPlot);
+        }
+        for(int i = 0; i < plotName2D.length; i++) {
+            // Get the uncut and triggered plots.
+            IHistogram2D uncutPlot = (IHistogram2D) tree.find(plotLocations2D[UNCUT][i]);
+            IHistogram2D triggeredPlot = (IHistogram2D) tree.find(plotLocations2D[TRIGGERED][i] + " (Passed All Cuts)");
+            
+            // Make a formatted plot for each.
+            FormattedPlot2D uncutFormattedPlot;
+            FormattedPlot2D triggeredFormattedPlot;
+            if(xAxisRanges2D[i] != -1) {
+                uncutFormattedPlot = new FormattedPlot2D(uncutPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (No Cuts)", xAxisRanges2D[i], yAxisRanges2D[i]);
+                triggeredFormattedPlot = new FormattedPlot2D(triggeredPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (Triggered)", xAxisRanges2D[i], yAxisRanges2D[i]);
+            } else {
+                uncutFormattedPlot = new FormattedPlot2D(uncutPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (No Cuts)");
+                triggeredFormattedPlot = new FormattedPlot2D(triggeredPlot, true, xTitles2D[i], yTitles2D[i], plotName2D[i] + " (Triggered)");
+            }
+            
+            // Add the plots to the module.
+            module.addPlot2D(uncutFormattedPlot);
+            module.addPlot2D(triggeredFormattedPlot);
+        }
+        
+        // Save the plots.
+        module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\MonteCarlo\\Trident\\Trigger\\");
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TridentTrackFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TridentTrackFormatter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TridentTrackFormatter.java	Wed Mar  9 11:43:24 2016
@@ -16,187 +16,187 @@
 import hep.aida.ref.plotter.PlotterRegion;
 
 public class TridentTrackFormatter {
-	/**
-	 * Loads all plots in a file and formats them according to the
-	 * indicated style.
-	 * @param args - Unused default executable parameter.
-	 * @throws IOException Occurs if there is an issue opening the file.
-	 */
-	public static void main(String[] args) throws IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\tmp\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String plotFile = rootDir + "trident-out.aida";
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree tree = af.createTreeFactory().create(plotFile);
-		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		
-		// Declare the histogram names.
-		String trackName = "Tracks in Event (All)";
-		String posTrackName = "Tracks in Event (Positive)";
-		String negTrackName = "Tracks in Event (Negative)";
-		String posMomentumName = "Momentum (Positive)";
-		String negMomentumName = "Momentum (Negative)";
-		String energySumName = "Energy Sum";
-		String momentumSumName = "Momentum Sum";
-		String energyMomentumDiffName = "Energy-Momentum Difference";
-		String invariantMassName = "Invariant Mass";
-		String energySum2DName = "2D Energy Sum";
-		String momentumSum2DName = "2D Momentum Sum";
-		String positionName = "Track Cluster Position";
-		
-		// Get the histograms.
-		IHistogram1D[] tracks = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + trackName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + trackName)
-		};
-		IHistogram1D[] posTracks = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + posTrackName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + posTrackName)
-		};
-		IHistogram1D[] negTracks = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + negTrackName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + negTrackName)
-		};
-		IHistogram1D[] posMomentum = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + posMomentumName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + posMomentumName)
-		};
-		IHistogram1D[] negMomentum = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + negMomentumName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + negMomentumName)
-		};
-		IHistogram1D[] energySum = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + energySumName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + energySumName)
-		};
-		IHistogram1D[] momentumSum = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + momentumSumName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + momentumSumName)
-		};
-		IHistogram1D[] energyMomentumDiff = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + energyMomentumDiffName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + energyMomentumDiffName)
-		};
-		IHistogram1D[] invariantMass = {
-				(IHistogram1D) tree.find("Trident Analysis/All/" + invariantMassName),
-				(IHistogram1D) tree.find("Trident Analysis/Cluster/" + invariantMassName)
-		};
-		IHistogram2D[] energySum2D = {
-				(IHistogram2D) tree.find("Trident Analysis/All/" + energySum2DName),
-				(IHistogram2D) tree.find("Trident Analysis/Cluster/" + energySum2DName)
-		};
-		IHistogram2D[] momentumSum2D = {
-				(IHistogram2D) tree.find("Trident Analysis/All/" + momentumSum2DName),
-				(IHistogram2D) tree.find("Trident Analysis/Cluster/" + momentumSum2DName)
-		};
-		IHistogram2D[] position = {
-				(IHistogram2D) tree.find("Trident Analysis/All/" + positionName),
-				(IHistogram2D) tree.find("Trident Analysis/Cluster/" + positionName)
-		};
-		
-		// Re-bin the histograms to have 5-times larger bins. First,
-		// get the bin count and upper and lower bounds of the plot.
-		int bins = invariantMass[0].axis().bins();
-		double low = invariantMass[0].axis().binLowerEdge(0);
-		double high = invariantMass[0].axis().binUpperEdge(invariantMass[0].axis().bins() - 1);
-		
-		// Create new plots with the larger bin sizes.
-		AIDA aida = AIDA.defaultInstance();
-		IHistogram1D[] newPlot = new IHistogram1D[2];
-		newPlot[0] = aida.histogram1D(invariantMassName, bins / 5, low, high);
-		newPlot[1] = aida.histogram1D("Cluster " + invariantMassName, bins / 5, low, high);
-		
-		// Populate the new plots with the data from the old ones.
-		for(int j = 0; j < 2; j++) {
-			for(int i = 0; i < bins; i++) {
-				int entries = invariantMass[j].binEntries(i);
-				double center = invariantMass[j].axis().binCenter(i);
-				for(int k = 0; k < entries; k++) {
-					newPlot[j].fill(center);
-				}
-			}
-		}
-		
-		// Replace the old plots.
-		invariantMass = newPlot;
-		
-		// Define the scaling factors for each plot.
-		double scaleFactor = 1;
-		
-		// Define the plot titles and arrays for 1D plots.
-		IHistogram[][] plots = { tracks, posTracks, negTracks, posMomentum, negMomentum, energySum, momentumSum, energyMomentumDiff, invariantMass };
-		String[] titles = { trackName, posTrackName, negTrackName, posMomentumName, negMomentumName, energySumName, momentumSumName,
-				energyMomentumDiffName, invariantMassName };
-		String[] xTitles = { "Tracks", "Tracks", "Tracks", "Momentum (GeV)", "Momentum (GeV)", "Energy Sum (GeV)", "Momentum Sum (GeV)",
-				"|E_Cluster - P_Track| (GeV)", "Invariant Mass (GeV)" };
-		String yTitle = "Count";
-		
-		// Define the plot titles and arrays for 2D plots.
-		IHistogram2D[][] plots2D = { energySum2D, momentumSum2D, position };
-		String[] titles2D = { energySum2DName, momentumSum2DName, positionName };
-		String[] xTitles2D = { "Positive Cluster Energy", "Positive Track Momentum", "x-Index" };
-		String[] yTitles2D = { "Negative Cluster Energy", "Negative Track Momentum", "y-Index" };
-		String zTitle2D = "Count";
-		
-		// Create a plotter factory.
-		IPlotterFactory plotterFactory = af.createPlotterFactory();
-		
-		// Format and display the basic histograms.
-		for(int i = 0; i < plots.length; i++) {
-			for(int j = 0; j < 2; j++) {
-				// Scale the histogram by the appropriate scaling factor.
-				plots[i][j].scale(1.0 / scaleFactor);
-				
-				// Create a plotter and plotting region for the plot.
-				IPlotter plotter = plotterFactory.create((j == 1 ? "Cluster " : "") + titles[i]);
-				plotter.createRegions(1);
-				plotter.region(0).plot(plots[i][j]);
-				
-				// Format the axis labels.
-				PlotterRegion region = (PlotterRegion) plotter.region(0);
-				region.getPlot().setTitle((j == 1 ? "Cluster " : "") + titles[i]);
-				region.getPlot().getXAxis().setLabel(xTitles[i]);
-				region.getPlot().getYAxis().setLabel(yTitle);
-				
-				// Format the fonts and general plot presentation.
-				PlotsFormatter.setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
-				
-				// Show the plot.
-				plotter.setParameter("plotterWidth", "2000");
-				plotter.setParameter("plotterHeight", "1200");
-				plotter.show();
-			}
-		}
-		
-		// Format and display the 2D histogram.
-		for(int i = 0; i < plots2D.length; i++) {
-			for(int j = 0; j < 2; j++) {
-				plots2D[i][j].scale(1.0 / scaleFactor);
-				IPlotter plotter2D = plotterFactory.create((j == 1 ? "Cluster " : "") + titles2D[i]);
-				plotter2D.createRegions(1);
-				plotter2D.region(0).plot(plots2D[i][j]);
-				
-				// Format the axis labels.
-				PlotterRegion region2D = (PlotterRegion) plotter2D.region(0);
-				region2D.getPlot().setTitle((j == 1 ? "Cluster " : "") + titles2D[i]);
-				region2D.getPlot().getXAxis().setLabel(xTitles2D[i]);
-				region2D.getPlot().getYAxis().setLabel(yTitles2D[i]);
-				
-				// Format the fonts and general plot presentation.
-				PlotsFormatter.setDefault2DStyle(region2D, true);
-				
-				// Show the plot.
-				plotter2D.setParameter("plotterWidth", "2000");
-				plotter2D.setParameter("plotterHeight", "1200");
-				plotter2D.show();
-			}
-		}
-		
-		// Close the tree.
-		tree.close();
-	}
+    /**
+     * Loads all plots in a file and formats them according to the
+     * indicated style.
+     * @param args - Unused default executable parameter.
+     * @throws IOException Occurs if there is an issue opening the file.
+     */
+    public static void main(String[] args) throws IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\tmp\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String plotFile = rootDir + "trident-out.aida";
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree tree = af.createTreeFactory().create(plotFile);
+        if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        
+        // Declare the histogram names.
+        String trackName = "Tracks in Event (All)";
+        String posTrackName = "Tracks in Event (Positive)";
+        String negTrackName = "Tracks in Event (Negative)";
+        String posMomentumName = "Momentum (Positive)";
+        String negMomentumName = "Momentum (Negative)";
+        String energySumName = "Energy Sum";
+        String momentumSumName = "Momentum Sum";
+        String energyMomentumDiffName = "Energy-Momentum Difference";
+        String invariantMassName = "Invariant Mass";
+        String energySum2DName = "2D Energy Sum";
+        String momentumSum2DName = "2D Momentum Sum";
+        String positionName = "Track Cluster Position";
+        
+        // Get the histograms.
+        IHistogram1D[] tracks = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + trackName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + trackName)
+        };
+        IHistogram1D[] posTracks = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + posTrackName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + posTrackName)
+        };
+        IHistogram1D[] negTracks = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + negTrackName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + negTrackName)
+        };
+        IHistogram1D[] posMomentum = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + posMomentumName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + posMomentumName)
+        };
+        IHistogram1D[] negMomentum = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + negMomentumName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + negMomentumName)
+        };
+        IHistogram1D[] energySum = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + energySumName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + energySumName)
+        };
+        IHistogram1D[] momentumSum = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + momentumSumName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + momentumSumName)
+        };
+        IHistogram1D[] energyMomentumDiff = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + energyMomentumDiffName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + energyMomentumDiffName)
+        };
+        IHistogram1D[] invariantMass = {
+                (IHistogram1D) tree.find("Trident Analysis/All/" + invariantMassName),
+                (IHistogram1D) tree.find("Trident Analysis/Cluster/" + invariantMassName)
+        };
+        IHistogram2D[] energySum2D = {
+                (IHistogram2D) tree.find("Trident Analysis/All/" + energySum2DName),
+                (IHistogram2D) tree.find("Trident Analysis/Cluster/" + energySum2DName)
+        };
+        IHistogram2D[] momentumSum2D = {
+                (IHistogram2D) tree.find("Trident Analysis/All/" + momentumSum2DName),
+                (IHistogram2D) tree.find("Trident Analysis/Cluster/" + momentumSum2DName)
+        };
+        IHistogram2D[] position = {
+                (IHistogram2D) tree.find("Trident Analysis/All/" + positionName),
+                (IHistogram2D) tree.find("Trident Analysis/Cluster/" + positionName)
+        };
+        
+        // Re-bin the histograms to have 5-times larger bins. First,
+        // get the bin count and upper and lower bounds of the plot.
+        int bins = invariantMass[0].axis().bins();
+        double low = invariantMass[0].axis().binLowerEdge(0);
+        double high = invariantMass[0].axis().binUpperEdge(invariantMass[0].axis().bins() - 1);
+        
+        // Create new plots with the larger bin sizes.
+        AIDA aida = AIDA.defaultInstance();
+        IHistogram1D[] newPlot = new IHistogram1D[2];
+        newPlot[0] = aida.histogram1D(invariantMassName, bins / 5, low, high);
+        newPlot[1] = aida.histogram1D("Cluster " + invariantMassName, bins / 5, low, high);
+        
+        // Populate the new plots with the data from the old ones.
+        for(int j = 0; j < 2; j++) {
+            for(int i = 0; i < bins; i++) {
+                int entries = invariantMass[j].binEntries(i);
+                double center = invariantMass[j].axis().binCenter(i);
+                for(int k = 0; k < entries; k++) {
+                    newPlot[j].fill(center);
+                }
+            }
+        }
+        
+        // Replace the old plots.
+        invariantMass = newPlot;
+        
+        // Define the scaling factors for each plot.
+        double scaleFactor = 1;
+        
+        // Define the plot titles and arrays for 1D plots.
+        IHistogram[][] plots = { tracks, posTracks, negTracks, posMomentum, negMomentum, energySum, momentumSum, energyMomentumDiff, invariantMass };
+        String[] titles = { trackName, posTrackName, negTrackName, posMomentumName, negMomentumName, energySumName, momentumSumName,
+                energyMomentumDiffName, invariantMassName };
+        String[] xTitles = { "Tracks", "Tracks", "Tracks", "Momentum (GeV)", "Momentum (GeV)", "Energy Sum (GeV)", "Momentum Sum (GeV)",
+                "|E_Cluster - P_Track| (GeV)", "Invariant Mass (GeV)" };
+        String yTitle = "Count";
+        
+        // Define the plot titles and arrays for 2D plots.
+        IHistogram2D[][] plots2D = { energySum2D, momentumSum2D, position };
+        String[] titles2D = { energySum2DName, momentumSum2DName, positionName };
+        String[] xTitles2D = { "Positive Cluster Energy", "Positive Track Momentum", "x-Index" };
+        String[] yTitles2D = { "Negative Cluster Energy", "Negative Track Momentum", "y-Index" };
+        String zTitle2D = "Count";
+        
+        // Create a plotter factory.
+        IPlotterFactory plotterFactory = af.createPlotterFactory();
+        
+        // Format and display the basic histograms.
+        for(int i = 0; i < plots.length; i++) {
+            for(int j = 0; j < 2; j++) {
+                // Scale the histogram by the appropriate scaling factor.
+                plots[i][j].scale(1.0 / scaleFactor);
+                
+                // Create a plotter and plotting region for the plot.
+                IPlotter plotter = plotterFactory.create((j == 1 ? "Cluster " : "") + titles[i]);
+                plotter.createRegions(1);
+                plotter.region(0).plot(plots[i][j]);
+                
+                // Format the axis labels.
+                PlotterRegion region = (PlotterRegion) plotter.region(0);
+                region.getPlot().setTitle((j == 1 ? "Cluster " : "") + titles[i]);
+                region.getPlot().getXAxis().setLabel(xTitles[i]);
+                region.getPlot().getYAxis().setLabel(yTitle);
+                
+                // Format the fonts and general plot presentation.
+                PlotsFormatter.setDefault1DStyle(region, new ColorStyle[] { ColorStyle.GREY });
+                
+                // Show the plot.
+                plotter.setParameter("plotterWidth", "2000");
+                plotter.setParameter("plotterHeight", "1200");
+                plotter.show();
+            }
+        }
+        
+        // Format and display the 2D histogram.
+        for(int i = 0; i < plots2D.length; i++) {
+            for(int j = 0; j < 2; j++) {
+                plots2D[i][j].scale(1.0 / scaleFactor);
+                IPlotter plotter2D = plotterFactory.create((j == 1 ? "Cluster " : "") + titles2D[i]);
+                plotter2D.createRegions(1);
+                plotter2D.region(0).plot(plots2D[i][j]);
+                
+                // Format the axis labels.
+                PlotterRegion region2D = (PlotterRegion) plotter2D.region(0);
+                region2D.getPlot().setTitle((j == 1 ? "Cluster " : "") + titles2D[i]);
+                region2D.getPlot().getXAxis().setLabel(xTitles2D[i]);
+                region2D.getPlot().getYAxis().setLabel(yTitles2D[i]);
+                
+                // Format the fonts and general plot presentation.
+                PlotsFormatter.setDefault2DStyle(region2D, true);
+                
+                // Show the plot.
+                plotter2D.setParameter("plotterWidth", "2000");
+                plotter2D.setParameter("plotterHeight", "1200");
+                plotter2D.show();
+            }
+        }
+        
+        // Close the tree.
+        tree.close();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TriggerPlotsFormat.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TriggerPlotsFormat.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/TriggerPlotsFormat.java	Wed Mar  9 11:43:24 2016
@@ -20,331 +20,331 @@
 import hep.aida.ref.plotter.PlotterRegion;
 
 public class TriggerPlotsFormat {
-	// Define plot fonts.
-	private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
-	private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
-	private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
-	
-	// Defines the color style options for plot data.
-	private enum ColorStyle {
-		 MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
-		  MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
-		MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
-		    RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
-		  FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
-		    TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
-		    BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
-		  PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
-		
-		private final Color fillColor;
-		private final Color lineColor;
-		
-		private ColorStyle(Color fillColor, Color lineColor) {
-			this.fillColor = fillColor;
-			this.lineColor = lineColor;
-		}
-		
-		public Color getFillColor() { return fillColor; }
-		
-		public Color getLineColor() { return lineColor; }
-	};
-		
-	/**
-	 * Loads all plots in a file and formats them according to the
-	 * indicated style.
-	 * @param args - Unused default executable parameter.
-	 * @throws IOException Occurs if there is an issue opening the file.
-	 */
-	public static void main(String[] args) throws IOException {
-		// Define the root directory for the plots.
-		String rootDir = "D:\\cygwin64\\home\\Kyle\\beam-plots\\base\\";
-		//String rootDir = "D:\\cygwin64\\home\\Kyle\\aprime-plots\\base\\readout-plots\\";
-		
-		// Define the new name of the file containing the trigger plots.
-		String[] plotFile = {
-				rootDir + "compiled-plots.aida"
-				//rootDir + "15-MeV\\compiled-plots.aida",
-				//rootDir + "20-MeV\\compiled-plots.aida",
-				//rootDir + "30-MeV\\compiled-plots.aida",
-				//rootDir + "40-MeV\\compiled-plots.aida",
-				//rootDir + "50-MeV\\compiled-plots.aida"
-		};
-		
-		// Define the names of each plot. This will be used for the
-		// legend in the case of multiple plots.
-		String[] treeName = {
-			"Background",
-			"15 MeV A'",
-			"20 MeV A'",
-			"30 MeV A'",
-			"40 MeV A'",
-			"50 MeV A'"
-		};
-		
-		// Define the color style for the plots.
-		ColorStyle[] dataColorStyle = {
-				ColorStyle.GREY,
-				ColorStyle.MS_GREEN,
-				ColorStyle.MS_BLUE,
-				ColorStyle.MS_ORANGE,
-				ColorStyle.MS_RED,
-				ColorStyle.TEAL,
-				ColorStyle.CRIMSON,
-				ColorStyle.FOREST
-		};
-		
-		// Get the plots file and open it.
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITree[] tree = new ITree[plotFile.length];
-		for(int i = 0; i < plotFile.length; i++) {
-			tree[i] = af.createTreeFactory().create(plotFile[i]);
-			if(tree[i] == null) { throw new IllegalArgumentException("Unable to load plot file."); }
-		}
-		
-		// Get a list of all the histograms in the file.
-		List<List<String>> treeHistograms = new ArrayList<List<String>>(plotFile.length);
-		for(int i = 0; i < plotFile.length; i++) {
-			treeHistograms.add(getHistograms(tree[i], "/NoCuts/"));//, "/PassedAll/"));
-		}
-		
-		// Create a plotter factory.
-		IPlotterFactory plotterFactory = af.createPlotterFactory();
-		
-		// Plot each histogram and format it.
-		for(String histogram : treeHistograms.get(0)) {
-			// Get the plot from the tree and verify that it is a 1D
-			// or 2D histogram. Other types are not supported.
-			IManagedObject histObject = tree[0].find(histogram);
-			if(!(histObject instanceof IHistogram1D) && !(histObject instanceof IHistogram2D)) {
-				continue;
-			}
-			
-			// Obtain the histogram object.
-			IBaseHistogram hist;
-			if(histObject instanceof IHistogram1D) { hist = (IHistogram1D) histObject; }
-			else { hist = (IHistogram2D) histObject; }
-			
-			// Define whether this is an overlay plot and whether
-			// this is a one or two dimensional plot.
-			boolean overlay = plotFile.length > 1;
-			boolean twoDimensional = hist instanceof IHistogram2D;
-			
-			// Generate the plotter and set its title. The plotter will
-			// use the title of the first tree's plot.
-			String plotTitle = hist.title();
-			IPlotter plotter = plotterFactory.create(plotTitle);
-			
-			// For single plots and one-dimensional overlay plots,
-			// there should only be a single plotter region.
-			if(!twoDimensional || !overlay) { plotter.createRegions(1); }
-			
-			// For two-dimensional overlay plots, create a region for
-			// each plot individually.
-			else { plotter.createRegions(2, (int) Math.ceil(plotFile.length / 2.0)); }
-			
-			// Find the histogram in each of the trees and plot them
-			// all on the same region.
-			for(int i = 0; i < plotFile.length; i++) {
-				// Get the histogram from the tree.
-				IManagedObject treeObject = tree[i].find(histogram);
-				IBaseHistogram treeHist;
-				if(treeObject instanceof IHistogram1D) { treeHist = (IHistogram1D) treeObject; }
-				else { treeHist = (IHistogram2D) treeObject; }
-				
-				// Display the plot.
-				if(treeHist != null) {
-					// Set the title of plot to the name associated with
-					// its tree. This ensures that the correct name will
-					// appear on the legend.
-					if(plotFile.length > 1) {
-						treeHist.setTitle(treeName[i]);
-					}
-					
-					// Plot the tree's data in the plotter region.
-					if(!twoDimensional || !overlay) { plotter.region(0).plot(treeHist); }
-					else {
-						plotter.region(i).plot(treeHist);
-						setDefault2DStyle(((PlotterRegion) plotter.region(i)), dataColorStyle);
-					}
-				}
-			}
-			
-			// Format the plot region.
-			if(!twoDimensional) { setDefault1DStyle(((PlotterRegion) plotter.region(0)), dataColorStyle); }
-			else { setDefault2DStyle(((PlotterRegion) plotter.region(0)), dataColorStyle); }
-			
-			// Show the plotter.
-			plotter.region(0).setTitle(plotTitle);
-			plotter.setParameter("plotterWidth", "750");
-			plotter.setParameter("plotterHeight", "600");
-			//plotter.setParameter("plotterWidth", "2000");
-			//plotter.setParameter("plotterHeight", "1200");
-			plotter.show();
-		}
-		
-		// Close the trees.
-		for(int i = 0; i < plotFile.length; i++) {
-			tree[i].close();
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the names of each plot on in the region.
-		String[] dataNames = region.getAllDataNames();
-		
-		// Check whether this is an overlay plot. Overlay plots contain
-		// more than one data name.
-		boolean overlay = (dataNames.length > 1 ? true : false);
-		
-		// Iterate over each plot in the region.
-		for(int i = 0; i < dataNames.length; i++) {
-			// Set the overlay style if needed.
-			if(overlay) {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with no fill. The color is set by the "color" argument.
-				fillStyle.setHistogramFill(false);
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarLineColor(color[i].getFillColor());
-				
-				// Set the legend text style.
-				region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
-			}
-			
-			// Otherwise, set the fill style for a single plot.
-			else {
-				// Get the fill style for the current data type.
-				JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
-				
-				// Set the histogram style to display thick-lined bars
-				// with a fill color. The colors are defined by the
-				// "color" argument.
-				fillStyle.setHistogramBarLineWidth(3);
-				fillStyle.setHistogramBarColor(color[i].getFillColor());
-				fillStyle.setHistogramBarLineColor(color[i].getLineColor());
-			}
-			
-			// Set the statistics box style.
-			region.getPlot().getStats().setVisible(true);
-			region.getPlot().getStats().setFont(BASIC_FONT);
-			
-			// Set the title font.
-			region.getPlot().getTitleObject().setFont(TITLE_FONT);
-			
-			// Set generic axis titles.
-			region.getPlot().getXAxis().setLabel("Data Label (Unit)");
-			region.getPlot().getYAxis().setLabel("Count");
-			
-			// Set the axis tick-mark fonts.
-			region.getPlot().getXAxis().setFont(BASIC_FONT);
-			region.getPlot().getYAxis().setFont(BASIC_FONT);
-			region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-			region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-		}
-	}
-	
-	/**
-	 * Sets the plot display formatting for 1D plots.
-	 * @param region - The plotter region to format.
-	 * @param color - The data color settings to use.
-	 */
-	private static final void setDefault2DStyle(PlotterRegion region, ColorStyle[] color) {
-		// Get the fill style object. 2D plots should never be overlay
-		// plots, so there should only ever be one data name.
-		JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
-		
-		// Set the fill style for a two-dimensional plot.
-		fillStyle.setLogZ(true);
-		fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
-		fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
-		
-		// Make the statistics box invisible.
-		region.getPlot().getStats().setVisible(false);
-		
-		// Set the general plot font (which is also the z-axis font).
-		region.getPlot().setFont(BASIC_FONT);
-		
-		// Set the title font.
-		region.getPlot().getTitleObject().setFont(TITLE_FONT);
-		
-		// Set generic axis titles.
-		region.getPlot().getXAxis().setLabel("Data Label (Unit)");
-		region.getPlot().getYAxis().setLabel("Data Label (Unit)");
-		
-		// Set the axis tick-mark fonts.
-		region.getPlot().getXAxis().setFont(BASIC_FONT);
-		region.getPlot().getYAxis().setFont(BASIC_FONT);
-		region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
-		region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
-	}
-	
-	/**
-	 * Gets a list of all objects that are not directories in a tree.
-	 * @param tree - The tree from which to extract the object names.
-	 * @return Returns the object names as <code>String</code> objects
-	 * in a <code>List</code> collection.
-	 */
-	private static final List<String> getHistograms(ITree tree) {
-		return getHistograms(tree, "/");
-	}
-	
-	/**
-	 * Gets a list of all objects that are not directories in a tree.
-	 * @param tree - The tree from which to extract the object names.
-	 * @return Returns the object names as <code>String</code> objects
-	 * in a <code>List</code> collection.
-	 */
-	private static final List<String> getHistograms(ITree tree, String rootDir) {
-		return getHistograms(tree, rootDir, new ArrayList<String>());
-	}
-	
-	/**
-	 * Recursive method that gets all object names from a tree that
-	 * are not directories. Method should not be called directly, but
-	 * rather called only through the <code>getHistograms(ITree)</code>
-	 * method.
-	 * @param tree - The tree from which to obtain the object names.
-	 * @param directory - The directory in which to search for objects.
-	 * @param list - The list in which to place the objects.
-	 * @return Returns the <code>List</code> collection that was given
-	 * as an argument.
-	 */
-	private static final List<String> getHistograms(ITree tree, String directory, List<String> list) {
-		// Get the list of objects in the directory.
-		String[] treeObjects = tree.listObjectNames(directory);
-		
-		// Print the objects.
-		for(String objectName : treeObjects) {
-			// Check if the object is a directory.
-			boolean isDirectory = isDirectory(objectName);
-			
-			// If the object is a directory, get the histograms from it.
-			if(isDirectory) {
-				getHistograms(tree, objectName, list);
-			}
-			
-			// If the object is a plot, add it to the list.
-			else { list.add(objectName); }
-		}
-		
-		// Return the list.
-		return list;
-	}
-	
-	/**
-	 * Checks whether a tree object is a directory.
-	 * @param object - The object to check.
-	 * @return Returns <code>true</code> if the object is a directory
-	 * and <code>false</code> otherwise.
-	 */
-	private static final boolean isDirectory(String object) {
-		return (object.toCharArray()[object.length() - 1] == '/');
-	}
+    // Define plot fonts.
+    private static final Font BASIC_FONT = new Font("Calibri", Font.PLAIN, 20);
+    private static final Font AXIS_FONT  = new Font("Calibri", Font.BOLD,  25);
+    private static final Font TITLE_FONT = new Font("Calibri", Font.BOLD,  35);
+    
+    // Defines the color style options for plot data.
+    private enum ColorStyle {
+         MS_BLUE(new Color( 79, 129, 189), new Color( 36,  64,  97)), MS_ORANGE(new Color(247, 150,  70), new Color(152,  72,   6)),
+          MS_RED(new Color(192,  80,  77), new Color( 99,  36,  35)),      GREY(new Color(166, 166, 166), new Color( 89,  89,  89)),
+        MS_GREEN(new Color(155, 187,  89), new Color( 79,  98,  40)),   CRIMSON(new Color(161,   0,   0), new Color(104,   0,   0)),
+            RUST(new Color(161,  80,   0), new Color(105,  80,   0)),    YELLOW(new Color(161, 161,   0), new Color(122, 109,   8)),
+          FOREST(new Color( 65, 102,   0), new Color( 37,  79,   0)),     GREEN(new Color(  7, 132,  70), new Color(  7,  82,  30)),
+            TEAL(new Color(  0, 130, 130), new Color(  0,  90, 100)),  CERULEAN(new Color(  0,  86, 130), new Color(  0,  28,  83)),
+            BLUE(new Color(  0,  33, 203), new Color(  0,   0, 137)),    INDIGO(new Color( 68,  10, 127), new Color(  0,   0,  61)),
+          PURPLE(new Color(106,   0, 106), new Color( 63,   0,  56)),   FUSCHIA(new Color(119,   0,  60), new Color( 60,   0,  60));
+        
+        private final Color fillColor;
+        private final Color lineColor;
+        
+        private ColorStyle(Color fillColor, Color lineColor) {
+            this.fillColor = fillColor;
+            this.lineColor = lineColor;
+        }
+        
+        public Color getFillColor() { return fillColor; }
+        
+        public Color getLineColor() { return lineColor; }
+    };
+        
+    /**
+     * Loads all plots in a file and formats them according to the
+     * indicated style.
+     * @param args - Unused default executable parameter.
+     * @throws IOException Occurs if there is an issue opening the file.
+     */
+    public static void main(String[] args) throws IOException {
+        // Define the root directory for the plots.
+        String rootDir = "D:\\cygwin64\\home\\Kyle\\beam-plots\\base\\";
+        //String rootDir = "D:\\cygwin64\\home\\Kyle\\aprime-plots\\base\\readout-plots\\";
+        
+        // Define the new name of the file containing the trigger plots.
+        String[] plotFile = {
+                rootDir + "compiled-plots.aida"
+                //rootDir + "15-MeV\\compiled-plots.aida",
+                //rootDir + "20-MeV\\compiled-plots.aida",
+                //rootDir + "30-MeV\\compiled-plots.aida",
+                //rootDir + "40-MeV\\compiled-plots.aida",
+                //rootDir + "50-MeV\\compiled-plots.aida"
+        };
+        
+        // Define the names of each plot. This will be used for the
+        // legend in the case of multiple plots.
+        String[] treeName = {
+            "Background",
+            "15 MeV A'",
+            "20 MeV A'",
+            "30 MeV A'",
+            "40 MeV A'",
+            "50 MeV A'"
+        };
+        
+        // Define the color style for the plots.
+        ColorStyle[] dataColorStyle = {
+                ColorStyle.GREY,
+                ColorStyle.MS_GREEN,
+                ColorStyle.MS_BLUE,
+                ColorStyle.MS_ORANGE,
+                ColorStyle.MS_RED,
+                ColorStyle.TEAL,
+                ColorStyle.CRIMSON,
+                ColorStyle.FOREST
+        };
+        
+        // Get the plots file and open it.
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITree[] tree = new ITree[plotFile.length];
+        for(int i = 0; i < plotFile.length; i++) {
+            tree[i] = af.createTreeFactory().create(plotFile[i]);
+            if(tree[i] == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+        }
+        
+        // Get a list of all the histograms in the file.
+        List<List<String>> treeHistograms = new ArrayList<List<String>>(plotFile.length);
+        for(int i = 0; i < plotFile.length; i++) {
+            treeHistograms.add(getHistograms(tree[i], "/NoCuts/"));//, "/PassedAll/"));
+        }
+        
+        // Create a plotter factory.
+        IPlotterFactory plotterFactory = af.createPlotterFactory();
+        
+        // Plot each histogram and format it.
+        for(String histogram : treeHistograms.get(0)) {
+            // Get the plot from the tree and verify that it is a 1D
+            // or 2D histogram. Other types are not supported.
+            IManagedObject histObject = tree[0].find(histogram);
+            if(!(histObject instanceof IHistogram1D) && !(histObject instanceof IHistogram2D)) {
+                continue;
+            }
+            
+            // Obtain the histogram object.
+            IBaseHistogram hist;
+            if(histObject instanceof IHistogram1D) { hist = (IHistogram1D) histObject; }
+            else { hist = (IHistogram2D) histObject; }
+            
+            // Define whether this is an overlay plot and whether
+            // this is a one or two dimensional plot.
+            boolean overlay = plotFile.length > 1;
+            boolean twoDimensional = hist instanceof IHistogram2D;
+            
+            // Generate the plotter and set its title. The plotter will
+            // use the title of the first tree's plot.
+            String plotTitle = hist.title();
+            IPlotter plotter = plotterFactory.create(plotTitle);
+            
+            // For single plots and one-dimensional overlay plots,
+            // there should only be a single plotter region.
+            if(!twoDimensional || !overlay) { plotter.createRegions(1); }
+            
+            // For two-dimensional overlay plots, create a region for
+            // each plot individually.
+            else { plotter.createRegions(2, (int) Math.ceil(plotFile.length / 2.0)); }
+            
+            // Find the histogram in each of the trees and plot them
+            // all on the same region.
+            for(int i = 0; i < plotFile.length; i++) {
+                // Get the histogram from the tree.
+                IManagedObject treeObject = tree[i].find(histogram);
+                IBaseHistogram treeHist;
+                if(treeObject instanceof IHistogram1D) { treeHist = (IHistogram1D) treeObject; }
+                else { treeHist = (IHistogram2D) treeObject; }
+                
+                // Display the plot.
+                if(treeHist != null) {
+                    // Set the title of plot to the name associated with
+                    // its tree. This ensures that the correct name will
+                    // appear on the legend.
+                    if(plotFile.length > 1) {
+                        treeHist.setTitle(treeName[i]);
+                    }
+                    
+                    // Plot the tree's data in the plotter region.
+                    if(!twoDimensional || !overlay) { plotter.region(0).plot(treeHist); }
+                    else {
+                        plotter.region(i).plot(treeHist);
+                        setDefault2DStyle(((PlotterRegion) plotter.region(i)), dataColorStyle);
+                    }
+                }
+            }
+            
+            // Format the plot region.
+            if(!twoDimensional) { setDefault1DStyle(((PlotterRegion) plotter.region(0)), dataColorStyle); }
+            else { setDefault2DStyle(((PlotterRegion) plotter.region(0)), dataColorStyle); }
+            
+            // Show the plotter.
+            plotter.region(0).setTitle(plotTitle);
+            plotter.setParameter("plotterWidth", "750");
+            plotter.setParameter("plotterHeight", "600");
+            //plotter.setParameter("plotterWidth", "2000");
+            //plotter.setParameter("plotterHeight", "1200");
+            plotter.show();
+        }
+        
+        // Close the trees.
+        for(int i = 0; i < plotFile.length; i++) {
+            tree[i].close();
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    private static final void setDefault1DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the names of each plot on in the region.
+        String[] dataNames = region.getAllDataNames();
+        
+        // Check whether this is an overlay plot. Overlay plots contain
+        // more than one data name.
+        boolean overlay = (dataNames.length > 1 ? true : false);
+        
+        // Iterate over each plot in the region.
+        for(int i = 0; i < dataNames.length; i++) {
+            // Set the overlay style if needed.
+            if(overlay) {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with no fill. The color is set by the "color" argument.
+                fillStyle.setHistogramFill(false);
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarLineColor(color[i].getFillColor());
+                
+                // Set the legend text style.
+                region.getPlot().getLegend().setFont(new Font("Calibri", Font.PLAIN, 20));
+            }
+            
+            // Otherwise, set the fill style for a single plot.
+            else {
+                // Get the fill style for the current data type.
+                JASHist1DHistogramStyle fillStyle = (JASHist1DHistogramStyle) region.getDataForName(dataNames[i]).getStyle();
+                
+                // Set the histogram style to display thick-lined bars
+                // with a fill color. The colors are defined by the
+                // "color" argument.
+                fillStyle.setHistogramBarLineWidth(3);
+                fillStyle.setHistogramBarColor(color[i].getFillColor());
+                fillStyle.setHistogramBarLineColor(color[i].getLineColor());
+            }
+            
+            // Set the statistics box style.
+            region.getPlot().getStats().setVisible(true);
+            region.getPlot().getStats().setFont(BASIC_FONT);
+            
+            // Set the title font.
+            region.getPlot().getTitleObject().setFont(TITLE_FONT);
+            
+            // Set generic axis titles.
+            region.getPlot().getXAxis().setLabel("Data Label (Unit)");
+            region.getPlot().getYAxis().setLabel("Count");
+            
+            // Set the axis tick-mark fonts.
+            region.getPlot().getXAxis().setFont(BASIC_FONT);
+            region.getPlot().getYAxis().setFont(BASIC_FONT);
+            region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+            region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+        }
+    }
+    
+    /**
+     * Sets the plot display formatting for 1D plots.
+     * @param region - The plotter region to format.
+     * @param color - The data color settings to use.
+     */
+    private static final void setDefault2DStyle(PlotterRegion region, ColorStyle[] color) {
+        // Get the fill style object. 2D plots should never be overlay
+        // plots, so there should only ever be one data name.
+        JASHist2DHistogramStyle fillStyle = (JASHist2DHistogramStyle) region.getDataForName(region.getAllDataNames()[0]).getStyle();
+        
+        // Set the fill style for a two-dimensional plot.
+        fillStyle.setLogZ(true);
+        fillStyle.setHistStyle(JASHist2DHistogramStyle.STYLE_COLORMAP);
+        fillStyle.setColorMapScheme(JASHist2DHistogramStyle.COLORMAP_RAINBOW);
+        
+        // Make the statistics box invisible.
+        region.getPlot().getStats().setVisible(false);
+        
+        // Set the general plot font (which is also the z-axis font).
+        region.getPlot().setFont(BASIC_FONT);
+        
+        // Set the title font.
+        region.getPlot().getTitleObject().setFont(TITLE_FONT);
+        
+        // Set generic axis titles.
+        region.getPlot().getXAxis().setLabel("Data Label (Unit)");
+        region.getPlot().getYAxis().setLabel("Data Label (Unit)");
+        
+        // Set the axis tick-mark fonts.
+        region.getPlot().getXAxis().setFont(BASIC_FONT);
+        region.getPlot().getYAxis().setFont(BASIC_FONT);
+        region.getPlot().getXAxis().getLabelObject().setFont(AXIS_FONT);
+        region.getPlot().getYAxis().getLabelObject().setFont(AXIS_FONT);
+    }
+    
+    /**
+     * Gets a list of all objects that are not directories in a tree.
+     * @param tree - The tree from which to extract the object names.
+     * @return Returns the object names as <code>String</code> objects
+     * in a <code>List</code> collection.
+     */
+    private static final List<String> getHistograms(ITree tree) {
+        return getHistograms(tree, "/");
+    }
+    
+    /**
+     * Gets a list of all objects that are not directories in a tree.
+     * @param tree - The tree from which to extract the object names.
+     * @return Returns the object names as <code>String</code> objects
+     * in a <code>List</code> collection.
+     */
+    private static final List<String> getHistograms(ITree tree, String rootDir) {
+        return getHistograms(tree, rootDir, new ArrayList<String>());
+    }
+    
+    /**
+     * Recursive method that gets all object names from a tree that
+     * are not directories. Method should not be called directly, but
+     * rather called only through the <code>getHistograms(ITree)</code>
+     * method.
+     * @param tree - The tree from which to obtain the object names.
+     * @param directory - The directory in which to search for objects.
+     * @param list - The list in which to place the objects.
+     * @return Returns the <code>List</code> collection that was given
+     * as an argument.
+     */
+    private static final List<String> getHistograms(ITree tree, String directory, List<String> list) {
+        // Get the list of objects in the directory.
+        String[] treeObjects = tree.listObjectNames(directory);
+        
+        // Print the objects.
+        for(String objectName : treeObjects) {
+            // Check if the object is a directory.
+            boolean isDirectory = isDirectory(objectName);
+            
+            // If the object is a directory, get the histograms from it.
+            if(isDirectory) {
+                getHistograms(tree, objectName, list);
+            }
+            
+            // If the object is a plot, add it to the list.
+            else { list.add(objectName); }
+        }
+        
+        // Return the list.
+        return list;
+    }
+    
+    /**
+     * Checks whether a tree object is a directory.
+     * @param object - The object to check.
+     * @return Returns <code>true</code> if the object is a directory
+     * and <code>false</code> otherwise.
+     */
+    private static final boolean isDirectory(String object) {
+        return (object.toCharArray()[object.length() - 1] == '/');
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/luca/FADCVariableTriggerFEEDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/FADCVariableTriggerFEEDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/FADCVariableTriggerFEEDriver.java	Wed Mar  9 11:43:24 2016
@@ -25,64 +25,64 @@
     // ==================================================================
     // ==== Trigger Cut Default Parameters ==============================
     // ==================================================================
-    private int minHitCount = 1;								// Minimum required cluster hit count threshold. (Hits)			
-    private double seedEnergyHigh = Double.MAX_VALUE;			// Maximum allowed cluster seed energy. (GeV)
-    private double seedEnergyLow = Double.MIN_VALUE;			// Minimum required cluster seed energy. (GeV)
-    private double clusterEnergyHigh = 1.5 * EcalUtils.GeV;		// Maximum allowed cluster total energy. (GeV)
-    private double clusterEnergyLow = .1 * EcalUtils.GeV;		// Minimum required cluster total energy. (GeV)
-    private double energySumHigh = 1.9 * EcalUtils.GeV;			// Maximum allowed pair energy sum. (GeV)
-    private double energySumLow = 0.0 * EcalUtils.GeV;			// Minimum required pair energy sum. (GeV)
-    private double energyDifferenceHigh = 2.2 * EcalUtils.GeV;	// Maximum allowed pair energy difference. (GeV)
-    private double energySlopeLow = 1.1;						// Minimum required pair energy slope value.
-    private double coplanarityHigh = 35;						// Maximum allowed pair coplanarity deviation. (Degrees)
+    private int minHitCount = 1;                                // Minimum required cluster hit count threshold. (Hits)         
+    private double seedEnergyHigh = Double.MAX_VALUE;           // Maximum allowed cluster seed energy. (GeV)
+    private double seedEnergyLow = Double.MIN_VALUE;            // Minimum required cluster seed energy. (GeV)
+    private double clusterEnergyHigh = 1.5 * EcalUtils.GeV;     // Maximum allowed cluster total energy. (GeV)
+    private double clusterEnergyLow = .1 * EcalUtils.GeV;       // Minimum required cluster total energy. (GeV)
+    private double energySumHigh = 1.9 * EcalUtils.GeV;         // Maximum allowed pair energy sum. (GeV)
+    private double energySumLow = 0.0 * EcalUtils.GeV;          // Minimum required pair energy sum. (GeV)
+    private double energyDifferenceHigh = 2.2 * EcalUtils.GeV;  // Maximum allowed pair energy difference. (GeV)
+    private double energySlopeLow = 1.1;                        // Minimum required pair energy slope value.
+    private double coplanarityHigh = 35;                        // Maximum allowed pair coplanarity deviation. (Degrees)
     
     // ==================================================================
     // ==== Trigger General Default Parameters ==========================
     // ==================================================================
-    private String clusterCollectionName = "EcalClusters";		// Name for the LCIO cluster collection.
-    private int pairCoincidence = 2;							// Maximum allowed time difference between clusters. (4 ns clock-cycles)
-    private double energySlopeParamF = 0.005500;				// A parameter value used for the energy slope calculation.
-    private double originX = 1393.0 * Math.tan(0.03052);		// ECal mid-plane, defined by photon beam position (30.52 mrad) at ECal face (z=1393 mm)
-    private int backgroundLevel = -1;							// Automatically sets the cuts to achieve a predetermined background rate.
+    private String clusterCollectionName = "EcalClusters";      // Name for the LCIO cluster collection.
+    private int pairCoincidence = 2;                            // Maximum allowed time difference between clusters. (4 ns clock-cycles)
+    private double energySlopeParamF = 0.005500;                // A parameter value used for the energy slope calculation.
+    private double originX = 1393.0 * Math.tan(0.03052);        // ECal mid-plane, defined by photon beam position (30.52 mrad) at ECal face (z=1393 mm)
+    private int backgroundLevel = -1;                           // Automatically sets the cuts to achieve a predetermined background rate.
     
     // ==================================================================
     // ==== Driver Internal Variables ===================================
     // ==================================================================
-    private Queue<List<Cluster>> topClusterQueue = null;	// Store clusters on the top half of the calorimeter.
-    private Queue<List<Cluster>> botClusterQueue = null;	// Store clusters on the bottom half of the calorimeter.
-    private int allClusters = 0;								// Track the number of clusters processed.
-    private int allPairs = 0;									// Track the number of cluster pairs processed.
-    private int clusterTotalEnergyCount = 0;					// Track the clusters which pass the total energy cut.
-    private int clusterSeedEnergyCount = 0;						// Track the clusters which pass the seed energy cut.
-    private int clusterHitCountCount = 0;						// Track the clusters which pass the hit count cut.
-    private int pairEnergySumCount = 0;							// Track the pairs which pass the energy sum cut.
-    private int pairEnergyDifferenceCount = 0;					// Track the pairs which pass the energy difference cut.
-    private int pairEnergySlopeCount = 0;						// Track the pairs which pass the energy slope cut.
-    private int pairCoplanarityCount = 0;						// Track the pairs which pass the coplanarity cut.
+    private Queue<List<Cluster>> topClusterQueue = null;    // Store clusters on the top half of the calorimeter.
+    private Queue<List<Cluster>> botClusterQueue = null;    // Store clusters on the bottom half of the calorimeter.
+    private int allClusters = 0;                                // Track the number of clusters processed.
+    private int allPairs = 0;                                   // Track the number of cluster pairs processed.
+    private int clusterTotalEnergyCount = 0;                    // Track the clusters which pass the total energy cut.
+    private int clusterSeedEnergyCount = 0;                     // Track the clusters which pass the seed energy cut.
+    private int clusterHitCountCount = 0;                       // Track the clusters which pass the hit count cut.
+    private int pairEnergySumCount = 0;                         // Track the pairs which pass the energy sum cut.
+    private int pairEnergyDifferenceCount = 0;                  // Track the pairs which pass the energy difference cut.
+    private int pairEnergySlopeCount = 0;                       // Track the pairs which pass the energy slope cut.
+    private int pairCoplanarityCount = 0;                       // Track the pairs which pass the coplanarity cut.
     
     /**
      * Prints out the results of the trigger at the end of the run.
      */
     @Override
     public void endOfData() {
-    	// Print out the results of the trigger cuts.
-    	System.out.printf("Trigger Processing Results%n");
-    	System.out.printf("\tSingle-Cluster Cuts%n");
-    	System.out.printf("\t\tTotal Clusters Processed     :: %d%n", allClusters);
-    	System.out.printf("\t\tPassed Seed Energy Cut       :: %d%n", clusterSeedEnergyCount);
-    	System.out.printf("\t\tPassed Hit Count Cut         :: %d%n", clusterHitCountCount);
-    	System.out.printf("\t\tPassed Total Energy Cut      :: %d%n", clusterTotalEnergyCount);
-    	System.out.printf("%n");
-    	System.out.printf("\tCluster Pair Cuts%n");
-    	System.out.printf("\t\tTotal Pairs Processed        :: %d%n", allPairs);
-    	System.out.printf("\t\tPassed Energy Sum Cut        :: %d%n", pairEnergySumCount);
-    	System.out.printf("\t\tPassed Energy Difference Cut :: %d%n", pairEnergyDifferenceCount);
-    	System.out.printf("\t\tPassed Energy Slope Cut      :: %d%n", pairEnergySlopeCount);
-    	System.out.printf("\t\tPassed Coplanarity Cut       :: %d%n", pairCoplanarityCount);
-    	System.out.printf("%n");
-    	System.out.printf("\tTrigger Count :: %d%n", numTriggers);
-    	
-    	// Run the superclass method.
+        // Print out the results of the trigger cuts.
+        System.out.printf("Trigger Processing Results%n");
+        System.out.printf("\tSingle-Cluster Cuts%n");
+        System.out.printf("\t\tTotal Clusters Processed     :: %d%n", allClusters);
+        System.out.printf("\t\tPassed Seed Energy Cut       :: %d%n", clusterSeedEnergyCount);
+        System.out.printf("\t\tPassed Hit Count Cut         :: %d%n", clusterHitCountCount);
+        System.out.printf("\t\tPassed Total Energy Cut      :: %d%n", clusterTotalEnergyCount);
+        System.out.printf("%n");
+        System.out.printf("\tCluster Pair Cuts%n");
+        System.out.printf("\t\tTotal Pairs Processed        :: %d%n", allPairs);
+        System.out.printf("\t\tPassed Energy Sum Cut        :: %d%n", pairEnergySumCount);
+        System.out.printf("\t\tPassed Energy Difference Cut :: %d%n", pairEnergyDifferenceCount);
+        System.out.printf("\t\tPassed Energy Slope Cut      :: %d%n", pairEnergySlopeCount);
+        System.out.printf("\t\tPassed Coplanarity Cut       :: %d%n", pairCoplanarityCount);
+        System.out.printf("%n");
+        System.out.printf("\tTrigger Count :: %d%n", numTriggers);
+        
+        // Run the superclass method.
         super.endOfData();
     }
     
@@ -92,53 +92,53 @@
      */
     @Override
     public void process(EventHeader event) {
-    	// Process the list of clusters for the event, if it exists.
+        // Process the list of clusters for the event, if it exists.
         if (event.hasCollection(Cluster.class, clusterCollectionName)) {
-        	// Get the collection of clusters.
-        	List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-        	
-        	// Create a list to hold clusters which pass the single
-        	// cluster cuts.
-        	List<Cluster> goodClusterList = new ArrayList<Cluster>(clusterList.size());
-        	
-        	// Sort through the cluster list and add clusters that pass
-        	// the single cluster cuts to the good list.
-        	clusterLoop:
-        	for(Cluster cluster : clusterList) {
-        		// Increment the number of processed clusters.
-        		allClusters++;
-        		
-        		// ==== Seed Hit Energy Cut ====================================
-        		// =============================================================
-        		// If the cluster fails the cut, skip to the next cluster.
-        		if(!clusterSeedEnergyCut(cluster)) { continue clusterLoop; }
-        		
-        		// Otherwise, note that it passed the cut.
-        		clusterSeedEnergyCount++;
-        		
-        		// ==== Cluster Hit Count Cut ==================================
-        		// =============================================================
-        		// If the cluster fails the cut, skip to the next cluster.
-        		if(!clusterHitCountCut(cluster)) { continue clusterLoop; }
-        		
-        		// Otherwise, note that it passed the cut.
-        		clusterHitCountCount++;
-        		
-        		// ==== Cluster Total Energy Cut ===============================
-        		// =============================================================
-        		// If the cluster fails the cut, skip to the next cluster.
-        		if(!clusterTotalEnergyCut(cluster)) { continue clusterLoop; }
-        		
-        		// Otherwise, note that it passed the cut.
-        		clusterTotalEnergyCount++;
-        		
-        		// A cluster that passes all of the single-cluster cuts
-        		// can be used in cluster pairs.
-        		goodClusterList.add(cluster);
-        	}
-        	
-        	// Put the good clusters into the cluster queue.
-        	updateClusterQueues(goodClusterList);
+            // Get the collection of clusters.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Create a list to hold clusters which pass the single
+            // cluster cuts.
+            List<Cluster> goodClusterList = new ArrayList<Cluster>(clusterList.size());
+            
+            // Sort through the cluster list and add clusters that pass
+            // the single cluster cuts to the good list.
+            clusterLoop:
+            for(Cluster cluster : clusterList) {
+                // Increment the number of processed clusters.
+                allClusters++;
+                
+                // ==== Seed Hit Energy Cut ====================================
+                // =============================================================
+                // If the cluster fails the cut, skip to the next cluster.
+                if(!clusterSeedEnergyCut(cluster)) { continue clusterLoop; }
+                
+                // Otherwise, note that it passed the cut.
+                clusterSeedEnergyCount++;
+                
+                // ==== Cluster Hit Count Cut ==================================
+                // =============================================================
+                // If the cluster fails the cut, skip to the next cluster.
+                if(!clusterHitCountCut(cluster)) { continue clusterLoop; }
+                
+                // Otherwise, note that it passed the cut.
+                clusterHitCountCount++;
+                
+                // ==== Cluster Total Energy Cut ===============================
+                // =============================================================
+                // If the cluster fails the cut, skip to the next cluster.
+                if(!clusterTotalEnergyCut(cluster)) { continue clusterLoop; }
+                
+                // Otherwise, note that it passed the cut.
+                clusterTotalEnergyCount++;
+                
+                // A cluster that passes all of the single-cluster cuts
+                // can be used in cluster pairs.
+                goodClusterList.add(cluster);
+            }
+            
+            // Put the good clusters into the cluster queue.
+            updateClusterQueues(goodClusterList);
         }
         
         // Perform the superclass event processing.
@@ -152,7 +152,7 @@
      * be set. Actual background rates equal about (5 * backgroundLevel) kHz.
      */
     public void setBackgroundLevel(int backgroundLevel) {
-    	this.backgroundLevel = backgroundLevel;
+        this.backgroundLevel = backgroundLevel;
     }
     
     /**
@@ -215,7 +215,7 @@
      * @param energySlopeLow - The parameter value.
      */
     public void setEnergySlopeLow(double energySlopeLow) {
-    	this.energySlopeLow = energySlopeLow;
+        this.energySlopeLow = energySlopeLow;
     }
     
     /**
@@ -299,12 +299,12 @@
      */
     @Override
     public void startOfData() {
-    	// Make sure that a valid cluster collection name has been
-    	// defined. If it has not, throw an exception.
+        // Make sure that a valid cluster collection name has been
+        // defined. If it has not, throw an exception.
         if (clusterCollectionName == null) {
             throw new RuntimeException("The parameter clusterCollectionName was not set!");
         }
-    	
+        
         // Initialize the top and bottom cluster queues.
         topClusterQueue = new LinkedList<List<Cluster>>();
         botClusterQueue = new LinkedList<List<Cluster>>();
@@ -345,9 +345,9 @@
         for (Cluster botCluster : botClusterQueue.element()) {
             for (List<Cluster> topClusters : topClusterQueue) {
                 for (Cluster topCluster : topClusters) {
-                	// The first cluster in a pair should always be
-                	// the higher energy cluster. If the top cluster
-                	// is higher energy, it goes first.
+                    // The first cluster in a pair should always be
+                    // the higher energy cluster. If the top cluster
+                    // is higher energy, it goes first.
                     if (topCluster.getEnergy() > botCluster.getEnergy()) {
                         Cluster[] clusterPair = {topCluster, botCluster};
                         clusterPairs.add(clusterPair);
@@ -366,24 +366,24 @@
         return clusterPairs;
     }
     
-	/**
-	 * Determines if the event produces a trigger.
-	 * 
-	 * @return Returns <code>true</code> if the event produces a trigger
-	 * and <code>false</code> if it does not.
-	 */
-	@Override
-	protected boolean triggerDecision(EventHeader event) {
-    	// If there is a list of clusters present for this event,
-    	// check whether it passes the trigger conditions.
-    	if (event.hasCollection(Cluster.class, clusterCollectionName)) {
-        	return testTrigger();
+    /**
+     * Determines if the event produces a trigger.
+     * 
+     * @return Returns <code>true</code> if the event produces a trigger
+     * and <code>false</code> if it does not.
+     */
+    @Override
+    protected boolean triggerDecision(EventHeader event) {
+        // If there is a list of clusters present for this event,
+        // check whether it passes the trigger conditions.
+        if (event.hasCollection(Cluster.class, clusterCollectionName)) {
+            return testTrigger();
         }
         
         // Otherwise, this event can not produce a trigger and should
         // return false automatically.
         else { return false; }
-	}
+    }
     
     /**
      * Checks whether the argument cluster possesses the minimum
@@ -394,7 +394,7 @@
      * and <code>false</code> if the cluster does not.
      */
     private boolean clusterHitCountCut(Cluster cluster) {
-    	return (getValueClusterHitCount(cluster) >= minHitCount);
+        return (getValueClusterHitCount(cluster) >= minHitCount);
     }
     
     /**
@@ -406,12 +406,12 @@
      * and <code>false</code> if the cluster does not.
      */
     private boolean clusterSeedEnergyCut(Cluster cluster) {
-    	// Get the cluster seed energy.
-    	double energy = getValueClusterSeedEnergy(cluster);
-    	
-    	// Check that it is above the minimum threshold and below the
-    	// maximum threshold.
-    	return (energy < seedEnergyHigh) && (energy > seedEnergyLow);
+        // Get the cluster seed energy.
+        double energy = getValueClusterSeedEnergy(cluster);
+        
+        // Check that it is above the minimum threshold and below the
+        // maximum threshold.
+        return (energy < seedEnergyHigh) && (energy > seedEnergyLow);
     }
     
     /**
@@ -423,12 +423,12 @@
      * and <code>false</code> if the cluster does not.
      */
     private boolean clusterTotalEnergyCut(Cluster cluster) {
-    	// Get the total cluster energy.
-    	double energy = getValueClusterTotalEnergy(cluster);
-    	
-    	// Check that it is above the minimum threshold and below the
-    	// maximum threshold.
-    	return (energy < clusterEnergyHigh) && (energy > clusterEnergyLow);
+        // Get the total cluster energy.
+        double energy = getValueClusterTotalEnergy(cluster);
+        
+        // Check that it is above the minimum threshold and below the
+        // maximum threshold.
+        return (energy < clusterEnergyHigh) && (energy > clusterEnergyLow);
     }
     
     /**
@@ -450,7 +450,7 @@
      * @return Returns the cut value.
      */
     private double getValueClusterTotalEnergy(Cluster cluster) {
-    	return cluster.getEnergy();
+        return cluster.getEnergy();
     }
     
     /**
@@ -461,7 +461,7 @@
      * @return Returns the cut value.
      */
     private int getValueClusterHitCount(Cluster cluster) {
-    	return cluster.getCalorimeterHits().size();
+        return cluster.getCalorimeterHits().size();
     }
     
     /**
@@ -472,7 +472,7 @@
      * @return Returns the cut value.
      */
     private double getValueClusterSeedEnergy(Cluster cluster) {
-    	return cluster.getCalorimeterHits().get(0).getCorrectedEnergy();
+        return cluster.getCalorimeterHits().get(0).getCorrectedEnergy();
     }
     
     /**
@@ -483,16 +483,16 @@
      * @return Returns the cut value.
      */
     private double getValueCoplanarity(Cluster[] clusterPair) {
-    	// Get the cluster angles.
-    	double[] clusterAngle = new double[2];
-    	for(int i = 0; i < 2; i++) {
+        // Get the cluster angles.
+        double[] clusterAngle = new double[2];
+        for(int i = 0; i < 2; i++) {
             double position[] = clusterPair[i].getCalorimeterHits().get(0).getPosition();
             //clusterAngle[i] = Math.toDegrees(Math.atan2(position[1], position[0] - originX));
             //clusterAngle[i] = (clusterAngle[i] + 180.0) % 180.0;
             clusterAngle[i] = (Math.toDegrees(Math.atan2(position[1], position[0] - originX)) + 180.0) % 180.0;
-    	}
-    	
-    	// Calculate the coplanarity cut value.
+        }
+        
+        // Calculate the coplanarity cut value.
         return Math.abs(clusterAngle[1] - clusterAngle[0]);
     }
     
@@ -504,7 +504,7 @@
      * @return Returns the cut value.
      */
     private double getValueEnergyDifference(Cluster[] clusterPair) {
-    	return clusterPair[0].getEnergy() - clusterPair[1].getEnergy();
+        return clusterPair[0].getEnergy() - clusterPair[1].getEnergy();
     }
     
     /**
@@ -515,15 +515,15 @@
      * @return Returns the cut value.
      */
     private double getValueEnergySlope(Cluster[] clusterPair) {
-    	// E + R*F
-    	// Get the low energy cluster energy.
-    	double slopeParamE = clusterPair[1].getEnergy();
-    	
-    	// Get the low energy cluster radial distance.
-    	double slopeParamR = getClusterDistance(clusterPair[1]);
-    	
-    	// Calculate the energy slope.
-    	return slopeParamE + slopeParamR * energySlopeParamF;
+        // E + R*F
+        // Get the low energy cluster energy.
+        double slopeParamE = clusterPair[1].getEnergy();
+        
+        // Get the low energy cluster radial distance.
+        double slopeParamR = getClusterDistance(clusterPair[1]);
+        
+        // Calculate the energy slope.
+        return slopeParamE + slopeParamR * energySlopeParamF;
     }
     
     /**
@@ -534,7 +534,7 @@
      * @return Returns the cut value.
      */
     private double getValueEnergySum(Cluster[] clusterPair) {
-    	return clusterPair[0].getEnergy() + clusterPair[1].getEnergy();
+        return clusterPair[0].getEnergy() + clusterPair[1].getEnergy();
     }
     
     /**
@@ -570,7 +570,7 @@
      * @return true if pair is found, false otherwise
      */
     private boolean pairEnergySlopeCut(Cluster[] clusterPair) {
-    	return (getValueEnergySlope(clusterPair) > energySlopeLow);
+        return (getValueEnergySlope(clusterPair) > energySlopeLow);
     }
     
     /**
@@ -582,175 +582,175 @@
      * the cut and <code>false</code> if it does not.
      */
     private boolean pairEnergySumCut(Cluster[] clusterPair) {
-    	// Get the energy sum value.
-    	double energySum = getValueEnergySum(clusterPair);
-    	
-    	// Check that it is within the allowed range.
+        // Get the energy sum value.
+        double energySum = getValueEnergySum(clusterPair);
+        
+        // Check that it is within the allowed range.
         return (energySum < energySumHigh) && (energySum > energySumLow);
     }
-	
+    
     private void setBackgroundCuts(int backgroundLevel) {
-    	// Make sure that the background level is valid.
-    	if(backgroundLevel < 1 || backgroundLevel > 10) {
-    		throw new RuntimeException(String.format("Trigger cuts are undefined for background level %d.", backgroundLevel));
-    	}
-    	
-    	// Otherwise, set the trigger cuts. Certain cuts are constant
-    	// across all background levels.
-    	clusterEnergyLow = 0.000;
-    	seedEnergyLow = 0.100;
-    	
-    	// Set the variable values.
-    	if(backgroundLevel == 1) {
-    		clusterEnergyHigh = 1.700;
-    		seedEnergyHigh = 1.300;
-    		energySumLow = 0.400;
-    		energySumHigh = 2.00;
-    		energyDifferenceHigh = 1.500;
-    		energySlopeLow = 1.0;
-    		coplanarityHigh = 40;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 2) {
-    		clusterEnergyHigh = 1.600;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.300;
-    		energySumHigh = 2.00;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.8;
-    		coplanarityHigh = 40;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 3) {
-    		clusterEnergyHigh = 1.600;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.200;
-    		energySumHigh = 2.000;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.7;
-    		coplanarityHigh = 40;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 4) {
-    		clusterEnergyHigh = 1.500;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.500;
-    		energySumHigh = 1.950;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.6;
-    		coplanarityHigh = 40;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 5) {
-    		clusterEnergyHigh = 1.500;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.400;
-    		energySumHigh = 2.000;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.6;
-    		coplanarityHigh = 45;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 6) {
-    		clusterEnergyHigh = 1.500;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.200;
-    		energySumHigh = 1.950;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.6;
-    		coplanarityHigh = 55;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 7) {
-    		clusterEnergyHigh = 1.700;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.200;
-    		energySumHigh = 2.000;
-    		energyDifferenceHigh = 1.500;
-    		energySlopeLow = 0.6;
-    		coplanarityHigh = 60;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 8) {
-    		clusterEnergyHigh = 1.700;
-    		seedEnergyHigh = 1.300;
-    		energySumLow = 0.200;
-    		energySumHigh = 2.000;
-    		energyDifferenceHigh = 1.500;
-    		energySlopeLow = 0.6;
-    		coplanarityHigh = 65;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 9) {
-    		clusterEnergyHigh = 1.500;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.400;
-    		energySumHigh = 1.950;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.5;
-    		coplanarityHigh = 60;
-    		minHitCount = 2;
-    	} else if(backgroundLevel == 10) {
-    		clusterEnergyHigh = 1.500;
-    		seedEnergyHigh = 1.200;
-    		energySumLow = 0.400;
-    		energySumHigh = 2.000;
-    		energyDifferenceHigh = 1.400;
-    		energySlopeLow = 0.5;
-    		coplanarityHigh = 65;
-    		minHitCount = 2;
-    	}
-    }
-    
-	/**
-	 * Tests all of the current cluster pairs for triggers.
-	 * 
-	 * @return Returns <code>true</code> if one of the cluster pairs
-	 * passes all of the cluster cuts and <code>false</code> otherwise.
-	 */
+        // Make sure that the background level is valid.
+        if(backgroundLevel < 1 || backgroundLevel > 10) {
+            throw new RuntimeException(String.format("Trigger cuts are undefined for background level %d.", backgroundLevel));
+        }
+        
+        // Otherwise, set the trigger cuts. Certain cuts are constant
+        // across all background levels.
+        clusterEnergyLow = 0.000;
+        seedEnergyLow = 0.100;
+        
+        // Set the variable values.
+        if(backgroundLevel == 1) {
+            clusterEnergyHigh = 1.700;
+            seedEnergyHigh = 1.300;
+            energySumLow = 0.400;
+            energySumHigh = 2.00;
+            energyDifferenceHigh = 1.500;
+            energySlopeLow = 1.0;
+            coplanarityHigh = 40;
+            minHitCount = 2;
+        } else if(backgroundLevel == 2) {
+            clusterEnergyHigh = 1.600;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.300;
+            energySumHigh = 2.00;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.8;
+            coplanarityHigh = 40;
+            minHitCount = 2;
+        } else if(backgroundLevel == 3) {
+            clusterEnergyHigh = 1.600;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.200;
+            energySumHigh = 2.000;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.7;
+            coplanarityHigh = 40;
+            minHitCount = 2;
+        } else if(backgroundLevel == 4) {
+            clusterEnergyHigh = 1.500;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.500;
+            energySumHigh = 1.950;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.6;
+            coplanarityHigh = 40;
+            minHitCount = 2;
+        } else if(backgroundLevel == 5) {
+            clusterEnergyHigh = 1.500;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.400;
+            energySumHigh = 2.000;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.6;
+            coplanarityHigh = 45;
+            minHitCount = 2;
+        } else if(backgroundLevel == 6) {
+            clusterEnergyHigh = 1.500;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.200;
+            energySumHigh = 1.950;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.6;
+            coplanarityHigh = 55;
+            minHitCount = 2;
+        } else if(backgroundLevel == 7) {
+            clusterEnergyHigh = 1.700;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.200;
+            energySumHigh = 2.000;
+            energyDifferenceHigh = 1.500;
+            energySlopeLow = 0.6;
+            coplanarityHigh = 60;
+            minHitCount = 2;
+        } else if(backgroundLevel == 8) {
+            clusterEnergyHigh = 1.700;
+            seedEnergyHigh = 1.300;
+            energySumLow = 0.200;
+            energySumHigh = 2.000;
+            energyDifferenceHigh = 1.500;
+            energySlopeLow = 0.6;
+            coplanarityHigh = 65;
+            minHitCount = 2;
+        } else if(backgroundLevel == 9) {
+            clusterEnergyHigh = 1.500;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.400;
+            energySumHigh = 1.950;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.5;
+            coplanarityHigh = 60;
+            minHitCount = 2;
+        } else if(backgroundLevel == 10) {
+            clusterEnergyHigh = 1.500;
+            seedEnergyHigh = 1.200;
+            energySumLow = 0.400;
+            energySumHigh = 2.000;
+            energyDifferenceHigh = 1.400;
+            energySlopeLow = 0.5;
+            coplanarityHigh = 65;
+            minHitCount = 2;
+        }
+    }
+    
+    /**
+     * Tests all of the current cluster pairs for triggers.
+     * 
+     * @return Returns <code>true</code> if one of the cluster pairs
+     * passes all of the cluster cuts and <code>false</code> otherwise.
+     */
     private boolean testTrigger() {
-    	// Get the list of cluster pairs.
-    	List<Cluster[]> clusterPairs = getClusterPairsTopBot();
+        // Get the list of cluster pairs.
+        List<Cluster[]> clusterPairs = getClusterPairsTopBot();
         
         // Iterate over the cluster pairs and perform each of the cluster
         // pair cuts on them. A cluster pair that passes all of the
         // cuts registers as a trigger.
-    	pairLoop:
+        pairLoop:
         for (Cluster[] clusterPair : clusterPairs) {
-    		// Increment the number of processed cluster pairs.
-    		allPairs++;
-    		
-    		// ==== Pair Energy Sum Cut ====================================
-    		// =============================================================
-    		// If the cluster fails the cut, skip to the next pair.
-    		if(!pairEnergySumCut(clusterPair)) { continue pairLoop; }
-    		
-    		// Otherwise, note that it passed the cut.
-    		pairEnergySumCount++;
-        	
-    		// ==== Pair Energy Difference Cut =============================
-    		// =============================================================
-    		// If the cluster fails the cut, skip to the next pair.
-    		if(!pairEnergyDifferenceCut(clusterPair)) { continue pairLoop; }
-    		
-    		// Otherwise, note that it passed the cut.
-    		pairEnergyDifferenceCount++;
-    		
-    		// ==== Pair Energy Slope Cut ==================================
-    		// =============================================================
-    		// If the cluster fails the cut, skip to the next pair.
-    		//if(!energyDistanceCut(clusterPair)) { continue pairLoop; }
-    		if(!pairEnergySlopeCut(clusterPair)) { continue pairLoop; }
-    		
-    		// Otherwise, note that it passed the cut.
-    		pairEnergySlopeCount++;
-    		
-    		// ==== Pair Coplanarity Cut ===================================
-    		// =============================================================
-    		// If the cluster fails the cut, skip to the next pair.
-    		if(!pairCoplanarityCut(clusterPair)) { continue pairLoop; }
-    		
-    		// Otherwise, note that it passed the cut.
-    		pairCoplanarityCount++;
-    		
-    		// Clusters that pass all of the pair cuts produce a trigger.
-    		return true;
+            // Increment the number of processed cluster pairs.
+            allPairs++;
+            
+            // ==== Pair Energy Sum Cut ====================================
+            // =============================================================
+            // If the cluster fails the cut, skip to the next pair.
+            if(!pairEnergySumCut(clusterPair)) { continue pairLoop; }
+            
+            // Otherwise, note that it passed the cut.
+            pairEnergySumCount++;
+            
+            // ==== Pair Energy Difference Cut =============================
+            // =============================================================
+            // If the cluster fails the cut, skip to the next pair.
+            if(!pairEnergyDifferenceCut(clusterPair)) { continue pairLoop; }
+            
+            // Otherwise, note that it passed the cut.
+            pairEnergyDifferenceCount++;
+            
+            // ==== Pair Energy Slope Cut ==================================
+            // =============================================================
+            // If the cluster fails the cut, skip to the next pair.
+            //if(!energyDistanceCut(clusterPair)) { continue pairLoop; }
+            if(!pairEnergySlopeCut(clusterPair)) { continue pairLoop; }
+            
+            // Otherwise, note that it passed the cut.
+            pairEnergySlopeCount++;
+            
+            // ==== Pair Coplanarity Cut ===================================
+            // =============================================================
+            // If the cluster fails the cut, skip to the next pair.
+            if(!pairCoplanarityCut(clusterPair)) { continue pairLoop; }
+            
+            // Otherwise, note that it passed the cut.
+            pairCoplanarityCount++;
+            
+            // Clusters that pass all of the pair cuts produce a trigger.
+            return true;
         }
         
         // If the loop terminates without producing a trigger, there
-    	// are no cluster pairs which meet the trigger conditions.
+        // are no cluster pairs which meet the trigger conditions.
         return false;
     }
     
@@ -761,14 +761,14 @@
      * @param clusterList - The clusters to add to the queues.
      */
     private void updateClusterQueues(List<Cluster> clusterList) {
-    	// Create lists to store the top and bottom clusters.
+        // Create lists to store the top and bottom clusters.
         ArrayList<Cluster> topClusterList = new ArrayList<Cluster>();
         ArrayList<Cluster> botClusterList = new ArrayList<Cluster>();
         
         // Loop over the clusters in the cluster list.
         for (Cluster cluster : clusterList) {
-        	// If the cluster is on the top of the calorimeter, it
-        	// goes into the top cluster list.
+            // If the cluster is on the top of the calorimeter, it
+            // goes into the top cluster list.
             if (cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy") > 0) {
                 topClusterList.add(cluster);
             }

Modified: java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger.java	Wed Mar  9 11:43:24 2016
@@ -15,209 +15,209 @@
  * @author Luca Colaneri
  */
 public class FEETrigger extends TriggerDriver {
-	// Store the LCIO cluster collection name.
-	private String clusterCollectionName = "EcalClusters";
-	
-	// Store the cluster total energy trigger threshold.
-	private double energyThreshold = 1.5;
-	
-	// Track the number of over-threshold clusters in each region.
-	private int zone1Count = 0;
-	private int zone2Count = 0;
-	private int zone3Count = 0;
-	
+    // Store the LCIO cluster collection name.
+    private String clusterCollectionName = "EcalClusters";
+    
+    // Store the cluster total energy trigger threshold.
+    private double energyThreshold = 1.5;
+    
+    // Track the number of over-threshold clusters in each region.
+    private int zone1Count = 0;
+    private int zone2Count = 0;
+    private int zone3Count = 0;
+    
     // The number of cluster over threshold that must occur in a region
-	// before a trigger occurs.
-	private int zone1Prescaling = 50;
-	private int zone2Prescaling = 10;
-	
-	/**
-	 * Sets the energy threshold required for a cluster to be counted.
-	 * 
-	 * @param energyThreshold - The energy threshold in GeV.
-	 */
-	public void setEnergyThreshold(int energyThreshold) {
-		this.energyThreshold = energyThreshold;
-	}
-	
-	/**
-	 * Sets the number of events over threshold which must occur in the
-	 * first region in order for a trigger to occur.
-	 * 
-	 * @param zone1Prescaling - The number of over-threshold clusters needed
-	 * for a trigger.
-	 */
-	public void setZone1Prescaling(int zone1Prescaling) {
-		this.zone1Prescaling = zone1Prescaling;
-	}
-	
-	/**
-	 * Sets the number of events over threshold which must occur in the
-	 * second region in order for a trigger to occur.
-	 * 
-	 * @param zone2Prescaling - The number of over-threshold clusters needed
-	 * for a trigger.
-	 */
-	public void setZone2Prescaling(int zone2Prescaling) {
-		this.zone2Prescaling = zone2Prescaling;
-	}
-	
-	/**
-	 * Checks if any clusters exist over the set energy threshold and,
-	 * if they do, increments the appropriate over-threshold count
-	 * variable for the zone in which the cluster resides.
-	 * 
-	 * @param event - The event from which clusters should be extracted.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Get the list of clusters from the event.
-			List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-			
-			// Loop over the clusters and check for any that pass the threshold.
-			for(Cluster cluster : clusterList) {
-				// Check if the current cluster exceeds the energy
-				// threshold. If it does not, continue to the next
-				// cluster in the list.
-				if(cluster.getEnergy() > energyThreshold) {
-					// Get the x-index of the seed hit.
-					int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-					
-					// Determine in which region the cluster is located
-					// and increment the counter for that region. Zones
-					// are defined as:
-					// Zone 1 is -13 < ix < -4 and 14 < ix < 21  MISTAKE!!! it's all reversed!! remember!!!
-					// Zone 2 is -20 < ix < -14 and ix > 20
-					// Zone 3 is -23 <= ix < -18
+    // before a trigger occurs.
+    private int zone1Prescaling = 50;
+    private int zone2Prescaling = 10;
+    
+    /**
+     * Sets the energy threshold required for a cluster to be counted.
+     * 
+     * @param energyThreshold - The energy threshold in GeV.
+     */
+    public void setEnergyThreshold(int energyThreshold) {
+        this.energyThreshold = energyThreshold;
+    }
+    
+    /**
+     * Sets the number of events over threshold which must occur in the
+     * first region in order for a trigger to occur.
+     * 
+     * @param zone1Prescaling - The number of over-threshold clusters needed
+     * for a trigger.
+     */
+    public void setZone1Prescaling(int zone1Prescaling) {
+        this.zone1Prescaling = zone1Prescaling;
+    }
+    
+    /**
+     * Sets the number of events over threshold which must occur in the
+     * second region in order for a trigger to occur.
+     * 
+     * @param zone2Prescaling - The number of over-threshold clusters needed
+     * for a trigger.
+     */
+    public void setZone2Prescaling(int zone2Prescaling) {
+        this.zone2Prescaling = zone2Prescaling;
+    }
+    
+    /**
+     * Checks if any clusters exist over the set energy threshold and,
+     * if they do, increments the appropriate over-threshold count
+     * variable for the zone in which the cluster resides.
+     * 
+     * @param event - The event from which clusters should be extracted.
+     */
+    @Override
+    public void process(EventHeader event) {
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the list of clusters from the event.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Loop over the clusters and check for any that pass the threshold.
+            for(Cluster cluster : clusterList) {
+                // Check if the current cluster exceeds the energy
+                // threshold. If it does not, continue to the next
+                // cluster in the list.
+                if(cluster.getEnergy() > energyThreshold) {
+                    // Get the x-index of the seed hit.
+                    int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                    
+                    // Determine in which region the cluster is located
+                    // and increment the counter for that region. Zones
+                    // are defined as:
+                    // Zone 1 is -13 < ix < -4 and 14 < ix < 21  MISTAKE!!! it's all reversed!! remember!!!
+                    // Zone 2 is -20 < ix < -14 and ix > 20
+                    // Zone 3 is -23 <= ix < -18
                                         //V3
                                         /*
-					if( ix > 18 || ix < -22) { zone3Count++; }
-					if(ix < 19 && ix  > 12 )  { zone2Count++; }
-					if((ix > 4 && ix < 13) || (ix > -23 && ix < -14)) { zone1Count++; }
+                    if( ix > 18 || ix < -22) { zone3Count++; }
+                    if(ix < 19 && ix  > 12 )  { zone2Count++; }
+                    if((ix > 4 && ix < 13) || (ix > -23 && ix < -14)) { zone1Count++; }
                                         */
                                         //V2
                                         /*
-					if( ix > 18 ) { zone3Count++; }
-					if(ix < 19 && ix  > 12 || ix <-20)  { zone2Count++; }
-					if((ix > 4 && ix < 13) || (ix > -21 && ix < -14)) { zone1Count++; }
+                    if( ix > 18 ) { zone3Count++; }
+                    if(ix < 19 && ix  > 12 || ix <-20)  { zone2Count++; }
+                    if((ix > 4 && ix < 13) || (ix > -21 && ix < -14)) { zone1Count++; }
                                         */
                                         
                                         //v4/*
                                         /*
                                         if( ix > 19 || ix < -22) { zone3Count++; }
-					if(ix < 20 && ix  > 12 || ix <-20 && ix > -23)  { zone2Count++; }
-					if((ix > 4 && ix < 13) || (ix > -21 && ix < -14)) { zone1Count++; }
+                    if(ix < 20 && ix  > 12 || ix <-20 && ix > -23)  { zone2Count++; }
+                    if((ix > 4 && ix < 13) || (ix > -21 && ix < -14)) { zone1Count++; }
                                         */
                                         //V prova
                                        /* 
-					if( ix != 50 ) { zone2Count++; }
-					*/
+                    if( ix != 50 ) { zone2Count++; }
+                    */
                                         //V6
                                         /*
                                         if( ix > 19 || ix < -22) { zone3Count++; }
-					if(ix < 20 && ix  > 8 || ix <-16 && ix > -23)  { zone2Count++; }
-					if((ix > 4 && ix < 9) || (ix > -17 && ix < -14)) { zone1Count++; }
+                    if(ix < 20 && ix  > 8 || ix <-16 && ix > -23)  { zone2Count++; }
+                    if((ix > 4 && ix < 9) || (ix > -17 && ix < -14)) { zone1Count++; }
                                         */
                                         //V7
                                         /*
                                         if( ix > 19 || ix < -22) { zone3Count++; }
-					if(ix < 20 && ix  > 15 )  { zone2Count++; }
-					if((ix > 5 && ix < 16) || (ix > -23 && ix < -14)) { zone1Count++; }
+                    if(ix < 20 && ix  > 15 )  { zone2Count++; }
+                    if((ix > 5 && ix < 16) || (ix > -23 && ix < -14)) { zone1Count++; }
                                         */
                                         //V8
                                         /*
                                         if( ix > 19 || ix < -17) { zone3Count++; } //x1
-					if(ix < 20 && ix  > 9 )  { zone2Count++; }//x10
-					if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
+                    if(ix < 20 && ix  > 9 )  { zone2Count++; }//x10
+                    if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
                                         }*/
                                          //V9
                                         /*
                                         if( ix > 19 || ix < -21) { zone3Count++; } //x1
-					if(ix < 20 && ix  > 9 || ix > -22 && ix <-17)  { zone2Count++; }//x10
-					if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
+                    if(ix < 20 && ix  > 9 || ix > -22 && ix <-17)  { zone2Count++; }//x10
+                    if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
                                         */ 
                                         //10
                                         
                                         /*
                                         if( ix > 19 || ix < -22) { zone3Count++; } //x1
-					if(ix < 20 && ix  > 9 || ix > -22 && ix <-17)  { zone2Count++; }//x10
-					if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
+                    if(ix < 20 && ix  > 9 || ix > -22 && ix <-17)  { zone2Count++; }//x10
+                    if((ix > 5 && ix < 10) || (ix > -18 && ix < -14)) { zone1Count++; }    //x50
                                         */
                                         
                                         //V11
                                         
                                         if( ix > 19 || ix < -22) { zone3Count++; } //x1
-					if(ix < 20 && ix  > 11 || ix > -22 && ix <-19)  { zone2Count++; }//x10
-					if((ix > 5 && ix < 12) || (ix > -20 && ix < -14)) { zone1Count++; }    //x50
+                    if(ix < 20 && ix  > 11 || ix > -22 && ix <-19)  { zone2Count++; }//x10
+                    if((ix > 5 && ix < 12) || (ix > -20 && ix < -14)) { zone1Count++; }    //x50
                                 
                                 }
-			}
-		}
-		
-		// Run the superclass event processing.
-		super.process(event);
-	}
-	
-	/**
-	 * Checks whether or not a trigger occurred.
-	 * 
-	 * @param event - The event on which to base the trigger decision.
-	 * @return Returns <code>true</code> if a trigger occurred and <code>
-	 * false</code> if a trigger did not.
-	 */
-	@Override
-	protected boolean triggerDecision(EventHeader event) {
-		// Check if the event has clusters. An event with no clusters
-		// should never result in a trigger.
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Check if any of the zone counts are high enough to trigger.
-			return triggerTest();
-		}
-		
-		// Events without clusters can not trigger.
-		else { return false; }
-	}
-	
-	/**
-	 * Checks if any of the regional counts are sufficiently high to
-	 * register a trigger.
-	 * 
-	 * @return Returns <code>true</code> if a region has enough clusters
-	 * to trigger and <code>false</code> otherwise.
-	 */
-	private boolean triggerTest() {
-		// Track whether a trigger occurred.
-		boolean trigger = false;
-		
-		// If any clusters occur in zone 3, reset the count and note
-		// that a trigger occurred.
-		if(zone3Count > 0) {
-			zone3Count = 0;
+            }
+        }
+        
+        // Run the superclass event processing.
+        super.process(event);
+    }
+    
+    /**
+     * Checks whether or not a trigger occurred.
+     * 
+     * @param event - The event on which to base the trigger decision.
+     * @return Returns <code>true</code> if a trigger occurred and <code>
+     * false</code> if a trigger did not.
+     */
+    @Override
+    protected boolean triggerDecision(EventHeader event) {
+        // Check if the event has clusters. An event with no clusters
+        // should never result in a trigger.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Check if any of the zone counts are high enough to trigger.
+            return triggerTest();
+        }
+        
+        // Events without clusters can not trigger.
+        else { return false; }
+    }
+    
+    /**
+     * Checks if any of the regional counts are sufficiently high to
+     * register a trigger.
+     * 
+     * @return Returns <code>true</code> if a region has enough clusters
+     * to trigger and <code>false</code> otherwise.
+     */
+    private boolean triggerTest() {
+        // Track whether a trigger occurred.
+        boolean trigger = false;
+        
+        // If any clusters occur in zone 3, reset the count and note
+        // that a trigger occurred.
+        if(zone3Count > 0) {
+            zone3Count = 0;
                          if(zone2Count==zone2Prescaling){zone2Count=0;}
                          if(zone1Count==zone1Prescaling){zone1Count=0;}
-			trigger = true;
-		}
-		
-		// If zone 2 has sufficient clusters (100 by default) to
-		// trigger, reset its count and note that a trigger occurred.
-		else if(zone2Count == zone2Prescaling) {
-			zone2Count = 0;
+            trigger = true;
+        }
+        
+        // If zone 2 has sufficient clusters (100 by default) to
+        // trigger, reset its count and note that a trigger occurred.
+        else if(zone2Count == zone2Prescaling) {
+            zone2Count = 0;
                         if(zone3Count>0){zone3Count=0;}
                         if(zone1Count==zone1Prescaling){zone1Count=0;}
-			trigger = true;
-		}
-		
-		// If zone 3 has sufficient clusters (1000 by default) to
-		// trigger, reset its count and note that a trigger occurred.
-		else if(zone1Count == zone1Prescaling) {
-			zone1Count = 0;
+            trigger = true;
+        }
+        
+        // If zone 3 has sufficient clusters (1000 by default) to
+        // trigger, reset its count and note that a trigger occurred.
+        else if(zone1Count == zone1Prescaling) {
+            zone1Count = 0;
                         if(zone3Count>0){zone3Count=0;}
                         if(zone2Count==zone2Prescaling){zone2Count=0;}
-			trigger = true;
-		}
-		
-		// Return whether or not a trigger occurred.
-		return trigger;
-	}
+            trigger = true;
+        }
+        
+        // Return whether or not a trigger occurred.
+        return trigger;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger2.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger2.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/FEETrigger2.java	Wed Mar  9 11:43:24 2016
@@ -15,159 +15,159 @@
  * @author Luca Colaneri
  */
 public class FEETrigger2 extends TriggerDriver {
-	// Store the LCIO cluster collection name.
-	private String clusterCollectionName = "EcalClusters";
-	
-	// Store the cluster total energy trigger threshold.
-	private double energyThreshold = 1.5;
-	
-	// Track the number of over-threshold clusters in each region.
-	private int zone1Count = 0;
-	private int zone2Count = 0;
-	private int zone3Count = 0;
+    // Store the LCIO cluster collection name.
+    private String clusterCollectionName = "EcalClusters";
+    
+    // Store the cluster total energy trigger threshold.
+    private double energyThreshold = 1.5;
+    
+    // Track the number of over-threshold clusters in each region.
+    private int zone1Count = 0;
+    private int zone2Count = 0;
+    private int zone3Count = 0;
         private int zone4Count = 0;
-	
+    
     // The number of cluster over threshold that must occur in a region
-	// before a trigger occurs.
-	private int zone1Prescaling = 1000;
-	private int zone2Prescaling = 70;
-	private int zone4Prescaling = 200;
-	/**
-	 * Sets the energy threshold required for a cluster to be counted.
-	 * 
-	 * @param energyThreshold - The energy threshold in GeV.
-	 */
-	public void setEnergyThreshold(int energyThreshold) {
-		this.energyThreshold = energyThreshold;
-	}
-	
-	/**
-	 * Sets the number of events over threshold which must occur in the
-	 * first region in order for a trigger to occur.
-	 * 
-	 * @param zone1Prescaling - The number of over-threshold clusters needed
-	 * for a trigger.
-	 */
-	public void setZone1Prescaling(int zone1Prescaling) {
-		this.zone1Prescaling = zone1Prescaling;
-	}
-	
-	/**
-	 * Sets the number of events over threshold which must occur in the
-	 * second region in order for a trigger to occur.
-	 * 
-	 * @param zone2Prescaling - The number of over-threshold clusters needed
-	 * for a trigger.
-	 */
-	public void setZone2Prescaling(int zone2Prescaling) {
-		this.zone2Prescaling = zone2Prescaling;
-	}
-	
-	/**
-	 * Checks if any clusters exist over the set energy threshold and,
-	 * if they do, increments the appropriate over-threshold count
-	 * variable for the zone in which the cluster resides.
-	 * 
-	 * @param event - The event from which clusters should be extracted.
-	 */
-	@Override
-	public void process(EventHeader event) {
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Get the list of clusters from the event.
-			List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
-			
-			// Loop over the clusters and check for any that pass the threshold.
-			for(Cluster cluster : clusterList) {
-				// Check if the current cluster exceeds the energy
-				// threshold. If it does not, continue to the next
-				// cluster in the list.
-				if(cluster.getEnergy() > energyThreshold) {
-					// Get the x-index of the seed hit.
-					int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
-					
-					// Determine in which region the cluster is located
-					// and increment the counter for that region. Zones
-					// are defined as:
-					// Zone 1 is -13 < ix < -4 and 14 < ix < 21
-					// Zone 2 is -20 < ix < -14 and ix > 20
-					// Zone 3 is -23 <= ix < -19
-					if(-23 <= ix && ix < -19) { zone3Count++; }
-					if((-20 < ix && ix < -14))  { zone2Count++; }
-					if((-13 < ix && ix < -4) || (14 < ix && ix < 21)) { zone1Count++; }
+    // before a trigger occurs.
+    private int zone1Prescaling = 1000;
+    private int zone2Prescaling = 70;
+    private int zone4Prescaling = 200;
+    /**
+     * Sets the energy threshold required for a cluster to be counted.
+     * 
+     * @param energyThreshold - The energy threshold in GeV.
+     */
+    public void setEnergyThreshold(int energyThreshold) {
+        this.energyThreshold = energyThreshold;
+    }
+    
+    /**
+     * Sets the number of events over threshold which must occur in the
+     * first region in order for a trigger to occur.
+     * 
+     * @param zone1Prescaling - The number of over-threshold clusters needed
+     * for a trigger.
+     */
+    public void setZone1Prescaling(int zone1Prescaling) {
+        this.zone1Prescaling = zone1Prescaling;
+    }
+    
+    /**
+     * Sets the number of events over threshold which must occur in the
+     * second region in order for a trigger to occur.
+     * 
+     * @param zone2Prescaling - The number of over-threshold clusters needed
+     * for a trigger.
+     */
+    public void setZone2Prescaling(int zone2Prescaling) {
+        this.zone2Prescaling = zone2Prescaling;
+    }
+    
+    /**
+     * Checks if any clusters exist over the set energy threshold and,
+     * if they do, increments the appropriate over-threshold count
+     * variable for the zone in which the cluster resides.
+     * 
+     * @param event - The event from which clusters should be extracted.
+     */
+    @Override
+    public void process(EventHeader event) {
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Get the list of clusters from the event.
+            List<Cluster> clusterList = event.get(Cluster.class, clusterCollectionName);
+            
+            // Loop over the clusters and check for any that pass the threshold.
+            for(Cluster cluster : clusterList) {
+                // Check if the current cluster exceeds the energy
+                // threshold. If it does not, continue to the next
+                // cluster in the list.
+                if(cluster.getEnergy() > energyThreshold) {
+                    // Get the x-index of the seed hit.
+                    int ix = cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix");
+                    
+                    // Determine in which region the cluster is located
+                    // and increment the counter for that region. Zones
+                    // are defined as:
+                    // Zone 1 is -13 < ix < -4 and 14 < ix < 21
+                    // Zone 2 is -20 < ix < -14 and ix > 20
+                    // Zone 3 is -23 <= ix < -19
+                    if(-23 <= ix && ix < -19) { zone3Count++; }
+                    if((-20 < ix && ix < -14))  { zone2Count++; }
+                    if((-13 < ix && ix < -4) || (14 < ix && ix < 21)) { zone1Count++; }
                                         if(ix>20){zone4Count++;}
-				}
-			}
-		}
-		
-		// Run the superclass event processing.
-		super.process(event);
-	}
-	
-	/**
-	 * Checks whether or not a trigger occurred.
-	 * 
-	 * @param event - The event on which to base the trigger decision.
-	 * @return Returns <code>true</code> if a trigger occurred and <code>
-	 * false</code> if a trigger did not.
-	 */
-	@Override
-	protected boolean triggerDecision(EventHeader event) {
-		// Check if the event has clusters. An event with no clusters
-		// should never result in a trigger.
-		if(event.hasCollection(Cluster.class, clusterCollectionName)) {
-			// Check if any of the zone counts are high enough to trigger.
-			return triggerTest();
-		}
-		
-		// Events without clusters can not trigger.
-		else { return false; }
-	}
-	
-	/**
-	 * Checks if any of the regional counts are sufficiently high to
-	 * register a trigger.
-	 * 
-	 * @return Returns <code>true</code> if a region has enough clusters
-	 * to trigger and <code>false</code> otherwise.
-	 */
-	private boolean triggerTest() {
-		// Track whether a trigger occurred.
-		boolean trigger = false;
-		
-		// If any clusters occur in zone 3, reset the count and note
-		// that a trigger occurred.
-		if(zone3Count > 0) {
-			zone3Count = 0;
+                }
+            }
+        }
+        
+        // Run the superclass event processing.
+        super.process(event);
+    }
+    
+    /**
+     * Checks whether or not a trigger occurred.
+     * 
+     * @param event - The event on which to base the trigger decision.
+     * @return Returns <code>true</code> if a trigger occurred and <code>
+     * false</code> if a trigger did not.
+     */
+    @Override
+    protected boolean triggerDecision(EventHeader event) {
+        // Check if the event has clusters. An event with no clusters
+        // should never result in a trigger.
+        if(event.hasCollection(Cluster.class, clusterCollectionName)) {
+            // Check if any of the zone counts are high enough to trigger.
+            return triggerTest();
+        }
+        
+        // Events without clusters can not trigger.
+        else { return false; }
+    }
+    
+    /**
+     * Checks if any of the regional counts are sufficiently high to
+     * register a trigger.
+     * 
+     * @return Returns <code>true</code> if a region has enough clusters
+     * to trigger and <code>false</code> otherwise.
+     */
+    private boolean triggerTest() {
+        // Track whether a trigger occurred.
+        boolean trigger = false;
+        
+        // If any clusters occur in zone 3, reset the count and note
+        // that a trigger occurred.
+        if(zone3Count > 0) {
+            zone3Count = 0;
                          if(zone2Count==zone2Prescaling){zone2Count=0;}
                          if(zone1Count==zone1Prescaling){zone1Count=0;}
-			trigger = true;
-		}
-		
-		// If zone 2 has sufficient clusters (100 by default) to
-		// trigger, reset its count and note that a trigger occurred.
-		else if(zone2Count == zone2Prescaling) {
-			zone2Count = 0;
+            trigger = true;
+        }
+        
+        // If zone 2 has sufficient clusters (100 by default) to
+        // trigger, reset its count and note that a trigger occurred.
+        else if(zone2Count == zone2Prescaling) {
+            zone2Count = 0;
                         if(zone3Count>0){zone3Count=0;}
                         if(zone1Count==zone1Prescaling){zone1Count=0;}
-			trigger = true;
-		}
-		
-		// If zone 3 has sufficient clusters (1000 by default) to
-		// trigger, reset its count and note that a trigger occurred.
-		else if(zone1Count == zone1Prescaling) {
-			zone1Count = 0;
+            trigger = true;
+        }
+        
+        // If zone 3 has sufficient clusters (1000 by default) to
+        // trigger, reset its count and note that a trigger occurred.
+        else if(zone1Count == zone1Prescaling) {
+            zone1Count = 0;
                         if(zone3Count>0){zone3Count=0;}
                         if(zone2Count==zone2Prescaling){zone2Count=0;}
-			trigger = true;
-		}
-		else if(zone4Count == zone4Prescaling) {
-			zone4Count = 0;
+            trigger = true;
+        }
+        else if(zone4Count == zone4Prescaling) {
+            zone4Count = 0;
                         if(zone3Count>0){zone3Count=0;}
                         if(zone2Count==zone2Prescaling){zone2Count=0;}
                         if(zone1Count==zone1Prescaling){zone1Count=0;}
-			trigger = true;
-		}
-		// Return whether or not a trigger occurred.
-		return trigger;
-	}
+            trigger = true;
+        }
+        // Return whether or not a trigger occurred.
+        return trigger;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/luca/LCIOReadScript.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/LCIOReadScript.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/LCIOReadScript.java	Wed Mar  9 11:43:24 2016
@@ -10,91 +10,91 @@
 import org.lcsim.lcio.LCIOWriter;
 
 public class LCIOReadScript {
-	public static void main(String[] args) {
-		// Make sure there arguments are valid.
-		if(args.length != 2) {
-			System.err.println("Error: Arguments must be [Input_File] [Output_File]");
-			System.exit(1);
-		}
-		
-		// Set the input/output files.
-		File inputFile = new File(args[0]);
-		File outputFile = new File(args[1]);
-		
-		// Make sure that the input file exists.
-		if(!inputFile.canRead()) {
-			System.err.println("Error: Input file can not be found.");
-			System.exit(1);
-		}
-		
-		// Create an LCIO reader to read it in.
-		LCIOReader reader = null;
-		try { reader = new LCIOReader(inputFile); }
-		catch(IOException e) {
-			e.printStackTrace();
-			System.exit(1);
-		}
-		
-		// Create an LCIO writer to output the new file.
-		LCIOWriter writer = null;
-		try { writer = new LCIOWriter(outputFile); }
-		catch(IOException e) {
-			e.printStackTrace();
-			System.exit(1);
-		}
-		
-		// Keep looping through events until there are no more.
-		while(true) {
-			// Try to get an event.
-			EventHeader event = null;
-			try { event = reader.read(); }
-			catch(IOException e) { }
-			
-			// If the event is still null, there either was no event
-			// or an error occurred.
-			if(event == null) { break; }
-			
-			// Get the event number to print a status update.
-			int num = event.getEventNumber();
-			if(num % 10000 == 0) { System.out.println("Parsing event " + num + "."); }
-			
-			// See if the MCParticle collection exists.
-			if(event.hasCollection(MCParticle.class, "MCParticle")) {
-				// Get the MCParticle collection from the event.
-				ArrayList<MCParticle> particleList = (ArrayList<MCParticle>) event.get(MCParticle.class, "MCParticle");
-				
-				// Remove the MCParticle collection from the event.
-				event.remove("MCParticle");
-				
-				// Make a new list for good particles which pass some test.
-				ArrayList<MCParticle> goodParticles = new ArrayList<MCParticle>();
-				
-				// Sort through the list of MCParticle objects in the
-				// full list and add good ones to the good list.
-				for(MCParticle p : particleList) {
-					if(p.getEnergy() >= 2.1) { goodParticles.add(p); }
-				}
-				
-				// Write the good particles back to the event.
-				event.put("MCParticle", goodParticles);
-			}
-			
-			// Write the event back out to the new file.
-			try { writer.write(event); }
-			catch(IOException e) {
-				e.printStackTrace();
-				System.exit(1);
-			}
-		}
-		
-		// Close the reader and writer.
-		try {
-			reader.close();
-			writer.close();
-		}
-		catch(IOException e) {
-			e.printStackTrace();
-			System.exit(1);
-		}
-	}
+    public static void main(String[] args) {
+        // Make sure there arguments are valid.
+        if(args.length != 2) {
+            System.err.println("Error: Arguments must be [Input_File] [Output_File]");
+            System.exit(1);
+        }
+        
+        // Set the input/output files.
+        File inputFile = new File(args[0]);
+        File outputFile = new File(args[1]);
+        
+        // Make sure that the input file exists.
+        if(!inputFile.canRead()) {
+            System.err.println("Error: Input file can not be found.");
+            System.exit(1);
+        }
+        
+        // Create an LCIO reader to read it in.
+        LCIOReader reader = null;
+        try { reader = new LCIOReader(inputFile); }
+        catch(IOException e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        
+        // Create an LCIO writer to output the new file.
+        LCIOWriter writer = null;
+        try { writer = new LCIOWriter(outputFile); }
+        catch(IOException e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        
+        // Keep looping through events until there are no more.
+        while(true) {
+            // Try to get an event.
+            EventHeader event = null;
+            try { event = reader.read(); }
+            catch(IOException e) { }
+            
+            // If the event is still null, there either was no event
+            // or an error occurred.
+            if(event == null) { break; }
+            
+            // Get the event number to print a status update.
+            int num = event.getEventNumber();
+            if(num % 10000 == 0) { System.out.println("Parsing event " + num + "."); }
+            
+            // See if the MCParticle collection exists.
+            if(event.hasCollection(MCParticle.class, "MCParticle")) {
+                // Get the MCParticle collection from the event.
+                ArrayList<MCParticle> particleList = (ArrayList<MCParticle>) event.get(MCParticle.class, "MCParticle");
+                
+                // Remove the MCParticle collection from the event.
+                event.remove("MCParticle");
+                
+                // Make a new list for good particles which pass some test.
+                ArrayList<MCParticle> goodParticles = new ArrayList<MCParticle>();
+                
+                // Sort through the list of MCParticle objects in the
+                // full list and add good ones to the good list.
+                for(MCParticle p : particleList) {
+                    if(p.getEnergy() >= 2.1) { goodParticles.add(p); }
+                }
+                
+                // Write the good particles back to the event.
+                event.put("MCParticle", goodParticles);
+            }
+            
+            // Write the event back out to the new file.
+            try { writer.write(event); }
+            catch(IOException e) {
+                e.printStackTrace();
+                System.exit(1);
+            }
+        }
+        
+        // Close the reader and writer.
+        try {
+            reader.close();
+            writer.close();
+        }
+        catch(IOException e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/luca/rate.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/rate.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/rate.java	Wed Mar  9 11:43:24 2016
@@ -435,15 +435,15 @@
      nevents++;
      
      
-    	/* natha's code for trigger
-    	List <AbstractIntData> aids = event.get(AbstractIntData.class, "TriggerBank");
-    	for (AbstractIntData aid : aids) {
-    		if (aid.getTag() == TIData.BANK_TAG) {
-    			TIData tt=(TIData)aid;
-    			if (!tt.isSingle1Trigger()) return;
+        /* natha's code for trigger
+        List <AbstractIntData> aids = event.get(AbstractIntData.class, "TriggerBank");
+        for (AbstractIntData aid : aids) {
+            if (aid.getTag() == TIData.BANK_TAG) {
+                TIData tt=(TIData)aid;
+                if (!tt.isSingle1Trigger()) return;
                         break;
-    		}
-    	}
+            }
+        }
      */ //nathans code for trigger end
      
     

Modified: java/trunk/users/src/main/java/org/hps/users/luca/ratesim.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/luca/ratesim.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/luca/ratesim.java	Wed Mar  9 11:43:24 2016
@@ -238,15 +238,15 @@
      nevents++;
      
      
-    	/* natha's code for trigger
-    	List <AbstractIntData> aids = event.get(AbstractIntData.class, "TriggerBank");
-    	for (AbstractIntData aid : aids) {
-    		if (aid.getTag() == TIData.BANK_TAG) {
-    			TIData tt=(TIData)aid;
-    			if (!tt.isSingle1Trigger()) return;
+        /* natha's code for trigger
+        List <AbstractIntData> aids = event.get(AbstractIntData.class, "TriggerBank");
+        for (AbstractIntData aid : aids) {
+            if (aid.getTag() == TIData.BANK_TAG) {
+                TIData tt=(TIData)aid;
+                if (!tt.isSingle1Trigger()) return;
                         break;
-    		}
-    	}
+            }
+        }
      */ //nathans code for trigger end
      
     

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalAnalogPrintDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalAnalogPrintDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalAnalogPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -22,67 +22,67 @@
  */
 public class HPSEcalAnalogPrintDriver extends Driver {
 
-	Subdetector ecal;
-	IDDecoder dec;
-	String ecalName;
-	String ecalReadoutName = "EcalHits";
-	String ecalCollectionName = null;
-	String outputFileName;
-	PrintWriter outputStream = null;
-	int flags;
+    Subdetector ecal;
+    IDDecoder dec;
+    String ecalName;
+    String ecalReadoutName = "EcalHits";
+    String ecalCollectionName = null;
+    String outputFileName;
+    PrintWriter outputStream = null;
+    int flags;
 
-	public HPSEcalAnalogPrintDriver() {
-	}
+    public HPSEcalAnalogPrintDriver() {
+    }
 
-	public void setEcalCollectionName(String ecalCollectionName) {
-		this.ecalCollectionName = ecalCollectionName;
-	}
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
 
-	public void setEcalName(String ecalName) {
-		this.ecalName = ecalName;
-	}
+    public void setEcalName(String ecalName) {
+        this.ecalName = ecalName;
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	@Override
-	public void startOfData() {
-		if (ecalCollectionName == null) {
-			throw new RuntimeException("The parameter ecalCollectionName was not set!");
-		}
+    @Override
+    public void startOfData() {
+        if (ecalCollectionName == null) {
+            throw new RuntimeException("The parameter ecalCollectionName was not set!");
+        }
 
-		if (ecalName == null) {
-			throw new RuntimeException("The parameter ecalName was not set!");
-		}
+        if (ecalName == null) {
+            throw new RuntimeException("The parameter ecalName was not set!");
+        }
 
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void detectorChanged(Detector detector) {
-		// Get the Subdetector.
-		ecal = (Subdetector) detector.getSubdetector(ecalName);
-		dec = ecal.getIDDecoder();
-	}
+    public void detectorChanged(Detector detector) {
+        // Get the Subdetector.
+        ecal = (Subdetector) detector.getSubdetector(ecalName);
+        dec = ecal.getIDDecoder();
+    }
 
-	@Override
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
-			//outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
-			List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
-			for (CalorimeterHit hit : hits) {
-				dec.setID(hit.getCellID());
-				outputStream.printf("%d\t%d\t%f\t%f\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getRawEnergy());
-			}
-		}
-	}
+    @Override
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
+            //outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
+            for (CalorimeterHit hit : hits) {
+                dec.setID(hit.getCellID());
+                outputStream.printf("%d\t%d\t%f\t%f\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getRawEnergy());
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalDigitalPrintDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalDigitalPrintDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalDigitalPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -22,70 +22,70 @@
  */
 public class HPSEcalDigitalPrintDriver extends Driver {
 
-	Subdetector ecal;
-	IDDecoder dec;
-	String ecalName = "Ecal";
-	String ecalReadoutName = "EcalHits";
-	String ecalCollectionName = "EcalRawHits";
-	String outputFileName;
-	PrintWriter outputStream = null;
-	int timeScale = 1;
-	int flags;
+    Subdetector ecal;
+    IDDecoder dec;
+    String ecalName = "Ecal";
+    String ecalReadoutName = "EcalHits";
+    String ecalCollectionName = "EcalRawHits";
+    String outputFileName;
+    PrintWriter outputStream = null;
+    int timeScale = 1;
+    int flags;
 
-	public HPSEcalDigitalPrintDriver() {
-	}
+    public HPSEcalDigitalPrintDriver() {
+    }
 
-	public void setTimeScale(int timeScale) {
-		this.timeScale = timeScale;
-	}
+    public void setTimeScale(int timeScale) {
+        this.timeScale = timeScale;
+    }
 
-	public void setEcalCollectionName(String ecalCollectionName) {
-		this.ecalCollectionName = ecalCollectionName;
-	}
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
 
-	public void setEcalName(String ecalName) {
-		this.ecalName = ecalName;
-	}
+    public void setEcalName(String ecalName) {
+        this.ecalName = ecalName;
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	public void startOfData() {
-		if (ecalCollectionName == null) {
-			throw new RuntimeException("The parameter ecalCollectionName was not set!");
-		}
+    public void startOfData() {
+        if (ecalCollectionName == null) {
+            throw new RuntimeException("The parameter ecalCollectionName was not set!");
+        }
 
-		if (ecalName == null) {
-			throw new RuntimeException("The parameter ecalName was not set!");
-		}
+        if (ecalName == null) {
+            throw new RuntimeException("The parameter ecalName was not set!");
+        }
 
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void detectorChanged(Detector detector) {
-		// Get the Subdetector.
-		ecal = (Subdetector) detector.getSubdetector(ecalName);
-		dec = ecal.getIDDecoder();
-	}
+    public void detectorChanged(Detector detector) {
+        // Get the Subdetector.
+        ecal = (Subdetector) detector.getSubdetector(ecalName);
+        dec = ecal.getIDDecoder();
+    }
 
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) {
-			List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
-			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (RawCalorimeterHit hit : hits) {
-				dec.setID(hit.getCellID());
-				outputStream.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTimeStamp() * timeScale, hit.getAmplitude());
-			}
-		}
-	}
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) {
+            List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
+            //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+            for (RawCalorimeterHit hit : hits) {
+                dec.setID(hit.getCellID());
+                outputStream.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTimeStamp() * timeScale, hit.getAmplitude());
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -22,68 +22,68 @@
  */
 public class HPSEcalRawTrackerHitPrintDriver extends Driver {
 
-	Subdetector ecal;
-	IDDecoder dec;
-	String ecalName = "Ecal";
-	String ecalReadoutName = "EcalHits";
-	String ecalCollectionName = "EcalRawHits";
-	String outputFileName;
-	PrintWriter outputStream = null;
-	int flags;
+    Subdetector ecal;
+    IDDecoder dec;
+    String ecalName = "Ecal";
+    String ecalReadoutName = "EcalHits";
+    String ecalCollectionName = "EcalRawHits";
+    String outputFileName;
+    PrintWriter outputStream = null;
+    int flags;
 
-	public HPSEcalRawTrackerHitPrintDriver() {
-	}
+    public HPSEcalRawTrackerHitPrintDriver() {
+    }
 
-	public void setEcalCollectionName(String ecalCollectionName) {
-		this.ecalCollectionName = ecalCollectionName;
-	}
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
 
-	public void setEcalName(String ecalName) {
-		this.ecalName = ecalName;
-	}
+    public void setEcalName(String ecalName) {
+        this.ecalName = ecalName;
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	public void startOfData() {
-		if (ecalCollectionName == null) {
-			throw new RuntimeException("The parameter ecalCollectionName was not set!");
-		}
+    public void startOfData() {
+        if (ecalCollectionName == null) {
+            throw new RuntimeException("The parameter ecalCollectionName was not set!");
+        }
 
-		if (ecalName == null) {
-			throw new RuntimeException("The parameter ecalName was not set!");
-		}
+        if (ecalName == null) {
+            throw new RuntimeException("The parameter ecalName was not set!");
+        }
 
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void detectorChanged(Detector detector) {
-		// Get the Subdetector.
-		ecal = (Subdetector) detector.getSubdetector(ecalName);
-		dec = ecal.getIDDecoder();
-	}
+    public void detectorChanged(Detector detector) {
+        // Get the Subdetector.
+        ecal = (Subdetector) detector.getSubdetector(ecalName);
+        dec = ecal.getIDDecoder();
+    }
 
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) {
-			//outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
-			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName);
-			for (RawTrackerHit hit : hits) {
-				dec.setID(hit.getCellID());
-				outputStream.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getADCValues().length);
-				for (int i = 0; i < hit.getADCValues().length; i++) {
-					outputStream.printf("%d\n", hit.getADCValues()[i]);
-				}
-			}
-		}
-	}
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) {
+            //outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName);
+            for (RawTrackerHit hit : hits) {
+                dec.setID(hit.getCellID());
+                outputStream.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getADCValues().length);
+                for (int i = 0; i < hit.getADCValues().length; i++) {
+                    outputStream.printf("%d\n", hit.getADCValues()[i]);
+                }
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java	Wed Mar  9 11:43:24 2016
@@ -20,42 +20,42 @@
  */
 public class HPSGenericRawTrackerHitPrintDriver extends Driver {
 
-	String outputFileName;
-	PrintWriter outputStream = null;
+    String outputFileName;
+    PrintWriter outputStream = null;
 
-	public HPSGenericRawTrackerHitPrintDriver() {
-	}
+    public HPSGenericRawTrackerHitPrintDriver() {
+    }
 
-	public void setOutputFileName(String outputFileName) {
-		this.outputFileName = outputFileName;
-	}
+    public void setOutputFileName(String outputFileName) {
+        this.outputFileName = outputFileName;
+    }
 
-	public void startOfData() {
-		if (outputFileName != null) {
-			try {
-				outputStream = new PrintWriter(outputFileName);
-			} catch (IOException ex) {
-				throw new RuntimeException("Invalid outputFilePath!");
-			}
-		} else {
-			outputStream = new PrintWriter(System.out, true);
-		}
-	}
+    public void startOfData() {
+        if (outputFileName != null) {
+            try {
+                outputStream = new PrintWriter(outputFileName);
+            } catch (IOException ex) {
+                throw new RuntimeException("Invalid outputFilePath!");
+            }
+        } else {
+            outputStream = new PrintWriter(System.out, true);
+        }
+    }
 
-	public void process(EventHeader event) {
-		// Get the list of ECal hits.
-		if (event.hasCollection(RawTrackerHit.class)) {
-			//outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
-			List<List<RawTrackerHit>> listOfLists = event.get(RawTrackerHit.class);
-			for (List<RawTrackerHit> hits : listOfLists) {
-				outputStream.printf("List with %d RawTrackerHits:\n", hits.size());
-				for (RawTrackerHit hit : hits) {
-					outputStream.printf("%d\t%d\n", hit.getCellID(), hit.getADCValues().length);
-					for (int i = 0; i < hit.getADCValues().length; i++) {
-						outputStream.printf("%d\n", hit.getADCValues()[i]);
-					}
-				}
-			}
-		}
-	}
+    public void process(EventHeader event) {
+        // Get the list of ECal hits.
+        if (event.hasCollection(RawTrackerHit.class)) {
+            //outputStream.println("Reading RawTrackerHits from event " + event.getEventNumber());
+            List<List<RawTrackerHit>> listOfLists = event.get(RawTrackerHit.class);
+            for (List<RawTrackerHit> hits : listOfLists) {
+                outputStream.printf("List with %d RawTrackerHits:\n", hits.size());
+                for (RawTrackerHit hit : hits) {
+                    outputStream.printf("%d\t%d\n", hit.getCellID(), hit.getADCValues().length);
+                    for (int i = 0; i < hit.getADCValues().length; i++) {
+                        outputStream.printf("%d\n", hit.getADCValues()[i]);
+                    }
+                }
+            }
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/LCIOTrackAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/LCIOTrackAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/LCIOTrackAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -24,7 +24,7 @@
  * @author Sho Uemura <[log in to unmask]>
  */
 // TODO: This is an exact duplicate of the class in the analysis.example package.
-//		 One of them should be sandboxed
+//       One of them should be sandboxed
 public class LCIOTrackAnalysis {
 
     protected Track track;

Modified: java/trunk/users/src/main/java/org/hps/users/mgraham/HPSTrackerHit.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/mgraham/HPSTrackerHit.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/HPSTrackerHit.java	Wed Mar  9 11:43:24 2016
@@ -16,23 +16,23 @@
         double t0;
         double amp;                
       public HPSTrackerHit(
-    		long id,
-    		int time,
-    		short[] adcValues, double t0, double Amp) {
-    	this.cellId = id;
-    	this.packedID = new Identifier(id);
-    	this.time = time;
-    	this.adcValues = adcValues;
+            long id,
+            int time,
+            short[] adcValues, double t0, double Amp) {
+        this.cellId = id;
+        this.packedID = 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.packedID = new Identifier(rth.getCellID());
-    	this.time = rth.getTime();
-    	this.adcValues = rth.getADCValues();
+            RawTrackerHit rth, double t0, double Amp) {
+        this.cellId = rth.getCellID();
+        this.packedID = new Identifier(rth.getCellID());
+        this.time = rth.getTime();
+        this.adcValues = rth.getADCValues();
         this.t0=t0;
         this.amp=Amp;        
     }

Modified: java/trunk/users/src/main/java/org/hps/users/mgraham/SVTRawTrackerHitThresholdDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/mgraham/SVTRawTrackerHitThresholdDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/SVTRawTrackerHitThresholdDriver.java	Wed Mar  9 11:43:24 2016
@@ -15,7 +15,7 @@
  * @author Matt Graham
  */
 // TODO: Check that this Driver works as expected after it was updated to use 
-// 		 the database conditions system.
+//       the database conditions system.
 public class SVTRawTrackerHitThresholdDriver extends Driver {
 
     private String rawTrackerHitCollectionName = "RawTrackerHitMaker_RawTrackerHits";

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/EcalScoringPlaneDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/EcalScoringPlaneDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/EcalScoringPlaneDriver.java	Wed Mar  9 11:43:24 2016
@@ -23,136 +23,136 @@
  */
 public class EcalScoringPlaneDriver extends Driver {
 
-	boolean verbose = false;
-	
-	// Collection Names
-	String ecalScoringPlaneHitsCollectionName = "TrackerHitsECal";
-	String tracksCollectionName = "MatchedTracks";
-	String trackToScoringPlaneHitRelationsName = "TrackToEcalScoringPlaneHitRelations";
-	String trackToMCParticleRelationsName = "TrackToMCParticleRelations";
-	
-	/**
-	 * Enable/disable verbose mode
-	 * 
-	 * @param verbose : set true to enable, false otherwise
-	 */
-	public void setVerbose(boolean verbose){
-		this.verbose = verbose; 
-	}
-	
-	@Override
-	protected void process(EventHeader event){
-		
-		// If the event doesn't have a collection of Tracks, skip it
-		if(!event.hasCollection(Track.class, tracksCollectionName)) return;
-		
-		// If the event doesn't have a collection of Ecal scoring plane hits, 
-		// skip it
-		if(!event.hasCollection(SimTrackerHit.class, ecalScoringPlaneHitsCollectionName)) return;
-		
-		// Get the collection of tracks from the event
-		List<Track> tracks = event.get(Track.class, tracksCollectionName);
-		
-		// Get the collection of Ecal scoring plane hits from the event
-		List<SimTrackerHit> scoringPlaneHits = event.get(SimTrackerHit.class, ecalScoringPlaneHitsCollectionName);
-		
-		// Create a collection to hold the scoring plane hits that were found to match
-		// a track
-		List<SimTrackerHit> matchedScoringPlaneHits = new ArrayList<SimTrackerHit>(); 
-		
-		// Create a collection of LCRelations between a track and the scoring plane hit
-		List<LCRelation> trackToScoringPlaneHitRelations = new ArrayList<LCRelation>();
-	
-		// Create a collection of LCRelations between a track and its corresponding MC particle
-		List<LCRelation> trackToMCParticleRelations = new ArrayList<LCRelation>();
-	
-		MCParticle particle = null;
-		for(Track track : tracks){
-		
-			// Get the MC particle associated with this track
-			particle = this.getMCParticleAssociatedWithTrack(track);
-			// If the MC particle is null, then the hits associated with the
-			// track did not have an MC particle associated with them
-			// TODO: Find out why some hits don't have any MC particles associated with them
-			if(particle == null) continue;
-		
-			// Add an LCRelation between the track and the corresponding MC particle
-			trackToMCParticleRelations.add(new BaseLCRelation(track, particle));
-			
-			// Loop over all of the scoring plane hits and check if the associated MC particle
-			// matches the one from the track
-			for(SimTrackerHit scoringPlaneHit : scoringPlaneHits){
-	
-				// If the MC particles don't match, move on to the next particle
-				if(!(scoringPlaneHit.getMCParticle() == particle)) continue; 
-					
-				this.printVerbose("Found a match between a track and a scoring plane hit.");
-				
-				// If a match is found, add the scoring plane hit to the list of matched hits and
-				// an LCRelation between the track and the scoring plane.
-				matchedScoringPlaneHits.add(scoringPlaneHit);
-				trackToScoringPlaneHitRelations.add(new BaseLCRelation(track, scoringPlaneHit));
-				
-				// Once a match is found, there is no need to loop through the rest of the list
-				break;
-			}
-		}
-		
-		// Store all of the collections in the event
-		event.put(ecalScoringPlaneHitsCollectionName, matchedScoringPlaneHits, SimTrackerHit.class, 0);
-		event.put(trackToScoringPlaneHitRelationsName, trackToScoringPlaneHitRelations, LCRelation.class, 0);
-		event.put(trackToMCParticleRelationsName, trackToMCParticleRelations, LCRelation.class, 0);
-	}
-	
-	/**
-	 * Print a message if verbose has been enabled.
-	 *  
-	 * @param message : message to print.
-	 */
-	private void printVerbose(String message){
-		if(verbose)
-			System.out.println(this.getClass().getSimpleName() + ": " + message);
-	}
-	
-	/**
-	 * Get the MC particle associated with a track.
-	 * 
-	 * @param track : Track to get the MC particle for
-	 * @return The MC particle associated with the track
-	 */
-	private MCParticle getMCParticleAssociatedWithTrack(Track track){
-		
-		Map <MCParticle, int[]>mcParticleMultiplicity = new HashMap<MCParticle, int[]>();
-		MCParticle particle;
-		for(TrackerHit hit : track.getTrackerHits()){
-		
-				// If one of the tracker hits doesn't have any MC particles associated
-				// with it, return null for now.
-				if(((HelicalTrackHit) hit).getMCParticles().size() == 0){
-					this.printVerbose("HelicalTrackHit is not associated with any MC particles.");
-					return null;
-				}
-				
-				particle = ((HelicalTrackHit) hit).getMCParticles().get(0);
-				if(!mcParticleMultiplicity.containsKey(particle)){
-					mcParticleMultiplicity.put(particle, new int[1]);
-					mcParticleMultiplicity.get(particle)[0] = 0;
-				}
-				
-				mcParticleMultiplicity.get(particle)[0]++;
-				
-		}
-		
-		// Look for the MC particle that occurs the most of the track
-		int maxValue = 0;
-		particle = null;
-		for(Map.Entry<MCParticle, int[]> entry : mcParticleMultiplicity.entrySet()){
-			if(maxValue < entry.getValue()[0]){
-				particle = entry.getKey();
-				maxValue = entry.getValue()[0];
-			}
-		}
-		
-		return particle;
-	}
+    boolean verbose = false;
+    
+    // Collection Names
+    String ecalScoringPlaneHitsCollectionName = "TrackerHitsECal";
+    String tracksCollectionName = "MatchedTracks";
+    String trackToScoringPlaneHitRelationsName = "TrackToEcalScoringPlaneHitRelations";
+    String trackToMCParticleRelationsName = "TrackToMCParticleRelations";
+    
+    /**
+     * Enable/disable verbose mode
+     * 
+     * @param verbose : set true to enable, false otherwise
+     */
+    public void setVerbose(boolean verbose){
+        this.verbose = verbose; 
+    }
+    
+    @Override
+    protected void process(EventHeader event){
+        
+        // If the event doesn't have a collection of Tracks, skip it
+        if(!event.hasCollection(Track.class, tracksCollectionName)) return;
+        
+        // If the event doesn't have a collection of Ecal scoring plane hits, 
+        // skip it
+        if(!event.hasCollection(SimTrackerHit.class, ecalScoringPlaneHitsCollectionName)) return;
+        
+        // Get the collection of tracks from the event
+        List<Track> tracks = event.get(Track.class, tracksCollectionName);
+        
+        // Get the collection of Ecal scoring plane hits from the event
+        List<SimTrackerHit> scoringPlaneHits = event.get(SimTrackerHit.class, ecalScoringPlaneHitsCollectionName);
+        
+        // Create a collection to hold the scoring plane hits that were found to match
+        // a track
+        List<SimTrackerHit> matchedScoringPlaneHits = new ArrayList<SimTrackerHit>(); 
+        
+        // Create a collection of LCRelations between a track and the scoring plane hit
+        List<LCRelation> trackToScoringPlaneHitRelations = new ArrayList<LCRelation>();
+    
+        // Create a collection of LCRelations between a track and its corresponding MC particle
+        List<LCRelation> trackToMCParticleRelations = new ArrayList<LCRelation>();
+    
+        MCParticle particle = null;
+        for(Track track : tracks){
+        
+            // Get the MC particle associated with this track
+            particle = this.getMCParticleAssociatedWithTrack(track);
+            // If the MC particle is null, then the hits associated with the
+            // track did not have an MC particle associated with them
+            // TODO: Find out why some hits don't have any MC particles associated with them
+            if(particle == null) continue;
+        
+            // Add an LCRelation between the track and the corresponding MC particle
+            trackToMCParticleRelations.add(new BaseLCRelation(track, particle));
+            
+            // Loop over all of the scoring plane hits and check if the associated MC particle
+            // matches the one from the track
+            for(SimTrackerHit scoringPlaneHit : scoringPlaneHits){
+    
+                // If the MC particles don't match, move on to the next particle
+                if(!(scoringPlaneHit.getMCParticle() == particle)) continue; 
+                    
+                this.printVerbose("Found a match between a track and a scoring plane hit.");
+                
+                // If a match is found, add the scoring plane hit to the list of matched hits and
+                // an LCRelation between the track and the scoring plane.
+                matchedScoringPlaneHits.add(scoringPlaneHit);
+                trackToScoringPlaneHitRelations.add(new BaseLCRelation(track, scoringPlaneHit));
+                
+                // Once a match is found, there is no need to loop through the rest of the list
+                break;
+            }
+        }
+        
+        // Store all of the collections in the event
+        event.put(ecalScoringPlaneHitsCollectionName, matchedScoringPlaneHits, SimTrackerHit.class, 0);
+        event.put(trackToScoringPlaneHitRelationsName, trackToScoringPlaneHitRelations, LCRelation.class, 0);
+        event.put(trackToMCParticleRelationsName, trackToMCParticleRelations, LCRelation.class, 0);
+    }
+    
+    /**
+     * Print a message if verbose has been enabled.
+     *  
+     * @param message : message to print.
+     */
+    private void printVerbose(String message){
+        if(verbose)
+            System.out.println(this.getClass().getSimpleName() + ": " + message);
+    }
+    
+    /**
+     * Get the MC particle associated with a track.
+     * 
+     * @param track : Track to get the MC particle for
+     * @return The MC particle associated with the track
+     */
+    private MCParticle getMCParticleAssociatedWithTrack(Track track){
+        
+        Map <MCParticle, int[]>mcParticleMultiplicity = new HashMap<MCParticle, int[]>();
+        MCParticle particle;
+        for(TrackerHit hit : track.getTrackerHits()){
+        
+                // If one of the tracker hits doesn't have any MC particles associated
+                // with it, return null for now.
+                if(((HelicalTrackHit) hit).getMCParticles().size() == 0){
+                    this.printVerbose("HelicalTrackHit is not associated with any MC particles.");
+                    return null;
+                }
+                
+                particle = ((HelicalTrackHit) hit).getMCParticles().get(0);
+                if(!mcParticleMultiplicity.containsKey(particle)){
+                    mcParticleMultiplicity.put(particle, new int[1]);
+                    mcParticleMultiplicity.get(particle)[0] = 0;
+                }
+                
+                mcParticleMultiplicity.get(particle)[0]++;
+                
+        }
+        
+        // Look for the MC particle that occurs the most of the track
+        int maxValue = 0;
+        particle = null;
+        for(Map.Entry<MCParticle, int[]> entry : mcParticleMultiplicity.entrySet()){
+            if(maxValue < entry.getValue()[0]){
+                particle = entry.getKey();
+                maxValue = entry.getValue()[0];
+            }
+        }
+        
+        return particle;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/ExtrapolationAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/ExtrapolationAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/ExtrapolationAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -30,312 +30,312 @@
  */
 public class ExtrapolationAnalysis  extends Driver {
 
-	AIDA aida = null;
-	List<IPlotter> plotters;
-
-	Hep3Vector bField = null;
-	
-	boolean verbose = false;
-	
-	// Collection Names
-	String matchedEcalScoringPlaneHitsCollectionName = "MatchedTrackerHitsEcal";
-	String trackToScoringPlaneHitRelationsName = "TrackToEcalScoringPlaneHitRelations";
-	String trackToMCParticleRelationsName = "TrackToMCParticleRelations";
-	
-	/**
-	 * Enable/disable verbose mode
-	 * 
-	 * @param verbose : true to enable, false otherwise
-	 */
-	public void setVerbose(boolean verbose){
-		this.verbose = verbose; 
-	}
-	
-	public void detectorChanged(Detector detector){
-		
-		// Get the magnetic field from the geometry
-		bField = detector.getFieldMap().getField(new BasicHep3Vector(0,0,0));
-		
-		//-----------------------//
-		//--- Setup all plots ---//
-		//-----------------------//
-		
-		// Setup AIDA
-		aida = AIDA.defaultInstance();
-		aida.tree().cd("/");
-	
-		// Instantiate a list to hold the collection of plotters
-		plotters = new ArrayList<IPlotter>();
-		IPlotter plotter = null; 
-		
-		//--- Plots of scoring plane positions ---//
-		//----------------------------------------//
-		plotter = PlotUtils.setupPlotter("Positions of Scoring plane hits matched to tracks", 2, 2);
-		PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - x", 0, "x (mm)",
-				aida.histogram1D("Scoring plane hit position - x", 100, -400, 400));
-		PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - y", 1, "y (mm)",
-				aida.histogram1D("Scoring plane hit position - y", 100, -200, 200));
-		PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - z", 2, "z (mm)",
-				aida.histogram1D("Scoring plane hit position - z", 100, 1000, 1500));
-		PlotUtils.setup2DRegion(plotter, "Scoring plane hit position - x-y", 3, "x (mm)", "y (mm)", 
-				aida.histogram2D("Scoring plane hit position - x-y", 100, -400, 400, 100, -200, 200));
-		plotters.add(plotter);	
-
-		//--- Plots of residuals at scoring plane ---//
-		//-------------------------------------------//
-		plotter = PlotUtils.setupPlotter("Residuals at scoring plane", 3, 3);
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at scoring plane", 0, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Top electron tracks - Bend plane residual at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at scoring plane", 0, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Top positron tracks - Bend plane residual at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at scoring plane", 1, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Bottom electron tracks - Bend plane residuals at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at scoring plane", 1, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Bottom positron tracks - Bend plane residuals at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Bend plane residuals at scoring plane", 2, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Bend plane residuals at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Bend plane residuals at scoring plane", 2, "x_{ep} - x_{sp} (mm)",
-				aida.histogram1D("Bend plane residuals at scoring plane", 60, -30, 30));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at scoring plane", 3,"y_{ep} - y_{sp} (mm)", 
-				aida.histogram1D("Top electron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at scoring plane", 3,"y_{ep} - y_{sp} (mm)", 
-				aida.histogram1D("Top positron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at scoring plane", 4,"y_{ep} - y_{sp} (mm)", 
-				aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at scoring plane", 4,"y_{ep} - y_{sp} (mm)", 
-				aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
-		PlotUtils.setup1DRegion(plotter, "Non-bend plane residuals at scoring plane", 5,"y_{ep} - y_{sp} (mm)", 
-				aida.histogram1D("Non-bend plane residuals at scoring plane", 30, -15, 15));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at scoring plane", 6, "z_{ep} - z_{sp} (mm)",
-				aida.histogram1D("Top electron tracks - z residuals at scoring plane", 10, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at scoring plane", 6, "z_{ep} - z_{sp} (mm)",
-				aida.histogram1D("Top positron tracks - z residuals at scoring plane", 10, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
-				aida.histogram1D("Bottom electron tracks - z residuals at scoring plane", 10, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
-				aida.histogram1D("Bottom positron tracks - z residuals at scoring plane", 10, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
-				aida.histogram1D("z residuals at scoring plane", 10, -5, 5));
-		plotters.add(plotter);	
-		
-		//--- Plots of residuals at target ---//
-		//------------------------------------//
-		plotter = PlotUtils.setupPlotter("Residuals at target", 3, 3);
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at target", 0, "x_{ep} - x_{t} (mm)",
-				aida.histogram1D("Top electron tracks - Bend plane residual at target", 40, -4, 4));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at target", 0, "x_{ep} - x_{t} (mm)",
-				aida.histogram1D("Top positron tracks - Bend plane residual at target", 40, -4, 4));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at target", 1, "x_{ep} - x_{t} (mm)",
-				aida.histogram1D("Bottom electron tracks - Bend plane residuals at target", 40, -4, 4));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at target", 1, "x_{ep} - x_{t} (mm)",
-				aida.histogram1D("Bottom positron tracks - Bend plane residuals at target", 40, -4, 4));
-		PlotUtils.setup1DRegion(plotter, "Bend plane residuals at target", 2, "x_{ep} - x_{t} (mm)",
-				aida.histogram1D("Bend plane residuals at target", 40, -4, 4));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at target", 3, "y_{ep} - y_{t} (mm)",
-				aida.histogram1D("Top electron tracks - Non-bend plane residuals at target", 20, -2, 2));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at target", 3, "y_{ep} - y_{t} (mm)",
-				aida.histogram1D("Top positron tracks - Non-bend plane residuals at target", 20, -2, 2));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at target", 4, "y_{ep} - y_{t} (mm)",
-				aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at target", 20, -2, 2));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at target", 4, "y_{ep} - y_{t} (mm)",
-				aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at target", 20, -2, 2));
-		PlotUtils.setup1DRegion(plotter, "Non-bend plane residuals at target", 5, "y_{ep} - y_{t} (mm)",
-				aida.histogram1D("Non-bend plane residuals at target", 20, -2, 2));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at target", 6, "z_{ep} - z_{t} (mm)",
-				aida.histogram1D("Top electron tracks - z residuals at target", 50, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at target", 6, "z_{ep} - z_{t} (mm)",
-				aida.histogram1D("Top positron tracks - z residuals at target", 50, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at target", 7, "z_{ep} - z_{t} (mm)",
-				aida.histogram1D("Bottom electron tracks - z residuals at target", 50, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at target", 7, "z_{ep} - z_{t} (mm)",
-				aida.histogram1D("Bottom positron tracks - z residuals at target", 50, -5, 5));
-		PlotUtils.setup1DRegion(plotter, "z residuals at target", 8, "z_{ep} - z_{t} (mm)",
-				aida.histogram1D("z residuals at target", 50, -5, 5));
-		plotters.add(plotter);	
-		
-		//--- Plot of residuals at scoring plane vs momentum ---//
-		//------------------------------------------------------//
-		plotter = PlotUtils.setupPlotter("Residuals vs Momentum", 2, 2);
-		PlotUtils.setup2DRegion(plotter, "Bend plane residuals vs momentum at scoring plane", 0, 
-				"Momentum (GeV)", "x_{ep} - x_{sp} (mm)",
-				aida.histogram2D("Bend plane residuals vs momentum at scoring plane", 5, 0, 2.5, 60, -30, 30));
-		PlotUtils.setup2DRegion(plotter, "Non-bend plane residuals vs momentum at scoring plane", 1, 
-				"Momentum (GeV)", "y_{ep} - y_{sp} (mm)",
-				aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane", 5, 0, 2.5, 60, -30, 30));
-		PlotUtils.setup2DRegion(plotter, "Bend plane residuals vs momentum at target", 2, 
-				"Momentum (GeV)", "x_{ep} - x_{t} (mm)",
-				aida.histogram2D("Bend plane residuals vs momentum at target", 5, 0, 2.5, 60, -3, 3));
-		PlotUtils.setup2DRegion(plotter, "Non-bend plane residuals vs momentum at target", 3, 
-				"Momentum (GeV)", "y_{ep} - y_{t} (mm)",
-				aida.histogram2D("Non-bend plane residuals vs momentum at target", 5, 0, 2.5, 50, -2.5, 2.5));
-		plotters.add(plotter);
-		
-		for(IPlotter iPlotter : plotters){
-			iPlotter.show(); 
-		}
-		
-	}
-	
-	public void process(EventHeader event){
-	
-		// If the event doesn't contain an LCRelation between a track and its 
-		// corresponding ECal scoring plane hit, skip the event.
-		if(!event.hasCollection(LCRelation.class, trackToScoringPlaneHitRelationsName)) return;
-		
-		List<LCRelation> trackToScoringPlaneHitRelations = event.get(LCRelation.class, trackToScoringPlaneHitRelationsName);
-		
-		for(LCRelation trackToScoringPlaneHitRelation : trackToScoringPlaneHitRelations){
-		
-			// Get the track
-			Track track = (Track) trackToScoringPlaneHitRelation.getFrom();
-			
-			// Get the track momentum
-			double[] momentum = BaseTrackState.computeMomentum(track.getTrackStates().get(0), bField.y());
-			double p = Math.sqrt(momentum[0]*momentum[0] + momentum[1]*momentum[1] + momentum[2]*momentum[2]);
-			this.printVerbose("Track momentum: " + p);
-			
-			// Get the corresponding scoring plane hit
-			SimTrackerHit scoringPlaneHit = (SimTrackerHit) trackToScoringPlaneHitRelation.getTo();
-			Hep3Vector scoringPlaneHitPosition = scoringPlaneHit.getPositionVec();
-			this.printVerbose("Scoring plane hit position: " + scoringPlaneHitPosition.toString());
-			
-			// Fill the scoring plane position histograms
-			aida.histogram1D("Scoring plane hit position - x").fill(scoringPlaneHitPosition.x());
-			aida.histogram1D("Scoring plane hit position - y").fill(scoringPlaneHitPosition.y());
-			aida.histogram1D("Scoring plane hit position - z").fill(scoringPlaneHitPosition.z());
-			aida.histogram2D("Scoring plane hit position - x-y").fill(scoringPlaneHitPosition.x(), scoringPlaneHitPosition.y());
-		
-			// Extrapolate the track to the scoring plane position
-			Hep3Vector trackPositionAtScoringPlane = TrackUtils.extrapolateTrack(track, scoringPlaneHitPosition.z());
-			this.printVerbose("Extrapolated track position: " + trackPositionAtScoringPlane.toString());
-				
-			// Find the residual between the extrapolated track position and the scoring plane hit position
-			double deltaX = trackPositionAtScoringPlane.x() - scoringPlaneHitPosition.x();
-			double deltaY = trackPositionAtScoringPlane.y() - scoringPlaneHitPosition.y();
-			// This should be 0 but it serves as a sanity check.
-			double deltaZ = trackPositionAtScoringPlane.z() - scoringPlaneHitPosition.z();
-		
-			if(track.getTrackerHits().get(0).getPosition()[2] > 0){
-				if(track.getTrackStates().get(0).getOmega() > 0){
-					aida.histogram1D("Top positron tracks - Bend plane residual at scoring plane").fill(deltaX);
-					aida.histogram1D("Top positron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
-					aida.histogram1D("Top positron tracks - z residuals at scoring plane").fill(deltaZ);	
-				} else { 
-					aida.histogram1D("Top electron tracks - Bend plane residual at scoring plane").fill(deltaX);
-					aida.histogram1D("Top electron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
-					aida.histogram1D("Top electron tracks - z residuals at scoring plane").fill(deltaZ);	
-				}
-			} else { 
-				if(track.getTrackStates().get(0).getOmega() > 0){
-					aida.histogram1D("Bottom positron tracks - Bend plane residuals at scoring plane").fill(deltaX);
-					aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
-					aida.histogram1D("Bottom positron tracks - z residuals at scoring plane").fill(deltaZ);
-				} else { 
-					aida.histogram1D("Bottom electron tracks - Bend plane residuals at scoring plane").fill(deltaX);
-					aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
-					aida.histogram1D("Bottom electron tracks - z residuals at scoring plane").fill(deltaZ);
-				}
-			}
-
-			aida.histogram1D("Bend plane residuals at scoring plane").fill(deltaX);
-			aida.histogram1D("Non-bend plane residuals at scoring plane").fill(deltaY);
-			aida.histogram1D("z residuals at target").fill(deltaZ);
-			aida.histogram2D("Bend plane residuals vs momentum at scoring plane").fill(p, deltaX);
-			aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane").fill(p, deltaY);
-		}
-		
-		if(!event.hasCollection(LCRelation.class, trackToMCParticleRelationsName)) return;
-		
-		List<LCRelation> trackToMCParticleRelations = event.get(LCRelation.class, trackToMCParticleRelationsName);
-		
-		for(LCRelation trackToMCParticleRelation : trackToMCParticleRelations){
-			
-			// Get the track
-			Track track = (Track) trackToMCParticleRelation.getFrom();
-			
-			// Get the track momentum
-			double[] momentum = BaseTrackState.computeMomentum(track.getTrackStates().get(0), bField.y());
-			double p = Math.sqrt(momentum[0]*momentum[0] + momentum[1]*momentum[1] + momentum[2]*momentum[2]);
-			this.printVerbose("Track momentum: " + p);
-
-			// Get the corresponding MC particle
-			MCParticle particle = (MCParticle) trackToMCParticleRelation.getTo();
-			
-			// Extrapolate the track to the origin
-			Hep3Vector trackPositionAtOrigin = TrackUtils.extrapolateTrack(track, particle.getOriginZ());
-			
-			// Find the residual between the extrapolated track and the position of the scoring plane at the origin
-			double deltaX = trackPositionAtOrigin.x() - particle.getOriginX();
-			double deltaY = trackPositionAtOrigin.y() - particle.getOriginY();
-			double deltaZ = trackPositionAtOrigin.z() - particle.getOriginZ();
-			
-			if(track.getTrackerHits().get(0).getPosition()[2] > 0){
-				if(track.getTrackStates().get(0).getOmega() > 0){
-					aida.histogram1D("Top positron tracks - Bend plane residual at target").fill(deltaX);
-					aida.histogram1D("Top positron tracks - Non-bend plane residuals at target").fill(deltaY);
-					aida.histogram1D("Top positron tracks - z residuals at target").fill(deltaZ);
-				} else { 
-					aida.histogram1D("Top electron tracks - Bend plane residual at target").fill(deltaX);
-					aida.histogram1D("Top electron tracks - Non-bend plane residuals at target").fill(deltaY);
-					aida.histogram1D("Top electron tracks - z residuals at target").fill(deltaZ);
-				}
-			} else { 
-				
-				if(track.getTrackStates().get(0).getOmega() > 0){
-					aida.histogram1D("Bottom positron tracks - Bend plane residuals at target").fill(deltaX);
-					aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at target").fill(deltaY);
-					aida.histogram1D("Bottom positron tracks - z residuals at target").fill(deltaZ);
-				} else { 
-					aida.histogram1D("Bottom electron tracks - Bend plane residuals at target").fill(deltaX);
-					aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at target").fill(deltaY);
-					aida.histogram1D("Bottom electron tracks - z residuals at target").fill(deltaZ);
-				}
-			}
-			
-			aida.histogram1D("Bend plane residuals at target").fill(deltaX);
-			aida.histogram1D("Non-bend plane residuals at target").fill(deltaY);
-			aida.histogram1D("z residuals at target").fill(deltaZ);
-			aida.histogram2D("Bend plane residuals vs momentum at target").fill(p, deltaX);
-			aida.histogram2D("Non-bend plane residuals vs momentum at target").fill(p, deltaY);
-		}
-	}
-	
-	@Override
-	protected void endOfData(){
-		
-		IHistogram2D histogram = aida.histogram2D("Bend plane residuals vs momentum at scoring plane");
-		int binsX = histogram.xAxis().bins();
-		for(int binX = 0; binX < binsX; binX++){
-			PlotUtils.getYProjection(binX, histogram);
-		}
-		
-		histogram = aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane");
-		binsX = histogram.xAxis().bins();
-		for(int binX = 0; binX < binsX; binX++){
-			PlotUtils.getYProjection(binX, histogram);
-		}
-	
-		histogram = aida.histogram2D("Bend plane residuals vs momentum at target");
-		binsX = histogram.xAxis().bins();
-		for(int binX = 0; binX < binsX; binX++){
-			PlotUtils.getYProjection(binX, histogram);
-		}
-		
-		histogram = aida.histogram2D("Non-bend plane residuals vs momentum at target");
-		binsX = histogram.xAxis().bins();
-		for(int binX = 0; binX < binsX; binX++){
-			PlotUtils.getYProjection(binX, histogram);
-		}
-	}
-	
-	/**
-	 * Print a message if verbose has been enabled.
-	 *  
-	 * @param message : message to print.
-	 */
-	private void printVerbose(String message){
-		if(verbose)
-			System.out.println(this.getClass().getSimpleName() + ": " + message);
-	}
-	
+    AIDA aida = null;
+    List<IPlotter> plotters;
+
+    Hep3Vector bField = null;
+    
+    boolean verbose = false;
+    
+    // Collection Names
+    String matchedEcalScoringPlaneHitsCollectionName = "MatchedTrackerHitsEcal";
+    String trackToScoringPlaneHitRelationsName = "TrackToEcalScoringPlaneHitRelations";
+    String trackToMCParticleRelationsName = "TrackToMCParticleRelations";
+    
+    /**
+     * Enable/disable verbose mode
+     * 
+     * @param verbose : true to enable, false otherwise
+     */
+    public void setVerbose(boolean verbose){
+        this.verbose = verbose; 
+    }
+    
+    public void detectorChanged(Detector detector){
+        
+        // Get the magnetic field from the geometry
+        bField = detector.getFieldMap().getField(new BasicHep3Vector(0,0,0));
+        
+        //-----------------------//
+        //--- Setup all plots ---//
+        //-----------------------//
+        
+        // Setup AIDA
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+    
+        // Instantiate a list to hold the collection of plotters
+        plotters = new ArrayList<IPlotter>();
+        IPlotter plotter = null; 
+        
+        //--- Plots of scoring plane positions ---//
+        //----------------------------------------//
+        plotter = PlotUtils.setupPlotter("Positions of Scoring plane hits matched to tracks", 2, 2);
+        PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - x", 0, "x (mm)",
+                aida.histogram1D("Scoring plane hit position - x", 100, -400, 400));
+        PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - y", 1, "y (mm)",
+                aida.histogram1D("Scoring plane hit position - y", 100, -200, 200));
+        PlotUtils.setup1DRegion(plotter, "Scoring plane hit position - z", 2, "z (mm)",
+                aida.histogram1D("Scoring plane hit position - z", 100, 1000, 1500));
+        PlotUtils.setup2DRegion(plotter, "Scoring plane hit position - x-y", 3, "x (mm)", "y (mm)", 
+                aida.histogram2D("Scoring plane hit position - x-y", 100, -400, 400, 100, -200, 200));
+        plotters.add(plotter);  
+
+        //--- Plots of residuals at scoring plane ---//
+        //-------------------------------------------//
+        plotter = PlotUtils.setupPlotter("Residuals at scoring plane", 3, 3);
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at scoring plane", 0, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Top electron tracks - Bend plane residual at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at scoring plane", 0, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Top positron tracks - Bend plane residual at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at scoring plane", 1, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Bottom electron tracks - Bend plane residuals at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at scoring plane", 1, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Bottom positron tracks - Bend plane residuals at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Bend plane residuals at scoring plane", 2, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Bend plane residuals at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Bend plane residuals at scoring plane", 2, "x_{ep} - x_{sp} (mm)",
+                aida.histogram1D("Bend plane residuals at scoring plane", 60, -30, 30));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at scoring plane", 3,"y_{ep} - y_{sp} (mm)", 
+                aida.histogram1D("Top electron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at scoring plane", 3,"y_{ep} - y_{sp} (mm)", 
+                aida.histogram1D("Top positron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at scoring plane", 4,"y_{ep} - y_{sp} (mm)", 
+                aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at scoring plane", 4,"y_{ep} - y_{sp} (mm)", 
+                aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at scoring plane", 30, -15, 15));
+        PlotUtils.setup1DRegion(plotter, "Non-bend plane residuals at scoring plane", 5,"y_{ep} - y_{sp} (mm)", 
+                aida.histogram1D("Non-bend plane residuals at scoring plane", 30, -15, 15));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at scoring plane", 6, "z_{ep} - z_{sp} (mm)",
+                aida.histogram1D("Top electron tracks - z residuals at scoring plane", 10, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at scoring plane", 6, "z_{ep} - z_{sp} (mm)",
+                aida.histogram1D("Top positron tracks - z residuals at scoring plane", 10, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
+                aida.histogram1D("Bottom electron tracks - z residuals at scoring plane", 10, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
+                aida.histogram1D("Bottom positron tracks - z residuals at scoring plane", 10, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "z residuals at scoring plane", 7, "z_{ep} - z_{sp} (mm)",
+                aida.histogram1D("z residuals at scoring plane", 10, -5, 5));
+        plotters.add(plotter);  
+        
+        //--- Plots of residuals at target ---//
+        //------------------------------------//
+        plotter = PlotUtils.setupPlotter("Residuals at target", 3, 3);
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at target", 0, "x_{ep} - x_{t} (mm)",
+                aida.histogram1D("Top electron tracks - Bend plane residual at target", 40, -4, 4));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Bend plane residuals at target", 0, "x_{ep} - x_{t} (mm)",
+                aida.histogram1D("Top positron tracks - Bend plane residual at target", 40, -4, 4));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at target", 1, "x_{ep} - x_{t} (mm)",
+                aida.histogram1D("Bottom electron tracks - Bend plane residuals at target", 40, -4, 4));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Bend plane residuals at target", 1, "x_{ep} - x_{t} (mm)",
+                aida.histogram1D("Bottom positron tracks - Bend plane residuals at target", 40, -4, 4));
+        PlotUtils.setup1DRegion(plotter, "Bend plane residuals at target", 2, "x_{ep} - x_{t} (mm)",
+                aida.histogram1D("Bend plane residuals at target", 40, -4, 4));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at target", 3, "y_{ep} - y_{t} (mm)",
+                aida.histogram1D("Top electron tracks - Non-bend plane residuals at target", 20, -2, 2));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - Non-bend plane residuals at target", 3, "y_{ep} - y_{t} (mm)",
+                aida.histogram1D("Top positron tracks - Non-bend plane residuals at target", 20, -2, 2));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at target", 4, "y_{ep} - y_{t} (mm)",
+                aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at target", 20, -2, 2));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - Non-bend plane residuals at target", 4, "y_{ep} - y_{t} (mm)",
+                aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at target", 20, -2, 2));
+        PlotUtils.setup1DRegion(plotter, "Non-bend plane residuals at target", 5, "y_{ep} - y_{t} (mm)",
+                aida.histogram1D("Non-bend plane residuals at target", 20, -2, 2));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at target", 6, "z_{ep} - z_{t} (mm)",
+                aida.histogram1D("Top electron tracks - z residuals at target", 50, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Top tracks - z residuals at target", 6, "z_{ep} - z_{t} (mm)",
+                aida.histogram1D("Top positron tracks - z residuals at target", 50, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at target", 7, "z_{ep} - z_{t} (mm)",
+                aida.histogram1D("Bottom electron tracks - z residuals at target", 50, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "Bottom tracks - z residuals at target", 7, "z_{ep} - z_{t} (mm)",
+                aida.histogram1D("Bottom positron tracks - z residuals at target", 50, -5, 5));
+        PlotUtils.setup1DRegion(plotter, "z residuals at target", 8, "z_{ep} - z_{t} (mm)",
+                aida.histogram1D("z residuals at target", 50, -5, 5));
+        plotters.add(plotter);  
+        
+        //--- Plot of residuals at scoring plane vs momentum ---//
+        //------------------------------------------------------//
+        plotter = PlotUtils.setupPlotter("Residuals vs Momentum", 2, 2);
+        PlotUtils.setup2DRegion(plotter, "Bend plane residuals vs momentum at scoring plane", 0, 
+                "Momentum (GeV)", "x_{ep} - x_{sp} (mm)",
+                aida.histogram2D("Bend plane residuals vs momentum at scoring plane", 5, 0, 2.5, 60, -30, 30));
+        PlotUtils.setup2DRegion(plotter, "Non-bend plane residuals vs momentum at scoring plane", 1, 
+                "Momentum (GeV)", "y_{ep} - y_{sp} (mm)",
+                aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane", 5, 0, 2.5, 60, -30, 30));
+        PlotUtils.setup2DRegion(plotter, "Bend plane residuals vs momentum at target", 2, 
+                "Momentum (GeV)", "x_{ep} - x_{t} (mm)",
+                aida.histogram2D("Bend plane residuals vs momentum at target", 5, 0, 2.5, 60, -3, 3));
+        PlotUtils.setup2DRegion(plotter, "Non-bend plane residuals vs momentum at target", 3, 
+                "Momentum (GeV)", "y_{ep} - y_{t} (mm)",
+                aida.histogram2D("Non-bend plane residuals vs momentum at target", 5, 0, 2.5, 50, -2.5, 2.5));
+        plotters.add(plotter);
+        
+        for(IPlotter iPlotter : plotters){
+            iPlotter.show(); 
+        }
+        
+    }
+    
+    public void process(EventHeader event){
+    
+        // If the event doesn't contain an LCRelation between a track and its 
+        // corresponding ECal scoring plane hit, skip the event.
+        if(!event.hasCollection(LCRelation.class, trackToScoringPlaneHitRelationsName)) return;
+        
+        List<LCRelation> trackToScoringPlaneHitRelations = event.get(LCRelation.class, trackToScoringPlaneHitRelationsName);
+        
+        for(LCRelation trackToScoringPlaneHitRelation : trackToScoringPlaneHitRelations){
+        
+            // Get the track
+            Track track = (Track) trackToScoringPlaneHitRelation.getFrom();
+            
+            // Get the track momentum
+            double[] momentum = BaseTrackState.computeMomentum(track.getTrackStates().get(0), bField.y());
+            double p = Math.sqrt(momentum[0]*momentum[0] + momentum[1]*momentum[1] + momentum[2]*momentum[2]);
+            this.printVerbose("Track momentum: " + p);
+            
+            // Get the corresponding scoring plane hit
+            SimTrackerHit scoringPlaneHit = (SimTrackerHit) trackToScoringPlaneHitRelation.getTo();
+            Hep3Vector scoringPlaneHitPosition = scoringPlaneHit.getPositionVec();
+            this.printVerbose("Scoring plane hit position: " + scoringPlaneHitPosition.toString());
+            
+            // Fill the scoring plane position histograms
+            aida.histogram1D("Scoring plane hit position - x").fill(scoringPlaneHitPosition.x());
+            aida.histogram1D("Scoring plane hit position - y").fill(scoringPlaneHitPosition.y());
+            aida.histogram1D("Scoring plane hit position - z").fill(scoringPlaneHitPosition.z());
+            aida.histogram2D("Scoring plane hit position - x-y").fill(scoringPlaneHitPosition.x(), scoringPlaneHitPosition.y());
+        
+            // Extrapolate the track to the scoring plane position
+            Hep3Vector trackPositionAtScoringPlane = TrackUtils.extrapolateTrack(track, scoringPlaneHitPosition.z());
+            this.printVerbose("Extrapolated track position: " + trackPositionAtScoringPlane.toString());
+                
+            // Find the residual between the extrapolated track position and the scoring plane hit position
+            double deltaX = trackPositionAtScoringPlane.x() - scoringPlaneHitPosition.x();
+            double deltaY = trackPositionAtScoringPlane.y() - scoringPlaneHitPosition.y();
+            // This should be 0 but it serves as a sanity check.
+            double deltaZ = trackPositionAtScoringPlane.z() - scoringPlaneHitPosition.z();
+        
+            if(track.getTrackerHits().get(0).getPosition()[2] > 0){
+                if(track.getTrackStates().get(0).getOmega() > 0){
+                    aida.histogram1D("Top positron tracks - Bend plane residual at scoring plane").fill(deltaX);
+                    aida.histogram1D("Top positron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
+                    aida.histogram1D("Top positron tracks - z residuals at scoring plane").fill(deltaZ);    
+                } else { 
+                    aida.histogram1D("Top electron tracks - Bend plane residual at scoring plane").fill(deltaX);
+                    aida.histogram1D("Top electron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
+                    aida.histogram1D("Top electron tracks - z residuals at scoring plane").fill(deltaZ);    
+                }
+            } else { 
+                if(track.getTrackStates().get(0).getOmega() > 0){
+                    aida.histogram1D("Bottom positron tracks - Bend plane residuals at scoring plane").fill(deltaX);
+                    aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
+                    aida.histogram1D("Bottom positron tracks - z residuals at scoring plane").fill(deltaZ);
+                } else { 
+                    aida.histogram1D("Bottom electron tracks - Bend plane residuals at scoring plane").fill(deltaX);
+                    aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at scoring plane").fill(deltaY);
+                    aida.histogram1D("Bottom electron tracks - z residuals at scoring plane").fill(deltaZ);
+                }
+            }
+
+            aida.histogram1D("Bend plane residuals at scoring plane").fill(deltaX);
+            aida.histogram1D("Non-bend plane residuals at scoring plane").fill(deltaY);
+            aida.histogram1D("z residuals at target").fill(deltaZ);
+            aida.histogram2D("Bend plane residuals vs momentum at scoring plane").fill(p, deltaX);
+            aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane").fill(p, deltaY);
+        }
+        
+        if(!event.hasCollection(LCRelation.class, trackToMCParticleRelationsName)) return;
+        
+        List<LCRelation> trackToMCParticleRelations = event.get(LCRelation.class, trackToMCParticleRelationsName);
+        
+        for(LCRelation trackToMCParticleRelation : trackToMCParticleRelations){
+            
+            // Get the track
+            Track track = (Track) trackToMCParticleRelation.getFrom();
+            
+            // Get the track momentum
+            double[] momentum = BaseTrackState.computeMomentum(track.getTrackStates().get(0), bField.y());
+            double p = Math.sqrt(momentum[0]*momentum[0] + momentum[1]*momentum[1] + momentum[2]*momentum[2]);
+            this.printVerbose("Track momentum: " + p);
+
+            // Get the corresponding MC particle
+            MCParticle particle = (MCParticle) trackToMCParticleRelation.getTo();
+            
+            // Extrapolate the track to the origin
+            Hep3Vector trackPositionAtOrigin = TrackUtils.extrapolateTrack(track, particle.getOriginZ());
+            
+            // Find the residual between the extrapolated track and the position of the scoring plane at the origin
+            double deltaX = trackPositionAtOrigin.x() - particle.getOriginX();
+            double deltaY = trackPositionAtOrigin.y() - particle.getOriginY();
+            double deltaZ = trackPositionAtOrigin.z() - particle.getOriginZ();
+            
+            if(track.getTrackerHits().get(0).getPosition()[2] > 0){
+                if(track.getTrackStates().get(0).getOmega() > 0){
+                    aida.histogram1D("Top positron tracks - Bend plane residual at target").fill(deltaX);
+                    aida.histogram1D("Top positron tracks - Non-bend plane residuals at target").fill(deltaY);
+                    aida.histogram1D("Top positron tracks - z residuals at target").fill(deltaZ);
+                } else { 
+                    aida.histogram1D("Top electron tracks - Bend plane residual at target").fill(deltaX);
+                    aida.histogram1D("Top electron tracks - Non-bend plane residuals at target").fill(deltaY);
+                    aida.histogram1D("Top electron tracks - z residuals at target").fill(deltaZ);
+                }
+            } else { 
+                
+                if(track.getTrackStates().get(0).getOmega() > 0){
+                    aida.histogram1D("Bottom positron tracks - Bend plane residuals at target").fill(deltaX);
+                    aida.histogram1D("Bottom positron tracks - Non-bend plane residuals at target").fill(deltaY);
+                    aida.histogram1D("Bottom positron tracks - z residuals at target").fill(deltaZ);
+                } else { 
+                    aida.histogram1D("Bottom electron tracks - Bend plane residuals at target").fill(deltaX);
+                    aida.histogram1D("Bottom electron tracks - Non-bend plane residuals at target").fill(deltaY);
+                    aida.histogram1D("Bottom electron tracks - z residuals at target").fill(deltaZ);
+                }
+            }
+            
+            aida.histogram1D("Bend plane residuals at target").fill(deltaX);
+            aida.histogram1D("Non-bend plane residuals at target").fill(deltaY);
+            aida.histogram1D("z residuals at target").fill(deltaZ);
+            aida.histogram2D("Bend plane residuals vs momentum at target").fill(p, deltaX);
+            aida.histogram2D("Non-bend plane residuals vs momentum at target").fill(p, deltaY);
+        }
+    }
+    
+    @Override
+    protected void endOfData(){
+        
+        IHistogram2D histogram = aida.histogram2D("Bend plane residuals vs momentum at scoring plane");
+        int binsX = histogram.xAxis().bins();
+        for(int binX = 0; binX < binsX; binX++){
+            PlotUtils.getYProjection(binX, histogram);
+        }
+        
+        histogram = aida.histogram2D("Non-bend plane residuals vs momentum at scoring plane");
+        binsX = histogram.xAxis().bins();
+        for(int binX = 0; binX < binsX; binX++){
+            PlotUtils.getYProjection(binX, histogram);
+        }
+    
+        histogram = aida.histogram2D("Bend plane residuals vs momentum at target");
+        binsX = histogram.xAxis().bins();
+        for(int binX = 0; binX < binsX; binX++){
+            PlotUtils.getYProjection(binX, histogram);
+        }
+        
+        histogram = aida.histogram2D("Non-bend plane residuals vs momentum at target");
+        binsX = histogram.xAxis().bins();
+        for(int binX = 0; binX < binsX; binX++){
+            PlotUtils.getYProjection(binX, histogram);
+        }
+    }
+    
+    /**
+     * Print a message if verbose has been enabled.
+     *  
+     * @param message : message to print.
+     */
+    private void printVerbose(String message){
+        if(verbose)
+            System.out.println(this.getClass().getSimpleName() + ": " + message);
+    }
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/LheToStdhep.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/LheToStdhep.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/LheToStdhep.java	Wed Mar  9 11:43:24 2016
@@ -32,248 +32,248 @@
  * TODO: Make this converter more generic.
  */
 public class LheToStdhep {
-	
-	private static final int N_PARTICLE_INDEX = 0;
-	private static final int PDG_ID_INDEX = 1;
-	private static final int STATUS_INDEX = 2; 
-	private static final int FIRST_MOTHER_INDEX = 3; 
-	private static final int SECOND_MOTHER_INDEX = 4; 
-	private static final int FIRST_DAUGHTER_INDEX = 5; 
-	private static final int SECOND_DAUGHTER_INDEX = 6; 
-	
-	private static double sigmaX = 0.2;
-	private static double sigmaY = 0.02;
-	private static double sigmaZ = 0.0;
-	
-	private static double offsetX = 0;
-	private static double offsetY = 0;
-	private static double offsetZ = 0.03;
-	
-	static int eventNumber = 0; 
-	
-	
-	public static void main(String[] args) throws IOException{
-
-		String lheFileName = null; 
-		String stdhepFileName = "output.stdhep";
-		
-		// Instantiate te command line parser
-		CommandLineParser parser = new PosixParser(); 
-
-		// Create the Options
-		// TODO: Add ability to parse list of files.
-		// Allow a user to pass tag.gz files
-		Options options = new Options(); 
-		options.addOption("i", "input", true, "Input LHE file name");
-		options.addOption("o", "output", true, "Output Stdhep file name");
-		
-		try { 
-			// Parse the command line arguments
-			CommandLine line = parser.parse(options, args);
-			
-			// If the file is not specified, notify the user and exit the program
-			if(!line.hasOption("i")){
-				System.out.println("Please specify an LHE file to process");
-				System.exit(0);
-			}
-			lheFileName = line.getOptionValue("i");
-		
-			// Check if the user has specified the output file name and that the
-			// extension is stdhep.  If not, add the extension
-			if(line.hasOption("o")){
-				stdhepFileName = line.getOptionValue("o");
-			}
-		} catch(ParseException e){
-			System.out.println("Unexpected exception: " + e.getMessage());
-		}
-		
-		convertToStdhep(lheFileName, stdhepFileName);
-		
-	}
-
-	/**
-	 * 
-	 */
-	static private void convertToStdhep(String lheFileName, String stdhepFileName) throws IOException{
-		List<Element> events = readLhe(lheFileName);
-
-		StdhepWriter writer = new StdhepWriter(
-						   	stdhepFileName,
-						   	"Import Stdhep Events",
-						   	"Imported from LHE generated from MadGraph",
-						   	events.size()
-							);
-		writer.setCompatibilityMode(false);
-		
-		for(Element event : events){
-			writeEvent(event, writer);
-		}
-		writer.close();
-	}
-
-	/**
-	 * 
-	 */
-	private static List<Element> readLhe(String lheFileName){
-		
-		// Instantiate the SAX parser used to build the JDOM document
-		SAXBuilder builder = new SAXBuilder(); 
-		
-		// Open the lhe file
-		File lheFile = new File(lheFileName);
-			
-		// Parse the lhe file and build the JDOM document
-		Document document = null;
-		List<Element> eventNodes = null; 
-		try {
-			
-			document = (Document) builder.build(lheFile);
-			
-			// Get the root node
-			Element rootNode = document.getRootElement(); 
-			
-			// Get a list of all nodes of type event
-			eventNodes = rootNode.getChildren("event");
-		
-		} catch (JDOMException e) {
-			e.printStackTrace();
-			
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		
-		return eventNodes; 
-	}
-
-	/**
-	 * 
-	 */
-	private static void writeEvent(Element event, StdhepWriter writer) throws IOException{
-		
-		int numberOfParticles = 0; 
-		int particleIndex = 0;
-		int pdgID[] = null; 
-		int particleStatus[] = null;
-		int motherParticles[] = null; 
-		int daughterParticles[] = null; 
-		double particleMomentum[] = null;
-		double particleVertex[] = null; 
-		
-		Random generator = new Random(); 
-		
-		eventNumber++; 
-		
-		System.out.println("#================================================#\n#");
-		System.out.println("# Event: " + eventNumber);
-		
-		
-		// Get the text within the event element node.  An element node contains
-		// information describing the event and it's particles.  The PDG ID of
-		// a particle along with it's kinematics is listed on it's own line.
-		// In order to parse the information for each particle, the text is 
-		// split using the newline character as a delimiter.  
-		String[] eventData = event.getTextTrim().split("\n");	
-	 
-		for(int datumIndex = 0; datumIndex < eventData.length; datumIndex++){
-			
-			// Split a line by whitespace
-			String[] eventTokens = eventData[datumIndex].split("\\s+");
-		
-			if(datumIndex == 0){
-				
-				numberOfParticles = Integer.valueOf(eventTokens[N_PARTICLE_INDEX]);
-				System.out.println("# Number of particles: " + numberOfParticles + "\n#");
-				System.out.println("#================================================#");
-		
-				// Reset all arrays used to build the Stdhep event
-				particleIndex = 0; 
-				particleStatus = new int[numberOfParticles];
-				pdgID = new int[numberOfParticles];
-				motherParticles = new int[numberOfParticles*2];
-				daughterParticles = new int[numberOfParticles*2];
-				particleMomentum = new double[numberOfParticles*5];
-				particleVertex = new double[numberOfParticles*4];
-			
-				continue;
-			}
-	
-			// Get the PDG ID of the particle
-			pdgID[particleIndex] = Integer.valueOf(eventTokens[PDG_ID_INDEX]);
-			
-			
-			System.out.println(">>> PDG ID: " + pdgID[particleIndex]);
-			
-			// Get the status of the particle (initial state = -1, final state = 1, resonance = 2)
-			particleStatus[particleIndex] = Integer.valueOf(eventTokens[STATUS_INDEX]);
-			if(particleStatus[particleIndex] == -1) particleStatus[particleIndex] = 3; 
-			System.out.println(">>>> Particle Status: " + particleStatus[particleIndex]);
-			
-			 // Get the mothers of a particle.  If the particle is a trident electron, then assign it
-			 // a mother value of 10 so it's distinguishable from the beam electron.
-			if(pdgID[particleIndex] == 611){
-				motherParticles[particleIndex*2] = 10;
-				// If the PDG ID is equal to 611/-611 (trident electron) change it back to 11/-11. 
-				// Otherwise, SLIC won't do anything with them.
-				pdgID[particleIndex] = 11;
-			} else if(pdgID[particleIndex] == -611){
-				motherParticles[particleIndex*2] = 10;
-				pdgID[particleIndex] = -11; 
-			} else {
-				motherParticles[particleIndex*2] = Integer.valueOf(eventTokens[FIRST_MOTHER_INDEX]);
-			}
-	        motherParticles[particleIndex*2 + 1] = Integer.valueOf(eventTokens[SECOND_MOTHER_INDEX]);
-	        System.out.println(">>>> Mothers: 1) " + motherParticles[particleIndex*2] + " 2) " + motherParticles[particleIndex*2 + 1]);
-	        
-	        // Get the daughter particles
-	        daughterParticles[particleIndex*2] = Integer.valueOf(eventTokens[FIRST_DAUGHTER_INDEX]);
-	        daughterParticles[particleIndex*2 + 1] = Integer.valueOf(eventTokens[SECOND_DAUGHTER_INDEX]);
-	        System.out.println(">>>> Daughter: 1) " + daughterParticles[particleIndex*2] + " 2) " + daughterParticles[particleIndex*2 + 1]);
-	        
-	        // Get the particle momentum, its mass and energy
-	        particleMomentum[particleIndex*5] = Double.valueOf(eventTokens[7]);		// px
-	        particleMomentum[particleIndex*5 + 1] = Double.valueOf(eventTokens[8]);	// py   
-	        particleMomentum[particleIndex*5 + 2] = Double.valueOf(eventTokens[9]); // pz
-	        particleMomentum[particleIndex*5 + 3] = Double.valueOf(eventTokens[10]); // Particle Energy
-	        particleMomentum[particleIndex*5 + 4] = Double.valueOf(eventTokens[11]); // Particle Mass
-	        
-	        // Rotate the particle by 30 mrad around the beam axis
-	        Hep3Vector rotatedMomentum = 
-	        		rotateToDetector(particleMomentum[particleIndex*5], 
-	        				particleMomentum[particleIndex*5+1], 
-	        				particleMomentum[particleIndex*5+1]);
-	        
-	        particleMomentum[particleIndex*5] = rotatedMomentum.x();
-	        particleMomentum[particleIndex*5 + 1] = rotatedMomentum.y();
-	        particleMomentum[particleIndex*5 + 2] = rotatedMomentum.z();
-
-	        // Set the origin of the particle
-	        Hep3Vector rotatedVertex = rotateToDetector(sigmaX*generator.nextGaussian() + offsetX, 
-	        		sigmaY*generator.nextGaussian() + offsetY, 
-	        		sigmaZ*generator.nextGaussian() + offsetZ);
-	        particleVertex[particleIndex*4] = rotatedVertex.x();
-	        particleVertex[particleIndex*4+1] = rotatedVertex.y();
-	        particleVertex[particleIndex*4+2] = rotatedVertex.z();
-	        particleVertex[particleIndex*4+3] = 0; 
-	        
-	        // Increment the particle number
-	        particleIndex++;
-	        
-			System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-		}
-		
-		// Create the Stdhep event and write it 
-	    StdhepEvent stdhepEvent = new StdhepEvent(eventNumber, numberOfParticles, particleStatus, 
-	    		pdgID, motherParticles, daughterParticles, particleMomentum, particleVertex);
-	    writer.writeRecord(stdhepEvent);
-	}
-
-	/**
-	 * 
-	 */
-	private static Hep3Vector rotateToDetector(double x, double y, double z){
-		IRotation3D rotation = new RotationGeant(0.0, 0.03, 0.0);
-		Hep3Vector vector = new BasicHep3Vector(x, y, z);
-		return rotation.rotated(vector);
-	}
+    
+    private static final int N_PARTICLE_INDEX = 0;
+    private static final int PDG_ID_INDEX = 1;
+    private static final int STATUS_INDEX = 2; 
+    private static final int FIRST_MOTHER_INDEX = 3; 
+    private static final int SECOND_MOTHER_INDEX = 4; 
+    private static final int FIRST_DAUGHTER_INDEX = 5; 
+    private static final int SECOND_DAUGHTER_INDEX = 6; 
+    
+    private static double sigmaX = 0.2;
+    private static double sigmaY = 0.02;
+    private static double sigmaZ = 0.0;
+    
+    private static double offsetX = 0;
+    private static double offsetY = 0;
+    private static double offsetZ = 0.03;
+    
+    static int eventNumber = 0; 
+    
+    
+    public static void main(String[] args) throws IOException{
+
+        String lheFileName = null; 
+        String stdhepFileName = "output.stdhep";
+        
+        // Instantiate te command line parser
+        CommandLineParser parser = new PosixParser(); 
+
+        // Create the Options
+        // TODO: Add ability to parse list of files.
+        // Allow a user to pass tag.gz files
+        Options options = new Options(); 
+        options.addOption("i", "input", true, "Input LHE file name");
+        options.addOption("o", "output", true, "Output Stdhep file name");
+        
+        try { 
+            // Parse the command line arguments
+            CommandLine line = parser.parse(options, args);
+            
+            // If the file is not specified, notify the user and exit the program
+            if(!line.hasOption("i")){
+                System.out.println("Please specify an LHE file to process");
+                System.exit(0);
+            }
+            lheFileName = line.getOptionValue("i");
+        
+            // Check if the user has specified the output file name and that the
+            // extension is stdhep.  If not, add the extension
+            if(line.hasOption("o")){
+                stdhepFileName = line.getOptionValue("o");
+            }
+        } catch(ParseException e){
+            System.out.println("Unexpected exception: " + e.getMessage());
+        }
+        
+        convertToStdhep(lheFileName, stdhepFileName);
+        
+    }
+
+    /**
+     * 
+     */
+    static private void convertToStdhep(String lheFileName, String stdhepFileName) throws IOException{
+        List<Element> events = readLhe(lheFileName);
+
+        StdhepWriter writer = new StdhepWriter(
+                            stdhepFileName,
+                            "Import Stdhep Events",
+                            "Imported from LHE generated from MadGraph",
+                            events.size()
+                            );
+        writer.setCompatibilityMode(false);
+        
+        for(Element event : events){
+            writeEvent(event, writer);
+        }
+        writer.close();
+    }
+
+    /**
+     * 
+     */
+    private static List<Element> readLhe(String lheFileName){
+        
+        // Instantiate the SAX parser used to build the JDOM document
+        SAXBuilder builder = new SAXBuilder(); 
+        
+        // Open the lhe file
+        File lheFile = new File(lheFileName);
+            
+        // Parse the lhe file and build the JDOM document
+        Document document = null;
+        List<Element> eventNodes = null; 
+        try {
+            
+            document = (Document) builder.build(lheFile);
+            
+            // Get the root node
+            Element rootNode = document.getRootElement(); 
+            
+            // Get a list of all nodes of type event
+            eventNodes = rootNode.getChildren("event");
+        
+        } catch (JDOMException e) {
+            e.printStackTrace();
+            
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        
+        return eventNodes; 
+    }
+
+    /**
+     * 
+     */
+    private static void writeEvent(Element event, StdhepWriter writer) throws IOException{
+        
+        int numberOfParticles = 0; 
+        int particleIndex = 0;
+        int pdgID[] = null; 
+        int particleStatus[] = null;
+        int motherParticles[] = null; 
+        int daughterParticles[] = null; 
+        double particleMomentum[] = null;
+        double particleVertex[] = null; 
+        
+        Random generator = new Random(); 
+        
+        eventNumber++; 
+        
+        System.out.println("#================================================#\n#");
+        System.out.println("# Event: " + eventNumber);
+        
+        
+        // Get the text within the event element node.  An element node contains
+        // information describing the event and it's particles.  The PDG ID of
+        // a particle along with it's kinematics is listed on it's own line.
+        // In order to parse the information for each particle, the text is 
+        // split using the newline character as a delimiter.  
+        String[] eventData = event.getTextTrim().split("\n");   
+     
+        for(int datumIndex = 0; datumIndex < eventData.length; datumIndex++){
+            
+            // Split a line by whitespace
+            String[] eventTokens = eventData[datumIndex].split("\\s+");
+        
+            if(datumIndex == 0){
+                
+                numberOfParticles = Integer.valueOf(eventTokens[N_PARTICLE_INDEX]);
+                System.out.println("# Number of particles: " + numberOfParticles + "\n#");
+                System.out.println("#================================================#");
+        
+                // Reset all arrays used to build the Stdhep event
+                particleIndex = 0; 
+                particleStatus = new int[numberOfParticles];
+                pdgID = new int[numberOfParticles];
+                motherParticles = new int[numberOfParticles*2];
+                daughterParticles = new int[numberOfParticles*2];
+                particleMomentum = new double[numberOfParticles*5];
+                particleVertex = new double[numberOfParticles*4];
+            
+                continue;
+            }
+    
+            // Get the PDG ID of the particle
+            pdgID[particleIndex] = Integer.valueOf(eventTokens[PDG_ID_INDEX]);
+            
+            
+            System.out.println(">>> PDG ID: " + pdgID[particleIndex]);
+            
+            // Get the status of the particle (initial state = -1, final state = 1, resonance = 2)
+            particleStatus[particleIndex] = Integer.valueOf(eventTokens[STATUS_INDEX]);
+            if(particleStatus[particleIndex] == -1) particleStatus[particleIndex] = 3; 
+            System.out.println(">>>> Particle Status: " + particleStatus[particleIndex]);
+            
+             // Get the mothers of a particle.  If the particle is a trident electron, then assign it
+             // a mother value of 10 so it's distinguishable from the beam electron.
+            if(pdgID[particleIndex] == 611){
+                motherParticles[particleIndex*2] = 10;
+                // If the PDG ID is equal to 611/-611 (trident electron) change it back to 11/-11. 
+                // Otherwise, SLIC won't do anything with them.
+                pdgID[particleIndex] = 11;
+            } else if(pdgID[particleIndex] == -611){
+                motherParticles[particleIndex*2] = 10;
+                pdgID[particleIndex] = -11; 
+            } else {
+                motherParticles[particleIndex*2] = Integer.valueOf(eventTokens[FIRST_MOTHER_INDEX]);
+            }
+            motherParticles[particleIndex*2 + 1] = Integer.valueOf(eventTokens[SECOND_MOTHER_INDEX]);
+            System.out.println(">>>> Mothers: 1) " + motherParticles[particleIndex*2] + " 2) " + motherParticles[particleIndex*2 + 1]);
+            
+            // Get the daughter particles
+            daughterParticles[particleIndex*2] = Integer.valueOf(eventTokens[FIRST_DAUGHTER_INDEX]);
+            daughterParticles[particleIndex*2 + 1] = Integer.valueOf(eventTokens[SECOND_DAUGHTER_INDEX]);
+            System.out.println(">>>> Daughter: 1) " + daughterParticles[particleIndex*2] + " 2) " + daughterParticles[particleIndex*2 + 1]);
+            
+            // Get the particle momentum, its mass and energy
+            particleMomentum[particleIndex*5] = Double.valueOf(eventTokens[7]);     // px
+            particleMomentum[particleIndex*5 + 1] = Double.valueOf(eventTokens[8]); // py   
+            particleMomentum[particleIndex*5 + 2] = Double.valueOf(eventTokens[9]); // pz
+            particleMomentum[particleIndex*5 + 3] = Double.valueOf(eventTokens[10]); // Particle Energy
+            particleMomentum[particleIndex*5 + 4] = Double.valueOf(eventTokens[11]); // Particle Mass
+            
+            // Rotate the particle by 30 mrad around the beam axis
+            Hep3Vector rotatedMomentum = 
+                    rotateToDetector(particleMomentum[particleIndex*5], 
+                            particleMomentum[particleIndex*5+1], 
+                            particleMomentum[particleIndex*5+1]);
+            
+            particleMomentum[particleIndex*5] = rotatedMomentum.x();
+            particleMomentum[particleIndex*5 + 1] = rotatedMomentum.y();
+            particleMomentum[particleIndex*5 + 2] = rotatedMomentum.z();
+
+            // Set the origin of the particle
+            Hep3Vector rotatedVertex = rotateToDetector(sigmaX*generator.nextGaussian() + offsetX, 
+                    sigmaY*generator.nextGaussian() + offsetY, 
+                    sigmaZ*generator.nextGaussian() + offsetZ);
+            particleVertex[particleIndex*4] = rotatedVertex.x();
+            particleVertex[particleIndex*4+1] = rotatedVertex.y();
+            particleVertex[particleIndex*4+2] = rotatedVertex.z();
+            particleVertex[particleIndex*4+3] = 0; 
+            
+            // Increment the particle number
+            particleIndex++;
+            
+            System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+        }
+        
+        // Create the Stdhep event and write it 
+        StdhepEvent stdhepEvent = new StdhepEvent(eventNumber, numberOfParticles, particleStatus, 
+                pdgID, motherParticles, daughterParticles, particleMomentum, particleVertex);
+        writer.writeRecord(stdhepEvent);
+    }
+
+    /**
+     * 
+     */
+    private static Hep3Vector rotateToDetector(double x, double y, double z){
+        IRotation3D rotation = new RotationGeant(0.0, 0.03, 0.0);
+        Hep3Vector vector = new BasicHep3Vector(x, y, z);
+        return rotation.rotated(vector);
+    }
 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/PlotUtils.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/PlotUtils.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/PlotUtils.java	Wed Mar  9 11:43:24 2016
@@ -20,71 +20,71 @@
  */
 public class PlotUtils {
 
-	// Default ctor
-	public PlotUtils(){}	
+    // Default ctor
+    public PlotUtils(){}    
 
-	public static IPlotter setupPlotter(String title, int regionX, int regionY){
-	    IPlotter plotter = AIDA.defaultInstance().analysisFactory().createPlotterFactory().create(title);
-	    plotter.setTitle(title);
-	    
-	    if(regionX < 0 || regionY < 0) throw new RuntimeException("Region dimensions need to be greater than 0!");
-	    else if(regionX != 0 || regionY != 0) plotter.createRegions(regionX, regionY);
-	    
-	    plotter.style().statisticsBoxStyle().setVisible(false);
-	    plotter.style().dataStyle().errorBarStyle().setVisible(false);
-	    plotter.setParameter("plotterWidth", "800");
-	    plotter.setParameter("plotterHeight", "800");
-	    
-	    return plotter;
-	    
-	}
+    public static IPlotter setupPlotter(String title, int regionX, int regionY){
+        IPlotter plotter = AIDA.defaultInstance().analysisFactory().createPlotterFactory().create(title);
+        plotter.setTitle(title);
+        
+        if(regionX < 0 || regionY < 0) throw new RuntimeException("Region dimensions need to be greater than 0!");
+        else if(regionX != 0 || regionY != 0) plotter.createRegions(regionX, regionY);
+        
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.setParameter("plotterWidth", "800");
+        plotter.setParameter("plotterHeight", "800");
+        
+        return plotter;
+        
+    }
     
     public static void setup2DRegion(IPlotter plotter, String title, int region, String xTitle, String yTitle, IHistogram2D histo){
-    	
-    	// Check if the specified region is valid
-    	if(region > plotter.numberOfRegions()) 
-    		throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
-    	
-		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
-		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
-		plotter.region(region).style().yAxisStyle().setLabel(yTitle);
-		plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
-		plotter.region(region).style().xAxisStyle().setVisible(true);
-		plotter.region(region).style().yAxisStyle().setVisible(true);
-		plotter.region(region).style().setParameter("hist2DStyle", "colorMap");
-    	plotter.region(region).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-    	
-    	if(histo != null) plotter.region(region).plot(histo);
+        
+        // Check if the specified region is valid
+        if(region > plotter.numberOfRegions()) 
+            throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
+        
+        plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+        plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
+        plotter.region(region).style().yAxisStyle().setLabel(yTitle);
+        plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
+        plotter.region(region).style().xAxisStyle().setVisible(true);
+        plotter.region(region).style().yAxisStyle().setVisible(true);
+        plotter.region(region).style().setParameter("hist2DStyle", "colorMap");
+        plotter.region(region).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        
+        if(histo != null) plotter.region(region).plot(histo);
     }
    
     public static void setup2DRegion(IPlotter plotter, String title, int region, String xTitle, String yTitle, ICloud2D cloud, IPlotterStyle style){
-    	
-    	// Check if the specified region is valid
-    	if(region > plotter.numberOfRegions()) 
-    		throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
-    	
-		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
-		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
-		String[] pars = plotter.region(region).style().xAxisStyle().availableParameters();
-		plotter.region(region).style().yAxisStyle().setLabel(yTitle);
-		plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
-		plotter.region(region).style().xAxisStyle().setVisible(true);
-		plotter.region(region).style().yAxisStyle().setVisible(true);
-		plotter.region(region).style().setParameter("showAsScatterPlot", "true");
-    	
-    	if(cloud != null) plotter.region(region).plot(cloud, style);
+        
+        // Check if the specified region is valid
+        if(region > plotter.numberOfRegions()) 
+            throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
+        
+        plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+        plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
+        String[] pars = plotter.region(region).style().xAxisStyle().availableParameters();
+        plotter.region(region).style().yAxisStyle().setLabel(yTitle);
+        plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
+        plotter.region(region).style().xAxisStyle().setVisible(true);
+        plotter.region(region).style().yAxisStyle().setVisible(true);
+        plotter.region(region).style().setParameter("showAsScatterPlot", "true");
+        
+        if(cloud != null) plotter.region(region).plot(cloud, style);
     }
     
     
     public static void setup1DRegion(IPlotter plotter, String title, int region, String xTitle, IHistogram1D histo){
-    	
-		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
-		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
-		plotter.region(region).style().xAxisStyle().setVisible(true);
-		plotter.region(region).style().dataStyle().fillStyle().setVisible(false);
-		plotter.region(region).style().dataStyle().lineStyle().setThickness(3);
-		
-		if(histo != null) plotter.region(region).plot(histo);
+        
+        plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+        plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
+        plotter.region(region).style().xAxisStyle().setVisible(true);
+        plotter.region(region).style().dataStyle().fillStyle().setVisible(false);
+        plotter.region(region).style().dataStyle().lineStyle().setThickness(3);
+        
+        if(histo != null) plotter.region(region).plot(histo);
     }
     
     /**
@@ -98,7 +98,7 @@
         int ix = (layer - 1) / 2;
         int iy = 0;
         if (!((HpsSiSensor) sensor).isTopLayer()){ 
-        	iy += 2;
+            iy += 2;
         }
         if (layer % 2 == 0) {
             iy += 1;
@@ -108,35 +108,35 @@
     }
    
     public static IHistogram1D getYProjection(int binX, IHistogram2D histogram){
-    	int binsY = histogram.yAxis().bins();
-    	double yMin = histogram.yAxis().lowerEdge();
-    	double yMax = histogram.yAxis().upperEdge(); 
-    	
-    	IHistogram1D projection 
-    		= AIDA.defaultInstance().histogram1D(histogram.title() + "_" + binX, binsY, yMin, yMax);
-    	projection.reset();
-    	
-    	double dataY = 0; 
-    	for(int binY = 0; binY < binsY; binY++){
-    		dataY = histogram.binEntries(binX, binY);
-    		projection.fill(yMin, dataY);
-    		yMin++;
-    	}
-    	
-    	return projection; 
+        int binsY = histogram.yAxis().bins();
+        double yMin = histogram.yAxis().lowerEdge();
+        double yMax = histogram.yAxis().upperEdge(); 
+        
+        IHistogram1D projection 
+            = AIDA.defaultInstance().histogram1D(histogram.title() + "_" + binX, binsY, yMin, yMax);
+        projection.reset();
+        
+        double dataY = 0; 
+        for(int binY = 0; binY < binsY; binY++){
+            dataY = histogram.binEntries(binX, binY);
+            projection.fill(yMin, dataY);
+            yMin++;
+        }
+        
+        return projection; 
     }
     
     public static double[] fitToGuassian(IHistogram1D histogram){
-    	
-    	double[] fitParameters = {0, 0};
-    	IFitter fitter = AIDA.defaultInstance().analysisFactory().createFitFactory().createFitter();
-    	IFitResult fitResult = fitter.fit(histogram, "g");
-    	int meanIndex  = fitResult.fittedFunction().indexOfParameter("mean");
-    	fitParameters[0] = fitResult.fittedParameters()[meanIndex];
+        
+        double[] fitParameters = {0, 0};
+        IFitter fitter = AIDA.defaultInstance().analysisFactory().createFitFactory().createFitter();
+        IFitResult fitResult = fitter.fit(histogram, "g");
+        int meanIndex  = fitResult.fittedFunction().indexOfParameter("mean");
+        fitParameters[0] = fitResult.fittedParameters()[meanIndex];
 
-    	int sigmaIndex  = fitResult.fittedFunction().indexOfParameter("sigma");
-    	fitParameters[1] = fitResult.fittedParameters()[sigmaIndex];
-    	
-		return fitParameters;
+        int sigmaIndex  = fitResult.fittedFunction().indexOfParameter("sigma");
+        fitParameters[1] = fitResult.fittedParameters()[sigmaIndex];
+        
+        return fitParameters;
     }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/ReconstructedParticleChecker.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/ReconstructedParticleChecker.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/ReconstructedParticleChecker.java	Wed Mar  9 11:43:24 2016
@@ -29,92 +29,92 @@
  *
  */
 public class ReconstructedParticleChecker extends Driver {
-	
-	private AIDA aida; 
-	private List<IPlotter> plotters = new ArrayList<IPlotter>(); 
+    
+    private AIDA aida; 
+    private List<IPlotter> plotters = new ArrayList<IPlotter>(); 
 
-	IHistogram1D xPositionResidual;
-	IHistogram1D yPositionResidual;
-	IHistogram1D zPositionResidual;
-	IHistogram1D r;
-	
-	// Collection Names
-	private String finalStateParticlesCollectionName = "FinalStateParticles";
-	
-	boolean debug = true; 
-	int plotterIndex = 0; 
-	
-	public ReconstructedParticleChecker(){} 
-	
-	protected void detectorChanged(Detector detector){
-		super.detectorChanged(detector);
-		
-		// Setup AIDA
-		aida = AIDA.defaultInstance(); 
-		aida.tree().cd("/");
-		
-		plotters.add(PlotUtils.setupPlotter("Track-Cluster Position Residual", 2, 2));
-		xPositionResidual = aida.histogram1D("x Residual", 100, -100, 100);
-		yPositionResidual = aida.histogram1D("y Residual", 100, -100, 100);
-		zPositionResidual = aida.histogram1D("z Residual", 100, -100, 100);
-		r = aida.histogram1D("r", 100, -100, 100);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "x Residual", 0, "delta x [mm]", xPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "y Residual", 1, "delta y [mm]", yPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "z Residual", 2, "delta z [mm]", zPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "r", 3, "r [mm]", r);
-		
-		
-		for(IPlotter plotter : plotters){
-			plotter.show(); 
-		}
-	}
-	
-	public void process(EventHeader event){
-		
-		// If the event doesn't contain any final state reconstructed 
-		// particles, skip the event 
-		if(!event.hasCollection(ReconstructedParticle.class, finalStateParticlesCollectionName)){
-			this.printDebug("Event does not contain ReconstructedParticles");
-			return;
-		}
-		
-		// Get the collections of reconstructed final state particles from the
-		// event
-		List<ReconstructedParticle> finalStateParticles 
-			= event.get(ReconstructedParticle.class, finalStateParticlesCollectionName); 
-				
-	
-		// Loop over all of the reconstructed particles in the event
-		for(ReconstructedParticle finalStateParticle : finalStateParticles){
-			
-			// Get the list of clusters from the event
-			List<Cluster> ecalClusters = finalStateParticle.getClusters(); 
-				this.printDebug("Number of Ecal clusters: " + ecalClusters.size()); 
-			if(ecalClusters.isEmpty()){
-				this.printDebug("Number of Ecal clusters: " + ecalClusters.size()); 
-				this.printDebug("List of Ecal cluster is empty ... skipping");
-				continue; 
-			}
-			
-			// Get the list of tracks from the event
-			List<Track> tracks = finalStateParticle.getTracks(); 
-			if(tracks.isEmpty()){
-				this.printDebug("List of tracks is empty ... skipping");
-				continue; 
-			}
-		
-			Hep3Vector ecalPosition = new BasicHep3Vector(ecalClusters.get(0).getPosition()); 
-			Hep3Vector trackPositionAtEcal = TrackUtils.extrapolateTrack(tracks.get(0),ecalPosition.z()); 
-			xPositionResidual.fill(trackPositionAtEcal.x() - ecalPosition.x());
-			yPositionResidual.fill(trackPositionAtEcal.y() - ecalPosition.y());
-			zPositionResidual.fill(trackPositionAtEcal.z() - ecalPosition.z());
-			r.fill(VecOp.sub(trackPositionAtEcal, ecalPosition).magnitude());
-		}
-		
-	}
-	
-	private void printDebug(String debugMessage){
-		if(debug)
-			System.out.println(this.getClass().getSimpleName() + ": " + debugMessage); 
-	}
+    IHistogram1D xPositionResidual;
+    IHistogram1D yPositionResidual;
+    IHistogram1D zPositionResidual;
+    IHistogram1D r;
+    
+    // Collection Names
+    private String finalStateParticlesCollectionName = "FinalStateParticles";
+    
+    boolean debug = true; 
+    int plotterIndex = 0; 
+    
+    public ReconstructedParticleChecker(){} 
+    
+    protected void detectorChanged(Detector detector){
+        super.detectorChanged(detector);
+        
+        // Setup AIDA
+        aida = AIDA.defaultInstance(); 
+        aida.tree().cd("/");
+        
+        plotters.add(PlotUtils.setupPlotter("Track-Cluster Position Residual", 2, 2));
+        xPositionResidual = aida.histogram1D("x Residual", 100, -100, 100);
+        yPositionResidual = aida.histogram1D("y Residual", 100, -100, 100);
+        zPositionResidual = aida.histogram1D("z Residual", 100, -100, 100);
+        r = aida.histogram1D("r", 100, -100, 100);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "x Residual", 0, "delta x [mm]", xPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "y Residual", 1, "delta y [mm]", yPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "z Residual", 2, "delta z [mm]", zPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "r", 3, "r [mm]", r);
+        
+        
+        for(IPlotter plotter : plotters){
+            plotter.show(); 
+        }
+    }
+    
+    public void process(EventHeader event){
+        
+        // If the event doesn't contain any final state reconstructed 
+        // particles, skip the event 
+        if(!event.hasCollection(ReconstructedParticle.class, finalStateParticlesCollectionName)){
+            this.printDebug("Event does not contain ReconstructedParticles");
+            return;
+        }
+        
+        // Get the collections of reconstructed final state particles from the
+        // event
+        List<ReconstructedParticle> finalStateParticles 
+            = event.get(ReconstructedParticle.class, finalStateParticlesCollectionName); 
+                
+    
+        // Loop over all of the reconstructed particles in the event
+        for(ReconstructedParticle finalStateParticle : finalStateParticles){
+            
+            // Get the list of clusters from the event
+            List<Cluster> ecalClusters = finalStateParticle.getClusters(); 
+                this.printDebug("Number of Ecal clusters: " + ecalClusters.size()); 
+            if(ecalClusters.isEmpty()){
+                this.printDebug("Number of Ecal clusters: " + ecalClusters.size()); 
+                this.printDebug("List of Ecal cluster is empty ... skipping");
+                continue; 
+            }
+            
+            // Get the list of tracks from the event
+            List<Track> tracks = finalStateParticle.getTracks(); 
+            if(tracks.isEmpty()){
+                this.printDebug("List of tracks is empty ... skipping");
+                continue; 
+            }
+        
+            Hep3Vector ecalPosition = new BasicHep3Vector(ecalClusters.get(0).getPosition()); 
+            Hep3Vector trackPositionAtEcal = TrackUtils.extrapolateTrack(tracks.get(0),ecalPosition.z()); 
+            xPositionResidual.fill(trackPositionAtEcal.x() - ecalPosition.x());
+            yPositionResidual.fill(trackPositionAtEcal.y() - ecalPosition.y());
+            zPositionResidual.fill(trackPositionAtEcal.z() - ecalPosition.z());
+            r.fill(VecOp.sub(trackPositionAtEcal, ecalPosition).magnitude());
+        }
+        
+    }
+    
+    private void printDebug(String debugMessage){
+        if(debug)
+            System.out.println(this.getClass().getSimpleName() + ": " + debugMessage); 
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SharedHitAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SharedHitAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SharedHitAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -98,14 +98,14 @@
     }
     
     
-	protected void detectorChanged(Detector detector){
-
-	    for (int layer = 1; layer <= 6; layer++) { 
-	        
-	        topLayerToStereoHit.put(layer, new ArrayList<TrackerHit>());
-	        bottomLayerToStereoHit.put(layer, new ArrayList<TrackerHit>());
-	    }
-	    
+    protected void detectorChanged(Detector detector){
+
+        for (int layer = 1; layer <= 6; layer++) { 
+            
+            topLayerToStereoHit.put(layer, new ArrayList<TrackerHit>());
+            bottomLayerToStereoHit.put(layer, new ArrayList<TrackerHit>());
+        }
+        
         tree = IAnalysisFactory.create().createTreeFactory().create();
         histogramFactory = IAnalysisFactory.create().createHistogramFactory(tree);
         
@@ -159,18 +159,18 @@
         plotters.get("Track Parameters").region(4).plot(trackPlots.get("tan_lambda"), this.createStyle(1, "", ""));
         plotters.get("Track Parameters").region(4).plot(trackPlots.get("tan_lambda - shared strip hit"),  this.createStyle(2, "", ""));
         plotters.get("Track Parameters").region(4).plot(trackPlots.get("tan_lambda - l1 Isolation"),  this.createStyle(3, "", ""));
-	
-		for (IPlotter plotter : plotters.values()) { 
-			plotter.show();
-		}
-	}
-	
-	@SuppressWarnings({ "unchecked", "rawtypes" })
+    
+        for (IPlotter plotter : plotters.values()) { 
+            plotter.show();
+        }
+    }
+    
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public void process(EventHeader event){
 
         // If the event doesn't have any tracks, skip it    
-		if(!event.hasCollection(Track.class, trackCollectionName)) return;
-    	
+        if(!event.hasCollection(Track.class, trackCollectionName)) return;
+        
         // Get the collection of tracks from the event
         List<Track> tracks = event.get(Track.class, trackCollectionName);
         
@@ -198,13 +198,13 @@
         this.mapStereoHits(stereoHits);
         
         // Loop over all of the tracks in the event
-    	for(Track track : tracks){
-    	
-    	    boolean sharedHitTrack = false;
+        for(Track track : tracks){
+        
+            boolean sharedHitTrack = false;
            boolean l1Isolation = true;
-    	    
-    	    // Fill the track parameter plots
-    	    
+            
+            // Fill the track parameter plots
+            
             // Loop through all of the stereo hits associated with a track
             for (TrackerHit rotatedStereoHit : track.getTrackerHits()) { 
                
@@ -277,15 +277,15 @@
                 trackPlots.get("tan_lambda - l1 Isolation").fill(TrackUtils.getTanLambda(track));
                 trackPlots.get("chi2 - l1 Isolation").fill(track.getChi2());
             }
-    	}
-	}
-	
+        }
+    }
+    
     private void mapStereoHits(List<TrackerHit> stereoHits) { 
        
-	    for (int layer = 1; layer <= 6; layer++) { 
-	        topLayerToStereoHit.get(layer).clear();
-	        bottomLayerToStereoHit.get(layer).clear();;
-	    }
+        for (int layer = 1; layer <= 6; layer++) { 
+            topLayerToStereoHit.get(layer).clear();
+            bottomLayerToStereoHit.get(layer).clear();;
+        }
         
         for (TrackerHit stereoHit : stereoHits) {
             HpsSiSensor sensor = (HpsSiSensor) ((RawTrackerHit) stereoHit.getRawHits().get(0)).getDetectorElement();

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtClusterAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtClusterAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtClusterAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -50,28 +50,28 @@
     // Plotting
     ITree tree; 
     IHistogramFactory histogramFactory; 
-	IPlotterFactory plotterFactory = IAnalysisFactory.create().createPlotterFactory();
-	protected Map<String, IPlotter> plotters = new HashMap<String, IPlotter>(); 
-	
-	// All clusters
-	private Map<String, IHistogram1D> clusterChargePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> singleHitClusterChargePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> multHitClusterChargePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> signalToNoisePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> singleHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> multHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> clusterSizePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> clusterTimePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram2D> clusterChargeVsTimePlots = new HashMap<String, IHistogram2D>();
-
-	// Clusters on track
-	private Map<String, IHistogram1D> trackClusterChargePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> trackHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> trackClusterTimePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram2D> trackClusterChargeVsMomentum = new HashMap<String, IHistogram2D>();
-	private Map<String, IHistogram2D> trackClusterChargeVsCosTheta = new HashMap<String, IHistogram2D>();
-	private Map<String, IHistogram2D> trackClusterChargeVsSinPhi = new HashMap<String, IHistogram2D>();
-	
+    IPlotterFactory plotterFactory = IAnalysisFactory.create().createPlotterFactory();
+    protected Map<String, IPlotter> plotters = new HashMap<String, IPlotter>(); 
+    
+    // All clusters
+    private Map<String, IHistogram1D> clusterChargePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> singleHitClusterChargePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> multHitClusterChargePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> signalToNoisePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> singleHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> multHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> clusterSizePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> clusterTimePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram2D> clusterChargeVsTimePlots = new HashMap<String, IHistogram2D>();
+
+    // Clusters on track
+    private Map<String, IHistogram1D> trackClusterChargePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> trackHitSignalToNoisePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> trackClusterTimePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram2D> trackClusterChargeVsMomentum = new HashMap<String, IHistogram2D>();
+    private Map<String, IHistogram2D> trackClusterChargeVsCosTheta = new HashMap<String, IHistogram2D>();
+    private Map<String, IHistogram2D> trackClusterChargeVsSinPhi = new HashMap<String, IHistogram2D>();
+    
     // Detector name
     private static final String SUBDETECTOR_NAME = "Tracker";
     
@@ -92,29 +92,29 @@
     
     private int computePlotterRegion(HpsSiSensor sensor) {
 
-		if (sensor.getLayerNumber() < 7) {
-			if (sensor.isTopLayer()) {
-				return 6*(sensor.getLayerNumber() - 1); 
-			} else { 
-				return 6*(sensor.getLayerNumber() - 1) + 1;
-			} 
-		} else { 
-		
-			if (sensor.isTopLayer()) {
-				if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
-					return 6*(sensor.getLayerNumber() - 7) + 2;
-				} else { 
-					return 6*(sensor.getLayerNumber() - 7) + 3;
-				}
-			} else if (sensor.isBottomLayer()) {
-				if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
-					return 6*(sensor.getLayerNumber() - 7) + 4;
-				} else {
-					return 6*(sensor.getLayerNumber() - 7) + 5;
-				}
-			}
-		}
-		return -1; 
+        if (sensor.getLayerNumber() < 7) {
+            if (sensor.isTopLayer()) {
+                return 6*(sensor.getLayerNumber() - 1); 
+            } else { 
+                return 6*(sensor.getLayerNumber() - 1) + 1;
+            } 
+        } else { 
+        
+            if (sensor.isTopLayer()) {
+                if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
+                    return 6*(sensor.getLayerNumber() - 7) + 2;
+                } else { 
+                    return 6*(sensor.getLayerNumber() - 7) + 3;
+                }
+            } else if (sensor.isBottomLayer()) {
+                if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
+                    return 6*(sensor.getLayerNumber() - 7) + 4;
+                } else {
+                    return 6*(sensor.getLayerNumber() - 7) + 5;
+                }
+            }
+        }
+        return -1; 
     }
     
     protected void detectorChanged(Detector detector) {
@@ -249,12 +249,12 @@
                                                           .get(sensor.getName()));
         }
         
-		for (IPlotter plotter : plotters.values()) { 
-			plotter.show();
-		}
-    }
-
-	@SuppressWarnings({ "unchecked", "rawtypes" })
+        for (IPlotter plotter : plotters.values()) { 
+            plotter.show();
+        }
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public void process(EventHeader event) { 
      
         if (runNumber == -1) runNumber = event.getRunNumber();
@@ -354,18 +354,18 @@
         this.mapReconstructedParticlesToTracks(tracks, fsParticles);
        
         // Loop over all of the tracks in the event
-    	for(Track track : tracks){
+        for(Track track : tracks){
 
             // Calculate the momentum of the track
             double p = this.getReconstructedParticle(track).getMomentum().magnitude();
-    	    
-    	    for (TrackerHit rotatedStereoHit : track.getTrackerHits()) { 
-    	    
-    	        // Get the HelicalTrackHit corresponding to the RotatedHelicalTrackHit
-    	        // associated with a track
+            
+            for (TrackerHit rotatedStereoHit : track.getTrackerHits()) { 
+            
+                // Get the HelicalTrackHit corresponding to the RotatedHelicalTrackHit
+                // associated with a track
                 Set<TrackerHit> trackClusters = stereoHitToClusters.allFrom(hthToRotatedHth.from(rotatedStereoHit));
-    	        
-    	        for (TrackerHit trackCluster : trackClusters) { 
+                
+                for (TrackerHit trackCluster : trackClusters) { 
                 
                     // Get the raw hits composing this cluster and use them to calculate the amplitude of the hit
                     double amplitudeSum = 0;
@@ -405,9 +405,9 @@
                     trackClusterChargeVsCosTheta.get(sensor.getName()).fill(TrackUtils.getCosTheta(track), amplitudeSum);
                     trackClusterChargeVsSinPhi.get(sensor.getName()).fill(Math.sin(TrackUtils.getPhi0(track)), amplitudeSum);
                     //trackClusterTimePlots.get(sensor.getName()).fill(trackCluster.time());
-    	        }
-    	    }
-    	}
+                }
+            }
+        }
     }
     
     public void endOfData() { 

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtDataRates.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtDataRates.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtDataRates.java	Wed Mar  9 11:43:24 2016
@@ -12,81 +12,81 @@
 
 public class SvtDataRates extends Driver {
 
-	//Map<VOLUMES, double[]> rawHitsPerLayer = new HashMap<VOLUMES, double[]>(); 
-	double[][] rawHitsPerLayer = new double[12][4];
-	
-	//public enum VOLUMES { TOP, BOTTOM };
-	
-	// Collection Names
-	String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    //Map<VOLUMES, double[]> rawHitsPerLayer = new HashMap<VOLUMES, double[]>(); 
+    double[][] rawHitsPerLayer = new double[12][4];
+    
+    //public enum VOLUMES { TOP, BOTTOM };
+    
+    // Collection Names
+    String rawTrackerHitCollectionName = "SVTRawTrackerHits";
 
-	double totalEvents = 0; 
-	int totalLayersPerVolume = 0; 
-	
-	public SvtDataRates(){}
-	
-	//static { 
-	//	hep.aida.jfree.AnalysisFactory.register();
-	//}
-	
-	protected void detectorChanged(Detector detector){
-	
-		List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
-		for(HpsSiSensor sensor : sensors){
-			this.printDebug("Layer: " + sensor.getLayerNumber() + " Module: " + sensor.getModuleNumber());
-		}
-		totalLayersPerVolume = sensors.size()/2;
-		//for(VOLUMES volume : VOLUMES.values()){
-		//	rawHitsPerLayer.put(volume, new double[totalLayersPerVolume]);
-		//}
-	}
-	
-	protected void process(EventHeader event){
-		
-		if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)){
-			return;
-		}
-		
-		totalEvents++; 
-		
-		List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
-		for(RawTrackerHit rawHit : rawHits){
-			
-			HpsSiSensor sensor = (HpsSiSensor) rawHit.getDetectorElement(); 
-			int layer = sensor.getLayerNumber();
-			int module = sensor.getModuleNumber();
-			//if(sensor.isTopLayer()){
-			//	rawHitsPerLayer.get(VOLUMES.TOP)[layer]++;
-			//} else { 
-			//	rawHitsPerLayer.get(VOLUMES.BOTTOM)[layer]++;
-			//}
-			
-			rawHitsPerLayer[layer-1][module]++;
-		}
-	}
-	
-	protected void endOfData(){
-	
-		//for(VOLUMES volume : VOLUMES.values()){
-			//System.out.println("Volume: " + volume);
-			//System.out.println("Hits per layer per event: ");
-			//for(int layer = 0; layer < totalLayersPerVolume; layer++){
-			//	System.out.println("Layer: " + (layer+1) + ": " + rawHitsPerLayer.get(volume)[layer]/totalEvents); 
-			//}
-		//}
-		
-		for(int layer = 0; layer < 12; layer++){
-			
-			for(int module = 0; module < 4; module++){
-				System.out.println("Layer: " + layer + 
-									" Module: " + module + 
-									" Hits Per Layer: " + rawHitsPerLayer[layer][module]/totalEvents); 
-			}
-		}
-	}
+    double totalEvents = 0; 
+    int totalLayersPerVolume = 0; 
+    
+    public SvtDataRates(){}
+    
+    //static { 
+    //  hep.aida.jfree.AnalysisFactory.register();
+    //}
+    
+    protected void detectorChanged(Detector detector){
+    
+        List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
+        for(HpsSiSensor sensor : sensors){
+            this.printDebug("Layer: " + sensor.getLayerNumber() + " Module: " + sensor.getModuleNumber());
+        }
+        totalLayersPerVolume = sensors.size()/2;
+        //for(VOLUMES volume : VOLUMES.values()){
+        //  rawHitsPerLayer.put(volume, new double[totalLayersPerVolume]);
+        //}
+    }
+    
+    protected void process(EventHeader event){
+        
+        if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)){
+            return;
+        }
+        
+        totalEvents++; 
+        
+        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+        for(RawTrackerHit rawHit : rawHits){
+            
+            HpsSiSensor sensor = (HpsSiSensor) rawHit.getDetectorElement(); 
+            int layer = sensor.getLayerNumber();
+            int module = sensor.getModuleNumber();
+            //if(sensor.isTopLayer()){
+            //  rawHitsPerLayer.get(VOLUMES.TOP)[layer]++;
+            //} else { 
+            //  rawHitsPerLayer.get(VOLUMES.BOTTOM)[layer]++;
+            //}
+            
+            rawHitsPerLayer[layer-1][module]++;
+        }
+    }
+    
+    protected void endOfData(){
+    
+        //for(VOLUMES volume : VOLUMES.values()){
+            //System.out.println("Volume: " + volume);
+            //System.out.println("Hits per layer per event: ");
+            //for(int layer = 0; layer < totalLayersPerVolume; layer++){
+            //  System.out.println("Layer: " + (layer+1) + ": " + rawHitsPerLayer.get(volume)[layer]/totalEvents); 
+            //}
+        //}
+        
+        for(int layer = 0; layer < 12; layer++){
+            
+            for(int module = 0; module < 4; module++){
+                System.out.println("Layer: " + layer + 
+                                    " Module: " + module + 
+                                    " Hits Per Layer: " + rawHitsPerLayer[layer][module]/totalEvents); 
+            }
+        }
+    }
 
-	private void printDebug(String debugMessage){
-		System.out.println(this.getClass().getSimpleName() + ": " + debugMessage);
-	}
-	
+    private void printDebug(String debugMessage){
+        System.out.println(this.getClass().getSimpleName() + ": " + debugMessage);
+    }
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitCorrelations.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitCorrelations.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitCorrelations.java	Wed Mar  9 11:43:24 2016
@@ -28,12 +28,12 @@
  */
 public class SvtHitCorrelations extends Driver {
 
-	// TODO: Add documentation
-	static { 
-	    hep.aida.jfree.AnalysisFactory.register();
-	}
+    // TODO: Add documentation
+    static { 
+        hep.aida.jfree.AnalysisFactory.register();
+    }
    
-	// Plotting
+    // Plotting
     ITree tree; 
     IHistogramFactory histogramFactory;
     IPlotterFactory plotterFactory = IAnalysisFactory.create().createPlotterFactory();
@@ -59,46 +59,46 @@
     boolean enableBottomAxialAxial = false;
     boolean enableBottomAxialStereo = false;
     
-	/**
-	 * 
-	 */
-	public void setEnableTopAxialAxial(boolean enableTopAxialAxial){
-		this.enableTopAxialAxial = enableTopAxialAxial;
-	}
-
-	/**
-	 * 
-	 */
-	public void setEnableTopAxialStereo(boolean enableTopAxialStereo){
-	    this.enableTopAxialStereo = enableTopAxialStereo; 
-	}
-	
-	/**
-	 * 
-	 */
-	public void setEnableBottomAxialAxial(boolean enableBottomAxialAxial){
-		this.enableBottomAxialAxial = enableBottomAxialAxial;
-	}
-	
-	/**
-	 * 
-	 */
-	public void setEnableBottomAxialStereo(boolean enableBottomAxialStereo){
-	    this.enableBottomAxialStereo = enableBottomAxialStereo; 
-	}
-    
-	/**
-	 * 
-	 */
-	private int computePlotterRegion(HpsSiSensor firstSensor, HpsSiSensor secondSensor) {
-	    return (this.getLayerNumber(firstSensor) - 1) + (this.getLayerNumber(secondSensor) - 1)*6;    
-	}
-	
-	protected void detectorChanged(Detector detector){
-	   
+    /**
+     * 
+     */
+    public void setEnableTopAxialAxial(boolean enableTopAxialAxial){
+        this.enableTopAxialAxial = enableTopAxialAxial;
+    }
+
+    /**
+     * 
+     */
+    public void setEnableTopAxialStereo(boolean enableTopAxialStereo){
+        this.enableTopAxialStereo = enableTopAxialStereo; 
+    }
+    
+    /**
+     * 
+     */
+    public void setEnableBottomAxialAxial(boolean enableBottomAxialAxial){
+        this.enableBottomAxialAxial = enableBottomAxialAxial;
+    }
+    
+    /**
+     * 
+     */
+    public void setEnableBottomAxialStereo(boolean enableBottomAxialStereo){
+        this.enableBottomAxialStereo = enableBottomAxialStereo; 
+    }
+    
+    /**
+     * 
+     */
+    private int computePlotterRegion(HpsSiSensor firstSensor, HpsSiSensor secondSensor) {
+        return (this.getLayerNumber(firstSensor) - 1) + (this.getLayerNumber(secondSensor) - 1)*6;    
+    }
+    
+    protected void detectorChanged(Detector detector){
+       
         tree = IAnalysisFactory.create().createTreeFactory().create();
         histogramFactory = IAnalysisFactory.create().createHistogramFactory(tree);
-	
+    
         sensors = detector.getSubdetector(SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsSiSensor.class);
 
         if (sensors.size() == 0) {
@@ -178,55 +178,55 @@
         }
 
         for (IPlotter plotter : plotters.values()) plotter.show();
-	}
-	
-	public void process(EventHeader event){
-	
+    }
+    
+    public void process(EventHeader event){
+    
         if (runNumber == -1) runNumber = event.getRunNumber();
-	    
-		if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) return;
-	
-		List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
-		
-		String plotName = "";
-		for(RawTrackerHit firstRawHit : rawHits){
-	
-			HpsSiSensor firstSensor = (HpsSiSensor) firstRawHit.getDetectorElement();
-			int firstChannel = firstRawHit.getIdentifierFieldValue("strip");
-			
-			for(RawTrackerHit secondRawHit : rawHits){
-			
-				HpsSiSensor secondSensor = (HpsSiSensor) secondRawHit.getDetectorElement();
-				int secondChannel = secondRawHit.getIdentifierFieldValue("strip");
-			
-				if(firstSensor.isTopLayer() && secondSensor.isTopLayer()){
-					if(enableTopAxialAxial && firstSensor.isAxial() && secondSensor.isAxial()){
-						
-					    plotName = "Top Axial Layer " + this.getLayerNumber(firstSensor) 
-					                + " vs Top Axial Layer " + this.getLayerNumber(secondSensor); 
-					    topAxialAxialPlots.get(plotName).fill(firstChannel, secondChannel);
-					} else if (enableTopAxialStereo && firstSensor.isAxial() && secondSensor.isStereo()) { 
-					    
-					    plotName = "Top Axial Layer " + this.getLayerNumber(firstSensor) 
-					                + " vs Top Stereo Layer " + this.getLayerNumber(secondSensor); 
-					    topAxialStereoPlots.get(plotName).fill(firstChannel, secondChannel);
-					}
-				} else if (firstSensor.isBottomLayer() && secondSensor.isBottomLayer()) { 
-					if(enableBottomAxialAxial && firstSensor.isAxial() && secondSensor.isAxial()){
-						
-					    plotName = "Bottom Axial Layer " + this.getLayerNumber(firstSensor) 
-					                + " vs Bottom Axial Layer " + this.getLayerNumber(secondSensor); 
-					    bottomAxialAxialPlots.get(plotName).fill(firstChannel, secondChannel);
-					} else if (enableBottomAxialStereo && firstSensor.isAxial() && secondSensor.isStereo()) { 
-					    
-					    plotName = "Bottom Axial Layer " + this.getLayerNumber(firstSensor) 
-					                + " vs Bottom Stereo Layer " + this.getLayerNumber(secondSensor); 
-					    bottomAxialStereoPlots.get(plotName).fill(firstChannel, secondChannel);
-					}
-				}
-			}
-		}
-	}
+        
+        if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) return;
+    
+        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+        
+        String plotName = "";
+        for(RawTrackerHit firstRawHit : rawHits){
+    
+            HpsSiSensor firstSensor = (HpsSiSensor) firstRawHit.getDetectorElement();
+            int firstChannel = firstRawHit.getIdentifierFieldValue("strip");
+            
+            for(RawTrackerHit secondRawHit : rawHits){
+            
+                HpsSiSensor secondSensor = (HpsSiSensor) secondRawHit.getDetectorElement();
+                int secondChannel = secondRawHit.getIdentifierFieldValue("strip");
+            
+                if(firstSensor.isTopLayer() && secondSensor.isTopLayer()){
+                    if(enableTopAxialAxial && firstSensor.isAxial() && secondSensor.isAxial()){
+                        
+                        plotName = "Top Axial Layer " + this.getLayerNumber(firstSensor) 
+                                    + " vs Top Axial Layer " + this.getLayerNumber(secondSensor); 
+                        topAxialAxialPlots.get(plotName).fill(firstChannel, secondChannel);
+                    } else if (enableTopAxialStereo && firstSensor.isAxial() && secondSensor.isStereo()) { 
+                        
+                        plotName = "Top Axial Layer " + this.getLayerNumber(firstSensor) 
+                                    + " vs Top Stereo Layer " + this.getLayerNumber(secondSensor); 
+                        topAxialStereoPlots.get(plotName).fill(firstChannel, secondChannel);
+                    }
+                } else if (firstSensor.isBottomLayer() && secondSensor.isBottomLayer()) { 
+                    if(enableBottomAxialAxial && firstSensor.isAxial() && secondSensor.isAxial()){
+                        
+                        plotName = "Bottom Axial Layer " + this.getLayerNumber(firstSensor) 
+                                    + " vs Bottom Axial Layer " + this.getLayerNumber(secondSensor); 
+                        bottomAxialAxialPlots.get(plotName).fill(firstChannel, secondChannel);
+                    } else if (enableBottomAxialStereo && firstSensor.isAxial() && secondSensor.isStereo()) { 
+                        
+                        plotName = "Bottom Axial Layer " + this.getLayerNumber(firstSensor) 
+                                    + " vs Bottom Stereo Layer " + this.getLayerNumber(secondSensor); 
+                        bottomAxialStereoPlots.get(plotName).fill(firstChannel, secondChannel);
+                    }
+                }
+            }
+        }
+    }
 
     public void endOfData() { 
       
@@ -240,12 +240,12 @@
             e.printStackTrace();
         }
     }
-	
-	
-	private int getLayerNumber(HpsSiSensor sensor) {
-	   return (int) Math.ceil(((double) sensor.getLayerNumber())/2); 
-	}
-	
+    
+    
+    private int getLayerNumber(HpsSiSensor sensor) {
+       return (int) Math.ceil(((double) sensor.getLayerNumber())/2); 
+    }
+    
     IPlotterStyle createStyle(String xAxisTitle, String yAxisTitle) { 
        
         // Create a default style
@@ -279,5 +279,5 @@
        
         return style;
     }
-	
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java	Wed Mar  9 11:43:24 2016
@@ -54,7 +54,7 @@
 
     int channelNumber = 0;
     int plotterIndex = 0;
-    int apvNumber = 0;	
+    int apvNumber = 0;  
     double totalNumberEvents = 0;
     double totalNumberOfRawHitEvents = 0;
     double[] totalTopSamples = new double[6];
@@ -210,7 +210,7 @@
      * 
      */
     public void setEnableTotalNumberOfHitsPlots(boolean enableTotalNumberOfHitsPlots){
-    	this.enableTotalNumberOfHitsPlots = enableTotalNumberOfHitsPlots;
+        this.enableTotalNumberOfHitsPlots = enableTotalNumberOfHitsPlots;
     }
 
     /**
@@ -391,13 +391,13 @@
         }
         
         if(enableTotalNumberOfHitsPlots){
-        	title = "Total Number of RawTrackerHits";
-        	plotters.add(PlotUtils.setupPlotter(title, 0, 0));
-        	plotters.get(plotterIndex).style().statisticsBoxStyle().setVisible(true);
-        	histo1D = aida.histogram1D(title, 100, 0, 75);
-        	histos1D.add(histo1D);
-        	PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, 0, "Number of RawTrackerHits", histo1D);
-        	plotterIndex++;
+            title = "Total Number of RawTrackerHits";
+            plotters.add(PlotUtils.setupPlotter(title, 0, 0));
+            plotters.get(plotterIndex).style().statisticsBoxStyle().setVisible(true);
+            histo1D = aida.histogram1D(title, 100, 0, 75);
+            histos1D.add(histo1D);
+            PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, 0, "Number of RawTrackerHits", histo1D);
+            plotterIndex++;
         }
 
         for(IPlotter plotter : plotters) plotter.show();
@@ -488,7 +488,7 @@
                     aida.histogram1D(title).fill(sample);
                 }
                 title = "Shaper Signal Amplitude";
-                aida.histogram1D(title).fill(fit.getAmp());	    
+                aida.histogram1D(title).fill(fit.getAmp());     
                 System.out.println("Amplitude: " + fit.getAmp());
                 title="t0";
                 aida.histogram1D(title).fill(fit.getT0());
@@ -595,9 +595,9 @@
                                 topSamples[sampleN-1] += samples[sampleN-1] - sensor.getPedestal(channel, sampleN-1);
                             }
                             else{
-                            	aida.histogram2D("APV Sample Number vs Sample Amplitude - Bottom").fill(sampleN, samples[sampleN-1] - sensor.getPedestal(channel, sampleN-1));
-                            	totalBottomSamples[sampleN-1]++;
-                            	bottomSamples[sampleN-1] += samples[sampleN - 1] - sensor.getPedestal(channel, sampleN-1);
+                                aida.histogram2D("APV Sample Number vs Sample Amplitude - Bottom").fill(sampleN, samples[sampleN-1] - sensor.getPedestal(channel, sampleN-1));
+                                totalBottomSamples[sampleN-1]++;
+                                bottomSamples[sampleN-1] += samples[sampleN - 1] - sensor.getPedestal(channel, sampleN-1);
                             }
                         }
                     }
@@ -659,7 +659,7 @@
                         int channel = ((RawTrackerHit) hts.rawhits().get(0)).getIdentifierFieldValue("strip");
                         
                         if(sensorName.equals("all")){
-                        	aida.histogram2D(sensor.getName() + " - t0 Resolution vs Channel #").fill(channel, meanT0 - hts.time());
+                            aida.histogram2D(sensor.getName() + " - t0 Resolution vs Channel #").fill(channel, meanT0 - hts.time());
                         } else {
                         if(sensor.getName().equals(sensorName)){
                             aida.histogram1D(sensorName + " - Hit Time Resolution").fill(meanT0 - hts.time());
@@ -675,67 +675,67 @@
 
     @Override
         public void endOfData(){
-    		String title;
-    		
-
-    		
+            String title;
+            
+
+            
             String plotName;
-    		if(enableOccupancy){
-    			for(HpsSiSensor sensor : sensors){
-    				title = sensor.getName() + " - Occupancy";
-    				// Scale the hits per channel by the number of events
-    				aida.histogram1D(title).scale(1/totalNumberEvents);
-    				
-    				// Write the occupancies to a file
-    				if(sensor.isTopLayer()){
-    					plotName = outputFile + "_top_";
-    				} else { 
-    					plotName = outputFile + "_bottom_";
-    				}
-    				
-					if(sensor.getLayerNumber() < 10){
-						plotName += "0" + sensor.getLayerNumber() + ".dat";
-					} else {
-						plotName += sensor.getLayerNumber() + ".dat";
-					}
-    			
-	    			// Open the output files stream
-	                if(plotName != null){
-	                	try{
-	                		output = new BufferedWriter(new FileWriter(plotName)); 
-                			for(int channel = 0; channel < 640; channel++){
-                				output.write(channel + " " + aida.histogram1D(title).binHeight(channel) + "\n");
-                			}
-                			output.close();
-	                	} catch(Exception e) {
-	                		System.out.println(this.getClass().getSimpleName() + " :Error! " + e.getMessage());
-	                	}
-	                }
-    			}
-    		}
-    		
-    		if(enableT0Plots){
-    			int bins = aida.histogram1D(sensorName + " - Hit Time Resolution").axis().bins();
-    			for(int bin = 0; bin < bins; bin++){
-    				System.out.println(bin + "        " + aida.histogram1D(sensorName + " - Hit Time Resolution").binHeight(bin));
-    			}
-    		}
-    	
-            	
-            	/*
+            if(enableOccupancy){
                 for(HpsSiSensor sensor : sensors){
-                    	if(outputFile != null && sensorName.equals(sensor.getName())){
-                    		try{
-                    			for(int channel = 0; channel < 639; channel++){
-    								output.write(channel + " " + this.getOccupancy(sensor, channel) + "\n");
-    							}
-                    			output.close();
-                    		} catch(IOException e){
-                    			System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
-                    		}
-                    	}
-                	
-                	System.out.println("%===================================================================%");
+                    title = sensor.getName() + " - Occupancy";
+                    // Scale the hits per channel by the number of events
+                    aida.histogram1D(title).scale(1/totalNumberEvents);
+                    
+                    // Write the occupancies to a file
+                    if(sensor.isTopLayer()){
+                        plotName = outputFile + "_top_";
+                    } else { 
+                        plotName = outputFile + "_bottom_";
+                    }
+                    
+                    if(sensor.getLayerNumber() < 10){
+                        plotName += "0" + sensor.getLayerNumber() + ".dat";
+                    } else {
+                        plotName += sensor.getLayerNumber() + ".dat";
+                    }
+                
+                    // Open the output files stream
+                    if(plotName != null){
+                        try{
+                            output = new BufferedWriter(new FileWriter(plotName)); 
+                            for(int channel = 0; channel < 640; channel++){
+                                output.write(channel + " " + aida.histogram1D(title).binHeight(channel) + "\n");
+                            }
+                            output.close();
+                        } catch(Exception e) {
+                            System.out.println(this.getClass().getSimpleName() + " :Error! " + e.getMessage());
+                        }
+                    }
+                }
+            }
+            
+            if(enableT0Plots){
+                int bins = aida.histogram1D(sensorName + " - Hit Time Resolution").axis().bins();
+                for(int bin = 0; bin < bins; bin++){
+                    System.out.println(bin + "        " + aida.histogram1D(sensorName + " - Hit Time Resolution").binHeight(bin));
+                }
+            }
+        
+                
+                /*
+                for(HpsSiSensor sensor : sensors){
+                        if(outputFile != null && sensorName.equals(sensor.getName())){
+                            try{
+                                for(int channel = 0; channel < 639; channel++){
+                                    output.write(channel + " " + this.getOccupancy(sensor, channel) + "\n");
+                                }
+                                output.close();
+                            } catch(IOException e){
+                                System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
+                            }
+                        }
+                    
+                    System.out.println("%===================================================================%");
                     System.out.println(sensor.getName() + " Bad Channels");
                     System.out.println("%===================================================================%");
                     for(int index = 0; index < 640; index++){
@@ -769,21 +769,21 @@
             }
             
             if(enableSamples){
-            	double sigma = 0;
-            	double[] topMean = new double[6];
-            	double[] bottomMean = new double[6];
-            	
+                double sigma = 0;
+                double[] topMean = new double[6];
+                double[] bottomMean = new double[6];
+                
                 System.out.println("%===================================================================% \n");
-            	for(int index = 0; index < topSamples.length; index++){
-            		topMean[index] = topSamples[index]/totalTopSamples[index];
-            		System.out.println("Top sample " + index + " mean: " + topMean[index]);
-            	}
-            	
+                for(int index = 0; index < topSamples.length; index++){
+                    topMean[index] = topSamples[index]/totalTopSamples[index];
+                    System.out.println("Top sample " + index + " mean: " + topMean[index]);
+                }
+                
                 System.out.println("\n%===================================================================% \n");
-            	for(int index = 0; index < bottomSamples.length; index++){
-            		bottomMean[index] = bottomSamples[index]/totalBottomSamples[index];
-            		System.out.println("Bottom sample " + index + " mean: " + bottomMean[index]);
-            	}
+                for(int index = 0; index < bottomSamples.length; index++){
+                    bottomMean[index] = bottomSamples[index]/totalBottomSamples[index];
+                    System.out.println("Bottom sample " + index + " mean: " + bottomMean[index]);
+                }
                 System.out.println("\n%===================================================================% \n");
             }
         }

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -46,8 +46,8 @@
     IPlotterFactory plotterFactory = IAnalysisFactory.create().createPlotterFactory();
     protected Map<String, IPlotter> plotters = new HashMap<String, IPlotter>();
     private Map<String, IHistogram1D> trackPlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> clusterChargePlots = new HashMap<String, IHistogram1D>();
-	private Map<String, IHistogram1D> clusterSizePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> clusterChargePlots = new HashMap<String, IHistogram1D>();
+    private Map<String, IHistogram1D> clusterSizePlots = new HashMap<String, IHistogram1D>();
 
     private List<HpsSiSensor> sensors;
     private Map<RawTrackerHit, LCRelation> fittedRawTrackerHitMap 
@@ -64,67 +64,67 @@
 
     private int runNumber = -1; 
     
-	int npositive = 0;
-	int nnegative = 0;
-	double ntracks = 0;
-	double ntracksTop = 0;
-	double ntracksBottom = 0;
-	double nTwoTracks = 0;
-	double nevents = 0;
-
-	double d0Cut = -9999;
-	
-	// Flags 
-	boolean electronCut = false;
-	boolean positronCut = false;
-	
+    int npositive = 0;
+    int nnegative = 0;
+    double ntracks = 0;
+    double ntracksTop = 0;
+    double ntracksBottom = 0;
+    double nTwoTracks = 0;
+    double nevents = 0;
+
+    double d0Cut = -9999;
+    
+    // Flags 
+    boolean electronCut = false;
+    boolean positronCut = false;
+    
     /**
      *  Default Constructor
      */    
-	public SvtTrackAnalysis(){
-	}
-	
-	public void setEnableElectronCut(boolean electronCut) {
-	    this.electronCut = electronCut;
-	}
-
-	public void setEnablePositronCut(boolean positronCut) {
-	    this.positronCut = positronCut;
-	}
-
-	public void setD0Cut(double d0Cut) {
-	   this.d0Cut = d0Cut; 
-	}
-	
-	private int computePlotterRegion(HpsSiSensor sensor) {
-
-		if (sensor.getLayerNumber() < 7) {
-			if (sensor.isTopLayer()) {
-				return 6*(sensor.getLayerNumber() - 1); 
-			} else { 
-				return 6*(sensor.getLayerNumber() - 1) + 1;
-			} 
-		} else { 
-		
-			if (sensor.isTopLayer()) {
-				if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
-					return 6*(sensor.getLayerNumber() - 7) + 2;
-				} else { 
-					return 6*(sensor.getLayerNumber() - 7) + 3;
-				}
-			} else if (sensor.isBottomLayer()) {
-				if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
-					return 6*(sensor.getLayerNumber() - 7) + 4;
-				} else {
-					return 6*(sensor.getLayerNumber() - 7) + 5;
-				}
-			}
-		}
-		return -1; 
-    }
-	
-	protected void detectorChanged(Detector detector){
-	
+    public SvtTrackAnalysis(){
+    }
+    
+    public void setEnableElectronCut(boolean electronCut) {
+        this.electronCut = electronCut;
+    }
+
+    public void setEnablePositronCut(boolean positronCut) {
+        this.positronCut = positronCut;
+    }
+
+    public void setD0Cut(double d0Cut) {
+       this.d0Cut = d0Cut; 
+    }
+    
+    private int computePlotterRegion(HpsSiSensor sensor) {
+
+        if (sensor.getLayerNumber() < 7) {
+            if (sensor.isTopLayer()) {
+                return 6*(sensor.getLayerNumber() - 1); 
+            } else { 
+                return 6*(sensor.getLayerNumber() - 1) + 1;
+            } 
+        } else { 
+        
+            if (sensor.isTopLayer()) {
+                if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
+                    return 6*(sensor.getLayerNumber() - 7) + 2;
+                } else { 
+                    return 6*(sensor.getLayerNumber() - 7) + 3;
+                }
+            } else if (sensor.isBottomLayer()) {
+                if (sensor.getSide() == HpsSiSensor.POSITRON_SIDE) {
+                    return 6*(sensor.getLayerNumber() - 7) + 4;
+                } else {
+                    return 6*(sensor.getLayerNumber() - 7) + 5;
+                }
+            }
+        }
+        return -1; 
+    }
+    
+    protected void detectorChanged(Detector detector){
+    
         tree = IAnalysisFactory.create().createTreeFactory().create();
         histogramFactory = IAnalysisFactory.create().createHistogramFactory(tree);
         
@@ -195,66 +195,66 @@
             
         }
 
-		//--- Track Extrapolation ---//
-		//---------------------------//	
-		/*plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal"));
-		plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal", 200, -350, 350, 200, -100, 100));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        //--- Track Extrapolation ---//
+        //---------------------------// 
+        /*plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal"));
+        plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal", 200, -350, 350, 200, -100, 100));
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style();
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Harp"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Harp", 200, -200, 200, 100, -50, 50));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
 
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal: curvature < 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal: curvature < 0",200, -350, 350, 200, -100, 100));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Harp: curvature < 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Harp: curvature < 0", 200, -200, 200, 100, -50, 50));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal: curvature > 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal: curvature > 0", 200, -350, 350, 200, -100, 100));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Harp: curvature > 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Harp: curvature > 0", 200, -200, 200, 100, -50, 50));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		
-		plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal: Two Tracks"));
-		plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal: Two Tracks", 200, -350, 350, 200, -100, 100));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        
+        plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Ecal: Two Tracks"));
+        plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Ecal: Two Tracks", 200, -350, 350, 200, -100, 100));
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style();
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Track Position at Harp: Two Tracks"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("Track Position at Harp: Two Tracks", 200, -200, 200, 100, -50, 50));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        
         
         //--- Momentum ---//
         //----------------//
@@ -262,99 +262,99 @@
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Px", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Py"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Py", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Pz"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Pz", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
-		
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Px: C > 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Px: C > 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Py: C > 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Py: C > 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Pz: C > 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Pz: C > 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
-		
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Px: C < 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Px: C < 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Py: C < 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Py: C < 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Pz: C < 0"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Pz: C < 0", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
-		
+        nPlotters++;
+        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("Px: Two Tracks"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("Px: Two Tracks", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
+        nPlotters++;
         
         plotters.add(aida.analysisFactory().createPlotterFactory().create("E over P"));
         plotters.get(nPlotters).region(0).plot(aida.histogram1D("E over P", 100, 0, 5));
         plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
         plotters.get(nPlotters).style().dataStyle().errorBarStyle().setVisible(false);
-		nPlotters++;
-		   
-		plotters.add(aida.analysisFactory().createPlotterFactory().create("E versus P"));
-	    plotters.get(nPlotters).region(0).plot(aida.histogram2D("E versus P", 100, 0, 1500, 100, 0, 4000));
-	    plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-	    plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-	    plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-	    nPlotters++;
+        nPlotters++;
+           
+        plotters.add(aida.analysisFactory().createPlotterFactory().create("E versus P"));
+        plotters.get(nPlotters).region(0).plot(aida.histogram2D("E versus P", 100, 0, 1500, 100, 0, 4000));
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
         
         //--- Cluster Matching ---//
         //------------------------//        
         plotters.add(aida.analysisFactory().createPlotterFactory().create("XY Difference between Ecal Cluster and Track Position"));
         plotters.get(nPlotters).region(0).plot(aida.histogram2D("XY Difference between Ecal Cluster and Track Position", 200, -200, 200, 100, -50, 50));
-		plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
-    	plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
-		nPlotters++;
-		*/
-		for (IPlotter plotter : plotters.values()) { 
-			plotter.show();
-		}
-	}
-	
-	@SuppressWarnings({ "unchecked", "rawtypes" })
+        plotters.get(nPlotters).region(0).style().setParameter("hist2DStyle", "colorMap");
+        plotters.get(nPlotters).region(0).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotters.get(nPlotters).style().statisticsBoxStyle().setVisible(false);
+        nPlotters++;
+        */
+        for (IPlotter plotter : plotters.values()) { 
+            plotter.show();
+        }
+    }
+    
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public void process(EventHeader event){
-		nevents++;
-
-		// Get the run number from the event
+        nevents++;
+
+        // Get the run number from the event
         if (runNumber == -1) runNumber = event.getRunNumber();
-		
+        
         // If the event doesn't have any tracks, skip it    
-		if(!event.hasCollection(Track.class, trackCollectionName)) return;
-    	
+        if(!event.hasCollection(Track.class, trackCollectionName)) return;
+        
         // Get the collection of tracks from the event
         List<Track> tracks = event.get(Track.class, trackCollectionName);
         
@@ -386,17 +386,17 @@
         trackPlots.get("Number of tracks").fill(tracks.size());
         
         // Loop over all of the tracks in the event
-    	for(Track track : tracks){
-    	    
-    	    if (TrackUtils.getR(track) < 0 && electronCut) continue;
-    	    
-    	    if (TrackUtils.getR(track) > 0 && positronCut) continue;
-    	    
-    	    if (d0Cut != -9999 && Math.abs(TrackUtils.getDoca(track)) < d0Cut) continue;
-    	    
-    	    trackPlots.get("Track charge").fill(TrackUtils.getR(track), 1);
-    
-    	    // Fill the track parameter plots
+        for(Track track : tracks){
+            
+            if (TrackUtils.getR(track) < 0 && electronCut) continue;
+            
+            if (TrackUtils.getR(track) > 0 && positronCut) continue;
+            
+            if (d0Cut != -9999 && Math.abs(TrackUtils.getDoca(track)) < d0Cut) continue;
+            
+            trackPlots.get("Track charge").fill(TrackUtils.getR(track), 1);
+    
+            // Fill the track parameter plots
             trackPlots.get("doca").fill(TrackUtils.getDoca(track));
             trackPlots.get("z0").fill(TrackUtils.getZ0(track));
             trackPlots.get("sin(phi0)").fill(TrackUtils.getPhi0(track));
@@ -444,8 +444,8 @@
             }
         }
     }
-	
-	public void endOfData() { 
+    
+    public void endOfData() { 
         
         String rootFile = "run" + runNumber + "_track_analysis.root";
         RootFileStore store = new RootFileStore(rootFile);
@@ -473,7 +473,7 @@
             fittedRawTrackerHitMap.put(FittedRawTrackerHit.getRawTrackerHit(fittedHit), fittedHit);
         }
     }
-	
+    
     /**
      * 
      * @param rawHit
@@ -489,101 +489,101 @@
 
             /*
             ntracks++;
-    		Hep3Vector positionEcal = TrackUtils.getTrackPositionAtEcal(track);
-    		System.out.println("Position at Ecal: " + positionEcal);
-    		Hep3Vector positionConverter = TrackUtils.extrapolateTrack(track,-700);
-    	
-    		aida.histogram2D("Track Position at Ecal").fill(positionEcal.y(), positionEcal.z());
-    		aida.histogram2D("Track Position at Harp").fill(positionConverter.y(), positionConverter.z());
-
-    		if(positionEcal.z() > 0 ) ntracksTop++;
-    		else if(positionEcal.z() < 0) ntracksBottom++;
+            Hep3Vector positionEcal = TrackUtils.getTrackPositionAtEcal(track);
+            System.out.println("Position at Ecal: " + positionEcal);
+            Hep3Vector positionConverter = TrackUtils.extrapolateTrack(track,-700);
+        
+            aida.histogram2D("Track Position at Ecal").fill(positionEcal.y(), positionEcal.z());
+            aida.histogram2D("Track Position at Harp").fill(positionConverter.y(), positionConverter.z());
+
+            if(positionEcal.z() > 0 ) ntracksTop++;
+            else if(positionEcal.z() < 0) ntracksBottom++;
             */
-    		
-    	
+            
+        
             /*    
-    		aida.histogram1D("Px").fill(track.getTrackStates().get(0).getMomentum()[0]);
-    		aida.histogram1D("Py").fill(track.getTrackStates().get(0).getMomentum()[1]);
-    		aida.histogram1D("Pz").fill(track.getTrackStates().get(0).getMomentum()[2]);
-    		aida.histogram1D("ChiSquared").fill(track.getChi2());
-    		
-    		if(Math.signum(TrackUtils.getR(track)) < 0){
-    			aida.histogram2D("Track Position at Ecal: curvature < 0").fill(positionEcal.y(), positionEcal.z());
-    			aida.histogram2D("Track Position at Harp: curvature < 0").fill(positionConverter.y(), positionConverter.z());
-        		aida.histogram1D("Px: C < 0").fill(track.getTrackStates().get(0).getMomentum()[0]);
-        		aida.histogram1D("Py: C < 0").fill(track.getTrackStates().get(0).getMomentum()[1]);
-        		aida.histogram1D("Pz: C < 0").fill(track.getTrackStates().get(0).getMomentum()[2]);
-        		nnegative++;
-    		} else if(Math.signum(TrackUtils.getR(track)) > 0){
-    			aida.histogram2D("Track Position at Ecal: curvature > 0").fill(positionEcal.y(), positionEcal.z());
-    			aida.histogram2D("Track Position at Harp: curvature > 0").fill(positionConverter.y(), positionConverter.z());
-        		aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[0]);
-        		aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[1]);
-        		aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[2]);
-        		npositive++;
-    		}
-    		
-    		if(tracks.size() > 1){
-    			aida.histogram2D("Track Position at Ecal: Two Tracks").fill(positionEcal.y(), positionEcal.z());
-    			aida.histogram2D("Track Position at Harp: Two Tracks").fill(positionConverter.y(), positionConverter.z()); 
-    			aida.histogram1D("Px: Two Tracks").fill(track.getTrackStates().get(0).getMomentum()[0]);
-    			if(tracks.size() == 2) nTwoTracks++;
-    		}
-    		
-    		trackToEcalPosition.put(positionEcal, track);
-    		ecalPos.add(positionEcal);  		
-    	}
-    	
-    	if(!event.hasCollection(Cluster.class, "EcalClusters")) return;
-    	List<Cluster> clusters = event.get(Cluster.class, "EcalClusters");
-    	
-
-    	for(Hep3Vector ecalP : ecalPos){
-        	double xdiff = 1000; 
-        	double ydiff = 1000;
-    		for(Cluster cluster : clusters){
-    			double xd = ecalP.y() - cluster.getPosition()[0];
-    			double yd = ecalP.z() - cluster.getPosition()[1];  
-    			if(yd < ydiff){
-    				xdiff = xd;
-    				ydiff = yd;
-    				trackToCluster.put(trackToEcalPosition.get(ecalP),cluster);
-    			}
-    		}
-    		clusters.remove(trackToCluster.get(trackToEcalPosition.get(ecalP)));
-    		aida.histogram2D("XY Difference between Ecal Cluster and Track Position").fill(xdiff, ydiff);
-    	}
-    	
-    	for(Map.Entry<Track, Cluster> entry : trackToCluster.entrySet()){
-    		double Energy = entry.getValue().getEnergy();
-    		Track track = entry.getKey();
-    		double pTotal = Math.sqrt(track.getTrackStates().get(0).getMomentum()[0]*track.getTrackStates().get(0).getMomentum()[0] + track.getTrackStates().get(0).getMomentum()[1]*track.getTrackStates().get(0).getMomentum()[1] + track.getTrackStates().get(0).getMomentum()[2]*track.getTrackStates().get(0).getMomentum()[2]);
-    		
-    		double ep = Energy/(pTotal*1000);
-    		
-    		System.out.println("Energy: " + Energy + "P: " + pTotal + " E over P: " + ep);
-    		
-    		aida.histogram1D("E over P").fill(ep);
-    		aida.histogram2D("E versus P").fill(Energy, pTotal*1000);
-    	}
-    	
-    	for(Cluster cluster : clusters){
-    		double[] clusterPosition = cluster.getPosition();
-    		
-    		System.out.println("Cluster Position: [" + clusterPosition[0] + ", " + clusterPosition[1] + ", " + clusterPosition[2]+ "]");
-    	}
-    	
-    	double ratio = nnegative/npositive;
-    	System.out.println("Ratio of Negative to Position Tracks: " + ratio);
-	
-    	double tracksRatio = ntracks/nevents;
-    	double tracksTopRatio = ntracksTop/nevents;
-    	double tracksBottomRatio = ntracksBottom/nevents;
-    	double twoTrackRatio = nTwoTracks/nevents;
-    	System.out.println("Number of tracks per event: " + tracksRatio);
-    	System.out.println("Number of top tracks per event: " + tracksTopRatio);
-    	System.out.println("Number of bottom tracks per event: " + tracksBottomRatio);
-    	System.out.println("Number of two track events: " + twoTrackRatio);
-	}*/
-
-
+            aida.histogram1D("Px").fill(track.getTrackStates().get(0).getMomentum()[0]);
+            aida.histogram1D("Py").fill(track.getTrackStates().get(0).getMomentum()[1]);
+            aida.histogram1D("Pz").fill(track.getTrackStates().get(0).getMomentum()[2]);
+            aida.histogram1D("ChiSquared").fill(track.getChi2());
+            
+            if(Math.signum(TrackUtils.getR(track)) < 0){
+                aida.histogram2D("Track Position at Ecal: curvature < 0").fill(positionEcal.y(), positionEcal.z());
+                aida.histogram2D("Track Position at Harp: curvature < 0").fill(positionConverter.y(), positionConverter.z());
+                aida.histogram1D("Px: C < 0").fill(track.getTrackStates().get(0).getMomentum()[0]);
+                aida.histogram1D("Py: C < 0").fill(track.getTrackStates().get(0).getMomentum()[1]);
+                aida.histogram1D("Pz: C < 0").fill(track.getTrackStates().get(0).getMomentum()[2]);
+                nnegative++;
+            } else if(Math.signum(TrackUtils.getR(track)) > 0){
+                aida.histogram2D("Track Position at Ecal: curvature > 0").fill(positionEcal.y(), positionEcal.z());
+                aida.histogram2D("Track Position at Harp: curvature > 0").fill(positionConverter.y(), positionConverter.z());
+                aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[0]);
+                aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[1]);
+                aida.histogram1D("Px: C > 0").fill(track.getTrackStates().get(0).getMomentum()[2]);
+                npositive++;
+            }
+            
+            if(tracks.size() > 1){
+                aida.histogram2D("Track Position at Ecal: Two Tracks").fill(positionEcal.y(), positionEcal.z());
+                aida.histogram2D("Track Position at Harp: Two Tracks").fill(positionConverter.y(), positionConverter.z()); 
+                aida.histogram1D("Px: Two Tracks").fill(track.getTrackStates().get(0).getMomentum()[0]);
+                if(tracks.size() == 2) nTwoTracks++;
+            }
+            
+            trackToEcalPosition.put(positionEcal, track);
+            ecalPos.add(positionEcal);          
+        }
+        
+        if(!event.hasCollection(Cluster.class, "EcalClusters")) return;
+        List<Cluster> clusters = event.get(Cluster.class, "EcalClusters");
+        
+
+        for(Hep3Vector ecalP : ecalPos){
+            double xdiff = 1000; 
+            double ydiff = 1000;
+            for(Cluster cluster : clusters){
+                double xd = ecalP.y() - cluster.getPosition()[0];
+                double yd = ecalP.z() - cluster.getPosition()[1];  
+                if(yd < ydiff){
+                    xdiff = xd;
+                    ydiff = yd;
+                    trackToCluster.put(trackToEcalPosition.get(ecalP),cluster);
+                }
+            }
+            clusters.remove(trackToCluster.get(trackToEcalPosition.get(ecalP)));
+            aida.histogram2D("XY Difference between Ecal Cluster and Track Position").fill(xdiff, ydiff);
+        }
+        
+        for(Map.Entry<Track, Cluster> entry : trackToCluster.entrySet()){
+            double Energy = entry.getValue().getEnergy();
+            Track track = entry.getKey();
+            double pTotal = Math.sqrt(track.getTrackStates().get(0).getMomentum()[0]*track.getTrackStates().get(0).getMomentum()[0] + track.getTrackStates().get(0).getMomentum()[1]*track.getTrackStates().get(0).getMomentum()[1] + track.getTrackStates().get(0).getMomentum()[2]*track.getTrackStates().get(0).getMomentum()[2]);
+            
+            double ep = Energy/(pTotal*1000);
+            
+            System.out.println("Energy: " + Energy + "P: " + pTotal + " E over P: " + ep);
+            
+            aida.histogram1D("E over P").fill(ep);
+            aida.histogram2D("E versus P").fill(Energy, pTotal*1000);
+        }
+        
+        for(Cluster cluster : clusters){
+            double[] clusterPosition = cluster.getPosition();
+            
+            System.out.println("Cluster Position: [" + clusterPosition[0] + ", " + clusterPosition[1] + ", " + clusterPosition[2]+ "]");
+        }
+        
+        double ratio = nnegative/npositive;
+        System.out.println("Ratio of Negative to Position Tracks: " + ratio);
+    
+        double tracksRatio = ntracks/nevents;
+        double tracksTopRatio = ntracksTop/nevents;
+        double tracksBottomRatio = ntracksBottom/nevents;
+        double twoTrackRatio = nTwoTracks/nevents;
+        System.out.println("Number of tracks per event: " + tracksRatio);
+        System.out.println("Number of top tracks per event: " + tracksTopRatio);
+        System.out.println("Number of bottom tracks per event: " + tracksBottomRatio);
+        System.out.println("Number of two track events: " + twoTrackRatio);
+    }*/
+
+

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java	Wed Mar  9 11:43:24 2016
@@ -100,7 +100,7 @@
      * Set the name of the file to output efficiency data to
      */
     public void setEfficiencyOutputFile(String efficiencyOutputFile){
-    	this.efficiencyOutputFile = efficiencyOutputFile;
+        this.efficiencyOutputFile = efficiencyOutputFile;
     }
 
     /**
@@ -124,31 +124,31 @@
      * @param message : debug message
      */
     private void printDebug(String message){
-    	if(debug){
-    		System.out.println(this.getClass().getSimpleName() + ": " + message);
-    	}
+        if(debug){
+            System.out.println(this.getClass().getSimpleName() + ": " + message);
+        }
     }
     
     /**
      * 
      */
     protected void detectorChanged(Detector detector){
-    	super.detectorChanged(detector);
-    	
-    	sensors = detector.getSubdetector("Tracker").getDetectorElement().findDescendants(HpsSiSensor.class);
-    	
+        super.detectorChanged(detector);
+        
+        sensors = detector.getSubdetector("Tracker").getDetectorElement().findDescendants(HpsSiSensor.class);
+        
         // setup AIDA
         aida = AIDA.defaultInstance();
         aida.tree().cd("/");
         
         // Open the output file stream
         if(efficiencyOutputFile != null && momentumOutputFile != null){
-        	try{
-        		efficiencyOutput = new BufferedWriter(new FileWriter(efficiencyOutputFile));
+            try{
+                efficiencyOutput = new BufferedWriter(new FileWriter(efficiencyOutputFile));
                 momentumOutput = new BufferedWriter(new FileWriter(momentumOutputFile));
-        	} catch(Exception e){
-        		System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
-        	}
+            } catch(Exception e){
+                System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
+            }
         }
         
         // Get the total number of SVT layers
@@ -164,28 +164,28 @@
         }
 
         if(trackingEfficiencyPlots){
-        	plotters.add(PlotUtils.setupPlotter("Track Momentum", 0, 0));
-        	histo1D.add(aida.histogram1D("Momentum - Reconstructed Tracks", 14, 0, 5.6));
-        	PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Reconstructed Tracks", 0, "Momentum [GeV]", histo1D.get(histo1DIndex));
+            plotters.add(PlotUtils.setupPlotter("Track Momentum", 0, 0));
+            histo1D.add(aida.histogram1D("Momentum - Reconstructed Tracks", 14, 0, 5.6));
+            PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Reconstructed Tracks", 0, "Momentum [GeV]", histo1D.get(histo1DIndex));
             histo1DIndex++;            
             histo1D.add(aida.histogram1D("Momentum - Findable Tracks", 14, 0, 5.6));
-        	PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Findable Tracks", 0, "Momentum [GeV]", histo1D.get(histo1DIndex));
-        	plotterIndex++;
-        	histo1DIndex++;
+            PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Findable Tracks", 0, "Momentum [GeV]", histo1D.get(histo1DIndex));
+            plotterIndex++;
+            histo1DIndex++;
         }
         
         for(IPlotter plotter : plotters){
-        	plotter.show();
+            plotter.show();
         }
     }
     
     private String samplesToString(short[] samples){
-    	String sampleList = "[ ";
-    	for(short sample : samples){
-    		sampleList += Short.toString(sample) + ", ";
-    	}
-    	sampleList += "]";
-    	return sampleList;
+        String sampleList = "[ ";
+        for(short sample : samples){
+            sampleList += Short.toString(sample) + ", ";
+        }
+        sampleList += "]";
+        return sampleList;
     }
 
     /**
@@ -196,7 +196,7 @@
     @Override
     protected void process(EventHeader event){
         
-    	// For now, only look at events with a single track
+        // For now, only look at events with a single track
         if(event.get(Track.class, trackCollectionName).size() > 1) return;
         eventNumber++;
 
@@ -204,46 +204,46 @@
         if(!event.hasCollection(SimTrackerHit.class, simTrackerHitCollectionName)) return;
         List<SimTrackerHit> simTrackerHits = event.get(SimTrackerHit.class, simTrackerHitCollectionName);
         this.printDebug("\nEvent " + eventNumber + " contains " + simTrackerHits.size() + " SimTrackerHits");
-    	// Loop through all SimTrackerHits and confirm that a corresponding RawTrackerHit was created
-    	for(SimTrackerHit simTrackHit : simTrackerHits){
-    		
-    		this.printDebug("SimTrackerHit Layer Number: " + simTrackHit.getLayerNumber());
-    	}
+        // Loop through all SimTrackerHits and confirm that a corresponding RawTrackerHit was created
+        for(SimTrackerHit simTrackHit : simTrackerHits){
+            
+            this.printDebug("SimTrackerHit Layer Number: " + simTrackHit.getLayerNumber());
+        }
 
         // Get the list of RawTrackerHits and add them to the sensor readout
         List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
         String volume; 
         for(RawTrackerHit rawHit : rawHits){
-        	HpsSiSensor sensor = (HpsSiSensor) rawHit.getDetectorElement();
-        	if(sensor.isTopLayer()){
-        		volume = "Top Volume ";
-        	} else { 
-        		volume = "Bottom Volume ";
-        	}
-    		this.printDebug(volume + "RawTrackerHit Channel #: " + rawHit.getIdentifierFieldValue("strip") + " Layer Number: " + rawHit.getLayerNumber()
-    				+ " Samples: " + samplesToString(rawHit.getADCValues()));
+            HpsSiSensor sensor = (HpsSiSensor) rawHit.getDetectorElement();
+            if(sensor.isTopLayer()){
+                volume = "Top Volume ";
+            } else { 
+                volume = "Bottom Volume ";
+            }
+            this.printDebug(volume + "RawTrackerHit Channel #: " + rawHit.getIdentifierFieldValue("strip") + " Layer Number: " + rawHit.getLayerNumber()
+                    + " Samples: " + samplesToString(rawHit.getADCValues()));
             ((HpsSiSensor) rawHit.getDetectorElement()).getReadout().addHit(rawHit);
         }
         
         if(event.hasCollection(SiTrackerHit.class, siTrackerHitCollectionName)){
-        	List<SiTrackerHit> hitlist = event.get(SiTrackerHit.class, siTrackerHitCollectionName);
-        	for(SiTrackerHit siTrackerHit : hitlist){
-    			this.printDebug("Cluster is comprised by the following raw hits:");
-        		for(RawTrackerHit rawHit : siTrackerHit.getRawHits()){
-            		this.printDebug("RawTrackerHit Channel #: " + rawHit.getIdentifierFieldValue("strip") + " Layer Number: " + rawHit.getLayerNumber());
-        		}
-        	}
+            List<SiTrackerHit> hitlist = event.get(SiTrackerHit.class, siTrackerHitCollectionName);
+            for(SiTrackerHit siTrackerHit : hitlist){
+                this.printDebug("Cluster is comprised by the following raw hits:");
+                for(RawTrackerHit rawHit : siTrackerHit.getRawHits()){
+                    this.printDebug("RawTrackerHit Channel #: " + rawHit.getIdentifierFieldValue("strip") + " Layer Number: " + rawHit.getLayerNumber());
+                }
+            }
         }
         
         // Get the MC Particles associated with the SimTrackerHits
         List<MCParticle> mcParticles = event.getMCParticles();
         if(debug){
-        	String particleList = "[ ";
-        	for(MCParticle mcParticle : mcParticles){
-        		particleList += mcParticle.getPDGID() + ", ";
-        	}
-        	particleList += "]";
-        	this.printDebug("MC Particles: " + particleList);
+            String particleList = "[ ";
+            for(MCParticle mcParticle : mcParticles){
+                particleList += mcParticle.getPDGID() + ", ";
+            }
+            particleList += "]";
+            this.printDebug("MC Particles: " + particleList);
         }
         
         // Get the magnetic field
@@ -264,10 +264,10 @@
                 Set<SimTrackerHit> trackerHits = findable.getSimTrackerHits(mcParticle);
                 if(this.isSameSvtVolume(trackerHits)){
                     if(debug){
-                    	this.printDebug("Track is findable");
-                    	this.printDebug("MC particle momentum: " + mcParticle.getMomentum().toString());
-                    }
-                    	
+                        this.printDebug("Track is findable");
+                        this.printDebug("MC particle momentum: " + mcParticle.getMomentum().toString());
+                    }
+                        
                     findableTracks++;
                     trackIsFindable = true;      
                 }
@@ -303,8 +303,8 @@
         
         if(!mcParticles.isEmpty() && trackingEfficiencyPlots){
             // If the list still contains MC Particles, a matching track wasn't found
-        	this.printDebug("No matching track found");
-        	
+            this.printDebug("No matching track found");
+            
             // Check that all stereoHits were correctly assigned to an MCParticle
             for(MCParticle mcParticle : mcParticles){
                 
@@ -326,7 +326,7 @@
                 
                 // Determine if the MC particle passed through the top or bottom SVT volume
                 for(SimTrackerHit simHit : simHits){
-                	HpsSiSensor sensor = (HpsSiSensor) simHit.getDetectorElement();
+                    HpsSiSensor sensor = (HpsSiSensor) simHit.getDetectorElement();
                     if(sensor.isTopLayer()){
                         this.printDebug("MC Particle passed through the top layer");
                         isTopTrack = true;
@@ -376,7 +376,7 @@
     {
         int volumeIndex = 0;
         for(SimTrackerHit simTrackerHit : simTrackerHits){
-        	HpsSiSensor sensor = (HpsSiSensor) simTrackerHit.getDetectorElement();
+            HpsSiSensor sensor = (HpsSiSensor) simTrackerHit.getDetectorElement();
             if(sensor.isTopLayer()) volumeIndex++;
             else volumeIndex--;
         }
@@ -454,24 +454,24 @@
    @Override
    public void endOfData()
    { 
-	   
+       
        if(trackingEfficiencyPlots && efficiencyOutputFile != null && momentumOutputFile != null){
-	   	   try{ 
-	   		   int bins = aida.histogram1D("Momentum - Findable Tracks").axis().bins();
-	   		   for(int index = 0; index < bins; index++){
-	   			   if(aida.histogram1D("Momentum - Reconstructed Tracks").binEntries(index) == 0) efficiencyOutput.write(index + " " + 0 + "\n");
-	   			   else	efficiencyOutput.write(index + " " + aida.histogram1D("Momentum - Reconstructed Tracks").binEntries(index) + "\n");
-	   			   
+           try{ 
+               int bins = aida.histogram1D("Momentum - Findable Tracks").axis().bins();
+               for(int index = 0; index < bins; index++){
+                   if(aida.histogram1D("Momentum - Reconstructed Tracks").binEntries(index) == 0) efficiencyOutput.write(index + " " + 0 + "\n");
+                   else efficiencyOutput.write(index + " " + aida.histogram1D("Momentum - Reconstructed Tracks").binEntries(index) + "\n");
+                   
                    if(aida.histogram1D("Momentum - Findable Tracks").binEntries(index) == 0) momentumOutput.write(index + " " + 0 + "\n");
-	   			   else momentumOutput.write(index + " " + aida.histogram1D("Momentum - Findable Tracks").binEntries(index) + "\n");
-	   		   }
-	   		   efficiencyOutput.close();
+                   else momentumOutput.write(index + " " + aida.histogram1D("Momentum - Findable Tracks").binEntries(index) + "\n");
+               }
+               efficiencyOutput.close();
                momentumOutput.close();
-	   	   } catch(IOException e){
-	   		   System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
-	   	   }
+           } catch(IOException e){
+               System.out.println(this.getClass().getSimpleName() + ": Error! " + e.getMessage());
+           }
        } 
-	   
+       
         System.out.println("%===============================================================%");
         System.out.println("%============== Track Reconstruction Efficiencies ==============%");
         System.out.println("%===============================================================%\n%");

Modified: java/trunk/users/src/main/java/org/hps/users/omoreno/TestRunTrackReconEfficiency.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/omoreno/TestRunTrackReconEfficiency.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/TestRunTrackReconEfficiency.java	Wed Mar  9 11:43:24 2016
@@ -60,18 +60,18 @@
     boolean topTrigger = false;
      
     // Collection Names
-    String stereoHitCollectionName 		= "HelicalTrackHits";
-    String trackCollectionName 			= "MatchedTracks";
-    String ecalClustersCollectionName 	= "EcalClusters";
-    String triggerDataCollectionName 	= "TriggerBank";
+    String stereoHitCollectionName      = "HelicalTrackHits";
+    String trackCollectionName          = "MatchedTracks";
+    String ecalClustersCollectionName   = "EcalClusters";
+    String triggerDataCollectionName    = "TriggerBank";
     
     // Plots
     IHistogram1D findableTrackMomentum; 
     IHistogram1D totalTrackMomentum; 
-	IHistogram1D xPositionResidual;
-	IHistogram1D yPositionResidual;
-	IHistogram1D zPositionResidual;
-	IHistogram1D r;
+    IHistogram1D xPositionResidual;
+    IHistogram1D yPositionResidual;
+    IHistogram1D zPositionResidual;
+    IHistogram1D r;
 
     /**
      * Dflt Ctor
@@ -89,7 +89,7 @@
      * 
      */
     public void setThresholdEnergy(double thresholdEnergy){
-    	this.thresholdEnergy = thresholdEnergy;
+        this.thresholdEnergy = thresholdEnergy;
     }
 
     public void setClusterEnergyDifference(double energyDifference){ 
@@ -117,15 +117,15 @@
         plotterIndex++;
 
         // Create plot for diffence in track and cluster position
-		plotters.add(PlotUtils.setupPlotter("Track-Cluster Position Residual", 2, 2));
-		xPositionResidual = aida.histogram1D("x Residual", 100, -100, 100);
-		yPositionResidual = aida.histogram1D("y Residual", 100, -100, 100);
-		zPositionResidual = aida.histogram1D("z Residual", 100, -100, 100);
-		r = aida.histogram1D("r", 100, -100, 100);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "x Residual", 0, "delta x [mm]", xPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "y Residual", 1, "delta y [mm]", yPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "z Residual", 2, "delta z [mm]", zPositionResidual);
-		PlotUtils.setup1DRegion(plotters.get(plotterIndex), "r", 3, "r [mm]", r);
+        plotters.add(PlotUtils.setupPlotter("Track-Cluster Position Residual", 2, 2));
+        xPositionResidual = aida.histogram1D("x Residual", 100, -100, 100);
+        yPositionResidual = aida.histogram1D("y Residual", 100, -100, 100);
+        zPositionResidual = aida.histogram1D("z Residual", 100, -100, 100);
+        r = aida.histogram1D("r", 100, -100, 100);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "x Residual", 0, "delta x [mm]", xPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "y Residual", 1, "delta y [mm]", yPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "z Residual", 2, "delta z [mm]", zPositionResidual);
+        PlotUtils.setup1DRegion(plotters.get(plotterIndex), "r", 3, "r [mm]", r);
         plotterIndex++; 
 
         // Show all of the plotters
@@ -154,138 +154,138 @@
         // If the event has a single Ecal cluster satisfying the threshold cut, 
         // check if there is a track that is well matched to the cluster
         if(ecalClusters.size() == 1){
-        	Cluster ecalCluster = ecalClusters.get(0);
-        	
-        	// If the cluster is above the energy threshold, then the track should
-        	// be findable
-        	if(!isClusterAboveEnergyThreshold(ecalCluster)) return;
-        	findableSingleTracks++;
-        	
-        	double[] clusterPosition = ecalCluster.getPosition();
-        	
-        	if(clusterPosition[0] > 0 && clusterPosition[1] > 0) 	   findableSingleTracksQuad1++;
-        	else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) findableSingleTracksQuad2++;
-        	else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) findableSingleTracksQuad3++;
-        	else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) findableSingleTracksQuad4++;	
-        	
-        	if(!isClusterMatchedToTrack(ecalCluster, tracks)) return;
-        	foundSingleTracks++;
-
-        	if(clusterPosition[0] > 0 && clusterPosition[1] > 0) 	   foundSingleTracksQuad1++;
-        	else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) foundSingleTracksQuad2++;
-        	else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) foundSingleTracksQuad3++;
-        	else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) foundSingleTracksQuad4++;	
+            Cluster ecalCluster = ecalClusters.get(0);
+            
+            // If the cluster is above the energy threshold, then the track should
+            // be findable
+            if(!isClusterAboveEnergyThreshold(ecalCluster)) return;
+            findableSingleTracks++;
+            
+            double[] clusterPosition = ecalCluster.getPosition();
+            
+            if(clusterPosition[0] > 0 && clusterPosition[1] > 0)       findableSingleTracksQuad1++;
+            else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) findableSingleTracksQuad2++;
+            else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) findableSingleTracksQuad3++;
+            else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) findableSingleTracksQuad4++;  
+            
+            if(!isClusterMatchedToTrack(ecalCluster, tracks)) return;
+            foundSingleTracks++;
+
+            if(clusterPosition[0] > 0 && clusterPosition[1] > 0)       foundSingleTracksQuad1++;
+            else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) foundSingleTracksQuad2++;
+            else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) foundSingleTracksQuad3++;
+            else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) foundSingleTracksQuad4++; 
         }
         
         // Only look at events which have two Ecal cluster 
         if(ecalClusters.size() != 2) return;
 
         // Check that the Ecal clusters are in opposite Ecal volumes. If 
-       	// they don't, skip the event.
-       	if(!hasClustersInOppositeVolumes(ecalClusters)){
-       		this.printDebug("Ecal clusters are not in opposite volumes");
-       		return;
-       	}
-       	nOppositeVolume++;
+        // they don't, skip the event.
+        if(!hasClustersInOppositeVolumes(ecalClusters)){
+            this.printDebug("Ecal clusters are not in opposite volumes");
+            return;
+        }
+        nOppositeVolume++;
       
-       	// Check that the Ecal clusters lie within some pre-defined window. If
-       	// they don't, skip the event. 
+        // Check that the Ecal clusters lie within some pre-defined window. If
+        // they don't, skip the event. 
         if(!isClusterWithinWindow(ecalClusters.get(0)) || !isClusterWithinWindow(ecalClusters.get(1))){
-        		this.printDebug("Ecal cluster falls outside of window.");
-        		return;        	
+                this.printDebug("Ecal cluster falls outside of window.");
+                return;         
         }
         nWithinWindow++;
        
         // Check that the Ecal clusters are above the threshold energy.  If 
         // they don't, skip the event.
         if(!isClusterAboveEnergyThreshold(ecalClusters.get(0)) || !isClusterAboveEnergyThreshold(ecalClusters.get(1))){
-        		this.printDebug("Ecal cluster energies are below threshold.");
-        		return;        	        	
-        }
-       	nAboveThreshold++;
+                this.printDebug("Ecal cluster energies are below threshold.");
+                return;                     
+        }
+        nAboveThreshold++;
  
-       	// Check that the difference between the Ecal cluster energies is 
+        // Check that the difference between the Ecal cluster energies is 
         // reasonable
-       	double energyDiff = Math.abs(ecalClusters.get(0).getEnergy() - ecalClusters.get(1).getEnergy()); 
-       	if(energyDiff > energyDifference){
-       		this.printDebug("The energy difference between the two clusters is too great.");
-       		return;
-       	}
+        double energyDiff = Math.abs(ecalClusters.get(0).getEnergy() - ecalClusters.get(1).getEnergy()); 
+        if(energyDiff > energyDifference){
+            this.printDebug("The energy difference between the two clusters is too great.");
+            return;
+        }
        
         // Check if the event contains a collection of tracks.  If it doesn't,
         // move on to the next event.
         if(!event.hasCollection(Track.class, trackCollectionName)){
-        	this.printDebug("Event doesn't contain a collection of tracks!");
-        	return;
+            this.printDebug("Event doesn't contain a collection of tracks!");
+            return;
         }
 
 
         // If there are no tracks in the collection, move on to the next event. 
         if(tracks.isEmpty()){
-        	this.printDebug("Event doesn't contain any tracks!");
-        	return;  
+            this.printDebug("Event doesn't contain any tracks!");
+            return;  
         }
        
         // Sort the tracks by SVT volume
-    	topTracks = new ArrayList<Track>();
-    	botTracks = new ArrayList<Track>();
+        topTracks = new ArrayList<Track>();
+        botTracks = new ArrayList<Track>();
         for(Track track : tracks){
-    		if(track.getTrackStates().get(0).getZ0() > 0)  topTracks.add(track);
-    		else if(track.getTrackStates().get(0).getZ0() < 0) botTracks.add(track);
-    	}
-        
-       	// Get the trigger information from the event
-       	List<GenericObject> triggerData = event.get(GenericObject.class, triggerDataCollectionName);
-       	GenericObject triggerDatum = triggerData.get(0);
-       	if(triggerDatum.getIntVal(4) > 0){
-       		this.printDebug("Ecal triggered by top cluster");
-       		topTrigger = true;
-       	} else if(triggerDatum.getIntVal(5) > 0){
-       		this.printDebug("Ecal triggered by bottom cluster");       		
-       		topTrigger = false;
-       	}
-       	
-       	// Match a track to the trigger cluster
-       	Cluster matchedCluster = null; 
-       	for(Cluster ecalCluster : ecalClusters){
-       		if(ecalCluster.getPosition()[1] > 0 && topTrigger){
-       			if(!isClusterMatchedToTrack(ecalCluster, topTracks)){
-       				this.printDebug("Trigger cluster-track match was not found.");
-       				return;
-       			}
-       			matchedCluster = ecalCluster; 
-       			findableBottomTracks++;
-       			break;
-       		} else if( ecalCluster.getPosition()[1] < 0 && !topTrigger){
-       			if(!isClusterMatchedToTrack(ecalCluster, botTracks)){
-       				this.printDebug("Trigger cluster-track match was not found.");
-       				return;
-       			}
-       			matchedCluster = ecalCluster;
-       			findableTopTracks++;
-       			break;
-       		}
-       	}
-       	if(matchedCluster != null) ecalClusters.remove(matchedCluster);
-       	nTrigClusterTrackMatch++;
-       	
+            if(track.getTrackStates().get(0).getZ0() > 0)  topTracks.add(track);
+            else if(track.getTrackStates().get(0).getZ0() < 0) botTracks.add(track);
+        }
+        
+        // Get the trigger information from the event
+        List<GenericObject> triggerData = event.get(GenericObject.class, triggerDataCollectionName);
+        GenericObject triggerDatum = triggerData.get(0);
+        if(triggerDatum.getIntVal(4) > 0){
+            this.printDebug("Ecal triggered by top cluster");
+            topTrigger = true;
+        } else if(triggerDatum.getIntVal(5) > 0){
+            this.printDebug("Ecal triggered by bottom cluster");            
+            topTrigger = false;
+        }
+        
+        // Match a track to the trigger cluster
+        Cluster matchedCluster = null; 
+        for(Cluster ecalCluster : ecalClusters){
+            if(ecalCluster.getPosition()[1] > 0 && topTrigger){
+                if(!isClusterMatchedToTrack(ecalCluster, topTracks)){
+                    this.printDebug("Trigger cluster-track match was not found.");
+                    return;
+                }
+                matchedCluster = ecalCluster; 
+                findableBottomTracks++;
+                break;
+            } else if( ecalCluster.getPosition()[1] < 0 && !topTrigger){
+                if(!isClusterMatchedToTrack(ecalCluster, botTracks)){
+                    this.printDebug("Trigger cluster-track match was not found.");
+                    return;
+                }
+                matchedCluster = ecalCluster;
+                findableTopTracks++;
+                break;
+            }
+        }
+        if(matchedCluster != null) ecalClusters.remove(matchedCluster);
+        nTrigClusterTrackMatch++;
+        
         // If the cluster passes all requirements, then there is likely a track
         // associated with it
         findableTracks++;
         
         // Now check if a track is associated with the non-trigger cluster
         if(topTrigger){
-       			if(!isClusterMatchedToTrack(ecalClusters.get(0), botTracks)){
-       				this.printDebug("Non trigger cluster-track match was not found.");
-       				return;
-       			}
-       			totalBottomTracks++;
+                if(!isClusterMatchedToTrack(ecalClusters.get(0), botTracks)){
+                    this.printDebug("Non trigger cluster-track match was not found.");
+                    return;
+                }
+                totalBottomTracks++;
         } else if(!topTrigger){
-       			if(!isClusterMatchedToTrack(ecalClusters.get(0), topTracks)){
-       				this.printDebug("Non trigger cluster-track match was not found.");
-       				return;
-       			}        	       
-       			totalTopTracks++;
+                if(!isClusterMatchedToTrack(ecalClusters.get(0), topTracks)){
+                    this.printDebug("Non trigger cluster-track match was not found.");
+                    return;
+                }                  
+                totalTopTracks++;
         } 
         ++totalTracks; 
     }    
@@ -305,67 +305,67 @@
      * 
      */
     private boolean isClusterWithinWindow(Cluster clusterPosition){
-    	return true;
+        return true;
     }
     
     /**
      * 
      */
     private boolean isClusterAboveEnergyThreshold(Cluster ecalCluster){
-    	if(ecalCluster.getEnergy() > thresholdEnergy) return true;
-    	return false;
+        if(ecalCluster.getEnergy() > thresholdEnergy) return true;
+        return false;
     }
      
     /**
      * 
      */
     private boolean hasClustersInOppositeVolumes(List<Cluster> ecalClusters){
-    	this.printPosition(ecalClusters.get(0).getPosition());
-    	this.printPosition(ecalClusters.get(1).getPosition());
-    	if((ecalClusters.get(0).getPosition()[1] > 0 && ecalClusters.get(1).getPosition()[1] < 0)
-    			|| (ecalClusters.get(0).getPosition()[1] < 0 && ecalClusters.get(1).getPosition()[1] > 0)){
-    		return true; 	
-    	}
-    	return false;
+        this.printPosition(ecalClusters.get(0).getPosition());
+        this.printPosition(ecalClusters.get(1).getPosition());
+        if((ecalClusters.get(0).getPosition()[1] > 0 && ecalClusters.get(1).getPosition()[1] < 0)
+                || (ecalClusters.get(0).getPosition()[1] < 0 && ecalClusters.get(1).getPosition()[1] > 0)){
+            return true;    
+        }
+        return false;
     }
     
     /**
      * 
      */
     private boolean isClusterMatchedToTrack(Cluster cluster, List<Track> tracks){
-    	Hep3Vector clusterPos = new BasicHep3Vector(cluster.getPosition());
-    	double rMax = Double.MAX_VALUE;
-    	Track matchedTrack = null; 
-    	for(Track track : tracks){
-    		
-    		Hep3Vector trkPosAtShowerMax = TrackUtils.extrapolateTrack(track,clusterPos.z());
-    		if(Double.isNaN(trkPosAtShowerMax.x()) || Double.isNaN(trkPosAtShowerMax.y())){
-    			this.printDebug("Invalid track position");
-    			return false; 
-    		}
-    		this.printDebug("Track position at shower max: " + trkPosAtShowerMax.toString());
+        Hep3Vector clusterPos = new BasicHep3Vector(cluster.getPosition());
+        double rMax = Double.MAX_VALUE;
+        Track matchedTrack = null; 
+        for(Track track : tracks){
+            
+            Hep3Vector trkPosAtShowerMax = TrackUtils.extrapolateTrack(track,clusterPos.z());
+            if(Double.isNaN(trkPosAtShowerMax.x()) || Double.isNaN(trkPosAtShowerMax.y())){
+                this.printDebug("Invalid track position");
+                return false; 
+            }
+            this.printDebug("Track position at shower max: " + trkPosAtShowerMax.toString());
  
-    		// Find the distance between the track position at shower
-    		// max and the cluster position
-    		double r = VecOp.sub(trkPosAtShowerMax, clusterPos).magnitude();
-    		this.printDebug("Distance between Ecal cluster and track position at shower max: " + r + " mm");
-        	
-    		// Check if the track is the closest to the cluster.  If it is, then
-    		// save the track and contineu looping over all other tracks
-    		if (r < rMax /*&& r <= maxTrackClusterDistance*/) {
-    			rMax = r;
-    			matchedTrack = track;
-    		}
-    	}
-    	if(matchedTrack != null) return true;
-    	return false;
+            // Find the distance between the track position at shower
+            // max and the cluster position
+            double r = VecOp.sub(trkPosAtShowerMax, clusterPos).magnitude();
+            this.printDebug("Distance between Ecal cluster and track position at shower max: " + r + " mm");
+            
+            // Check if the track is the closest to the cluster.  If it is, then
+            // save the track and contineu looping over all other tracks
+            if (r < rMax /*&& r <= maxTrackClusterDistance*/) {
+                rMax = r;
+                matchedTrack = track;
+            }
+        }
+        if(matchedTrack != null) return true;
+        return false;
     }
     
     /**
      * 
      */
     private void printPosition(double[] position){
-    	this.printDebug("[ " + position[0] + ", " + position[1] + ", " + position[2] + " ]");
+        this.printDebug("[ " + position[0] + ", " + position[1] + ", " + position[2] + " ]");
     }
     
     
@@ -373,28 +373,28 @@
     public void endOfData(){ 
         System.out.println("%===================================================================% \n");
         if(findableSingleTracks > 0){
-        	System.out.println("% Total single track efficiency: " + foundSingleTracks + " / " + findableSingleTracks + " = " + (foundSingleTracks/findableSingleTracks)*100 + "%");
+            System.out.println("% Total single track efficiency: " + foundSingleTracks + " / " + findableSingleTracks + " = " + (foundSingleTracks/findableSingleTracks)*100 + "%");
         }
         if(findableSingleTracksQuad1 > 0){
-        	System.out.println("% Total single track efficiency - Quad 1: " + foundSingleTracksQuad1 + " / " + findableSingleTracksQuad1 + " = " + (foundSingleTracksQuad1/findableSingleTracksQuad1)*100 + "%");
+            System.out.println("% Total single track efficiency - Quad 1: " + foundSingleTracksQuad1 + " / " + findableSingleTracksQuad1 + " = " + (foundSingleTracksQuad1/findableSingleTracksQuad1)*100 + "%");
         }
         if(findableSingleTracksQuad2 > 0){
-        	System.out.println("% Total single track efficiency - Quad 2: " + foundSingleTracksQuad2 + " / " + findableSingleTracksQuad2 + " = " + (foundSingleTracksQuad2/findableSingleTracksQuad2)*100 + "%");
+            System.out.println("% Total single track efficiency - Quad 2: " + foundSingleTracksQuad2 + " / " + findableSingleTracksQuad2 + " = " + (foundSingleTracksQuad2/findableSingleTracksQuad2)*100 + "%");
         }
         if(findableSingleTracksQuad3 > 0){
-        	System.out.println("% Total single track efficiency - Quad 3: " + foundSingleTracksQuad3 + " / " + findableSingleTracksQuad3 + " = " + (foundSingleTracksQuad3/findableSingleTracksQuad3)*100 + "%");
+            System.out.println("% Total single track efficiency - Quad 3: " + foundSingleTracksQuad3 + " / " + findableSingleTracksQuad3 + " = " + (foundSingleTracksQuad3/findableSingleTracksQuad3)*100 + "%");
         }
         if(findableSingleTracksQuad4 > 0){
-        	System.out.println("% Total single track efficiency - Quad 4: " + foundSingleTracksQuad4 + " / " + findableSingleTracksQuad4 + " = " + (foundSingleTracksQuad4/findableSingleTracksQuad4)*100 + "%");
+            System.out.println("% Total single track efficiency - Quad 4: " + foundSingleTracksQuad4 + " / " + findableSingleTracksQuad4 + " = " + (foundSingleTracksQuad4/findableSingleTracksQuad4)*100 + "%");
         }
         if(nOppositeVolume > 0){
-        	System.out.println("% Total events passing opposite volume requirement: " + nOppositeVolume + " / " + eventNumber + " = " + (nOppositeVolume/eventNumber)*100 + "%");
+            System.out.println("% Total events passing opposite volume requirement: " + nOppositeVolume + " / " + eventNumber + " = " + (nOppositeVolume/eventNumber)*100 + "%");
         }
         if(nAboveThreshold > 0){
-        	System.out.println("% Total events with both clusters above energy threshold: " + nAboveThreshold + " / " + eventNumber + " = " + (nAboveThreshold/eventNumber)*100 + "%");
+            System.out.println("% Total events with both clusters above energy threshold: " + nAboveThreshold + " / " + eventNumber + " = " + (nAboveThreshold/eventNumber)*100 + "%");
         }
         if(nTrigClusterTrackMatch > 0){
-        	System.out.println("% Total events with a trigger cluster-track match: " + nTrigClusterTrackMatch + " / " + eventNumber + " = " + (nTrigClusterTrackMatch/eventNumber)*100 + "%");
+            System.out.println("% Total events with a trigger cluster-track match: " + nTrigClusterTrackMatch + " / " + eventNumber + " = " + (nTrigClusterTrackMatch/eventNumber)*100 + "%");
         }
         if(findableTracks > 0){
             System.out.println("% Total Track Reconstruction Efficiency: " + totalTracks + " / " + findableTracks + " = " + (totalTracks / findableTracks) * 100 + "%");

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/FastTrackResidualDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/FastTrackResidualDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/FastTrackResidualDriver.java	Wed Mar  9 11:43:24 2016
@@ -78,11 +78,11 @@
     }
     
     public void detectorChanged(Detector detector) {
-	// Get the Subdetector.
-	ecal = detector.getSubdetector(ecalName);
-
-	// Cache ref to decoder.
-	dec = ecal.getIDDecoder();
+    // Get the Subdetector.
+    ecal = detector.getSubdetector(ecalName);
+
+    // Cache ref to decoder.
+    dec = ecal.getIDDecoder();
         
         //Ecal geometry
         crystalX = (13.3 + 16.0) / 2;
@@ -793,7 +793,7 @@
                 style.setParameter("hist2DStyle", "colorMap");
                 style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
                 ((PlotterRegion) plotter_ecalhitmult.region(idx)).getPlot().setAllowUserInteraction(false);
-		((PlotterRegion) plotter_ecalhitmult.region(idx)).getPlot().setAllowPopupMenus(false);
+        ((PlotterRegion) plotter_ecalhitmult.region(idx)).getPlot().setAllowPopupMenus(false);
           }
                
         

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/GblResidualDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/GblResidualDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/GblResidualDriver.java	Wed Mar  9 11:43:24 2016
@@ -156,7 +156,7 @@
             
             // select GBL tracks
             if(TrackType.isGBL(track.getType())) {
-            	
+                
                 TrackState stateIP = null;
                 TrackState stateLast = null;
                 for(TrackState state : track.getTrackStates()) {
@@ -164,14 +164,14 @@
                     if (state.getLocation() == TrackState.AtIP) stateIP = state;
                 }
 
-            	System.out.println("Event " + event.getEventNumber() 
-            			+ " gbl track parameters " + 
-            			stateIP.getD0() + " " +
-            			stateIP.getZ0() + " " +
-            			stateIP.getPhi() + " " +
-            			stateIP.getOmega() + " " +
-            			stateIP.getTanLambda()
-            			);
+                System.out.println("Event " + event.getEventNumber() 
+                        + " gbl track parameters " + 
+                        stateIP.getD0() + " " +
+                        stateIP.getZ0() + " " +
+                        stateIP.getPhi() + " " +
+                        stateIP.getOmega() + " " +
+                        stateIP.getTanLambda()
+                        );
 
 
                 // find seed track

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/SimpleResiduals.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/SimpleResiduals.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/SimpleResiduals.java	Wed Mar  9 11:43:24 2016
@@ -98,11 +98,11 @@
     }
     
     public void detectorChanged(Detector detector) {
-	// Get the Subdetector.
-	ecal = detector.getSubdetector(ecalName);
-
-	// Cache ref to decoder.
-	dec = ecal.getIDDecoder();
+    // Get the Subdetector.
+    ecal = detector.getSubdetector(ecalName);
+
+    // Cache ref to decoder.
+    dec = ecal.getIDDecoder();
     }
     
     public SimpleResiduals() {

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/gbl/GBLDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/gbl/GBLDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/gbl/GBLDriver.java	Wed Mar  9 11:43:24 2016
@@ -22,81 +22,81 @@
  */
 public class GBLDriver extends Driver {
 
-	private boolean _debug = false;
-	private boolean _isMC = false;
-	MaterialSupervisor _materialManager = null;
-	MultipleScattering _scattering = null;
-	private HpsGblFitter _gbl_fitter = null; 
-	private String milleBinaryName = "";
-	
-	public GBLDriver() {
-	}
-	
-	public void setDebug(boolean debug) {
-		_debug = debug;
-	}
-	
-	public void setIsMC(boolean mcflag) {
-		_isMC = mcflag;
-	}
-	
-	protected void detectorChanged(Detector det) {
-	    System.out.printf("%s: detectorChanged\n",getClass().getSimpleName());
+    private boolean _debug = false;
+    private boolean _isMC = false;
+    MaterialSupervisor _materialManager = null;
+    MultipleScattering _scattering = null;
+    private HpsGblFitter _gbl_fitter = null; 
+    private String milleBinaryName = "";
+    
+    public GBLDriver() {
+    }
+    
+    public void setDebug(boolean debug) {
+        _debug = debug;
+    }
+    
+    public void setIsMC(boolean mcflag) {
+        _isMC = mcflag;
+    }
+    
+    protected void detectorChanged(Detector det) {
+        System.out.printf("%s: detectorChanged\n",getClass().getSimpleName());
         Hep3Vector bfieldvec = det.getFieldMap().getField(new BasicHep3Vector(0., 1., 0.));
         double bfield = bfieldvec.y();
         System.out.printf("%s: b-field %s\n",getClass().getSimpleName(),bfieldvec.toString());
-		 _materialManager = new MaterialSupervisor();
-		 _scattering = new MultipleScattering(_materialManager);
-		 _materialManager.buildModel(det);
-		 _scattering.setBField(Math.abs(bfield)); // only absolute of B is needed as it's used for momentum calculation only
-		 _gbl_fitter = new HpsGblFitter(bfield, _scattering, _isMC);
-		 if(!milleBinaryName.equalsIgnoreCase("")) {
-			 _gbl_fitter.setMilleBinary(new MilleBinary());
-		 }
-		 System.out.printf("%s: detectorChanged end\n",getClass().getSimpleName());
-	}
+         _materialManager = new MaterialSupervisor();
+         _scattering = new MultipleScattering(_materialManager);
+         _materialManager.buildModel(det);
+         _scattering.setBField(Math.abs(bfield)); // only absolute of B is needed as it's used for momentum calculation only
+         _gbl_fitter = new HpsGblFitter(bfield, _scattering, _isMC);
+         if(!milleBinaryName.equalsIgnoreCase("")) {
+             _gbl_fitter.setMilleBinary(new MilleBinary());
+         }
+         System.out.printf("%s: detectorChanged end\n",getClass().getSimpleName());
+    }
 
-	protected void process(EventHeader event) {
+    protected void process(EventHeader event) {
 
-		List<Track> seedTracks = null;
+        List<Track> seedTracks = null;
         if(event.hasCollection(Track.class,"MatchedTracks")) {        
             seedTracks = event.get(Track.class, "MatchedTracks");
              if(_debug) {
                 System.out.printf("%s: Event %d has %d tracks\n", this.getClass().getSimpleName(),event.getEventNumber(),seedTracks.size());
              }
         } else {
-        	 if(_debug) {
+             if(_debug) {
                  System.out.printf("%s: No tracks in Event %d \n", this.getClass().getSimpleName(),event.getEventNumber());
               }
-        	 return;
+             return;
         }
-	    
+        
         
         for(int itrack = 0; itrack < seedTracks.size(); ++itrack) {
 
-        	if(_debug) {
-        		System.out.printf("%s: do the fit for track  %d \n", this.getClass().getSimpleName(),itrack);
-        	}
+            if(_debug) {
+                System.out.printf("%s: do the fit for track  %d \n", this.getClass().getSimpleName(),itrack);
+            }
 
-        	// Reset
-        	_gbl_fitter.clear();
-        	
-        	// Run the GBL fit on this track
-        	int status = _gbl_fitter.Fit(seedTracks.get(itrack));
+            // Reset
+            _gbl_fitter.clear();
+            
+            // Run the GBL fit on this track
+            int status = _gbl_fitter.Fit(seedTracks.get(itrack));
         
-        	if(_debug) {
-        		System.out.printf("%s: fit status %d \n", this.getClass().getSimpleName(),status);
-        	}
+            if(_debug) {
+                System.out.printf("%s: fit status %d \n", this.getClass().getSimpleName(),status);
+            }
         
         }
         
         
         
-	}
+    }
 
-	protected void endOfData() {
-	}
+    protected void endOfData() {
+    }
 
 
-	
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/gbl/HpsGblFitter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/gbl/HpsGblFitter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/gbl/HpsGblFitter.java	Wed Mar  9 11:43:24 2016
@@ -118,7 +118,7 @@
         // Store the projection from local to measurement frame for each strip cluster
         // need to use pointer for TMatrix here?
 //        Map<Integer, Matrix> proL2m_list = new HashMap<Integer, Matrix>();
-        // Save the association between strip cluster and label	
+        // Save the association between strip cluster and label 
 //        Map<HelicalTrackStrip, Integer> stripLabelMap = new HashMap<HelicalTrackStrip, Integer>();
         //start trajectory at refence point (s=0) - this point has no measurement
         GblPoint ref_point = new GblPoint(jacPointToPoint);
@@ -253,7 +253,7 @@
             BasicMatrix meas = new BasicMatrix(1, 2);
             meas.setElement(0, 0, res_meas.x());
             meas.setElement(0, 1, 0.);
-//			    //meas[0][0] += deltaU[iLayer] # misalignment
+//              //meas[0][0] += deltaU[iLayer] # misalignment
 
             BasicMatrix measErr = new BasicMatrix(1, 2);
             measErr.setElement(0, 0, res_err_meas.x());
@@ -411,7 +411,7 @@
         //double diff = endTime - startTime;
         //double cps = CLOCKS_PER_SEC;
         //if( m_debug ) {
-        //	std::cout << "HpsGblFitter: " << " Time elapsed " << diff / cps << " s" << std::endl;
+        //  std::cout << "HpsGblFitter: " << " Time elapsed " << diff / cps << " s" << std::endl;
         //}
         if (_debug) {
             System.out.printf("%s:  Fit() done successfully.\n", this.getClass().getSimpleName());

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/testrun/TrigRateDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/testrun/TrigRateDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/testrun/TrigRateDriver.java	Wed Mar  9 11:43:24 2016
@@ -80,11 +80,11 @@
     }
     
     public void detectorChanged(Detector detector) {
-	// Get the Subdetector.
-	ecal = detector.getSubdetector(ecalName);
-
-	// Cache ref to decoder.
-	dec = ecal.getIDDecoder();
+    // Get the Subdetector.
+    ecal = detector.getSubdetector(ecalName);
+
+    // Cache ref to decoder.
+    dec = ecal.getIDDecoder();
         
         //plotterFrame = new AIDAFrame();
         //plotterFrame.setTitle("TrigRateFrame");

Modified: java/trunk/users/src/main/java/org/hps/users/phansson/tools/TrackingGeometryChecker.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/phansson/tools/TrackingGeometryChecker.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/tools/TrackingGeometryChecker.java	Wed Mar  9 11:43:24 2016
@@ -14,29 +14,29 @@
 import org.lcsim.geometry.Detector;
 import org.lcsim.util.Driver;
 
-/**	 
+/**  
  * Check tracking geometry.
  * @author Per Hansson Adrian <[log in to unmask]>
  *
  */
 public class TrackingGeometryChecker extends Driver {
 
-	private int debug = 1;
+    private int debug = 1;
 
-	/**
-	 * Check tracking geometry.
-	 */
-	public TrackingGeometryChecker() {
-	}
-	
-	protected void detectorChanged(Detector arg0) {
-		super.detectorChanged(arg0);
-		
-		 // Get all of the sensors composing the SVT and add them to the set of all sensors
+    /**
+     * Check tracking geometry.
+     */
+    public TrackingGeometryChecker() {
+    }
+    
+    protected void detectorChanged(Detector arg0) {
+        super.detectorChanged(arg0);
+        
+         // Get all of the sensors composing the SVT and add them to the set of all sensors
         IDetectorElement detectorElement = arg0.getDetectorElement().findDetectorElement("Tracker");
         IIdentifierHelper helper = detectorElement.getIdentifierHelper();
         List<HpsSiSensor> sensors = new ArrayList<HpsSiSensor>();
-		sensors.addAll(detectorElement.findDescendants(HpsSiSensor.class));
+        sensors.addAll(detectorElement.findDescendants(HpsSiSensor.class));
         System.out.printf("%s: Total number of sensors: %d\n",getClass().getSimpleName(), sensors.size());
 
         IIdentifier sensorIdent;
@@ -70,57 +70,57 @@
             IDetectorElement m = sensor;
             int im=0;
             while((m=m.getParent()) != null) {
-            	System.out.printf("%s: DE mother %d name %s\n",getClass().getSimpleName(), im, m.getName());
-            	if(m.hasGeometryInfo()) {
-            		System.out.printf("%s: DE mother %d pos  %s\n",getClass().getSimpleName(), im, m.getGeometry().getPosition().toString());
-            	} else {
-            		System.out.printf("%s: DE mother - no geom info - \n",getClass().getSimpleName(), im);            		
-            	}
+                System.out.printf("%s: DE mother %d name %s\n",getClass().getSimpleName(), im, m.getName());
+                if(m.hasGeometryInfo()) {
+                    System.out.printf("%s: DE mother %d pos  %s\n",getClass().getSimpleName(), im, m.getGeometry().getPosition().toString());
+                } else {
+                    System.out.printf("%s: DE mother - no geom info - \n",getClass().getSimpleName(), im);                  
+                }
                 im++;
             }
 
             
         }
-		
-	}
-	
-	protected void startOfData() {
-		super.startOfData();
-	}
-	
-	protected void process(EventHeader event) {
-		
-	    
-//		List<SimTrackerHit> simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits");
+        
+    }
+    
+    protected void startOfData() {
+        super.startOfData();
+    }
+    
+    protected void process(EventHeader event) {
+        
+        
+//      List<SimTrackerHit> simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits");
 //        if (simTrackerHits == null) {
 //            throw new RuntimeException("Missing SimTrackerHit collection");
 //        }
 //        
 //        if(debug>0) System.out.printf("%s: found %d simTrackerHits\n",getClass().getSimpleName(),simTrackerHits.size());
 //        for(SimTrackerHit simTrackerHit : simTrackerHits) {
-//        	if(debug>0) printSimTrackerHitInfo(simTrackerHit);
+//          if(debug>0) printSimTrackerHitInfo(simTrackerHit);
 //        }
-	}
-	
-	protected void endOfData() {
-		super.endOfData();
-	}
+    }
+    
+    protected void endOfData() {
+        super.endOfData();
+    }
 
-	protected int getDebug() {
-		return debug;
-	}
+    protected int getDebug() {
+        return debug;
+    }
 
-	protected void setDebug(int debug) {
-		this.debug = debug;
-	}
+    protected void setDebug(int debug) {
+        this.debug = debug;
+    }
 
-	private static void printSimTrackerHitInfo(SimTrackerHit simTrackerHit) {
-		System.out.printf("\nSimTrackerHit:\n");
-		System.out.printf("\t position: %s\n",simTrackerHit.getPositionVec().toString());
-		System.out.printf("\t DetectorElement: %s\n",simTrackerHit.getDetectorElement().getName());
-		System.out.printf("\t DetectorElement position: %s\n",simTrackerHit.getDetectorElement().getGeometry().getPosition().toString());
-		System.out.printf("\t PhysVol name at position: %s\n",simTrackerHit.getDetectorElement().getGeometry().getPhysicalVolume(simTrackerHit.getPositionVec()).getName());
-	}
+    private static void printSimTrackerHitInfo(SimTrackerHit simTrackerHit) {
+        System.out.printf("\nSimTrackerHit:\n");
+        System.out.printf("\t position: %s\n",simTrackerHit.getPositionVec().toString());
+        System.out.printf("\t DetectorElement: %s\n",simTrackerHit.getDetectorElement().getName());
+        System.out.printf("\t DetectorElement position: %s\n",simTrackerHit.getDetectorElement().getGeometry().getPosition().toString());
+        System.out.printf("\t PhysVol name at position: %s\n",simTrackerHit.getDetectorElement().getGeometry().getPhysicalVolume(simTrackerHit.getPositionVec()).getName());
+    }
 }
 
 

Modified: java/trunk/users/src/main/java/org/hps/users/rafo/test1.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/rafo/test1.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/rafo/test1.java	Wed Mar  9 11:43:24 2016
@@ -4,15 +4,15 @@
 import org.lcsim.util.Driver;
 
 public class test1 extends Driver {
-	private int clusterID;
+    private int clusterID;
     
-	public void process(EventHeader event) {
-    	System.out.println("The cluster ID = " + clusterID);
-	}
+    public void process(EventHeader event) {
+        System.out.println("The cluster ID = " + clusterID);
+    }
     
-	public void setClusterID(int clusterID) {
-    	this.clusterID = clusterID;
-	}
+    public void setClusterID(int clusterID) {
+        this.clusterID = clusterID;
+    }
 }
 
 

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/GetChargeFromScalersMultirun.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/GetChargeFromScalersMultirun.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/GetChargeFromScalersMultirun.java	Wed Mar  9 11:43:24 2016
@@ -18,144 +18,144 @@
  *
  */
 public class GetChargeFromScalersMultirun {
-	private static ArrayList<String> runs;
-	private static ArrayList<Date> starts;
-	private static ArrayList<Date> ends;
+    private static ArrayList<String> runs;
+    private static ArrayList<Date> starts;
+    private static ArrayList<Date> ends;
 
-	public static void main(String[] arg) throws FileNotFoundException, ParseException{
-		String inputFile = arg[0];
-		String timingInfoFile = arg[1];
-		String outputFile = arg[2];
-		
-		
-		readTimingInfoFile(timingInfoFile);
-		
-		Map map = getCharges(runs, starts, ends, inputFile);
-		mergeBiasIntervals(map);
-		
-		ArrayList<String> keys = new ArrayList(map.keySet());
-		Collections.sort(keys);
-		
-		
-		PrintWriter pw = new PrintWriter(new File(outputFile));
-		for(String s : keys){
-			pw.println(s + "\t" + map.get(s));
-			System.out.println(s + "\t" + map.get(s));
-		}
-		pw.close();
-	}
+    public static void main(String[] arg) throws FileNotFoundException, ParseException{
+        String inputFile = arg[0];
+        String timingInfoFile = arg[1];
+        String outputFile = arg[2];
+        
+        
+        readTimingInfoFile(timingInfoFile);
+        
+        Map map = getCharges(runs, starts, ends, inputFile);
+        mergeBiasIntervals(map);
+        
+        ArrayList<String> keys = new ArrayList(map.keySet());
+        Collections.sort(keys);
+        
+        
+        PrintWriter pw = new PrintWriter(new File(outputFile));
+        for(String s : keys){
+            pw.println(s + "\t" + map.get(s));
+            System.out.println(s + "\t" + map.get(s));
+        }
+        pw.close();
+    }
 
-	static void readTimingInfoFile(String s) throws FileNotFoundException, ParseException{
-		Scanner scanner = new Scanner(new File(s));
-		scanner.useDelimiter("[\n\t]");
-		runs = new ArrayList();
-		starts = new ArrayList();
-		ends = new ArrayList();
-		DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z");
-		
-		while(scanner.hasNext()){
-			runs.add(scanner.next());
-			String n = scanner.next();
-			if(n.matches("\\d+"))
-				starts.add(new Date(Long.parseLong(n)));
-			else 
-				starts.add(df.parse(n));
-			n = scanner.next();
-			if(n.matches("\\d+"))
-				ends.add(new Date(Long.parseLong(n)));
-			else 
-				ends.add(df.parse(n));
-			
-		}
-		scanner.close();
-	}
-	
-	
-	
-	
-	
-	/**
-	 * returns charge in microCoulombs
-	 * @param runs names of the runs   
-	 * @param starts starting times of the runs
-	 * @param ends ending times of the runs
-	 * @param file the mya file that we need to use
-	 * @return a map relating the runs to the charges (uC).  
-	 * @throws FileNotFoundException
-	 */
-	
-	static Map<String, Double> getCharges(ArrayList<String> runs, ArrayList<Date> starts, ArrayList<Date> ends, String file) throws FileNotFoundException{
-		Scanner s = new Scanner(new File(file));
-		HashMap<String, Double> map = new HashMap();
-		long prev = 0;
-		long time = 0;
-		for(int i = 0; i< runs.size(); i++){
-			long endt = ends.get(i).getTime();
-			long startt = starts.get(i).getTime();
-			
-			double charge = 0;
-			boolean started = false;
-			double prevval = 0;
-			if(time > endt){
-				s.close();
-				s = new Scanner(new File(file));
-			}
-			inner : while(s.hasNext()){
-				String var = s.next();
-				prev = time;
-				time = s.nextLong()*1000; //convert from s to ms
+    static void readTimingInfoFile(String s) throws FileNotFoundException, ParseException{
+        Scanner scanner = new Scanner(new File(s));
+        scanner.useDelimiter("[\n\t]");
+        runs = new ArrayList();
+        starts = new ArrayList();
+        ends = new ArrayList();
+        DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z");
+        
+        while(scanner.hasNext()){
+            runs.add(scanner.next());
+            String n = scanner.next();
+            if(n.matches("\\d+"))
+                starts.add(new Date(Long.parseLong(n)));
+            else 
+                starts.add(df.parse(n));
+            n = scanner.next();
+            if(n.matches("\\d+"))
+                ends.add(new Date(Long.parseLong(n)));
+            else 
+                ends.add(df.parse(n));
+            
+        }
+        scanner.close();
+    }
+    
+    
+    
+    
+    
+    /**
+     * returns charge in microCoulombs
+     * @param runs names of the runs   
+     * @param starts starting times of the runs
+     * @param ends ending times of the runs
+     * @param file the mya file that we need to use
+     * @return a map relating the runs to the charges (uC).  
+     * @throws FileNotFoundException
+     */
+    
+    static Map<String, Double> getCharges(ArrayList<String> runs, ArrayList<Date> starts, ArrayList<Date> ends, String file) throws FileNotFoundException{
+        Scanner s = new Scanner(new File(file));
+        HashMap<String, Double> map = new HashMap();
+        long prev = 0;
+        long time = 0;
+        for(int i = 0; i< runs.size(); i++){
+            long endt = ends.get(i).getTime();
+            long startt = starts.get(i).getTime();
+            
+            double charge = 0;
+            boolean started = false;
+            double prevval = 0;
+            if(time > endt){
+                s.close();
+                s = new Scanner(new File(file));
+            }
+            inner : while(s.hasNext()){
+                String var = s.next();
+                prev = time;
+                time = s.nextLong()*1000; //convert from s to ms
 
-				double val = s.nextDouble();
-				if(!var.equals("scaler_calc1"))
-					continue;
-				
-				if(!started && time> startt){ //first sample in the run
-					charge += (val)/2.*(time-startt);
-					started= true;
-				}
-				
-				else if(time > startt && endt > time){ //middle samples in the run
-					charge += (val/*+prevval*/)/*/2.*/*(time-prev);
-					
-				}
-				
-				if(endt < time){ //last sample that is in the run
-					charge += (/*prev*/val)/2.*(endt-prev);
-					break inner;
-				}
-				prevval = val;
-			}
-			charge/=1e6;
-			map.put(runs.get(i), charge);
-		}
-		s.close();
-		return map;
+                double val = s.nextDouble();
+                if(!var.equals("scaler_calc1"))
+                    continue;
+                
+                if(!started && time> startt){ //first sample in the run
+                    charge += (val)/2.*(time-startt);
+                    started= true;
+                }
+                
+                else if(time > startt && endt > time){ //middle samples in the run
+                    charge += (val/*+prevval*/)/*/2.*/*(time-prev);
+                    
+                }
+                
+                if(endt < time){ //last sample that is in the run
+                    charge += (/*prev*/val)/2.*(endt-prev);
+                    break inner;
+                }
+                prevval = val;
+            }
+            charge/=1e6;
+            map.put(runs.get(i), charge);
+        }
+        s.close();
+        return map;
 
-	}
-	
-	/**
-	 * If the subsections of the runs in which the bias is on are labeled according to a scheme,
-	they will be added together.  
-	for instance, 5779a, 5779b, 5779c, etc. will be added up as 5779bias.   
-	 * @param map the map of run names (and portions of runs that have bias labeled as [run number][a,b,c,d...],
-	 * corresponding to the total charge in that run (or piece of a run).  
-	 */
-	static void mergeBiasIntervals(Map<String, Double> map){
-		Map<String, Double> map2 = new HashMap();
-		for(Map.Entry<String, Double> entry : map.entrySet()){
-			String key1 = entry.getKey();
-			if(!entry.getKey().matches("\\d+a"))
-					continue;
-			double charge = entry.getValue();
-			for(Map.Entry<String, Double> entry2 : map.entrySet()){
-				if(entry2.getKey().matches(key1.substring(0, 4) + "[b-z]"))
-						charge += entry2.getValue();
-			}
-			map2.put(key1.substring(0, 4) + "bias", charge);
-			
-		}
-		for(Map.Entry<String, Double> e : map2.entrySet()){
-			map.put(e.getKey(), e.getValue());
-		}
-	}
+    }
+    
+    /**
+     * If the subsections of the runs in which the bias is on are labeled according to a scheme,
+    they will be added together.  
+    for instance, 5779a, 5779b, 5779c, etc. will be added up as 5779bias.   
+     * @param map the map of run names (and portions of runs that have bias labeled as [run number][a,b,c,d...],
+     * corresponding to the total charge in that run (or piece of a run).  
+     */
+    static void mergeBiasIntervals(Map<String, Double> map){
+        Map<String, Double> map2 = new HashMap();
+        for(Map.Entry<String, Double> entry : map.entrySet()){
+            String key1 = entry.getKey();
+            if(!entry.getKey().matches("\\d+a"))
+                    continue;
+            double charge = entry.getValue();
+            for(Map.Entry<String, Double> entry2 : map.entrySet()){
+                if(entry2.getKey().matches(key1.substring(0, 4) + "[b-z]"))
+                        charge += entry2.getValue();
+            }
+            map2.put(key1.substring(0, 4) + "bias", charge);
+            
+        }
+        for(Map.Entry<String, Double> e : map2.entrySet()){
+            map.put(e.getKey(), e.getValue());
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/HitrateHistograms.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/HitrateHistograms.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/HitrateHistograms.java	Wed Mar  9 11:43:24 2016
@@ -19,109 +19,109 @@
 import org.lcsim.util.Driver;
 
 public class HitrateHistograms extends Driver{
-	HashMap<String, IHistogram2D[]> hist2d = new HashMap<String, IHistogram2D[]>();
+    HashMap<String, IHistogram2D[]> hist2d = new HashMap<String, IHistogram2D[]>();
 
-	IAnalysisFactory af = IAnalysisFactory.create();
-	IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
-	IPlotterFactory pf = af.createPlotterFactory();
-	public HitrateHistograms(){
-		addHistograms2D("Ecal", 1, -30, 30, -8, 16);
-		addHistograms2D("muon", 8, -30, 30, -8, 16);
+    IAnalysisFactory af = IAnalysisFactory.create();
+    IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
+    IPlotterFactory pf = af.createPlotterFactory();
+    public HitrateHistograms(){
+        addHistograms2D("Ecal", 1, -30, 30, -8, 16);
+        addHistograms2D("muon", 8, -30, 30, -8, 16);
 
-		try {
-			ecalDecoder = new IDDecoder(new IDDescriptor("system:0:6,layer:6:2,ix:8:-8,iy:16:-6"));
-		} catch (IDException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+        try {
+            ecalDecoder = new IDDecoder(new IDDescriptor("system:0:6,layer:6:2,ix:8:-8,iy:16:-6"));
+        } catch (IDException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
 
 
 
-	}
-	private void addHistograms2D(String detector, int nLayers, int ixMin, int ixMax,  int iyMin, int iyMax){
-		IPlotter plotter1 = pf.create("detector");
-		int nx = (int)Math.ceil(Math.sqrt(nLayers));
-		int ny = (int)Math.ceil(nLayers/(double)nx);
-		plotter1.createRegions(nx, ny);
+    }
+    private void addHistograms2D(String detector, int nLayers, int ixMin, int ixMax,  int iyMin, int iyMax){
+        IPlotter plotter1 = pf.create("detector");
+        int nx = (int)Math.ceil(Math.sqrt(nLayers));
+        int ny = (int)Math.ceil(nLayers/(double)nx);
+        plotter1.createRegions(nx, ny);
 
-		hist2d.put(detector,new IHistogram2D[nLayers]);
-		for(int i = 0; i< nLayers; i++){
-			hist2d.get(detector)[i] 
-			                     = hf.createHistogram2D(detector + " layer " + (i+1), ixMax-ixMin, ixMin, ixMax, iyMax-iyMin, iyMin, iyMax);
-			plotter1.region(i).plot(hist2d.get(detector)[i]);
+        hist2d.put(detector,new IHistogram2D[nLayers]);
+        for(int i = 0; i< nLayers; i++){
+            hist2d.get(detector)[i] 
+                                 = hf.createHistogram2D(detector + " layer " + (i+1), ixMax-ixMin, ixMin, ixMax, iyMax-iyMin, iyMin, iyMax);
+            plotter1.region(i).plot(hist2d.get(detector)[i]);
 
-		}
-	}
+        }
+    }
 
 
-	IDDecoder ecalDecoder;
-	private float recency;
+    IDDecoder ecalDecoder;
+    private float recency;
 
-	public void process(EventHeader header){
+    public void process(EventHeader header){
 
 
-		//System.out.println(header.keys());
+        //System.out.println(header.keys());
 
 
-		for(SIOSimCalorimeterHit hit: header.get(SIOSimCalorimeterHit.class,"EcalHits")){
-			int fieldCount = hit.getIDDecoder().getFieldCount();
-			ecalDecoder.setID(hit.getCellID());
-			int ix = ecalDecoder.getValue("ix");
-			int iy = ecalDecoder.getValue("iy");
-			int layer = ecalDecoder.getValue("layer");
-			hist2d.get("Ecal")[layer].fill(ix, iy);
-		}
-		
-		
-		/*if(recency != 0)
-		for(IHistogram2D[] hists : hist2d.values()){
-			for(IHistogram2D hist : hists){
-				hf.
-			}
-		}*/
-		//}
-	}
-	/**
-	 * "recency" is a parameter used to determine how to time-weight the 
-	 * histogram so that the more recent events are more highly weighted.
-	 * A recency of zero means that there is no time weightedness.
-	 * A recency of R means that each event is weighted by a factor of (1-R)^n,
-	 * where n is the number of events that have taken place since the event shown.
-	 * @param recency
-	 */
-	//public void setRecency(float recency){
-	//this.recency = recency;
-	//}
+        for(SIOSimCalorimeterHit hit: header.get(SIOSimCalorimeterHit.class,"EcalHits")){
+            int fieldCount = hit.getIDDecoder().getFieldCount();
+            ecalDecoder.setID(hit.getCellID());
+            int ix = ecalDecoder.getValue("ix");
+            int iy = ecalDecoder.getValue("iy");
+            int layer = ecalDecoder.getValue("layer");
+            hist2d.get("Ecal")[layer].fill(ix, iy);
+        }
+        
+        
+        /*if(recency != 0)
+        for(IHistogram2D[] hists : hist2d.values()){
+            for(IHistogram2D hist : hists){
+                hf.
+            }
+        }*/
+        //}
+    }
+    /**
+     * "recency" is a parameter used to determine how to time-weight the 
+     * histogram so that the more recent events are more highly weighted.
+     * A recency of zero means that there is no time weightedness.
+     * A recency of R means that each event is weighted by a factor of (1-R)^n,
+     * where n is the number of events that have taken place since the event shown.
+     * @param recency
+     */
+    //public void setRecency(float recency){
+    //this.recency = recency;
+    //}
 
-	public void startOfData(){
+    public void startOfData(){
 
-	}
-	public void endOfData(){
+    }
+    public void endOfData(){
 
-		for(String name : hist2d.keySet()){
-			IHistogram2D[] hists = hist2d.get(name);
-			System.out.println(name);
-			for(int i = 0; i< hists.length; i++){
-				double max = hists[i].maxBinHeight();
-				double total = hists[i].sumAllBinHeights();
-				double ratioPercent = 100.*max/(double)total;
-				System.out.printf("  layer %d: %.2f %% of hits were in the most populated bin\n",i, ratioPercent);
-			}
-		}
-	}
-	public static void main(String arg[]) throws IOException{
-		LCIOReader lcReader = new LCIOReader(new File(arg[0]));
-		HitrateHistograms driver = new HitrateHistograms();
-		driver.startOfData();
-		for(int i=0;i<1000;i++){
-			EventHeader event = lcReader.read();
+        for(String name : hist2d.keySet()){
+            IHistogram2D[] hists = hist2d.get(name);
+            System.out.println(name);
+            for(int i = 0; i< hists.length; i++){
+                double max = hists[i].maxBinHeight();
+                double total = hists[i].sumAllBinHeights();
+                double ratioPercent = 100.*max/(double)total;
+                System.out.printf("  layer %d: %.2f %% of hits were in the most populated bin\n",i, ratioPercent);
+            }
+        }
+    }
+    public static void main(String arg[]) throws IOException{
+        LCIOReader lcReader = new LCIOReader(new File(arg[0]));
+        HitrateHistograms driver = new HitrateHistograms();
+        driver.startOfData();
+        for(int i=0;i<1000;i++){
+            EventHeader event = lcReader.read();
 
-			if(event == null)
-				break;
-			driver.process(event);
+            if(event == null)
+                break;
+            driver.process(event);
 
-		}
-		driver.endOfData();
-	}
+        }
+        driver.endOfData();
+    }
 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/PulserFilter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/PulserFilter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/PulserFilter.java	Wed Mar  9 11:43:24 2016
@@ -25,65 +25,65 @@
 
 public class PulserFilter extends Driver{
 
-	public void process(EventHeader event) {
+    public void process(EventHeader event) {
 
-		// only keep pulser triggers:
-		if (!event.hasCollection(GenericObject.class,"TriggerBank"))
-			throw new Driver.NextEventException();
-		boolean isPulser=false;
-		for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
-		{
-			if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
-			TIData tid = new TIData(gob);
-			if (tid.isPulserTrigger())
-			{
-				isPulser=true;
-				break;
-			}
-		}
+        // only keep pulser triggers:
+        if (!event.hasCollection(GenericObject.class,"TriggerBank"))
+            throw new Driver.NextEventException();
+        boolean isPulser=false;
+        for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
+        {
+            if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
+            TIData tid = new TIData(gob);
+            if (tid.isPulserTrigger())
+            {
+                isPulser=true;
+                break;
+            }
+        }
 
-		// don't drop any events with EPICS data or scalers data
-		// (could also do this via event tag=31)
-		final EpicsData edata = EpicsData.read(event);
-		if (edata != null) return;
-		ScalerData sdata = ScalerData.read(event);
-		if(sdata != null) return;
+        // don't drop any events with EPICS data or scalers data
+        // (could also do this via event tag=31)
+        final EpicsData edata = EpicsData.read(event);
+        if (edata != null) return;
+        ScalerData sdata = ScalerData.read(event);
+        if(sdata != null) return;
 
-		if (!isPulser) throw new Driver.NextEventException();
+        if (!isPulser) throw new Driver.NextEventException();
 
 
-	}
+    }
 
-	public static void main(String arg[]) throws IOException{
-		ConditionsDriver hack = new ConditionsDriver();
-		hack.setDetectorName("HPS-EngRun2015-Nominal-v1");
-		hack.setFreeze(true);
-		hack.setRunNumber(Integer.parseInt(arg[2]));
-		hack.initialize();
-		PulserFilter pf = new PulserFilter();
-		LCIOWriter writer = new LCIOWriter(arg[1]);
-		File file = new File(arg[0]);
-		LCIOReader reader = new LCIOReader(file);
-		System.out.println(file.getPath());
+    public static void main(String arg[]) throws IOException{
+        ConditionsDriver hack = new ConditionsDriver();
+        hack.setDetectorName("HPS-EngRun2015-Nominal-v1");
+        hack.setFreeze(true);
+        hack.setRunNumber(Integer.parseInt(arg[2]));
+        hack.initialize();
+        PulserFilter pf = new PulserFilter();
+        LCIOWriter writer = new LCIOWriter(arg[1]);
+        File file = new File(arg[0]);
+        LCIOReader reader = new LCIOReader(file);
+        System.out.println(file.getPath());
 
-		try{
-			while(true){
-				try{
-					EventHeader eh = reader.read();
-					if(eh.getEventNumber() %100 == 0)
-						System.out.println(eh.getEventNumber());
-					pf.process(eh);
-					writer.write(eh);
-				}catch(Driver.NextEventException e){
+        try{
+            while(true){
+                try{
+                    EventHeader eh = reader.read();
+                    if(eh.getEventNumber() %100 == 0)
+                        System.out.println(eh.getEventNumber());
+                    pf.process(eh);
+                    writer.write(eh);
+                }catch(Driver.NextEventException e){
 
-				}
-			}
-		}catch(IOException e){
-			e.printStackTrace();
-			reader.close();
-		}
+                }
+            }
+        }catch(IOException e){
+            e.printStackTrace();
+            reader.close();
+        }
 
 
-		writer.close();
-	}
+        writer.close();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java	Wed Mar  9 11:43:24 2016
@@ -13,183 +13,183 @@
 import hep.aida.ref.plotter.PlotterUtilities;
 
 public class StyleUtil {
-	
-	public static void stylize(IPlotterRegion r, String title, String lx, String ly, double xmin, double xmax, double ymin, double ymax){
-		r.setTitle(title);
-		stylize(r, lx, ly);
-		r.setXLimits(xmin, xmax);
-		r.setYLimits(ymin, ymax);
-	}
-	public static void stylize(IPlotterRegion r, String title, String lx, String ly){
-		r.setTitle(title);
-		stylize(r, lx, ly);
-	}
-	public static void stylize(IPlotterRegion r, String lx, String ly){
-		
-		r.style().titleStyle().textStyle().setFontSize(22);
-		r.style().xAxisStyle().setLabel(lx);
-		r.style().xAxisStyle().labelStyle().setFontSize(16);
-		r.style().xAxisStyle().tickLabelStyle().setFontSize(14);
-		r.style().yAxisStyle().setLabel(ly);
-		r.style().yAxisStyle().labelStyle().setFontSize(16);
-		r.style().yAxisStyle().tickLabelStyle().setFontSize(14);
-		//	r.style().statisticsBoxStyle().set;
-		//debugPrint());
-		r.style().legendBoxStyle().textStyle().setFontSize(16);
-		r.style().statisticsBoxStyle().textStyle().setFontSize(16);
-		
-		//r.style().dataStyle().showInLegendBox(false);
-		
-		r.style().legendBoxStyle().boxStyle().foregroundStyle().setOpacity(1.0);
-		r.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-		r.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", "false");
-		//debugPrint(r.style().dataStyle().availableParameters()));
-		//r.style().dataStyle().setParameter("showDataInStatisticsBox", "false");
-		r.style().setParameter("hist2DStyle", "colorMap");
-		//r.style().dataBoxStyle()
-	}
-	public static void addHorizontalLine(IPlotterRegion r, double y, String name){
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IFunction f = af.createFunctionFactory(af.createTreeFactory().create()).createFunctionByName(name, "p0");
-		f.setParameter("p0", y);
-		r.plot(f);
-	}
-	public static void addParabola(IPlotterRegion region, double p0,
-			double p1, double p2, String string) {
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IFunction f = af.createFunctionFactory(af.createTreeFactory().create()).createFunctionByName(string, "p2");
-		f.setParameter("p0", p0);
-		f.setParameter("p1", p1);
-		f.setParameter("p2", p2);
-		region.plot(f);
-	}
-	public static void noFillHistogramBars(IPlotterRegion region) {
-		region.style().dataStyle().setParameter("fillHistogramBars", "false");
-		region.style().dataStyle().fillStyle().setVisible(false);
-		
+    
+    public static void stylize(IPlotterRegion r, String title, String lx, String ly, double xmin, double xmax, double ymin, double ymax){
+        r.setTitle(title);
+        stylize(r, lx, ly);
+        r.setXLimits(xmin, xmax);
+        r.setYLimits(ymin, ymax);
+    }
+    public static void stylize(IPlotterRegion r, String title, String lx, String ly){
+        r.setTitle(title);
+        stylize(r, lx, ly);
+    }
+    public static void stylize(IPlotterRegion r, String lx, String ly){
+        
+        r.style().titleStyle().textStyle().setFontSize(22);
+        r.style().xAxisStyle().setLabel(lx);
+        r.style().xAxisStyle().labelStyle().setFontSize(16);
+        r.style().xAxisStyle().tickLabelStyle().setFontSize(14);
+        r.style().yAxisStyle().setLabel(ly);
+        r.style().yAxisStyle().labelStyle().setFontSize(16);
+        r.style().yAxisStyle().tickLabelStyle().setFontSize(14);
+        //  r.style().statisticsBoxStyle().set;
+        //debugPrint());
+        r.style().legendBoxStyle().textStyle().setFontSize(16);
+        r.style().statisticsBoxStyle().textStyle().setFontSize(16);
+        
+        //r.style().dataStyle().showInLegendBox(false);
+        
+        r.style().legendBoxStyle().boxStyle().foregroundStyle().setOpacity(1.0);
+        r.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        r.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", "false");
+        //debugPrint(r.style().dataStyle().availableParameters()));
+        //r.style().dataStyle().setParameter("showDataInStatisticsBox", "false");
+        r.style().setParameter("hist2DStyle", "colorMap");
+        //r.style().dataBoxStyle()
+    }
+    public static void addHorizontalLine(IPlotterRegion r, double y, String name){
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IFunction f = af.createFunctionFactory(af.createTreeFactory().create()).createFunctionByName(name, "p0");
+        f.setParameter("p0", y);
+        r.plot(f);
+    }
+    public static void addParabola(IPlotterRegion region, double p0,
+            double p1, double p2, String string) {
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IFunction f = af.createFunctionFactory(af.createTreeFactory().create()).createFunctionByName(string, "p2");
+        f.setParameter("p0", p0);
+        f.setParameter("p1", p1);
+        f.setParameter("p2", p2);
+        region.plot(f);
+    }
+    public static void noFillHistogramBars(IPlotterRegion region) {
+        region.style().dataStyle().setParameter("fillHistogramBars", "false");
+        region.style().dataStyle().fillStyle().setVisible(false);
+        
 
-		region.style().dataStyle().lineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
-		region.style().dataStyle().lineStyle().setParameter("colorRotate", "black, red, green, blue");
-		region.style().dataStyle().lineStyle().setParameter("thickness", "3");
-		region.style().dataStyle().outlineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
-		//debug = true;
-		debugPrint(region.style().dataStyle().outlineStyle().availableParameters());
-		region.style().dataStyle().outlineStyle().setParameter("colorRotate", "black, red, green, blue");
-		region.style().dataStyle().outlineStyle().setParameter("thickness", "3");
-		region.style().dataStyle().errorBarStyle().setVisible(false);
-		debugPrint(region.style().dataStyle().lineStyle().availableParameterOptions("colorRotateMethod"));
-	}
-	public static void setSize(IPlotter p, int width, int height){
-		p.setParameter("plotterWidth", width +"");
-		p.setParameter("plotterHeight", height +"");
-	}
-	
-	public static void setLog(IPlotterRegion r){
+        region.style().dataStyle().lineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
+        region.style().dataStyle().lineStyle().setParameter("colorRotate", "black, red, green, blue");
+        region.style().dataStyle().lineStyle().setParameter("thickness", "3");
+        region.style().dataStyle().outlineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
+        //debug = true;
+        debugPrint(region.style().dataStyle().outlineStyle().availableParameters());
+        region.style().dataStyle().outlineStyle().setParameter("colorRotate", "black, red, green, blue");
+        region.style().dataStyle().outlineStyle().setParameter("thickness", "3");
+        region.style().dataStyle().errorBarStyle().setVisible(false);
+        debugPrint(region.style().dataStyle().lineStyle().availableParameterOptions("colorRotateMethod"));
+    }
+    public static void setSize(IPlotter p, int width, int height){
+        p.setParameter("plotterWidth", width +"");
+        p.setParameter("plotterHeight", height +"");
+    }
+    
+    public static void setLog(IPlotterRegion r){
 
-		r.style().yAxisStyle().setParameter("scale", "log");
-		r.style().gridStyle().setUnits(100);
-		debugPrint(r.style().gridStyle().availableParameters()); 
-		
-	}
-	static boolean debug = false;
-	static void debugPrint(String[] stuff){
-		if(debug){
-			System.out.println(Arrays.toString(stuff));
-		}
-	}
-	public static void main(String arg[]){
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
-		
-		IPlotter p = af.createPlotterFactory().create();
-		debugPrint(p.availableParameters());
-		p.createRegions(1, 2);
-		IHistogram1D h1 = hf.createHistogram1D("blah", 100, -5, 5);
-		IHistogram1D h2 = hf.createHistogram1D("bleh", 100, -5, 5);
-		Random random = new Random();
-		for(int i = 0; i< 100000; i++){
-			h1.fill(random.nextGaussian());
-			h2.fill(random.nextGaussian()*2);
-		}
-		hideLegendAndStats(p.region(1));
-		noFillHistogramBars(p.region(0));
-		stylize(p.region(0), "title", "x axis label", "y axis label");
-		stylize(p.region(1), "stuff", "x axis label", "y axis label");
-		p.region(0).plot(h1);
-		p.region(0).plot(h2);
-		
+        r.style().yAxisStyle().setParameter("scale", "log");
+        r.style().gridStyle().setUnits(100);
+        debugPrint(r.style().gridStyle().availableParameters()); 
+        
+    }
+    static boolean debug = false;
+    static void debugPrint(String[] stuff){
+        if(debug){
+            System.out.println(Arrays.toString(stuff));
+        }
+    }
+    public static void main(String arg[]){
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
+        
+        IPlotter p = af.createPlotterFactory().create();
+        debugPrint(p.availableParameters());
+        p.createRegions(1, 2);
+        IHistogram1D h1 = hf.createHistogram1D("blah", 100, -5, 5);
+        IHistogram1D h2 = hf.createHistogram1D("bleh", 100, -5, 5);
+        Random random = new Random();
+        for(int i = 0; i< 100000; i++){
+            h1.fill(random.nextGaussian());
+            h2.fill(random.nextGaussian()*2);
+        }
+        hideLegendAndStats(p.region(1));
+        noFillHistogramBars(p.region(0));
+        stylize(p.region(0), "title", "x axis label", "y axis label");
+        stylize(p.region(1), "stuff", "x axis label", "y axis label");
+        p.region(0).plot(h1);
+        p.region(0).plot(h2);
+        
 
-		IHistogram2D h3 = hf.createHistogram2D("blah", 100, -5, 5, 100, -5,5);
-		
-		for(int i = 0; i< 100000; i++){
-			h3.fill(random.nextGaussian(), random.nextGaussian());
-		}
-		
-		p.region(1).plot(h3);
-		
-		
-		
-		p.show();
-		
-		p = af.createPlotterFactory().create();
-		debugPrint(p.availableParameters());
-		p.createRegions(1, 2);
-		
-		p.region(0).plot(h1);
-		setLog(p.region(0));
-		
-		
-		
-		p.show();
-	}
-	public static void hideLegendAndStats(IPlotterRegion r){
-		r.style().statisticsBoxStyle().setVisible(false);
-		r.style().legendBoxStyle().setVisible(false);
-	}
-	public static IPlotterStyle smoothCurveStyle(IPlotterFactory pf) {
-		IPlotterStyle style = pf.createPlotterStyle();
-		debugPrint(style.dataStyle().availableParameters());
-		
-		style.dataStyle().markerStyle().setVisible(false);
-		
-		return style;
-	}
-	public static void writeToFile(IPlotter plotter, String filename, String filetype){
-		//JFrame frame = new JFrame()
-		//if(plotter.)
-		//plotter.hide();
-		//plotter.show();
-		//PlotterUtilities.writeToFile(plotter, filename, filetype, null);
-		try {
-			
-			
-			//PlotterUtilities.writeToFile(plotter, filename, filetype, null);
-			Thread.sleep(1000);
-			Component c = PlotterUtilities.componentForPlotter(plotter);
-			int width = Integer.parseInt(plotter.parameterValue("plotterWidth"));
-			int height = Integer.parseInt(plotter.parameterValue("plotterHeight"));
-			if(width <= 0){
-				width = 300;
-				plotter.setParameter("plotterWidth", Integer.toString(width));
-			}
-			if(height <= 0){
-				height = 300;
+        IHistogram2D h3 = hf.createHistogram2D("blah", 100, -5, 5, 100, -5,5);
+        
+        for(int i = 0; i< 100000; i++){
+            h3.fill(random.nextGaussian(), random.nextGaussian());
+        }
+        
+        p.region(1).plot(h3);
+        
+        
+        
+        p.show();
+        
+        p = af.createPlotterFactory().create();
+        debugPrint(p.availableParameters());
+        p.createRegions(1, 2);
+        
+        p.region(0).plot(h1);
+        setLog(p.region(0));
+        
+        
+        
+        p.show();
+    }
+    public static void hideLegendAndStats(IPlotterRegion r){
+        r.style().statisticsBoxStyle().setVisible(false);
+        r.style().legendBoxStyle().setVisible(false);
+    }
+    public static IPlotterStyle smoothCurveStyle(IPlotterFactory pf) {
+        IPlotterStyle style = pf.createPlotterStyle();
+        debugPrint(style.dataStyle().availableParameters());
+        
+        style.dataStyle().markerStyle().setVisible(false);
+        
+        return style;
+    }
+    public static void writeToFile(IPlotter plotter, String filename, String filetype){
+        //JFrame frame = new JFrame()
+        //if(plotter.)
+        //plotter.hide();
+        //plotter.show();
+        //PlotterUtilities.writeToFile(plotter, filename, filetype, null);
+        try {
+            
+            
+            //PlotterUtilities.writeToFile(plotter, filename, filetype, null);
+            Thread.sleep(1000);
+            Component c = PlotterUtilities.componentForPlotter(plotter);
+            int width = Integer.parseInt(plotter.parameterValue("plotterWidth"));
+            int height = Integer.parseInt(plotter.parameterValue("plotterHeight"));
+            if(width <= 0){
+                width = 300;
+                plotter.setParameter("plotterWidth", Integer.toString(width));
+            }
+            if(height <= 0){
+                height = 300;
 
-				plotter.setParameter("plotterHeight", Integer.toString(height));
-			}
-			
-			c.setSize(width, height);
-			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-			Graphics2D graphics2D = image.createGraphics();
-			c.paint(graphics2D);
-			ImageIO.write(image,filetype, new File(filename));
-			Runtime.getRuntime().exec("open " + filename);
-			System.out.println("saved");
-			
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-	}
+                plotter.setParameter("plotterHeight", Integer.toString(height));
+            }
+            
+            c.setSize(width, height);
+            BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+            Graphics2D graphics2D = image.createGraphics();
+            c.paint(graphics2D);
+            ImageIO.write(image,filetype, new File(filename));
+            Runtime.getRuntime().exec("open " + filename);
+            System.out.println("saved");
+            
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java	Wed Mar  9 11:43:24 2016
@@ -17,156 +17,156 @@
 // full of aida output files.  Then add up all of the histograms in each sub folder,
 // and put the sums in separate files in a folder called "sums"
 public class SumEverything {
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		if(arg.length == 2){
-			twoArg(arg[0], arg[1]);
-		}
-		else if(arg.length == 1){
-			oneArg(arg[0]);
-		}
-		else 
-			polyArg(arg);
-	}
-	static void oneArg(final String indir) throws IllegalArgumentException, IOException{
-		File outdir = new File(indir + "/sums");
-		outdir.mkdir();
-		ArrayList<Thread> threads = new ArrayList<Thread>();
-		for(final File subdirf : new File(indir).listFiles()){
-			Thread t = new Thread(){
-				public void run(){
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        if(arg.length == 2){
+            twoArg(arg[0], arg[1]);
+        }
+        else if(arg.length == 1){
+            oneArg(arg[0]);
+        }
+        else 
+            polyArg(arg);
+    }
+    static void oneArg(final String indir) throws IllegalArgumentException, IOException{
+        File outdir = new File(indir + "/sums");
+        outdir.mkdir();
+        ArrayList<Thread> threads = new ArrayList<Thread>();
+        for(final File subdirf : new File(indir).listFiles()){
+            Thread t = new Thread(){
+                public void run(){
 
-					String subdir = subdirf.getAbsolutePath();
-					if(subdir.matches(".*/sums/?"))
-						return;
-					String split[] = subdir.split("/");
-					String outfile = indir + "/sums/" + split[split.length-1] + ".aida";
-					try {
-						twoArg(subdir, outfile);
-					} catch (IllegalArgumentException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					} catch (IOException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
-				}
-			};
-			threads.add(t);
-			t.start();
-		}
-		for(Thread t : threads){
-			try {
-				t.join();
-			} catch (InterruptedException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-		new File(indir + "/sums/total.aida").delete();
-		twoArg(outdir.getAbsolutePath(), indir + "/sums/total.aida");
+                    String subdir = subdirf.getAbsolutePath();
+                    if(subdir.matches(".*/sums/?"))
+                        return;
+                    String split[] = subdir.split("/");
+                    String outfile = indir + "/sums/" + split[split.length-1] + ".aida";
+                    try {
+                        twoArg(subdir, outfile);
+                    } catch (IllegalArgumentException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    } catch (IOException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+                }
+            };
+            threads.add(t);
+            t.start();
+        }
+        for(Thread t : threads){
+            try {
+                t.join();
+            } catch (InterruptedException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+        new File(indir + "/sums/total.aida").delete();
+        twoArg(outdir.getAbsolutePath(), indir + "/sums/total.aida");
 
-	}
+    }
 
 
 
-	static void twoArg(String indir, String out) throws IllegalArgumentException, IOException{
+    static void twoArg(String indir, String out) throws IllegalArgumentException, IOException{
 
-		run(new File(indir).listFiles(), out);
-	}
-	static void run(File[] files, String out) throws IllegalArgumentException, IOException{
-		
-		long timeStart = System.currentTimeMillis();
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITreeFactory tf = af.createTreeFactory();
-		new File(out).delete();
-		ITree outtree = tf.create(out, "xml", false, true);
-		//IHistogramFactory hf = af.createHistogramFactory(outtree);
-		int j = 0;
-		String names[] = null;
-		for(File s : files){
-			if(!s.getAbsolutePath().endsWith("aida"))
-				continue;
-			try{
-				ITree tree = tf.create(s.getAbsolutePath(),"xml");
+        run(new File(indir).listFiles(), out);
+    }
+    static void run(File[] files, String out) throws IllegalArgumentException, IOException{
+        
+        long timeStart = System.currentTimeMillis();
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITreeFactory tf = af.createTreeFactory();
+        new File(out).delete();
+        ITree outtree = tf.create(out, "xml", false, true);
+        //IHistogramFactory hf = af.createHistogramFactory(outtree);
+        int j = 0;
+        String names[] = null;
+        for(File s : files){
+            if(!s.getAbsolutePath().endsWith("aida"))
+                continue;
+            try{
+                ITree tree = tf.create(s.getAbsolutePath(),"xml");
 
 
-				if(j == 0){
-					names = tree.listObjectNames("/", true);
-					System.out.println(Arrays.toString(names));
-					outtree.mount("/tmp", tree, "/");
-					for(String name : names){
-						if(name.endsWith("/")){
-							outtree.mkdirs(name);
-							continue;
-						}
-						Object o = tree.find(name);
-						if(o instanceof IHistogram1D || o instanceof IHistogram2D)
-							outtree.cp("/tmp" + name, name);
-					}
-					outtree.unmount("/tmp");
-					//tree.close();
+                if(j == 0){
+                    names = tree.listObjectNames("/", true);
+                    System.out.println(Arrays.toString(names));
+                    outtree.mount("/tmp", tree, "/");
+                    for(String name : names){
+                        if(name.endsWith("/")){
+                            outtree.mkdirs(name);
+                            continue;
+                        }
+                        Object o = tree.find(name);
+                        if(o instanceof IHistogram1D || o instanceof IHistogram2D)
+                            outtree.cp("/tmp" + name, name);
+                    }
+                    outtree.unmount("/tmp");
+                    //tree.close();
 
-				}
-				else{
-					//tree.
-					//String [] names = tree.listObjectNames("/", true);
-					//outtree.mount("/tmp", tree, "/");
-					//System.out.println(Arrays.toString(names));
-					for(String name : names){
-						if(name.endsWith("/"))
-							continue;
-						Object o = null;
-						try{
-							o = tree.find(name);
-						} catch(IllegalArgumentException e){
-							System.err.println("couldn't find object called " + name +  " in file " + s);
-							throw e;
-						}
-						if(o instanceof IHistogram1D){
-							if(((IHistogram1D)o).allEntries() != 0)
-							((IHistogram1D)outtree.find(name)).add((IHistogram1D)o);
-						}
-						if(o instanceof IHistogram2D)
-							if(((IHistogram2D)o).allEntries() != 0)
-							((IHistogram2D)outtree.find(name)).add((IHistogram2D)o);
-					}
-					//outtree.unmount("/tmp");
-					//tree.close();
-				}
+                }
+                else{
+                    //tree.
+                    //String [] names = tree.listObjectNames("/", true);
+                    //outtree.mount("/tmp", tree, "/");
+                    //System.out.println(Arrays.toString(names));
+                    for(String name : names){
+                        if(name.endsWith("/"))
+                            continue;
+                        Object o = null;
+                        try{
+                            o = tree.find(name);
+                        } catch(IllegalArgumentException e){
+                            System.err.println("couldn't find object called " + name +  " in file " + s);
+                            throw e;
+                        }
+                        if(o instanceof IHistogram1D){
+                            if(((IHistogram1D)o).allEntries() != 0)
+                            ((IHistogram1D)outtree.find(name)).add((IHistogram1D)o);
+                        }
+                        if(o instanceof IHistogram2D)
+                            if(((IHistogram2D)o).allEntries() != 0)
+                            ((IHistogram2D)outtree.find(name)).add((IHistogram2D)o);
+                    }
+                    //outtree.unmount("/tmp");
+                    //tree.close();
+                }
 
-				tree.close();
-				j++;
-				System.out.println(j + " files have been read (" +(System.currentTimeMillis()-timeStart)/j + " ms per event");
+                tree.close();
+                j++;
+                System.out.println(j + " files have been read (" +(System.currentTimeMillis()-timeStart)/j + " ms per event");
 
-			} catch(IllegalArgumentException e){
-				//print the filename
-				System.out.println("Exception happened at file " + s.getAbsolutePath());
+            } catch(IllegalArgumentException e){
+                //print the filename
+                System.out.println("Exception happened at file " + s.getAbsolutePath());
 
-				e.printStackTrace();
-			}
+                e.printStackTrace();
+            }
 
-			outtree.commit();
-			System.out.println("summed file " + out +" commited.  Total time = " + (System.currentTimeMillis()-timeStart)/1000 + " seconds");
-		}
-	}
+            outtree.commit();
+            System.out.println("summed file " + out +" commited.  Total time = " + (System.currentTimeMillis()-timeStart)/1000 + " seconds");
+        }
+    }
 
-	static void polyArg(String[] arg) throws IllegalArgumentException, IOException{
-		ArrayList<File> files = new ArrayList<File>();
-		boolean nextIsOutput = false;
-		for(String a : arg){
-			if(a.equals("-o")){
-				nextIsOutput = true; 
-				continue;
-			}
-			if(nextIsOutput){
-				run(files.toArray(new File[0]), a);
-				nextIsOutput = false;
-				files.clear();
-				continue;
-			}
-			files.add(new File(a));
+    static void polyArg(String[] arg) throws IllegalArgumentException, IOException{
+        ArrayList<File> files = new ArrayList<File>();
+        boolean nextIsOutput = false;
+        for(String a : arg){
+            if(a.equals("-o")){
+                nextIsOutput = true; 
+                continue;
+            }
+            if(nextIsOutput){
+                run(files.toArray(new File[0]), a);
+                nextIsOutput = false;
+                files.clear();
+                continue;
+            }
+            files.add(new File(a));
 
-		}
-	}
+        }
+    }
 }
 

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/BinGenerator.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/BinGenerator.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/BinGenerator.java	Wed Mar  9 11:43:24 2016
@@ -5,86 +5,86 @@
 import java.io.PrintWriter;
 
 public class BinGenerator {
-	public static void main(String arg[]) throws FileNotFoundException{
-		int nBins = 32;
+    public static void main(String arg[]) throws FileNotFoundException{
+        int nBins = 32;
 
-		PrintStream pw = new PrintStream("generatedbins.txt");
-		pw.println(nBins);
-		double[] thetaBins = getThetaBins(nBins);
-		for(int i = 0; i< nBins; i++){
-			double thetaMin = thetaBins[i];
-			double thetaMax = thetaBins[i+1];
-			double phiBounds[] = getPhiBounds(thetaMin, thetaMax);
-			pw.printf("%d %.4f %.4f ", phiBounds.length/2, thetaMin, thetaMax);
-			for(int j = 0; j< phiBounds.length; j++){
-				pw.printf("%.4f ", phiBounds[j]);
-			}
-			pw.println();
-		}
-		ShowCustomBinning.main(new String[]{"generatedbins.txt"});
+        PrintStream pw = new PrintStream("generatedbins.txt");
+        pw.println(nBins);
+        double[] thetaBins = getThetaBins(nBins);
+        for(int i = 0; i< nBins; i++){
+            double thetaMin = thetaBins[i];
+            double thetaMax = thetaBins[i+1];
+            double phiBounds[] = getPhiBounds(thetaMin, thetaMax);
+            pw.printf("%d %.4f %.4f ", phiBounds.length/2, thetaMin, thetaMax);
+            for(int j = 0; j< phiBounds.length; j++){
+                pw.printf("%.4f ", phiBounds[j]);
+            }
+            pw.println();
+        }
+        ShowCustomBinning.main(new String[]{"generatedbins.txt"});
 
-	}
+    }
 
-	private static double[] getThetaBins(int nBins){
-		/*double thetaMin = 0.035;
-		double dTheta = .2/nBins;
-		double[] bins = new double[nBins +1];
-		for(int i = 0; i< nBins+1; i++){
-			bins[i] = thetaMin+dTheta*i;
-		}
-		return bins; */
-		double thetaMax = .200;
-		double thetaMin = .040;
+    private static double[] getThetaBins(int nBins){
+        /*double thetaMin = 0.035;
+        double dTheta = .2/nBins;
+        double[] bins = new double[nBins +1];
+        for(int i = 0; i< nBins+1; i++){
+            bins[i] = thetaMin+dTheta*i;
+        }
+        return bins; */
+        double thetaMax = .200;
+        double thetaMin = .040;
 
-		double[] bins = new double[nBins +1];
-		for(int i = 0; i<nBins+1; i++){
-			bins[i] = thetaMin+i*(thetaMax-thetaMin)/nBins;
-		}
-		return bins;
-		/*double xMin = 1/(thetaMax*thetaMax);
-		double xMax = 1/(thetaMin*thetaMin);
-		for(int i = 0; i< nBins+1; i++){
-			double x = xMax - i*(xMax-xMin)/nBins;
-			bins[i] = Math.pow(x, -.5);
-		}
-		return bins;*/
-	}
-	private static double[] getPhiBounds(double thetaMin, double thetaMax){
-		double phiBins[] = new double[6];
-		double dphi = .01; 
-		int edgeNumber = 0;
+        double[] bins = new double[nBins +1];
+        for(int i = 0; i<nBins+1; i++){
+            bins[i] = thetaMin+i*(thetaMax-thetaMin)/nBins;
+        }
+        return bins;
+        /*double xMin = 1/(thetaMax*thetaMax);
+        double xMax = 1/(thetaMin*thetaMin);
+        for(int i = 0; i< nBins+1; i++){
+            double x = xMax - i*(xMax-xMin)/nBins;
+            bins[i] = Math.pow(x, -.5);
+        }
+        return bins;*/
+    }
+    private static double[] getPhiBounds(double thetaMin, double thetaMax){
+        double phiBins[] = new double[6];
+        double dphi = .01; 
+        int edgeNumber = 0;
 
-		boolean prevInRange = false;
-		for(double phi = 0; phi< 3.14; phi+= dphi){
-			
-			// make the angular cuts on the tracks such that the particles that go into that cut 
-			// are expected to be within 4 mm (~= 2 times the angular resolution of 1.5 mrad) of 
-			// the ecal cuts.  
-			double d = 4;
-			
-			boolean inRange = EcalUtil.fid_ECal_spherical_more_strict(thetaMin, phi, d) && EcalUtil.fid_ECal_spherical_more_strict(thetaMax, phi, d)
-								&& EcalUtil.fid_ECal_spherical_more_strict(thetaMin, -phi, d) && EcalUtil.fid_ECal_spherical_more_strict(thetaMax, -phi, d);
-			if(inRange && !prevInRange)
-				phiBins[edgeNumber++] = phi;
-			if(prevInRange && !inRange)
-				phiBins[edgeNumber++] = phi-dphi;
-			prevInRange = inRange;	
-		}
-		if(phiBins[2] == 0)
-			return new double[]{phiBins[0], phiBins[1]};
-		if(phiBins[4] == 0)
-			return new double[]{phiBins[0], phiBins[1],phiBins[2], phiBins[3]};
-		
-		//3 segments: choose the largest two
-		if(phiBins[4] != 0 && phiBins[1] - phiBins[0] > phiBins[3]-phiBins[2] && phiBins[5] - phiBins[4] > phiBins[3]-phiBins[2]){
-			return new double[]{phiBins[0], phiBins[1],phiBins[4], phiBins[5]};
-		}
-		if(phiBins[4] != 0 && phiBins[3] - phiBins[2] > phiBins[1]-phiBins[0] && phiBins[5] - phiBins[4] > phiBins[1]-phiBins[0]){
-			return new double[]{phiBins[2], phiBins[3],phiBins[4], phiBins[5]};
-		}
-		return new double[]{phiBins[0], phiBins[1],phiBins[2], phiBins[3]};
-		
-		
-	}
+        boolean prevInRange = false;
+        for(double phi = 0; phi< 3.14; phi+= dphi){
+            
+            // make the angular cuts on the tracks such that the particles that go into that cut 
+            // are expected to be within 4 mm (~= 2 times the angular resolution of 1.5 mrad) of 
+            // the ecal cuts.  
+            double d = 4;
+            
+            boolean inRange = EcalUtil.fid_ECal_spherical_more_strict(thetaMin, phi, d) && EcalUtil.fid_ECal_spherical_more_strict(thetaMax, phi, d)
+                                && EcalUtil.fid_ECal_spherical_more_strict(thetaMin, -phi, d) && EcalUtil.fid_ECal_spherical_more_strict(thetaMax, -phi, d);
+            if(inRange && !prevInRange)
+                phiBins[edgeNumber++] = phi;
+            if(prevInRange && !inRange)
+                phiBins[edgeNumber++] = phi-dphi;
+            prevInRange = inRange;  
+        }
+        if(phiBins[2] == 0)
+            return new double[]{phiBins[0], phiBins[1]};
+        if(phiBins[4] == 0)
+            return new double[]{phiBins[0], phiBins[1],phiBins[2], phiBins[3]};
+        
+        //3 segments: choose the largest two
+        if(phiBins[4] != 0 && phiBins[1] - phiBins[0] > phiBins[3]-phiBins[2] && phiBins[5] - phiBins[4] > phiBins[3]-phiBins[2]){
+            return new double[]{phiBins[0], phiBins[1],phiBins[4], phiBins[5]};
+        }
+        if(phiBins[4] != 0 && phiBins[3] - phiBins[2] > phiBins[1]-phiBins[0] && phiBins[5] - phiBins[4] > phiBins[1]-phiBins[0]){
+            return new double[]{phiBins[2], phiBins[3],phiBins[4], phiBins[5]};
+        }
+        return new double[]{phiBins[0], phiBins[1],phiBins[2], phiBins[3]};
+        
+        
+    }
 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/CustomBinning.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/CustomBinning.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/CustomBinning.java	Wed Mar  9 11:43:24 2016
@@ -5,76 +5,76 @@
 import java.util.Scanner;
 
 public class CustomBinning {
-	public CustomBinning(File f) throws FileNotFoundException{
-		Scanner s = new Scanner(f);
+    public CustomBinning(File f) throws FileNotFoundException{
+        Scanner s = new Scanner(f);
 
-		nTheta = s.nextInt();  //number of bins in theta;
-		thetaMax = new double[nTheta];
-		thetaMin = new double[nTheta];
-		
-		phiMax = new double[nTheta][];
-		phiMin = new double[nTheta][];
-		int i = 0;
-		while(s.hasNext()){ //new row
-			int nPhi = s.nextInt();
-			thetaMin[i] = s.nextDouble();
-			thetaMax[i] = s.nextDouble();
-			
-			phiMax[i] = new double[nPhi];
-			phiMin[i] = new double[nPhi];
-			for(int j = 0; j<nPhi; j++){
-				phiMin[i][j] = s.nextDouble();
-				phiMax[i][j] = s.nextDouble();
-			}
-			i++;
-		}
-	}
-	double[][] phiMax;
-	double[][] phiMin;
-	public double thetaMax[], thetaMin[];
-	public int nTheta;
+        nTheta = s.nextInt();  //number of bins in theta;
+        thetaMax = new double[nTheta];
+        thetaMin = new double[nTheta];
+        
+        phiMax = new double[nTheta][];
+        phiMin = new double[nTheta][];
+        int i = 0;
+        while(s.hasNext()){ //new row
+            int nPhi = s.nextInt();
+            thetaMin[i] = s.nextDouble();
+            thetaMax[i] = s.nextDouble();
+            
+            phiMax[i] = new double[nPhi];
+            phiMin[i] = new double[nPhi];
+            for(int j = 0; j<nPhi; j++){
+                phiMin[i][j] = s.nextDouble();
+                phiMax[i][j] = s.nextDouble();
+            }
+            i++;
+        }
+    }
+    double[][] phiMax;
+    double[][] phiMin;
+    public double thetaMax[], thetaMin[];
+    public int nTheta;
 
-	double getSteradians(int binNumber){
-		double t1 = thetaMin[binNumber];
-		double t2 = thetaMax[binNumber];
-		double dCos = Math.cos(t1)-Math.cos(t2);
-		double dPhiTot = 0;
-		for(int i = 0; i< phiMax[binNumber].length; i++){
-			dPhiTot += phiMax[binNumber][i]-phiMin[binNumber][i];
-		}
-		return 2*dPhiTot*dCos;  //factor of two because top and bottom
-	}
-	boolean inRange(double theta, double phi){
-		phi = Math.abs(phi);
-		/*int i =(int) Math.floor((theta-theta0)/deltaTheta);
-		if(i>= nTheta || i<0)
-			return false;*/
-		if(theta > thetaMax[nTheta-1] || theta < thetaMin[0])
-			return false;
-		int i;
-		boolean found = false;
-		for(i = 0; i< nTheta; i++){
-			if(theta > thetaMin[i] && theta < thetaMax[i]){
-				found = true;
-				break;
-			}
-		}
-		if(!found)
-			return false;
-		
-		for(int j = 0; j<phiMax[i].length; j++){
-			if(phi>phiMin[i][j] && phi< phiMax[i][j])
-				return true;
-		}
-		return false;
+    double getSteradians(int binNumber){
+        double t1 = thetaMin[binNumber];
+        double t2 = thetaMax[binNumber];
+        double dCos = Math.cos(t1)-Math.cos(t2);
+        double dPhiTot = 0;
+        for(int i = 0; i< phiMax[binNumber].length; i++){
+            dPhiTot += phiMax[binNumber][i]-phiMin[binNumber][i];
+        }
+        return 2*dPhiTot*dCos;  //factor of two because top and bottom
+    }
+    boolean inRange(double theta, double phi){
+        phi = Math.abs(phi);
+        /*int i =(int) Math.floor((theta-theta0)/deltaTheta);
+        if(i>= nTheta || i<0)
+            return false;*/
+        if(theta > thetaMax[nTheta-1] || theta < thetaMin[0])
+            return false;
+        int i;
+        boolean found = false;
+        for(i = 0; i< nTheta; i++){
+            if(theta > thetaMin[i] && theta < thetaMax[i]){
+                found = true;
+                break;
+            }
+        }
+        if(!found)
+            return false;
+        
+        for(int j = 0; j<phiMax[i].length; j++){
+            if(phi>phiMin[i][j] && phi< phiMax[i][j])
+                return true;
+        }
+        return false;
 
-	}
-	public double getTotSteradians() {
-		double tot = 0;
-		for(int i = 0; i<nTheta; i++){
-			tot += getSteradians(i);
-		}
-		return tot;
-	}
+    }
+    public double getTotSteradians() {
+        double tot = 0;
+        for(int i = 0; i<nTheta; i++){
+            tot += getSteradians(i);
+        }
+        return tot;
+    }
 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/DisplayHistograms.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/DisplayHistograms.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/DisplayHistograms.java	Wed Mar  9 11:43:24 2016
@@ -3,8 +3,8 @@
 import java.io.IOException;
 
 public class DisplayHistograms {
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		//System.out.println("dognabo");
-		MakeHistograms.main(new String[]{arg[0]});
-	}
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        //System.out.println("dognabo");
+        MakeHistograms.main(new String[]{arg[0]});
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/EcalUtil.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/EcalUtil.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/EcalUtil.java	Wed Mar  9 11:43:24 2016
@@ -12,232 +12,232 @@
 import org.lcsim.event.Cluster;
 
 public class EcalUtil {
-	
-	static int[] getCrystalIndex(Cluster c){
-		if(map == null){
-			try{
-				readMap();
-			}catch(Exception e){
-				e.printStackTrace();
-			}
-		}
-		c.getPosition();
-		int bestix = 0, bestiy = 0;
-		double bestdist = 100000;
-
-		double cx = c.getPosition()[0];
-		double cy = c.getPosition()[1];
-		for(int ix = -23; ix<= 23; ix++){
-			if(!map.containsKey(200+ix))
-				continue;
-			double x = map.get(200+ix)[0];
-			if(Math.abs(x-cx)<bestdist){
-				bestdist = Math.abs(x-cx);
-				bestix = ix;
-			}
-		}
-		
-		bestdist = 100000;
-		for(int iy = -5; iy<= 5; iy++){
-			if(!map.containsKey(100*iy + bestix))
-				continue;
-			double y = map.get(100*iy + bestix)[1];
-			if(Math.abs(y-cy)<bestdist){
-				bestdist = Math.abs(y-cy);
-				bestiy = iy;
-			}
-		}
-		return new int[]{bestix, bestiy}; 
-	}
-	
-	
-	/**
-	 * Holly's algorithm.  
-	 * @param x x position of cluster
-	 * @param y y position of cluster
-	 * @param e energy of cluster
-	 * @param pid type of particle (11 = electron; -1 = positron)
-	 * @return array of doubles
-	 * <br> [0] theta = atan(py/pz)
-	 * <br> [1] phi = atan(px/pz) 
-	 */
-	static double [] toHollysCoordinates(double x, double y, double e, int pid){
-		if(pid == 11){
-			return new double[]{0.00071 * y +0.000357, 0.00071*x + 0.00003055*e + 0.04572/e +0.0006196};
-		} else if(pid == -11){
-			return new double[]{0.00071 * y +0.000357, 0.00071*x - 0.0006465*e + 0.045757/e +0.003465};
-		}
-		return null;
-	}
-	
-	static double getSteradians(double x, double y, double e,int pid, double dA){
-		double thetaPhi[] = toHollysCoordinates(x, y, e, pid);
-		return .00071*.00071*dA/Math.sqrt(thetaPhi[0]*thetaPhi[0]+ thetaPhi[1]*thetaPhi[1]+1);
-	}
-	
-	static boolean isSeedEdge(Cluster c){
-		CalorimeterHit seedhit  = (CalorimeterHit)c.getCalorimeterHits().get(0);
-		//	seedhit
-		int ix = seedhit.getIdentifierFieldValue("ix");
-		int iy = seedhit.getIdentifierFieldValue("iy");
-
-		//seedhit.get
-		return isEdge(ix, iy);
-	}
-	static boolean isEdge(int ix, int iy){
-		if(iy == 5 || iy == 1 || iy == -1 || iy == -5)
-			return true;
-		if(ix == -23 || ix == 23)
-			return true;
-		if((iy == 2 || iy == -2) && (ix >=-11 && ix <= -1))
-			return true;
-		return false;
-	}
-	public static boolean fid_ECal(Cluster c){
-		return fid_ECal(c.getPosition()[0], c.getPosition()[1]);
-	}
-	public static boolean fid_ECal(double x, double y)
-	{
-		y = Math.abs(y);
-
-		boolean in_fid = false;
-		double x_edge_low = -262.74;
-		double x_edge_high = 347.7;
-		double y_edge_low = 33.54;
-		double y_edge_high = 75.18;
-
-		double x_gap_low = -106.66;
-		double x_gap_high = 42.17;
-		double y_gap_high = 47.18;
-
-		y = Math.abs(y);
-
-		if( x > x_edge_low && x < x_edge_high && y > y_edge_low && y < y_edge_high )
-		{
-			if( !(x > x_gap_low && x < x_gap_high && y > y_edge_low && y < y_gap_high) )
-			{
-				in_fid = true;
-			}
-		}
-
-		return in_fid;
-	}
-	/**
-	 * 
-	 * @param x
-	 * @param y
-	 * @param d the additional distance from the edge of the ecal in addition
-	 *       to what is required by fid_Cal(double, double)
-	 * @return
-	 */
-	public static boolean fid_ecal_more_strict(double x, double y, double d){
-		y = Math.abs(y);
-
-		boolean in_fid = false;
-		 
-		double x_edge_low = -262.74 + d;
-		double x_edge_high = 347.7 - d;
-		double y_edge_low = 33.54 + d;
-		double y_edge_high = 75.18 - d;
-
-		double x_gap_low = -106.66 - d;
-		double x_gap_high = 42.17 + d;
-		double y_gap_high = 47.18 + d;
-
-		y = Math.abs(y);
-
-		if( x > x_edge_low && x < x_edge_high && y > y_edge_low && y < y_edge_high )
-		{
-			if( !(x > x_gap_low && x < x_gap_high && y > y_edge_low && y < y_gap_high) )
-			{
-				in_fid = true;
-			}
-		}
-
-		return in_fid;
-	}
-	static double[] toSphericalFromBeam(double pxpz, double pypz){
-		double x = pxpz, y = pypz, z = 1;
-		double beamTilt = .03057;
-		double xtemp = Math.cos(beamTilt)*x - Math.sin(beamTilt)*z;
-		double ztemp = Math.cos(beamTilt)*z + Math.sin(beamTilt)*x;
-		double ytemp = y;
-		
-		double theta = Math.atan(Math.hypot(xtemp, ytemp)/ ztemp);
-		double phi = Math.atan2(ytemp, xtemp);
-		
-		
-		return new double[]{theta, phi};
-	}
-	static Map<Integer, double[]> map ;
-	static void readMap() throws FileNotFoundException{
-		Scanner s = new Scanner(new File(System.getenv("HOME") + "/ecal_positions.txt"));
-		map = new HashMap();
-		
-		while(s.hasNext()){
-			int ix =s.nextInt();
-			int iy = s.nextInt();
-			double x = s.nextDouble();
-			double y =s.nextDouble();
-			map.put(ix+100*iy, new double[]{x, y});
-			
-		}
-		s.close();
-	}
-	static double getArea(int ix, int iy){
-		int ixp = ix+1;
-		if(ixp == 0)
-			ixp = 1;
-		int ixm = ix-1;
-		if(ixm == 0)
-			ixm = -1;
-		double[] plus = map.get(ixp+100*(iy+1));
-		double[] minus = map.get(ixm+100*(iy-1));
-		return (plus[0]-minus[0])*(plus[1]-minus[1])/4;
-	}
-	
-	public static double[] getThetaPhiSpherical(double x,double y){
-		double hcoord[] = toHollysCoordinates(x,y, 1.056, 11);
-		return toSphericalFromBeam(Math.tan(hcoord[1]),Math.tan(hcoord[0]));
-	}
-	/*beam tilt*/
-	static double tilt = .03057;
-	//assuming FEE electron.
-
-	public static double[] getXY(double theta, double phi){
-		
-		double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(tilt)+Math.cos(theta)*Math.sin(tilt);
-		double uy = Math.sin(phi)*Math.sin(theta);
-		double uz = Math.cos(theta)*Math.cos(tilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(tilt);
-		double pxpz = ux/uz;
-		double pypz = uy/uz;
-		//holly's coordinates:
-		double h1 = Math.atan(pypz);
-		double h2 = Math.atan(pxpz);
-		//0.00071 * y +0.000357,
-		//0.00071*x + 0.00003055*e + 0.04572/e +0.0006196
-		double y = (h1-0.000357)/0.00071;
-		double e = 1.056;
-		double x = (h2 - 0.00003055*e - 0.04572/e -0.0006196)/0.00071;
-		return new double[]{x,y};
-	}
-	public static boolean fid_ECal_spherical(double theta, double phi){
-		double[] xy = getXY(theta, phi);
-		double x = xy[0];
-		double y = xy[1];
-		return fid_ECal(x, y);
-	}
-	public static boolean fid_ECal_spherical_more_strict(double theta, double phi, double d){
-		double[] xy = getXY(theta, phi);
-		double x = xy[0];
-		double y = xy[1];
-		return fid_ecal_more_strict(x, y, d);
-	}
-	public static void main(String arg[]){
-		double x = 0, y = 0;
-		double sp[] = getThetaPhiSpherical(x,y); 
-		System.out.println(Arrays.toString(getXY(sp[0], sp[1])));
-	}
+    
+    static int[] getCrystalIndex(Cluster c){
+        if(map == null){
+            try{
+                readMap();
+            }catch(Exception e){
+                e.printStackTrace();
+            }
+        }
+        c.getPosition();
+        int bestix = 0, bestiy = 0;
+        double bestdist = 100000;
+
+        double cx = c.getPosition()[0];
+        double cy = c.getPosition()[1];
+        for(int ix = -23; ix<= 23; ix++){
+            if(!map.containsKey(200+ix))
+                continue;
+            double x = map.get(200+ix)[0];
+            if(Math.abs(x-cx)<bestdist){
+                bestdist = Math.abs(x-cx);
+                bestix = ix;
+            }
+        }
+        
+        bestdist = 100000;
+        for(int iy = -5; iy<= 5; iy++){
+            if(!map.containsKey(100*iy + bestix))
+                continue;
+            double y = map.get(100*iy + bestix)[1];
+            if(Math.abs(y-cy)<bestdist){
+                bestdist = Math.abs(y-cy);
+                bestiy = iy;
+            }
+        }
+        return new int[]{bestix, bestiy}; 
+    }
+    
+    
+    /**
+     * Holly's algorithm.  
+     * @param x x position of cluster
+     * @param y y position of cluster
+     * @param e energy of cluster
+     * @param pid type of particle (11 = electron; -1 = positron)
+     * @return array of doubles
+     * <br> [0] theta = atan(py/pz)
+     * <br> [1] phi = atan(px/pz) 
+     */
+    static double [] toHollysCoordinates(double x, double y, double e, int pid){
+        if(pid == 11){
+            return new double[]{0.00071 * y +0.000357, 0.00071*x + 0.00003055*e + 0.04572/e +0.0006196};
+        } else if(pid == -11){
+            return new double[]{0.00071 * y +0.000357, 0.00071*x - 0.0006465*e + 0.045757/e +0.003465};
+        }
+        return null;
+    }
+    
+    static double getSteradians(double x, double y, double e,int pid, double dA){
+        double thetaPhi[] = toHollysCoordinates(x, y, e, pid);
+        return .00071*.00071*dA/Math.sqrt(thetaPhi[0]*thetaPhi[0]+ thetaPhi[1]*thetaPhi[1]+1);
+    }
+    
+    static boolean isSeedEdge(Cluster c){
+        CalorimeterHit seedhit  = (CalorimeterHit)c.getCalorimeterHits().get(0);
+        //  seedhit
+        int ix = seedhit.getIdentifierFieldValue("ix");
+        int iy = seedhit.getIdentifierFieldValue("iy");
+
+        //seedhit.get
+        return isEdge(ix, iy);
+    }
+    static boolean isEdge(int ix, int iy){
+        if(iy == 5 || iy == 1 || iy == -1 || iy == -5)
+            return true;
+        if(ix == -23 || ix == 23)
+            return true;
+        if((iy == 2 || iy == -2) && (ix >=-11 && ix <= -1))
+            return true;
+        return false;
+    }
+    public static boolean fid_ECal(Cluster c){
+        return fid_ECal(c.getPosition()[0], c.getPosition()[1]);
+    }
+    public static boolean fid_ECal(double x, double y)
+    {
+        y = Math.abs(y);
+
+        boolean in_fid = false;
+        double x_edge_low = -262.74;
+        double x_edge_high = 347.7;
+        double y_edge_low = 33.54;
+        double y_edge_high = 75.18;
+
+        double x_gap_low = -106.66;
+        double x_gap_high = 42.17;
+        double y_gap_high = 47.18;
+
+        y = Math.abs(y);
+
+        if( x > x_edge_low && x < x_edge_high && y > y_edge_low && y < y_edge_high )
+        {
+            if( !(x > x_gap_low && x < x_gap_high && y > y_edge_low && y < y_gap_high) )
+            {
+                in_fid = true;
+            }
+        }
+
+        return in_fid;
+    }
+    /**
+     * 
+     * @param x
+     * @param y
+     * @param d the additional distance from the edge of the ecal in addition
+     *       to what is required by fid_Cal(double, double)
+     * @return
+     */
+    public static boolean fid_ecal_more_strict(double x, double y, double d){
+        y = Math.abs(y);
+
+        boolean in_fid = false;
+         
+        double x_edge_low = -262.74 + d;
+        double x_edge_high = 347.7 - d;
+        double y_edge_low = 33.54 + d;
+        double y_edge_high = 75.18 - d;
+
+        double x_gap_low = -106.66 - d;
+        double x_gap_high = 42.17 + d;
+        double y_gap_high = 47.18 + d;
+
+        y = Math.abs(y);
+
+        if( x > x_edge_low && x < x_edge_high && y > y_edge_low && y < y_edge_high )
+        {
+            if( !(x > x_gap_low && x < x_gap_high && y > y_edge_low && y < y_gap_high) )
+            {
+                in_fid = true;
+            }
+        }
+
+        return in_fid;
+    }
+    static double[] toSphericalFromBeam(double pxpz, double pypz){
+        double x = pxpz, y = pypz, z = 1;
+        double beamTilt = .03057;
+        double xtemp = Math.cos(beamTilt)*x - Math.sin(beamTilt)*z;
+        double ztemp = Math.cos(beamTilt)*z + Math.sin(beamTilt)*x;
+        double ytemp = y;
+        
+        double theta = Math.atan(Math.hypot(xtemp, ytemp)/ ztemp);
+        double phi = Math.atan2(ytemp, xtemp);
+        
+        
+        return new double[]{theta, phi};
+    }
+    static Map<Integer, double[]> map ;
+    static void readMap() throws FileNotFoundException{
+        Scanner s = new Scanner(new File(System.getenv("HOME") + "/ecal_positions.txt"));
+        map = new HashMap();
+        
+        while(s.hasNext()){
+            int ix =s.nextInt();
+            int iy = s.nextInt();
+            double x = s.nextDouble();
+            double y =s.nextDouble();
+            map.put(ix+100*iy, new double[]{x, y});
+            
+        }
+        s.close();
+    }
+    static double getArea(int ix, int iy){
+        int ixp = ix+1;
+        if(ixp == 0)
+            ixp = 1;
+        int ixm = ix-1;
+        if(ixm == 0)
+            ixm = -1;
+        double[] plus = map.get(ixp+100*(iy+1));
+        double[] minus = map.get(ixm+100*(iy-1));
+        return (plus[0]-minus[0])*(plus[1]-minus[1])/4;
+    }
+    
+    public static double[] getThetaPhiSpherical(double x,double y){
+        double hcoord[] = toHollysCoordinates(x,y, 1.056, 11);
+        return toSphericalFromBeam(Math.tan(hcoord[1]),Math.tan(hcoord[0]));
+    }
+    /*beam tilt*/
+    static double tilt = .03057;
+    //assuming FEE electron.
+
+    public static double[] getXY(double theta, double phi){
+        
+        double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(tilt)+Math.cos(theta)*Math.sin(tilt);
+        double uy = Math.sin(phi)*Math.sin(theta);
+        double uz = Math.cos(theta)*Math.cos(tilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(tilt);
+        double pxpz = ux/uz;
+        double pypz = uy/uz;
+        //holly's coordinates:
+        double h1 = Math.atan(pypz);
+        double h2 = Math.atan(pxpz);
+        //0.00071 * y +0.000357,
+        //0.00071*x + 0.00003055*e + 0.04572/e +0.0006196
+        double y = (h1-0.000357)/0.00071;
+        double e = 1.056;
+        double x = (h2 - 0.00003055*e - 0.04572/e -0.0006196)/0.00071;
+        return new double[]{x,y};
+    }
+    public static boolean fid_ECal_spherical(double theta, double phi){
+        double[] xy = getXY(theta, phi);
+        double x = xy[0];
+        double y = xy[1];
+        return fid_ECal(x, y);
+    }
+    public static boolean fid_ECal_spherical_more_strict(double theta, double phi, double d){
+        double[] xy = getXY(theta, phi);
+        double x = xy[0];
+        double y = xy[1];
+        return fid_ecal_more_strict(x, y, d);
+    }
+    public static void main(String arg[]){
+        double x = 0, y = 0;
+        double sp[] = getThetaPhiSpherical(x,y); 
+        System.out.println(Arrays.toString(getXY(sp[0], sp[1])));
+    }
 }
-	
-
+    
+

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java	Wed Mar  9 11:43:24 2016
@@ -17,129 +17,129 @@
 //arg[5] is the radius (in fm) for calculating predicted form factors
 
 public class ExtractFormFactors {
-	static double Na = 6.022e23;
-	static double hbarc = .1973269788;
-	static double alpha = 1/137.;
-	static double q = 1.602e-19;
-	static double amu = .931454;
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		IAnalysisFactory af = IAnalysisFactory.create();
-		ITreeFactory tf = af.createTreeFactory();
+    static double Na = 6.022e23;
+    static double hbarc = .1973269788;
+    static double alpha = 1/137.;
+    static double q = 1.602e-19;
+    static double amu = .931454;
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        IAnalysisFactory af = IAnalysisFactory.create();
+        ITreeFactory tf = af.createTreeFactory();
 
-		String[] inpaths = new String[]{"theta", "theta top", "theta bottom"};
-		String[] outpaths = new String[]{"form factors", "top only", "bottom only"};
-		
-		for(int config = 0; config < 3; config ++){
-			ITree treeNew = af.createTreeFactory().create();
+        String[] inpaths = new String[]{"theta", "theta top", "theta bottom"};
+        String[] outpaths = new String[]{"form factors", "top only", "bottom only"};
+        
+        for(int config = 0; config < 3; config ++){
+            ITree treeNew = af.createTreeFactory().create();
 
 
 
-			IDataPointSetFactory dpsf = af.createDataPointSetFactory(treeNew);
+            IDataPointSetFactory dpsf = af.createDataPointSetFactory(treeNew);
 
-			IPlotterFactory pf = af.createPlotterFactory();
-			IPlotter p = pf.create(outpaths[config]);
+            IPlotterFactory pf = af.createPlotterFactory();
+            IPlotter p = pf.create(outpaths[config]);
 
 
-			int Nsets = arg.length/10;
-			dpsMeasured = new IDataPointSet[Nsets];
+            int Nsets = arg.length/10;
+            dpsMeasured = new IDataPointSet[Nsets];
 
-			for(int set = 0; set< Nsets; set++){
-				String title = arg[0+10*set];
-				String inputFile = arg[1+10*set];
-				CustomBinning cb = new CustomBinning(new File(arg[2+10*set]));
+            for(int set = 0; set< Nsets; set++){
+                String title = arg[0+10*set];
+                String inputFile = arg[1+10*set];
+                CustomBinning cb = new CustomBinning(new File(arg[2+10*set]));
 
 
-				double Q = Double.parseDouble(arg[3+10*set]); //in nC
-				double E = Double.parseDouble(arg[4+10*set]); //in GeV
-				double aDensity = Double.parseDouble(arg[5+10*set]); //in g/cm^2
-				double M = Double.parseDouble(arg[6+10*set]); // in amu
-				double Z = Double.parseDouble(arg[7+10*set]); 
-				double r = Double.parseDouble(arg[8+10*set]);
-				double prescale = Math.pow(2,Double.parseDouble(arg[9+10*set]));
+                double Q = Double.parseDouble(arg[3+10*set]); //in nC
+                double E = Double.parseDouble(arg[4+10*set]); //in GeV
+                double aDensity = Double.parseDouble(arg[5+10*set]); //in g/cm^2
+                double M = Double.parseDouble(arg[6+10*set]); // in amu
+                double Z = Double.parseDouble(arg[7+10*set]); 
+                double r = Double.parseDouble(arg[8+10*set]);
+                double prescale = Math.pow(2,Double.parseDouble(arg[9+10*set]));
 
-				double luminosity = Q*1e-9/q*aDensity/(M/Na)*1e-24;  //nuclei per barn times # of beam electrons
-				
-				double scale = Math.pow((Z*alpha*hbarc)/(2*E), 2)/100; //this should be in barns
-				
-				if(config != 0) //one half of the detector only
-					scale /= 2;  
-				double recoil = 2*E/(M*amu);
+                double luminosity = Q*1e-9/q*aDensity/(M/Na)*1e-24;  //nuclei per barn times # of beam electrons
+                
+                double scale = Math.pow((Z*alpha*hbarc)/(2*E), 2)/100; //this should be in barns
+                
+                if(config != 0) //one half of the detector only
+                    scale /= 2;  
+                double recoil = 2*E/(M*amu);
 
 
-				//double luminosity = Double.parseDouble(arg[2]);
-				//double scale = Double.parseDouble(arg[3]);
-				//double recoil = Double.parseDouble(arg[4]);
-				//double r = Double.parseDouble(arg[5]);
+                //double luminosity = Double.parseDouble(arg[2]);
+                //double scale = Double.parseDouble(arg[3]);
+                //double recoil = Double.parseDouble(arg[4]);
+                //double r = Double.parseDouble(arg[5]);
 
-				ITree tree0 = tf.create(inputFile, "xml");
-				//IHistogram1D hist_iso = (IHistogram1D) tree0.find("theta isolated ");
-				IHistogram1D hist = (IHistogram1D) tree0.find(inpaths[config]);
-				System.out.println(inpaths[config] + " " + title + " " + hist.binHeight(0));
+                ITree tree0 = tf.create(inputFile, "xml");
+                //IHistogram1D hist_iso = (IHistogram1D) tree0.find("theta isolated ");
+                IHistogram1D hist = (IHistogram1D) tree0.find(inpaths[config]);
+                System.out.println(inpaths[config] + " " + title + " " + hist.binHeight(0));
 
-				dpsMeasured[set] = dpsf.create(title, 2);
-				//IDataPointSet dps_iso = dpsf.create("F(Q)^2 (measured isolated)", 2);
+                dpsMeasured[set] = dpsf.create(title, 2);
+                //IDataPointSet dps_iso = dpsf.create("F(Q)^2 (measured isolated)", 2);
 
-				if(set == 0)
-					dpsTheory = dpsf.create("theoretical", 2);
+                if(set == 0)
+                    dpsTheory = dpsf.create("theoretical", 2);
 
-				int nBins = hist.axis().bins();
+                int nBins = hist.axis().bins();
 
-				for(int i = 0; i< nBins; i++){
-					double thmax = cb.thetaMax[i];
-					double thmin = cb.thetaMin[i];
-					double n = hist.binHeight(i);
-					//double n_iso = hist_iso.binHeight(i);
+                for(int i = 0; i< nBins; i++){
+                    double thmax = cb.thetaMax[i];
+                    double thmin = cb.thetaMin[i];
+                    double n = hist.binHeight(i);
+                    //double n_iso = hist_iso.binHeight(i);
 
-					//scale = Math.pow(74/137.*.2/(2*1.057), 2);
-					double mottInt = MottIntegral.mottIntegral(recoil, scale, i, cb);
-					double F2 =n*prescale/luminosity/mottInt;
-					double dF2 = Math.sqrt(n)*prescale/luminosity/mottInt;
+                    //scale = Math.pow(74/137.*.2/(2*1.057), 2);
+                    double mottInt = MottIntegral.mottIntegral(recoil, scale, i, cb);
+                    double F2 =n*prescale/luminosity/mottInt;
+                    double dF2 = Math.sqrt(n)*prescale/luminosity/mottInt;
 
-					//double F2_iso =n_iso*prescale/luminosity/mottInt;
-					//double dF2_iso = Math.sqrt(n_iso)*prescale/luminosity/mottInt;
+                    //double F2_iso =n_iso*prescale/luminosity/mottInt;
+                    //double dF2_iso = Math.sqrt(n_iso)*prescale/luminosity/mottInt;
 
 
-					IDataPoint dp = dpsMeasured[set].addPoint();
+                    IDataPoint dp = dpsMeasured[set].addPoint();
 
-					double trigStuff = Math.pow(Math.sin((thmax+thmin)/4),2);
-					double Q2 = 4*E*E*trigStuff/(1+recoil*trigStuff);
-					double dQ2 = E*E*(thmax+thmin)*(thmax-thmin)*2;
-					dp.coordinate(0).setValue(Q2);
-					dp.coordinate(0).setErrorMinus(dQ2);
-					dp.coordinate(0).setErrorPlus(dQ2);
-					dp.coordinate(1).setValue(F2);
-					dp.coordinate(1).setErrorMinus(dF2);
-					dp.coordinate(1).setErrorPlus(dF2);
+                    double trigStuff = Math.pow(Math.sin((thmax+thmin)/4),2);
+                    double Q2 = 4*E*E*trigStuff/(1+recoil*trigStuff);
+                    double dQ2 = E*E*(thmax+thmin)*(thmax-thmin)*2;
+                    dp.coordinate(0).setValue(Q2);
+                    dp.coordinate(0).setErrorMinus(dQ2);
+                    dp.coordinate(0).setErrorPlus(dQ2);
+                    dp.coordinate(1).setValue(F2);
+                    dp.coordinate(1).setErrorMinus(dF2);
+                    dp.coordinate(1).setErrorPlus(dF2);
 
-					/*dp = dps_iso.addPoint();
-				dp.coordinate(0).setValue(Q2);
-				dp.coordinate(0).setErrorMinus(dQ2);
-				dp.coordinate(0).setErrorPlus(dQ2);
-				dp.coordinate(1).setValue(F2_iso);
-				dp.coordinate(1).setErrorMinus(dF2_iso);
-				dp.coordinate(1).setErrorPlus(dF2_iso);
-					 */
-					double F_calc = 0;
-					if(Z == 74){
-						//double R = 5.373; 
-						double R = 6.87;
-						F_calc = F_calc(Q2, R);
-					} else if(Z== 6){
-						double rp = 0.8786;
-						double a = 1.64;
-						F_calc = F_calc_alt(Q2, 6,a, Math.sqrt(a*a*(1-1/12.)+rp*rp) );
-					}
+                    /*dp = dps_iso.addPoint();
+                dp.coordinate(0).setValue(Q2);
+                dp.coordinate(0).setErrorMinus(dQ2);
+                dp.coordinate(0).setErrorPlus(dQ2);
+                dp.coordinate(1).setValue(F2_iso);
+                dp.coordinate(1).setErrorMinus(dF2_iso);
+                dp.coordinate(1).setErrorPlus(dF2_iso);
+                     */
+                    double F_calc = 0;
+                    if(Z == 74){
+                        //double R = 5.373; 
+                        double R = 6.87;
+                        F_calc = F_calc(Q2, R);
+                    } else if(Z== 6){
+                        double rp = 0.8786;
+                        double a = 1.64;
+                        F_calc = F_calc_alt(Q2, 6,a, Math.sqrt(a*a*(1-1/12.)+rp*rp) );
+                    }
 
-					if(set == 0){
-						dp = dpsTheory.addPoint();
-						dp.coordinate(0).setValue(Q2);
-						//double F_calc = 1-r*r*Q2/(6*hbarc*hbarc);
-						dp.coordinate(1).setValue(F_calc*F_calc);
-						dp.coordinate(1).setErrorMinus(0);
-						dp.coordinate(1).setErrorPlus(0);
+                    if(set == 0){
+                        dp = dpsTheory.addPoint();
+                        dp.coordinate(0).setValue(Q2);
+                        //double F_calc = 1-r*r*Q2/(6*hbarc*hbarc);
+                        dp.coordinate(1).setValue(F_calc*F_calc);
+                        dp.coordinate(1).setErrorMinus(0);
+                        dp.coordinate(1).setErrorPlus(0);
 
-					}
-					//System.out.println(i + "\t" + thmin+ "\t" + thmax + "\t"+ F_calc*F_calc + "\t" + F2 + "\t" + dF2);
+                    }
+                    //System.out.println(i + "\t" + thmin+ "\t" + thmax + "\t"+ F_calc*F_calc + "\t" + F2 + "\t" + dF2);
 
 
 
@@ -147,36 +147,36 @@
 
 
 
-				}
+                }
 
-				p.region(0).plot(dpsMeasured[set]);
+                p.region(0).plot(dpsMeasured[set]);
 
-				//p.region(0).plot(dps_iso);
-			}
-			
-			IPlotterStyle style = StyleUtil.smoothCurveStyle(pf);
-			p.region(0).plot(dpsTheory, style);
-			StyleUtil.stylize(p.region(0), "Form Factors", "Q^2 (GeV^2)", "|F(Q^2)|^2");
-			p.show();
-		}
+                //p.region(0).plot(dps_iso);
+            }
+            
+            IPlotterStyle style = StyleUtil.smoothCurveStyle(pf);
+            p.region(0).plot(dpsTheory, style);
+            StyleUtil.stylize(p.region(0), "Form Factors", "Q^2 (GeV^2)", "|F(Q^2)|^2");
+            p.show();
+        }
 
-	}
-	static IDataPointSet dpsMeasured[];
-	static IDataPointSet dpsTheory;
+    }
+    static IDataPointSet dpsMeasured[];
+    static IDataPointSet dpsTheory;
 
-	static double F_calc(double Q2, double r){
-		double x = Math.sqrt(Q2*r*r/(hbarc*hbarc));
-		double F_calc = 3/(x*x*x)*(Math.sin(x)-x*Math.cos(x));
-		return F_calc;
-	}
+    static double F_calc(double Q2, double r){
+        double x = Math.sqrt(Q2*r*r/(hbarc*hbarc));
+        double F_calc = 3/(x*x*x)*(Math.sin(x)-x*Math.cos(x));
+        return F_calc;
+    }
 
-	static double F_calc_alt(double Q2, double Z, double a, double b){
-		return (1-(Z-2)/(6*Z)*a*a*Q2/(hbarc*hbarc))*Math.exp(-1/4.*b*b*Q2/(hbarc*hbarc));
-	}
+    static double F_calc_alt(double Q2, double Z, double a, double b){
+        return (1-(Z-2)/(6*Z)*a*a*Q2/(hbarc*hbarc))*Math.exp(-1/4.*b*b*Q2/(hbarc*hbarc));
+    }
 
 
-	void temp_test(){
-		
-	}
+    void temp_test(){
+        
+    }
 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java	Wed Mar  9 11:43:24 2016
@@ -11,285 +11,285 @@
 import static java.lang.Math.*;
 
 public class FEESpectrumGenerator {
-	/*************
-	 * CONSTANTS *
-	 *************/
-	static double alpha = 1/137., hbarc = .197, q = 1.6e-19, Na= 6.022e23;
-	static double me = .000511;
-	static double amu = 931.4941;
-
-	private static double sqrt2 = Math.sqrt(2);
-
-	/***************
-	 * OTHER STUFF *
-	 ***************/
-
-	static int counter = 0;
-
-	static Random random = new Random();
-	static double thetaMax = .1;
-	static double thetaMin = .03;
-	/**
-	 * 
-	 * @return a random angle theta, with no form factor.  
-	 */
-	public static double getRandomThetaBare(){
-		double r = random.nextDouble();
-		double dTheta = (thetaMax-thetaMin)/4;
-		double theta = (thetaMax+thetaMin)/2;
-		int nIter = 11;
-		for(int i = 0; i< nIter; i++){
-			double x = MottIntegral.integral(a, theta);
-			double f = (x-xmin)/(xmax-xmin);
-			if(f<r){
-				theta += dTheta;
-			} else if(f> r){
-				theta -= dTheta;
-			}
-			dTheta /= 2;
-		}
-		return theta;
-
-
-	}
-
-	static double combine(double theta, double rms){
-		return theta + sqrt2 *rms*random.nextGaussian();
-	}
-
-
-	/**
-	 * 
-	 * @param a recoil factor = 2*E/M
-	 * @return a random angle theta, with no form factor.  
-	 */
-	public static double getRandomThetaWithFormFactor(FormFactor f){
-		while(true){
-			double theta = getRandomThetaBare();
-			double trigstuff = pow(sin(theta/2), 2);
-			double Q2 = 4*E*E*trigstuff/(1+a*trigstuff);
-			counter ++;
-			double f2 = f.getFormFactorSquared(Q2);
-			if(f2 > random.nextDouble())
-				return theta;
-		}
-	}
-
-
-
-		static double b = -1;
-	
-
-
-
-	static boolean radCorrections = false;
-	static int Nevents;
-	static double M, E, Q, aDensity;
-	static int Z;
-	static double a, xmax, xmin;
-	static boolean display;
-
-
-	private static CustomBinning cb;
-	public static void main(String arg[]) throws IOException{
-		String filename = arg[0];
-		M = Double.parseDouble(arg[1]);
-		E = Double.parseDouble(arg[2]);
-		thetaMin = Double.parseDouble(arg[3]);
-		thetaMax = Double.parseDouble(arg[4]);
-		Z = Integer.parseInt(arg[5]);
-
-		String outfile = null;
-		aDensity = Double.parseDouble(arg[6]);
-		Q = Double.parseDouble(arg[7]);
-
-		radCorrections = Boolean.parseBoolean(arg[8]);
-
-		if(arg.length>9){
-			display = true;
-			cb = new CustomBinning(new File(arg[9]));
-			outfile = arg[10];
-		}
-
-
-		a = 2*E/(M*amu);
-		xmin = MottIntegral.integral(a, thetaMin);
-		xmax = MottIntegral.integral(a, thetaMax);
-
-		double scale = Math.pow((Z*alpha*hbarc)/(2*E), 2)/100; //this should be in barns
-		double sigma = MottIntegral.mottIntegralWithFormFactor(a, scale, thetaMin, thetaMax, FormFactor.get(Z), 1000, E);
-		
-		double luminosity = Q*1e-9/q*aDensity/(M/Na)*1e-24;
-		Nevents = (int)(sigma*luminosity);
-
-
-		System.out.println(Nevents);
-
-		String title = "fee";
-		String comment = "fee";
-		StdhepWriter writer = new StdhepWriter(filename, title, comment, Nevents);
-		IAnalysisFactory af = null;
-		ITree tree = null;
-
-		if(display){
-			af = IAnalysisFactory.create();
-			tree = af.createTreeFactory().create(outfile,"xml",false,true);
-			IHistogramFactory hf = af.createHistogramFactory(tree);
-			
-			double thetaBins[] = new double[cb.nTheta+1];
-			for(int i = 0; i<cb.nTheta; i++){
-				thetaBins[i] = cb.thetaMin[i];
-			}
-
-			thetaBins[thetaBins.length-1] = cb.thetaMax[cb.nTheta-1];
-			
-			thetaHist = hf.createHistogram1D("theta", "theta", thetaBins);
-			
-			EHist = hf.createHistogram1D("energy", 200, 0, 1.3);
-			IPlotter p = af.createPlotterFactory().create();
-			p.createRegions(2,1);
-			p.region(0).plot(thetaHist);
-			p.region(1).plot(EHist);
-			p.show();
-		}
-
-		for(int i = 1; i<= Nevents; i++){
-			int nevhep = i; 
-			int nhep = 1;
-			int[] isthep = {1}; 
-			int[] idhep = {11};
-			int[] jmohep = {0,0}; 
-			int[] jdahep = {0,0};
-			double[] phep = randomMomentum();
-			double[] vhep = {0,0,0,0};
-			
-			
-			if(phep[3] > .5*E){
-				StdhepEvent event = new StdhepEvent(nevhep, nhep, isthep, idhep, jmohep, jdahep, phep, vhep);
-				double smear = .02;
-				if(display)
-					EHist.fill(phep[3]*(1+random.nextGaussian()*smear));
-				writer.writeRecord(event);
-			}
-			else{ // if the event has enough energy loss,
-				  // write it out as a blank event.  This way,
-				  // slic doesnt have to deal with low energy electrons
-				  // 
-				StdhepEvent event = new StdhepEvent(i, 0, 
-						new int[0],
-						new int[0],
-						new int[0],
-						new int[0],
-						new double[0],
-						new double[0]);
-				writer.writeRecord(event);
-			}
-			if(i%1000 == 0)
-				System.out.println("event " + i);
-		}
-		writer.close();
-		if(tree != null)
-			tree.commit();
-		
-		/*
-		String title = arg[0+10*set];
-		String inputFile = arg[1+10*set];
-		CustomBinning cb = new CustomBinning(new File(arg[2+10*set]));
-
-
-		double Q = Double.parseDouble(arg[3+10*set]); //in nC
-		double E = Double.parseDouble(arg[4+10*set]); //in GeV
-		double aDensity = Double.parseDouble(arg[5+10*set]); //in g/cm^2
-		double M = Double.parseDouble(arg[6+10*set]); // in amu
-		double Z = Double.parseDouble(arg[7+10*set]); 
-		double r = Double.parseDouble(arg[8+10*set]);
-		double prescale = Math.pow(2,Double.parseDouble(arg[9+10*set]));
-		 */
-		if(display){
-			ExtractFormFactors.main(new String[]{
-					"generated",
-					outfile,
-					arg[9],
-					Double.toString(Q),
-					Double.toString(E),
-					Double.toString(aDensity),
-					Double.toString(M),
-					Double.toString(Z),
-					"3", //not used
-					"0" //no prescale
-
-			});
-
-			displayResiduals();
-
-		}
-	}
-
-	private static void displayResiduals() {
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IDataPointSetFactory dpsf = af.createDataPointSetFactory(af.createTreeFactory().create());
-		IDataPointSet residuals = dpsf.create("residuals", 2);
-		for(int i = 0; i<ExtractFormFactors.dpsMeasured[0].size(); i++){
-			IDataPoint gen = ExtractFormFactors.dpsMeasured[0].point(i);
-			IDataPoint the = ExtractFormFactors.dpsTheory.point(i);
-
-			IDataPoint res = residuals.addPoint();
-			res.coordinate(0).setValue(gen.coordinate(0).value());
-			res.coordinate(1).setValue(gen.coordinate(1).value()-the.coordinate(1).value());
-			double err = Math.hypot(gen.coordinate(1).errorMinus(), the.coordinate(1).errorMinus());
-			res.coordinate(1).setErrorMinus(err);
-			res.coordinate(1).setErrorPlus(err);
-		}
-		IPlotter p = af.createPlotterFactory().create();
-		p.region(0).plot(residuals);
-		p.show();
-
-	}
-
-
-
-	static IHistogram1D thetaHist = null, EHist;
-
-
-
-	private static double[] randomMomentum() {
-		double theta = getRandomThetaWithFormFactor(FormFactor.get(Z));
-		double phi = random.nextDouble()*2*PI-PI;
-		if(thetaHist != null)
-			if(cb.inRange(theta, phi))
-				thetaHist.fill(theta);
-		double trigstuff = pow(sin(theta/2.), 2);
-		double Ep = E/(1+a*trigstuff);
-		double m = .000511;
-
-
-
-		if(radCorrections){
-
-			// L.W. Mo, Y.S. Tsai, Radiative Corrections to Elastic and inelastic ep and $\mu$p scattering
-			// Stanford Linear Accelerator Center, Stanford University, Stanford, CA
-			// Reviews of Modern Physics  Volume 41 Number 1, January 1969
-
-			//otherwise apply radiative corrections
-			double Q2 = 4*E*Ep*trigstuff;
-
-			//effective number of pre and post radiation lengths caused by radiative effects
-			double t = 3/4.*(alpha/Math.PI)*(Math.log(Q2/(me*me)-1));
-
-			// rms theta for 
-			double theta_rms = MultipleScattering.getThetaRMS(t, E);
-			theta = combine(theta, theta_rms);
-			
-			if(b == -1){
-				b = MultipleScattering.b(Z);
-			}
-			double bt = b*t;
-			Ep *= MultipleScattering.getRandomEnergyFraction(bt)*MultipleScattering.getRandomEnergyFraction(bt);
-			
-		}
-		if(Double.isNaN(Ep))
-			return null;
-		double p = sqrt(Ep*Ep-m*m);
-		return new double[]{p*sin(theta)*cos(phi), p*sin(theta)*sin(phi), p*cos(theta), Ep, m};
-	}
+    /*************
+     * CONSTANTS *
+     *************/
+    static double alpha = 1/137., hbarc = .197, q = 1.6e-19, Na= 6.022e23;
+    static double me = .000511;
+    static double amu = 931.4941;
+
+    private static double sqrt2 = Math.sqrt(2);
+
+    /***************
+     * OTHER STUFF *
+     ***************/
+
+    static int counter = 0;
+
+    static Random random = new Random();
+    static double thetaMax = .1;
+    static double thetaMin = .03;
+    /**
+     * 
+     * @return a random angle theta, with no form factor.  
+     */
+    public static double getRandomThetaBare(){
+        double r = random.nextDouble();
+        double dTheta = (thetaMax-thetaMin)/4;
+        double theta = (thetaMax+thetaMin)/2;
+        int nIter = 11;
+        for(int i = 0; i< nIter; i++){
+            double x = MottIntegral.integral(a, theta);
+            double f = (x-xmin)/(xmax-xmin);
+            if(f<r){
+                theta += dTheta;
+            } else if(f> r){
+                theta -= dTheta;
+            }
+            dTheta /= 2;
+        }
+        return theta;
+
+
+    }
+
+    static double combine(double theta, double rms){
+        return theta + sqrt2 *rms*random.nextGaussian();
+    }
+
+
+    /**
+     * 
+     * @param a recoil factor = 2*E/M
+     * @return a random angle theta, with no form factor.  
+     */
+    public static double getRandomThetaWithFormFactor(FormFactor f){
+        while(true){
+            double theta = getRandomThetaBare();
+            double trigstuff = pow(sin(theta/2), 2);
+            double Q2 = 4*E*E*trigstuff/(1+a*trigstuff);
+            counter ++;
+            double f2 = f.getFormFactorSquared(Q2);
+            if(f2 > random.nextDouble())
+                return theta;
+        }
+    }
+
+
+
+        static double b = -1;
+    
+
+
+
+    static boolean radCorrections = false;
+    static int Nevents;
+    static double M, E, Q, aDensity;
+    static int Z;
+    static double a, xmax, xmin;
+    static boolean display;
+
+
+    private static CustomBinning cb;
+    public static void main(String arg[]) throws IOException{
+        String filename = arg[0];
+        M = Double.parseDouble(arg[1]);
+        E = Double.parseDouble(arg[2]);
+        thetaMin = Double.parseDouble(arg[3]);
+        thetaMax = Double.parseDouble(arg[4]);
+        Z = Integer.parseInt(arg[5]);
+
+        String outfile = null;
+        aDensity = Double.parseDouble(arg[6]);
+        Q = Double.parseDouble(arg[7]);
+
+        radCorrections = Boolean.parseBoolean(arg[8]);
+
+        if(arg.length>9){
+            display = true;
+            cb = new CustomBinning(new File(arg[9]));
+            outfile = arg[10];
+        }
+
+
+        a = 2*E/(M*amu);
+        xmin = MottIntegral.integral(a, thetaMin);
+        xmax = MottIntegral.integral(a, thetaMax);
+
+        double scale = Math.pow((Z*alpha*hbarc)/(2*E), 2)/100; //this should be in barns
+        double sigma = MottIntegral.mottIntegralWithFormFactor(a, scale, thetaMin, thetaMax, FormFactor.get(Z), 1000, E);
+        
+        double luminosity = Q*1e-9/q*aDensity/(M/Na)*1e-24;
+        Nevents = (int)(sigma*luminosity);
+
+
+        System.out.println(Nevents);
+
+        String title = "fee";
+        String comment = "fee";
+        StdhepWriter writer = new StdhepWriter(filename, title, comment, Nevents);
+        IAnalysisFactory af = null;
+        ITree tree = null;
+
+        if(display){
+            af = IAnalysisFactory.create();
+            tree = af.createTreeFactory().create(outfile,"xml",false,true);
+            IHistogramFactory hf = af.createHistogramFactory(tree);
+            
+            double thetaBins[] = new double[cb.nTheta+1];
+            for(int i = 0; i<cb.nTheta; i++){
+                thetaBins[i] = cb.thetaMin[i];
+            }
+
+            thetaBins[thetaBins.length-1] = cb.thetaMax[cb.nTheta-1];
+            
+            thetaHist = hf.createHistogram1D("theta", "theta", thetaBins);
+            
+            EHist = hf.createHistogram1D("energy", 200, 0, 1.3);
+            IPlotter p = af.createPlotterFactory().create();
+            p.createRegions(2,1);
+            p.region(0).plot(thetaHist);
+            p.region(1).plot(EHist);
+            p.show();
+        }
+
+        for(int i = 1; i<= Nevents; i++){
+            int nevhep = i; 
+            int nhep = 1;
+            int[] isthep = {1}; 
+            int[] idhep = {11};
+            int[] jmohep = {0,0}; 
+            int[] jdahep = {0,0};
+            double[] phep = randomMomentum();
+            double[] vhep = {0,0,0,0};
+            
+            
+            if(phep[3] > .5*E){
+                StdhepEvent event = new StdhepEvent(nevhep, nhep, isthep, idhep, jmohep, jdahep, phep, vhep);
+                double smear = .02;
+                if(display)
+                    EHist.fill(phep[3]*(1+random.nextGaussian()*smear));
+                writer.writeRecord(event);
+            }
+            else{ // if the event has enough energy loss,
+                  // write it out as a blank event.  This way,
+                  // slic doesnt have to deal with low energy electrons
+                  // 
+                StdhepEvent event = new StdhepEvent(i, 0, 
+                        new int[0],
+                        new int[0],
+                        new int[0],
+                        new int[0],
+                        new double[0],
+                        new double[0]);
+                writer.writeRecord(event);
+            }
+            if(i%1000 == 0)
+                System.out.println("event " + i);
+        }
+        writer.close();
+        if(tree != null)
+            tree.commit();
+        
+        /*
+        String title = arg[0+10*set];
+        String inputFile = arg[1+10*set];
+        CustomBinning cb = new CustomBinning(new File(arg[2+10*set]));
+
+
+        double Q = Double.parseDouble(arg[3+10*set]); //in nC
+        double E = Double.parseDouble(arg[4+10*set]); //in GeV
+        double aDensity = Double.parseDouble(arg[5+10*set]); //in g/cm^2
+        double M = Double.parseDouble(arg[6+10*set]); // in amu
+        double Z = Double.parseDouble(arg[7+10*set]); 
+        double r = Double.parseDouble(arg[8+10*set]);
+        double prescale = Math.pow(2,Double.parseDouble(arg[9+10*set]));
+         */
+        if(display){
+            ExtractFormFactors.main(new String[]{
+                    "generated",
+                    outfile,
+                    arg[9],
+                    Double.toString(Q),
+                    Double.toString(E),
+                    Double.toString(aDensity),
+                    Double.toString(M),
+                    Double.toString(Z),
+                    "3", //not used
+                    "0" //no prescale
+
+            });
+
+            displayResiduals();
+
+        }
+    }
+
+    private static void displayResiduals() {
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IDataPointSetFactory dpsf = af.createDataPointSetFactory(af.createTreeFactory().create());
+        IDataPointSet residuals = dpsf.create("residuals", 2);
+        for(int i = 0; i<ExtractFormFactors.dpsMeasured[0].size(); i++){
+            IDataPoint gen = ExtractFormFactors.dpsMeasured[0].point(i);
+            IDataPoint the = ExtractFormFactors.dpsTheory.point(i);
+
+            IDataPoint res = residuals.addPoint();
+            res.coordinate(0).setValue(gen.coordinate(0).value());
+            res.coordinate(1).setValue(gen.coordinate(1).value()-the.coordinate(1).value());
+            double err = Math.hypot(gen.coordinate(1).errorMinus(), the.coordinate(1).errorMinus());
+            res.coordinate(1).setErrorMinus(err);
+            res.coordinate(1).setErrorPlus(err);
+        }
+        IPlotter p = af.createPlotterFactory().create();
+        p.region(0).plot(residuals);
+        p.show();
+
+    }
+
+
+
+    static IHistogram1D thetaHist = null, EHist;
+
+
+
+    private static double[] randomMomentum() {
+        double theta = getRandomThetaWithFormFactor(FormFactor.get(Z));
+        double phi = random.nextDouble()*2*PI-PI;
+        if(thetaHist != null)
+            if(cb.inRange(theta, phi))
+                thetaHist.fill(theta);
+        double trigstuff = pow(sin(theta/2.), 2);
+        double Ep = E/(1+a*trigstuff);
+        double m = .000511;
+
+
+
+        if(radCorrections){
+
+            // L.W. Mo, Y.S. Tsai, Radiative Corrections to Elastic and inelastic ep and $\mu$p scattering
+            // Stanford Linear Accelerator Center, Stanford University, Stanford, CA
+            // Reviews of Modern Physics  Volume 41 Number 1, January 1969
+
+            //otherwise apply radiative corrections
+            double Q2 = 4*E*Ep*trigstuff;
+
+            //effective number of pre and post radiation lengths caused by radiative effects
+            double t = 3/4.*(alpha/Math.PI)*(Math.log(Q2/(me*me)-1));
+
+            // rms theta for 
+            double theta_rms = MultipleScattering.getThetaRMS(t, E);
+            theta = combine(theta, theta_rms);
+            
+            if(b == -1){
+                b = MultipleScattering.b(Z);
+            }
+            double bt = b*t;
+            Ep *= MultipleScattering.getRandomEnergyFraction(bt)*MultipleScattering.getRandomEnergyFraction(bt);
+            
+        }
+        if(Double.isNaN(Ep))
+            return null;
+        double p = sqrt(Ep*Ep-m*m);
+        return new double[]{p*sin(theta)*cos(phi), p*sin(theta)*sin(phi), p*cos(theta), Ep, m};
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FormFactor.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FormFactor.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FormFactor.java	Wed Mar  9 11:43:24 2016
@@ -2,42 +2,42 @@
 
 public abstract class FormFactor {
 
-	abstract double getFormFactor(double q2);
+    abstract double getFormFactor(double q2);
 
-	double getFormFactorSquared(double q2){
-		return Math.pow(getFormFactor(q2), 2);
-	}
-	static double hbarc = .197;
-	static FormFactor carbon = new FormFactor(){
+    double getFormFactorSquared(double q2){
+        return Math.pow(getFormFactor(q2), 2);
+    }
+    static double hbarc = .197;
+    static FormFactor carbon = new FormFactor(){
 
-		@Override
-		public double getFormFactor(double Q2) {
-			double Z= 6;
-			double rp = 0.8786;
-			double a = 1.64;
-			double b = Math.sqrt(a*a*(1-1/12.)+rp*rp);
-			return (1-(Z-2)/(6*Z)*a*a*Q2/(hbarc*hbarc))*Math.exp(-1/4.*b*b*Q2/(hbarc*hbarc));
-		}
+        @Override
+        public double getFormFactor(double Q2) {
+            double Z= 6;
+            double rp = 0.8786;
+            double a = 1.64;
+            double b = Math.sqrt(a*a*(1-1/12.)+rp*rp);
+            return (1-(Z-2)/(6*Z)*a*a*Q2/(hbarc*hbarc))*Math.exp(-1/4.*b*b*Q2/(hbarc*hbarc));
+        }
 
-	};
-	static FormFactor tungsten = new FormFactor(){
+    };
+    static FormFactor tungsten = new FormFactor(){
 
-		@Override
-		public double getFormFactor(double Q2) {
-			double Z= 74;
-			double r = 6.87;
-			double x = Math.sqrt(Q2*r*r/(hbarc*hbarc));
-			double F_calc = 3/(x*x*x)*(Math.sin(x)-x*Math.cos(x));
-			return F_calc;
-		}
-		
-	};
-	static FormFactor get(int Z){
-		if(Z == 6)
-			return carbon;
-		if(Z == 74)
-			return tungsten;
-		System.err.println("Form Factor for " + Z + " not implemented");
-		return null;
-	}
+        @Override
+        public double getFormFactor(double Q2) {
+            double Z= 74;
+            double r = 6.87;
+            double x = Math.sqrt(Q2*r*r/(hbarc*hbarc));
+            double F_calc = 3/(x*x*x)*(Math.sin(x)-x*Math.cos(x));
+            return F_calc;
+        }
+        
+    };
+    static FormFactor get(int Z){
+        if(Z == 6)
+            return carbon;
+        if(Z == 74)
+            return tungsten;
+        System.err.println("Form Factor for " + Z + " not implemented");
+        return null;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java	Wed Mar  9 11:43:24 2016
@@ -35,448 +35,448 @@
 import org.hps.users.spaul.StyleUtil;
 
 public class MakeHistograms {
-	
-	
-	
-	static boolean display = false;
-	static CustomBinning cb;
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		if(arg.length == 1){
-			File file = new File(arg[0]);
-			String path = arg[0];
-			if(file.isDirectory()){
-				org.hps.users.spaul.SumEverything.main(new String[]{path, "temp.aida"});
-				path = "temp.aida";
-			}
-			IAnalysisFactory af = IAnalysisFactory.create();
-			ITreeFactory tf = af.createTreeFactory();
-			ITree tree0 = tf.create(path, "xml");
-			extractHistograms(tree0);
-			setupPlotter(af);
-
-		} else{
-
-			String input = arg[0];
-			String output = arg[1];
-			cb = new CustomBinning(new File(arg[2]));
-			if(arg[arg.length -1].equals("display"))
-				display = true;
-			IAnalysisFactory af = IAnalysisFactory.create();
-			ITree tree = af.createTreeFactory().create(output,"xml",false,true);
-			IHistogramFactory hf = af.createHistogramFactory(tree);
-			setupHistograms(hf);
-			if(display){
-				setupPlotter(af);
-			}
-			ConditionsDriver hack = new ConditionsDriver();
-			//hack.setXmlConfigResource("/u/group/hps/hps_soft/detector-data/detectors/HPS-EngRun2015-Nominal-v3");
-			hack.setDetectorName("HPS-EngRun2015-Nominal-v3");
-			hack.setFreeze(true);
-			hack.setRunNumber(Integer.parseInt(arg[3]));
-			
-			hack.initialize();
-			beamTiltY = Double.parseDouble(arg[4]);
-			beamTiltX = Double.parseDouble(arg[5]);
-			LCIOReader reader = new LCIOReader(new File(input));
-			//reader.open(input);
-			//reader.
-			EventHeader event = reader.read();
-			int nEvents = 0;
-			try{
-				outer : while(event != null){
-					processEvent(event);
-
-					//System.out.println(Q2);
-
-					event = reader.read();
-				}
-			} catch (Exception e){
-				e.printStackTrace();
-			}
-			tree.commit();
-			tree.close();
-		}
-
-	}
-
-	static IHistogram2D h1, h2, h2a, h2b, h2c;
-	static IHistogram2D h4,h4a;
-	static IHistogram1D h3, /*h3a,*/ h3_t, h3_b;
-	static IHistogram1D h5, h5a; 
-	//static IHistogram2D h6, h6a;
-	static IHistogram1D h7, h7a;
-	static IHistogram1D h8;
-	static IHistogram1D h9_t, h9_b;
-	static IHistogram1D h10_t, h10_b;
-	private static IHistogram1D h4y;
-
-	private static void extractHistograms(ITree tree0) {
-		h1 = (IHistogram2D) tree0.find("theta vs energy");
-
-		h2 = (IHistogram2D) tree0.find("theta vs phi");
-		h2a = (IHistogram2D) tree0.find("theta vs phi cut");
-		h2b = (IHistogram2D) tree0.find("theta vs phi cut alt");
-		h2c = (IHistogram2D) tree0.find("theta vs phi alt");
-
-		h3 = (IHistogram1D) tree0.find("theta");
-		//h3a = (IHistogram1D) tree0.find("theta isolated ");
-		h3_t = (IHistogram1D) tree0.find("theta top");
-		h3_b = (IHistogram1D) tree0.find("theta bottom");
-		
-		h4 = (IHistogram2D) tree0.find("px\\/pz vs py\\/pz");
-		h4a = (IHistogram2D) tree0.find("px\\/pz vs py\\/pz cut");
-		System.out.println(h4a.xAxis().bins());
-		h5 = (IHistogram1D) tree0.find("energy top");
-		h5 = (IHistogram1D) tree0.find("energy bottom");
-
-//		h6 = (IHistogram2D) tree0.find("cluster");
-//		h6a = (IHistogram2D) tree0.find("cluster matched");
-		h7 = (IHistogram1D) tree0.find("y top");
-		h7a = (IHistogram1D) tree0.find("y bottom");
-		h8 = (IHistogram1D) tree0.find("seed energy");
-		
-
-		h9_t = (IHistogram1D) tree0.find("pz top");
-		h9_b = (IHistogram1D) tree0.find("pz bottom");
-		
-
-		h10_t = (IHistogram1D) tree0.find("clustsize top");
-		h10_b = (IHistogram1D) tree0.find("clustsize bottom");
-
-	}
-	static void setupHistograms(IHistogramFactory hf){
-		//h1 = hf.createHistogram2D("px\\/pz vs py\\/pz", 160, -.16, .24, 160, -.2, .2);
-
-
-
-
-		h2 = hf.createHistogram2D("theta vs phi", 300, 0, .3, 314, -3.14, 3.14);
-
-		h2a = hf.createHistogram2D("theta vs phi cut", 300, 0, .3, 314, -3.14, 3.14);
-
-		double thetaBins[] = new double[cb.nTheta+1];
-		for(int i = 0; i<cb.nTheta; i++){
-			thetaBins[i] = cb.thetaMin[i];
-		}
-
-		thetaBins[thetaBins.length-1] = cb.thetaMax[cb.nTheta-1];
-
-		double phiBins[] = new double[315];
-		for(int i = 0; i<315; i++){
-			phiBins[i] = i/50.-3.14;  //every 10 mrad;
-		}
-
-		double eBins[] = new double[66];
-		for(int i = 0; i<66; i++){
-			eBins[i] = i/50.;  //every 20 MeV up to 1300 MeV
-		}
-
-
-		h1 = hf.createHistogram2D("theta vs energy", "theta vs energy", thetaBins, eBins);
-
-
-		//identical to h2a, except different binning
-		h2b = hf.createHistogram2D("theta vs phi cut alt", "theta vs phi cut alt", thetaBins, phiBins);
-		h2c = hf.createHistogram2D("theta vs phi alt", "theta vs phi alt", thetaBins, phiBins);
-
-		h3 = hf.createHistogram1D("theta", "theta", thetaBins);
-//		h3a = hf.createHistogram1D("theta isolated ", "theta isolated", thetaBins);
-
-		h3_t = hf.createHistogram1D("theta top", "theta top", thetaBins);
-		h3_b = hf.createHistogram1D("theta bottom", "theta bottom", thetaBins);
-
-		
-		h4 = hf.createHistogram2D("px\\/pz vs py\\/pz", 300, -.16, .24, 300, -.2, .2);
-		h4a = hf.createHistogram2D("px\\/pz vs py\\/pz cut", 300, -.16, .24, 300, -.2, .2);
-		h4y = hf.createHistogram1D("py\\pz", 1200, -.06, .06);
-		
-		h5 = hf.createHistogram1D("energy top", 75, 0, 1.5);
-		h5a = hf.createHistogram1D("energy bottom", 75, 0, 1.5);
-		
-
-		h9_t = hf.createHistogram1D("pz top", 75, 0, 1.5);
-		h9_b = hf.createHistogram1D("pz bottom", 75, 0, 1.5);
-		
-//		h6 = hf.createHistogram2D("cluster", 47, -23.5, 23.5, 11, -5.5, 5.5);
-//		h6a = hf.createHistogram2D("cluster matched", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
-		h7 = hf.createHistogram1D("y top", 500, 0, 100);
-
-		h7a = hf.createHistogram1D("y bottom", 500, 0, 100);
-
-		h8 = hf.createHistogram1D("seed energy", 120, 0, 1.2);
-		
-		h10_t = hf.createHistogram1D("clustsize top", 10,0, 10);
-		h10_b = hf.createHistogram1D("clustsize bottom", 10,0, 10);
-	}
-	static void setupPlotter(IAnalysisFactory af){
-		IPlotterFactory pf = af.createPlotterFactory();
-		IPlotter p = pf.create();
-		p.createRegions(2,2);
-		p.region(0).plot(h2);
-		StyleUtil.stylize(p.region(0), "theta", "phi");
-//		p.region(1).plot(h3a);
-		StyleUtil.stylize(p.region(1), "theta", "# of particles");
-		p.region(2).plot(h9_t);
-		p.region(2).plot(h9_b);
-		StyleUtil.noFillHistogramBars(p.region(2));
-		StyleUtil.stylize(p.region(2), "pztilt" ,"pztilt", "# of particles");
-		p.region(3).plot(h5);
-		p.region(3).plot(h5a);
-		StyleUtil.noFillHistogramBars(p.region(3));
-		StyleUtil.stylize(p.region(3), "energy", "# of particles");
-
-		p.show();
-		
-		//new window for the next plot
-		IPlotter p2 = pf.create();
-		p2.region(0).plot(h2b);
-		//IDataPointSetFactory dpsf = af.createDataPointSetFactory(af.createTreeFactory().create());
-
-		StyleUtil.stylize(p2.region(0), "theta", "phi");
-
-		p2.show();
-
-		//new window for the next plot
-		IPlotter p3 = pf.create();
-		p3.region(0).plot(h2c);
-		StyleUtil.stylize(p3.region(0), "theta", "phi");
-
-		p3.show();
-
-		//new window for the next plot
-		IPlotter p4 = pf.create();
-		p4.region(0).plot(h4);
-		StyleUtil.stylize(p4.region(0), "px/pz", "py/pz");
-
-		p4.show();
-
-		//new window for the next plot
-		IPlotter p5 = pf.create();
-		p5.region(0).plot(h4a);
-		StyleUtil.stylize(p5.region(0), "px/pz", "py/pz");
-
-		p5.show();
-
-		IPlotter p6 = pf.create("efficiency");
-		p6.createRegions(1,2);
-//		p6.region(0).plot(h6);
-		StyleUtil.stylize(p6.region(0), "ix", "iy");
-//		p6.region(1).plot(h6a);
-		StyleUtil.stylize(p6.region(1), "ix", "iy");
-		p6.show();
-
-		IPlotter p7 = pf.create("theta vs energy");
-		//p6.createRegions(1,2);
-		p7.region(0).plot(h1);
-		StyleUtil.stylize(p7.region(0), "theta", "energy");
-		//		StyleUtil.stylize(p6.region(1), "ix", "iy");
-		p7.show();
-
-		IPlotter p8 = pf.create("y");
-		//p6.createRegions(1,2);
-		p8.region(0).plot(h7);
-		p8.region(0).plot(h7a);
-		StyleUtil.stylize(p8.region(0), "y", "# of particles");
-		//		StyleUtil.stylize(p6.region(1), "ix", "iy");
-		p8.show();
-		
-		IPlotter p9 = pf.create("theta: top vs. bottom");
-		//p6.createRegions(1,2);
-		p9.region(0).plot(h3_t);
-		p9.region(0).plot(h3_b);
-		StyleUtil.stylize(p9.region(0), "theta", "theta", "# of particles");
-		StyleUtil.noFillHistogramBars(p9.region(0));
-				//StyleUtil.stylize(p6.region(1), "ix", "iy");
-		p9.show();
-		
-		IPlotter p10 = pf.create("seed energy");
-		//p6.createRegions(1,2);
-		p10.createRegions(2,1);
-		p10.region(0).plot(h8);
-		StyleUtil.stylize(p10.region(0), "seed energy", "seed energy (GeV)", "# of particles");
-		
-		p10.region(1).plot(h10_t);
-		p10.region(1).plot(h10_b);
-		StyleUtil.noFillHistogramBars(p10.region(1));
-		StyleUtil.stylize(p10.region(1), "clust size", "n ecal hits", "# of particles");
-		
-		//StyleUtil.noFillHistogramBars(p10.region(0));
-				//StyleUtil.stylize(p6.region(1), "ix", "iy");
-		p10.show();
-
-	}
-	private static void processEvent(EventHeader event) {
-		if(event.getEventNumber() %10000 == 0)
-			System.out.println("event number " + event.getEventNumber());
-
-		for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
-		{
-			if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
-			TIData tid = new TIData(gob);
-			if (!tid.isSingle1Trigger())
-			{
-				return;
-			}
-		}
-		List<ReconstructedParticle> particles = event.get(ReconstructedParticle.class, "FinalStateParticles");
-		particles = RemoveDuplicateParticles.removeDuplicateParticles(particles);
-		outer : for(ReconstructedParticle p : particles){
-			
-
-			boolean isGood = addParticle(p);
-			
-
-		}
-		
-	}
-
-	
-
-	static double eMin = .8;
-	static double eMax = 1.2;
-	static double beamEnergy = 1.057;
-
-	static double beamTiltX = .03057;
-	static double beamTiltY;
-	static double maxChi2 = 50;
-	//maximum difference between the reconstructed energy and momentum
-	static double maxdE = .5;
-
-	static double seedEnergyCut = .4;
-
-
-	static boolean addParticle(ReconstructedParticle part){
-		if(part.getTracks().size() != 0){
-			if(part.getMomentum().magnitudeSquared() > .8
-					&& part.getTracks().get(0).getChi2() > maxChi2){
-				h4y.fill(part.getMomentum().y()/part.getMomentum().z());
-			}
-		}
-		if(part.getCharge() != -1)
-			return false;
-		if(part.getClusters().size() == 0)
-			return false;
-		Cluster c = part.getClusters().get(0);
-		double time = c.getCalorimeterHits().get(0).getTime();
-
-		if(!(time>40 && time <50))
-			return false;
-		double seedEnergy = 0;
-		for(CalorimeterHit hit : c.getCalorimeterHits()){
-			if(hit.getCorrectedEnergy() > seedEnergy)
-				seedEnergy = hit.getCorrectedEnergy();
-		}
-		h8.fill(seedEnergy);
-		
-		
-		if(seedEnergy < seedEnergyCut)
-			return false;
-		
-		if(c.getPosition()[1] > 0){
-			h10_t.fill(c.getSize());
-		}
-		else{ 
-			h10_b.fill(c.getSize());
-		}
-		
-		
-		if(c.getCalorimeterHits().size() < 3)
-			return false;
-		
-
-		if(c.getEnergy() > eMin && c.getEnergy() < eMax){
-			if(c.getPosition()[1] > 0)
-				h7.fill(c.getPosition()[1]);
-			else if(c.getPosition()[1] < 0)
-				h7a.fill(-c.getPosition()[1]);
-		}
-		
-		if(EcalUtil.fid_ECal(c)){
-			
-			if(c.getPosition()[1] > 0){
-				h5.fill(c.getEnergy());
-			}
-			else{ 
-				h5a.fill(c.getEnergy());
-			}
-			if(part.getTracks().size() == 0)
-				return false;
-			Track t = part.getTracks().get(0);
-			if(t.getChi2()>maxChi2){
-				return false;
-			}
-			if(!TrackType.isGBL(t.getType()))
-				return false;
-			
-			
-			
-			Hep3Vector p = part.getMomentum();
-
-
-
-			double px = p.x(), pz = p.z();
-			double pxtilt = px*Math.cos(beamTiltX)-pz*Math.sin(beamTiltX);
-			double py = p.y();
-			double pztilt = pz*Math.cos(beamTiltX)+px*Math.sin(beamTiltX);
-			
-			double pytilt = py*Math.cos(beamTiltY)-pztilt*Math.sin(beamTiltY);
-			pztilt = pz*Math.cos(beamTiltY) + pytilt*Math.sin(beamTiltY);
-
-			if(Math.abs(pztilt - c.getEnergy()) > maxdE)
-				return false;
-			if(c.getPosition()[1] > 0)
-				h9_t.fill(pztilt);
-			else
-				h9_b.fill(pztilt);
-
-			double theta = Math.atan(Math.hypot(pxtilt, pytilt)/pztilt);
-			double phi =Math.atan2(pytilt, pxtilt);
-			boolean inRange = cb.inRange(theta, phi);
-			if(inRange)
-				h1.fill(theta, c.getEnergy());
-
-
-
-			if(c.getEnergy() > eMin && c.getEnergy() < eMax) {
-
-
-
-				h2.fill(theta, phi);
-				h2c.fill(theta, phi);
-
-				h4.fill(px/pz, py/pz);
-				//h4y.fill(py/pz);
-
-				if(inRange){
-
-					//System.out.println(c.getEnergy() + " " + t.getType());
-					/*for(TrackState ts : t.getTrackStates()){
-						if(ts.getLocation() == TrackState.AtIP)
-							System.out.println(Arrays.toString( 
-									ts.getReferencePoint()));
-					}*/
-					h2a.fill(theta, phi);
-					h2b.fill(theta, phi);
-					
-					h3.fill(theta);
-					if(py > 0)
-						h3_t.fill(theta);
-					else 
-						h3_b.fill(theta);
-					//if(h3_t.sumBinHeights()+h3_b.sumBinHeights() != h3.sumBinHeights())
-						//System.out.println("NABO ERROR");
-					
-					
-					h4a.fill(px/pz, py/pz);
-				}
-
-
-				return true;
-			}
-
-		}
-		return false;
-	}
-	
+    
+    
+    
+    static boolean display = false;
+    static CustomBinning cb;
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        if(arg.length == 1){
+            File file = new File(arg[0]);
+            String path = arg[0];
+            if(file.isDirectory()){
+                org.hps.users.spaul.SumEverything.main(new String[]{path, "temp.aida"});
+                path = "temp.aida";
+            }
+            IAnalysisFactory af = IAnalysisFactory.create();
+            ITreeFactory tf = af.createTreeFactory();
+            ITree tree0 = tf.create(path, "xml");
+            extractHistograms(tree0);
+            setupPlotter(af);
+
+        } else{
+
+            String input = arg[0];
+            String output = arg[1];
+            cb = new CustomBinning(new File(arg[2]));
+            if(arg[arg.length -1].equals("display"))
+                display = true;
+            IAnalysisFactory af = IAnalysisFactory.create();
+            ITree tree = af.createTreeFactory().create(output,"xml",false,true);
+            IHistogramFactory hf = af.createHistogramFactory(tree);
+            setupHistograms(hf);
+            if(display){
+                setupPlotter(af);
+            }
+            ConditionsDriver hack = new ConditionsDriver();
+            //hack.setXmlConfigResource("/u/group/hps/hps_soft/detector-data/detectors/HPS-EngRun2015-Nominal-v3");
+            hack.setDetectorName("HPS-EngRun2015-Nominal-v3");
+            hack.setFreeze(true);
+            hack.setRunNumber(Integer.parseInt(arg[3]));
+            
+            hack.initialize();
+            beamTiltY = Double.parseDouble(arg[4]);
+            beamTiltX = Double.parseDouble(arg[5]);
+            LCIOReader reader = new LCIOReader(new File(input));
+            //reader.open(input);
+            //reader.
+            EventHeader event = reader.read();
+            int nEvents = 0;
+            try{
+                outer : while(event != null){
+                    processEvent(event);
+
+                    //System.out.println(Q2);
+
+                    event = reader.read();
+                }
+            } catch (Exception e){
+                e.printStackTrace();
+            }
+            tree.commit();
+            tree.close();
+        }
+
+    }
+
+    static IHistogram2D h1, h2, h2a, h2b, h2c;
+    static IHistogram2D h4,h4a;
+    static IHistogram1D h3, /*h3a,*/ h3_t, h3_b;
+    static IHistogram1D h5, h5a; 
+    //static IHistogram2D h6, h6a;
+    static IHistogram1D h7, h7a;
+    static IHistogram1D h8;
+    static IHistogram1D h9_t, h9_b;
+    static IHistogram1D h10_t, h10_b;
+    private static IHistogram1D h4y;
+
+    private static void extractHistograms(ITree tree0) {
+        h1 = (IHistogram2D) tree0.find("theta vs energy");
+
+        h2 = (IHistogram2D) tree0.find("theta vs phi");
+        h2a = (IHistogram2D) tree0.find("theta vs phi cut");
+        h2b = (IHistogram2D) tree0.find("theta vs phi cut alt");
+        h2c = (IHistogram2D) tree0.find("theta vs phi alt");
+
+        h3 = (IHistogram1D) tree0.find("theta");
+        //h3a = (IHistogram1D) tree0.find("theta isolated ");
+        h3_t = (IHistogram1D) tree0.find("theta top");
+        h3_b = (IHistogram1D) tree0.find("theta bottom");
+        
+        h4 = (IHistogram2D) tree0.find("px\\/pz vs py\\/pz");
+        h4a = (IHistogram2D) tree0.find("px\\/pz vs py\\/pz cut");
+        System.out.println(h4a.xAxis().bins());
+        h5 = (IHistogram1D) tree0.find("energy top");
+        h5 = (IHistogram1D) tree0.find("energy bottom");
+
+//      h6 = (IHistogram2D) tree0.find("cluster");
+//      h6a = (IHistogram2D) tree0.find("cluster matched");
+        h7 = (IHistogram1D) tree0.find("y top");
+        h7a = (IHistogram1D) tree0.find("y bottom");
+        h8 = (IHistogram1D) tree0.find("seed energy");
+        
+
+        h9_t = (IHistogram1D) tree0.find("pz top");
+        h9_b = (IHistogram1D) tree0.find("pz bottom");
+        
+
+        h10_t = (IHistogram1D) tree0.find("clustsize top");
+        h10_b = (IHistogram1D) tree0.find("clustsize bottom");
+
+    }
+    static void setupHistograms(IHistogramFactory hf){
+        //h1 = hf.createHistogram2D("px\\/pz vs py\\/pz", 160, -.16, .24, 160, -.2, .2);
+
+
+
+
+        h2 = hf.createHistogram2D("theta vs phi", 300, 0, .3, 314, -3.14, 3.14);
+
+        h2a = hf.createHistogram2D("theta vs phi cut", 300, 0, .3, 314, -3.14, 3.14);
+
+        double thetaBins[] = new double[cb.nTheta+1];
+        for(int i = 0; i<cb.nTheta; i++){
+            thetaBins[i] = cb.thetaMin[i];
+        }
+
+        thetaBins[thetaBins.length-1] = cb.thetaMax[cb.nTheta-1];
+
+        double phiBins[] = new double[315];
+        for(int i = 0; i<315; i++){
+            phiBins[i] = i/50.-3.14;  //every 10 mrad;
+        }
+
+        double eBins[] = new double[66];
+        for(int i = 0; i<66; i++){
+            eBins[i] = i/50.;  //every 20 MeV up to 1300 MeV
+        }
+
+
+        h1 = hf.createHistogram2D("theta vs energy", "theta vs energy", thetaBins, eBins);
+
+
+        //identical to h2a, except different binning
+        h2b = hf.createHistogram2D("theta vs phi cut alt", "theta vs phi cut alt", thetaBins, phiBins);
+        h2c = hf.createHistogram2D("theta vs phi alt", "theta vs phi alt", thetaBins, phiBins);
+
+        h3 = hf.createHistogram1D("theta", "theta", thetaBins);
+//      h3a = hf.createHistogram1D("theta isolated ", "theta isolated", thetaBins);
+
+        h3_t = hf.createHistogram1D("theta top", "theta top", thetaBins);
+        h3_b = hf.createHistogram1D("theta bottom", "theta bottom", thetaBins);
+
+        
+        h4 = hf.createHistogram2D("px\\/pz vs py\\/pz", 300, -.16, .24, 300, -.2, .2);
+        h4a = hf.createHistogram2D("px\\/pz vs py\\/pz cut", 300, -.16, .24, 300, -.2, .2);
+        h4y = hf.createHistogram1D("py\\pz", 1200, -.06, .06);
+        
+        h5 = hf.createHistogram1D("energy top", 75, 0, 1.5);
+        h5a = hf.createHistogram1D("energy bottom", 75, 0, 1.5);
+        
+
+        h9_t = hf.createHistogram1D("pz top", 75, 0, 1.5);
+        h9_b = hf.createHistogram1D("pz bottom", 75, 0, 1.5);
+        
+//      h6 = hf.createHistogram2D("cluster", 47, -23.5, 23.5, 11, -5.5, 5.5);
+//      h6a = hf.createHistogram2D("cluster matched", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        h7 = hf.createHistogram1D("y top", 500, 0, 100);
+
+        h7a = hf.createHistogram1D("y bottom", 500, 0, 100);
+
+        h8 = hf.createHistogram1D("seed energy", 120, 0, 1.2);
+        
+        h10_t = hf.createHistogram1D("clustsize top", 10,0, 10);
+        h10_b = hf.createHistogram1D("clustsize bottom", 10,0, 10);
+    }
+    static void setupPlotter(IAnalysisFactory af){
+        IPlotterFactory pf = af.createPlotterFactory();
+        IPlotter p = pf.create();
+        p.createRegions(2,2);
+        p.region(0).plot(h2);
+        StyleUtil.stylize(p.region(0), "theta", "phi");
+//      p.region(1).plot(h3a);
+        StyleUtil.stylize(p.region(1), "theta", "# of particles");
+        p.region(2).plot(h9_t);
+        p.region(2).plot(h9_b);
+        StyleUtil.noFillHistogramBars(p.region(2));
+        StyleUtil.stylize(p.region(2), "pztilt" ,"pztilt", "# of particles");
+        p.region(3).plot(h5);
+        p.region(3).plot(h5a);
+        StyleUtil.noFillHistogramBars(p.region(3));
+        StyleUtil.stylize(p.region(3), "energy", "# of particles");
+
+        p.show();
+        
+        //new window for the next plot
+        IPlotter p2 = pf.create();
+        p2.region(0).plot(h2b);
+        //IDataPointSetFactory dpsf = af.createDataPointSetFactory(af.createTreeFactory().create());
+
+        StyleUtil.stylize(p2.region(0), "theta", "phi");
+
+        p2.show();
+
+        //new window for the next plot
+        IPlotter p3 = pf.create();
+        p3.region(0).plot(h2c);
+        StyleUtil.stylize(p3.region(0), "theta", "phi");
+
+        p3.show();
+
+        //new window for the next plot
+        IPlotter p4 = pf.create();
+        p4.region(0).plot(h4);
+        StyleUtil.stylize(p4.region(0), "px/pz", "py/pz");
+
+        p4.show();
+
+        //new window for the next plot
+        IPlotter p5 = pf.create();
+        p5.region(0).plot(h4a);
+        StyleUtil.stylize(p5.region(0), "px/pz", "py/pz");
+
+        p5.show();
+
+        IPlotter p6 = pf.create("efficiency");
+        p6.createRegions(1,2);
+//      p6.region(0).plot(h6);
+        StyleUtil.stylize(p6.region(0), "ix", "iy");
+//      p6.region(1).plot(h6a);
+        StyleUtil.stylize(p6.region(1), "ix", "iy");
+        p6.show();
+
+        IPlotter p7 = pf.create("theta vs energy");
+        //p6.createRegions(1,2);
+        p7.region(0).plot(h1);
+        StyleUtil.stylize(p7.region(0), "theta", "energy");
+        //      StyleUtil.stylize(p6.region(1), "ix", "iy");
+        p7.show();
+
+        IPlotter p8 = pf.create("y");
+        //p6.createRegions(1,2);
+        p8.region(0).plot(h7);
+        p8.region(0).plot(h7a);
+        StyleUtil.stylize(p8.region(0), "y", "# of particles");
+        //      StyleUtil.stylize(p6.region(1), "ix", "iy");
+        p8.show();
+        
+        IPlotter p9 = pf.create("theta: top vs. bottom");
+        //p6.createRegions(1,2);
+        p9.region(0).plot(h3_t);
+        p9.region(0).plot(h3_b);
+        StyleUtil.stylize(p9.region(0), "theta", "theta", "# of particles");
+        StyleUtil.noFillHistogramBars(p9.region(0));
+                //StyleUtil.stylize(p6.region(1), "ix", "iy");
+        p9.show();
+        
+        IPlotter p10 = pf.create("seed energy");
+        //p6.createRegions(1,2);
+        p10.createRegions(2,1);
+        p10.region(0).plot(h8);
+        StyleUtil.stylize(p10.region(0), "seed energy", "seed energy (GeV)", "# of particles");
+        
+        p10.region(1).plot(h10_t);
+        p10.region(1).plot(h10_b);
+        StyleUtil.noFillHistogramBars(p10.region(1));
+        StyleUtil.stylize(p10.region(1), "clust size", "n ecal hits", "# of particles");
+        
+        //StyleUtil.noFillHistogramBars(p10.region(0));
+                //StyleUtil.stylize(p6.region(1), "ix", "iy");
+        p10.show();
+
+    }
+    private static void processEvent(EventHeader event) {
+        if(event.getEventNumber() %10000 == 0)
+            System.out.println("event number " + event.getEventNumber());
+
+        for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
+        {
+            if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
+            TIData tid = new TIData(gob);
+            if (!tid.isSingle1Trigger())
+            {
+                return;
+            }
+        }
+        List<ReconstructedParticle> particles = event.get(ReconstructedParticle.class, "FinalStateParticles");
+        particles = RemoveDuplicateParticles.removeDuplicateParticles(particles);
+        outer : for(ReconstructedParticle p : particles){
+            
+
+            boolean isGood = addParticle(p);
+            
+
+        }
+        
+    }
+
+    
+
+    static double eMin = .8;
+    static double eMax = 1.2;
+    static double beamEnergy = 1.057;
+
+    static double beamTiltX = .03057;
+    static double beamTiltY;
+    static double maxChi2 = 50;
+    //maximum difference between the reconstructed energy and momentum
+    static double maxdE = .5;
+
+    static double seedEnergyCut = .4;
+
+
+    static boolean addParticle(ReconstructedParticle part){
+        if(part.getTracks().size() != 0){
+            if(part.getMomentum().magnitudeSquared() > .8
+                    && part.getTracks().get(0).getChi2() > maxChi2){
+                h4y.fill(part.getMomentum().y()/part.getMomentum().z());
+            }
+        }
+        if(part.getCharge() != -1)
+            return false;
+        if(part.getClusters().size() == 0)
+            return false;
+        Cluster c = part.getClusters().get(0);
+        double time = c.getCalorimeterHits().get(0).getTime();
+
+        if(!(time>40 && time <50))
+            return false;
+        double seedEnergy = 0;
+        for(CalorimeterHit hit : c.getCalorimeterHits()){
+            if(hit.getCorrectedEnergy() > seedEnergy)
+                seedEnergy = hit.getCorrectedEnergy();
+        }
+        h8.fill(seedEnergy);
+        
+        
+        if(seedEnergy < seedEnergyCut)
+            return false;
+        
+        if(c.getPosition()[1] > 0){
+            h10_t.fill(c.getSize());
+        }
+        else{ 
+            h10_b.fill(c.getSize());
+        }
+        
+        
+        if(c.getCalorimeterHits().size() < 3)
+            return false;
+        
+
+        if(c.getEnergy() > eMin && c.getEnergy() < eMax){
+            if(c.getPosition()[1] > 0)
+                h7.fill(c.getPosition()[1]);
+            else if(c.getPosition()[1] < 0)
+                h7a.fill(-c.getPosition()[1]);
+        }
+        
+        if(EcalUtil.fid_ECal(c)){
+            
+            if(c.getPosition()[1] > 0){
+                h5.fill(c.getEnergy());
+            }
+            else{ 
+                h5a.fill(c.getEnergy());
+            }
+            if(part.getTracks().size() == 0)
+                return false;
+            Track t = part.getTracks().get(0);
+            if(t.getChi2()>maxChi2){
+                return false;
+            }
+            if(!TrackType.isGBL(t.getType()))
+                return false;
+            
+            
+            
+            Hep3Vector p = part.getMomentum();
+
+
+
+            double px = p.x(), pz = p.z();
+            double pxtilt = px*Math.cos(beamTiltX)-pz*Math.sin(beamTiltX);
+            double py = p.y();
+            double pztilt = pz*Math.cos(beamTiltX)+px*Math.sin(beamTiltX);
+            
+            double pytilt = py*Math.cos(beamTiltY)-pztilt*Math.sin(beamTiltY);
+            pztilt = pz*Math.cos(beamTiltY) + pytilt*Math.sin(beamTiltY);
+
+            if(Math.abs(pztilt - c.getEnergy()) > maxdE)
+                return false;
+            if(c.getPosition()[1] > 0)
+                h9_t.fill(pztilt);
+            else
+                h9_b.fill(pztilt);
+
+            double theta = Math.atan(Math.hypot(pxtilt, pytilt)/pztilt);
+            double phi =Math.atan2(pytilt, pxtilt);
+            boolean inRange = cb.inRange(theta, phi);
+            if(inRange)
+                h1.fill(theta, c.getEnergy());
+
+
+
+            if(c.getEnergy() > eMin && c.getEnergy() < eMax) {
+
+
+
+                h2.fill(theta, phi);
+                h2c.fill(theta, phi);
+
+                h4.fill(px/pz, py/pz);
+                //h4y.fill(py/pz);
+
+                if(inRange){
+
+                    //System.out.println(c.getEnergy() + " " + t.getType());
+                    /*for(TrackState ts : t.getTrackStates()){
+                        if(ts.getLocation() == TrackState.AtIP)
+                            System.out.println(Arrays.toString( 
+                                    ts.getReferencePoint()));
+                    }*/
+                    h2a.fill(theta, phi);
+                    h2b.fill(theta, phi);
+                    
+                    h3.fill(theta);
+                    if(py > 0)
+                        h3_t.fill(theta);
+                    else 
+                        h3_b.fill(theta);
+                    //if(h3_t.sumBinHeights()+h3_b.sumBinHeights() != h3.sumBinHeights())
+                        //System.out.println("NABO ERROR");
+                    
+                    
+                    h4a.fill(px/pz, py/pz);
+                }
+
+
+                return true;
+            }
+
+        }
+        return false;
+    }
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MottIntegral.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MottIntegral.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MottIntegral.java	Wed Mar  9 11:43:24 2016
@@ -1,66 +1,66 @@
 package org.hps.users.spaul.feecc;
 
 public class MottIntegral {
-	/**
-	 * @param bin
-	 * @param scale = Z^2alpha^2/(4*E^2)
-	 * @param recoil = 2E/M
-	 * @return the integral of 1/sin^4(th/2)*cos^2(th/2)/(1+a*sin^2(th/2)) times dPhi*sin(theta),
-	 * which appears in the integral of mott scattering.
-	 * 
-	 * NOTE the sin(theta) is because dOmega = dTheta*dPhi*sin(theta)
-	 */
-	static double mottIntegral(double recoil, double scale, int bin, CustomBinning cb){
-		double dPhi = 0;
-		for(int i = 0; i< cb.phiMax[bin].length; i++)
-			dPhi += 2*(cb.phiMax[bin][i] - cb.phiMin[bin][i]); //factor of 2 from top and bottom
-		
-		double Imax = integral(recoil, cb.thetaMax[bin]);
-		       
-		double Imin = integral(recoil, cb.thetaMin[bin]);
-		double dI = Imax-Imin; 
-		
-		
-		double retval = scale*dPhi*dI;
-		return retval;
-	}
-	
-	static double mottIntegral(double recoil, double scale, double thetaMin, double thetaMax){
-		double Imax = integral(recoil, thetaMax);
-	
-		double Imin = integral(recoil, thetaMin);
-		double dI = Imax-Imin; 
-		
-		double dPhi = 2*Math.PI;  //full range in phi
-		double retval = scale*dPhi*dI;
-		return retval;
-	}
-	
-	static double integral(double a, double th){
-		double sinth22 = Math.pow(Math.sin(th/2), 2);
-		return 2*(-1/sinth22+(1+a)*(Math.log(2/sinth22+2*a)));
-	}
-	
-	static double mottIntegralWithFormFactor(double recoil, double scale, double thetaMin, double thetaMax, FormFactor ff, int nsteps, double E){
-		double sum = 0;
-		double prev = -1;
+    /**
+     * @param bin
+     * @param scale = Z^2alpha^2/(4*E^2)
+     * @param recoil = 2E/M
+     * @return the integral of 1/sin^4(th/2)*cos^2(th/2)/(1+a*sin^2(th/2)) times dPhi*sin(theta),
+     * which appears in the integral of mott scattering.
+     * 
+     * NOTE the sin(theta) is because dOmega = dTheta*dPhi*sin(theta)
+     */
+    static double mottIntegral(double recoil, double scale, int bin, CustomBinning cb){
+        double dPhi = 0;
+        for(int i = 0; i< cb.phiMax[bin].length; i++)
+            dPhi += 2*(cb.phiMax[bin][i] - cb.phiMin[bin][i]); //factor of 2 from top and bottom
+        
+        double Imax = integral(recoil, cb.thetaMax[bin]);
+               
+        double Imin = integral(recoil, cb.thetaMin[bin]);
+        double dI = Imax-Imin; 
+        
+        
+        double retval = scale*dPhi*dI;
+        return retval;
+    }
+    
+    static double mottIntegral(double recoil, double scale, double thetaMin, double thetaMax){
+        double Imax = integral(recoil, thetaMax);
+    
+        double Imin = integral(recoil, thetaMin);
+        double dI = Imax-Imin; 
+        
+        double dPhi = 2*Math.PI;  //full range in phi
+        double retval = scale*dPhi*dI;
+        return retval;
+    }
+    
+    static double integral(double a, double th){
+        double sinth22 = Math.pow(Math.sin(th/2), 2);
+        return 2*(-1/sinth22+(1+a)*(Math.log(2/sinth22+2*a)));
+    }
+    
+    static double mottIntegralWithFormFactor(double recoil, double scale, double thetaMin, double thetaMax, FormFactor ff, int nsteps, double E){
+        double sum = 0;
+        double prev = -1;
 
-		double dTheta = (thetaMax-thetaMin)/nsteps;
-		for(int i = 0; i<nsteps; i++){
-			double theta = i*(thetaMax-thetaMin)/nsteps+thetaMin;
-			double I = integral(recoil, theta);
-			if(i != 0)
-			{
-				double ts = Math.pow(Math.sin(theta/2),2);
-				double q2 = 4*E*E*ts/(1+recoil*ts);
-				double f2 = ff.getFormFactorSquared(q2);
-				sum+= (I-prev)*f2;
-			}
-			prev = I;
-			
-		}
-		double dPhi = 2*Math.PI;  //full range in phi
-		double retval = scale*dPhi*sum;
-		return retval;
-	}
+        double dTheta = (thetaMax-thetaMin)/nsteps;
+        for(int i = 0; i<nsteps; i++){
+            double theta = i*(thetaMax-thetaMin)/nsteps+thetaMin;
+            double I = integral(recoil, theta);
+            if(i != 0)
+            {
+                double ts = Math.pow(Math.sin(theta/2),2);
+                double q2 = 4*E*E*ts/(1+recoil*ts);
+                double f2 = ff.getFormFactorSquared(q2);
+                sum+= (I-prev)*f2;
+            }
+            prev = I;
+            
+        }
+        double dPhi = 2*Math.PI;  //full range in phi
+        double retval = scale*dPhi*sum;
+        return retval;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MultipleScattering.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MultipleScattering.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MultipleScattering.java	Wed Mar  9 11:43:24 2016
@@ -8,99 +8,99 @@
 import java.util.Random;
 
 public class MultipleScattering {
-	
-	
-	/* 
-	 V.L. Highland, Nucl. Instrum. Methods 129, 497 (1975); Nucl. Instrum. Methods 161, 171 (1979)
-	 
-	 G.R. Lynch and O.I. Dahl, Nucl. Instrum. Methods B58, 6 (1991).
-	 
-	 */
-	/**
-	 * @param t number of scattering lengths
-	 * @param p momentum in GeV/c
-	 * @return the rms scattering angle of an electron with beta == 1.
-	 */
-	static double getThetaRMS(double t, double p){
-		return .0136/p*Math.sqrt(t)*(1+.038*Math.log(t));
-	}
-	/**
-	 * Mo Tsai equations A.4-5
-	 * @param Z
-	 * @return
-	 */
-	static double b(int Z){
-		double xi = Math.log(1440.*Math.pow(Z, -2/3.))/Math.log(183.*Math.pow(Z,-1/3.));
-		System.out.println(xi);
-		return 4/3.*(1+1/9.*(Z+1.)/(Z+xi)/Math.log(183.*Math.pow(Z,-1/3.)));
-		
-	
-	}
-	
-	
-	public static void main(String arg[]){
-		
-		System.out.println(b(6));
-		System.out.println(b(74));
-		
-		double bt = 0.03;
-		
-		IAnalysisFactory af = IAnalysisFactory.create();
-		IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
-		IHistogram1D h = hf.createHistogram1D("x", 100, 0, 1.5);
-		IPlotter p = af.createPlotterFactory().create();
-		p.region(0).plot(h);
-		p.show();
-		for(int i = 0; i< 100000; i++){
-			h.fill(getRandomEnergyFraction(bt)*getRandomEnergyFraction(bt)*(1+r.nextGaussian()*.045)*1.056);
-		}
-	}
-	
-	static double pdf(double x, double bt){
-		return bt/(1-x)*(x+3/4.*(1-x)*(1-x))*Math.pow(Math.log(1./x), bt);
-	}
-	static Random r = new Random();
-	/**************************
-	 * CONFIGURABLE VARIABLES *
-	 **************************/
-	/**
-	 * step size in x
-	 */
-	static double dx = .001;
-	/**
-	 * starting distance from peak to begin numerical integration
-	 */
-	static double delta0 = .05;
-	
-	/**
-	 * fraction of the energy to cut off at.  (all events with less than this energy will be blanked out,
-	 * and therefore not simulated in slic.  Slic was having problems dealing with low energy events.  
-	 */
-	static double xCutoff = .5;
-	
-	static double getRandomEnergyFraction(double bt){
-		double p = r.nextDouble(); 
-		if(p< Math.pow(delta0, bt)){
-			return 1-Math.pow(p, 1/bt);
-		}
-		double sum = Math.pow(delta0,bt);
-		if(sum > p){
-			return 1;
-		}
-		double x = 1-delta0;
-		while(true){
-			double contribution = pdf(x, bt)*dx;
-			if(sum + contribution > p)
-			{
-				return x - (p-sum)/contribution*dx;
-			}
-			if(x < 0)
-			{
-				return 0;
-			}
-			x -= dx;
-			sum += contribution;
-		}
-		//return 1;
-	}
+    
+    
+    /* 
+     V.L. Highland, Nucl. Instrum. Methods 129, 497 (1975); Nucl. Instrum. Methods 161, 171 (1979)
+     
+     G.R. Lynch and O.I. Dahl, Nucl. Instrum. Methods B58, 6 (1991).
+     
+     */
+    /**
+     * @param t number of scattering lengths
+     * @param p momentum in GeV/c
+     * @return the rms scattering angle of an electron with beta == 1.
+     */
+    static double getThetaRMS(double t, double p){
+        return .0136/p*Math.sqrt(t)*(1+.038*Math.log(t));
+    }
+    /**
+     * Mo Tsai equations A.4-5
+     * @param Z
+     * @return
+     */
+    static double b(int Z){
+        double xi = Math.log(1440.*Math.pow(Z, -2/3.))/Math.log(183.*Math.pow(Z,-1/3.));
+        System.out.println(xi);
+        return 4/3.*(1+1/9.*(Z+1.)/(Z+xi)/Math.log(183.*Math.pow(Z,-1/3.)));
+        
+    
+    }
+    
+    
+    public static void main(String arg[]){
+        
+        System.out.println(b(6));
+        System.out.println(b(74));
+        
+        double bt = 0.03;
+        
+        IAnalysisFactory af = IAnalysisFactory.create();
+        IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
+        IHistogram1D h = hf.createHistogram1D("x", 100, 0, 1.5);
+        IPlotter p = af.createPlotterFactory().create();
+        p.region(0).plot(h);
+        p.show();
+        for(int i = 0; i< 100000; i++){
+            h.fill(getRandomEnergyFraction(bt)*getRandomEnergyFraction(bt)*(1+r.nextGaussian()*.045)*1.056);
+        }
+    }
+    
+    static double pdf(double x, double bt){
+        return bt/(1-x)*(x+3/4.*(1-x)*(1-x))*Math.pow(Math.log(1./x), bt);
+    }
+    static Random r = new Random();
+    /**************************
+     * CONFIGURABLE VARIABLES *
+     **************************/
+    /**
+     * step size in x
+     */
+    static double dx = .001;
+    /**
+     * starting distance from peak to begin numerical integration
+     */
+    static double delta0 = .05;
+    
+    /**
+     * fraction of the energy to cut off at.  (all events with less than this energy will be blanked out,
+     * and therefore not simulated in slic.  Slic was having problems dealing with low energy events.  
+     */
+    static double xCutoff = .5;
+    
+    static double getRandomEnergyFraction(double bt){
+        double p = r.nextDouble(); 
+        if(p< Math.pow(delta0, bt)){
+            return 1-Math.pow(p, 1/bt);
+        }
+        double sum = Math.pow(delta0,bt);
+        if(sum > p){
+            return 1;
+        }
+        double x = 1-delta0;
+        while(true){
+            double contribution = pdf(x, bt)*dx;
+            if(sum + contribution > p)
+            {
+                return x - (p-sum)/contribution*dx;
+            }
+            if(x < 0)
+            {
+                return 0;
+            }
+            x -= dx;
+            sum += contribution;
+        }
+        //return 1;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java	Wed Mar  9 11:43:24 2016
@@ -7,61 +7,61 @@
 import org.lcsim.event.ReconstructedParticle;
 
 public class RemoveDuplicateParticles {
-	public static List<ReconstructedParticle> removeDuplicateParticles(List<ReconstructedParticle> input){
-		//System.out.println("\n" + input.size());
-		List<ReconstructedParticle> output = new ArrayList();
-		for(ReconstructedParticle p : input){
-			boolean add = true;
-			boolean replace = false;
-			ReconstructedParticle duplicate = null;
-			/*if(p.getTracks().size() == 0){
-				//System.out.println("no track");
-				continue;
-			}
-			if(!TrackType.isGBL(p.getTracks().get(0).getType())){
-				//System.out.println("non gbl track");
-				continue;
-			}*/
-			inner : for(ReconstructedParticle p2 : output){
-				if(p.getEnergy() == p2.getEnergy()){
-					
-					if(betterThan(p, p2)){
-						duplicate = p2;
-						replace = true;
-					}
-					else{
-						add = false; //keep the one that is already there
-					}
-					break inner;
-				}
-			}
-			if(replace){
-				output.remove(duplicate);
-				//System.out.println("replaced");
-				output.add(p);
-			}else if(add){
-				output.add(p);
-				//System.out.println("added");
-			}else{
-				//System.out.println("retained");
-			}
-		}
-		//System.out.println(output.size());
-		return output;
-	}
+    public static List<ReconstructedParticle> removeDuplicateParticles(List<ReconstructedParticle> input){
+        //System.out.println("\n" + input.size());
+        List<ReconstructedParticle> output = new ArrayList();
+        for(ReconstructedParticle p : input){
+            boolean add = true;
+            boolean replace = false;
+            ReconstructedParticle duplicate = null;
+            /*if(p.getTracks().size() == 0){
+                //System.out.println("no track");
+                continue;
+            }
+            if(!TrackType.isGBL(p.getTracks().get(0).getType())){
+                //System.out.println("non gbl track");
+                continue;
+            }*/
+            inner : for(ReconstructedParticle p2 : output){
+                if(p.getEnergy() == p2.getEnergy()){
+                    
+                    if(betterThan(p, p2)){
+                        duplicate = p2;
+                        replace = true;
+                    }
+                    else{
+                        add = false; //keep the one that is already there
+                    }
+                    break inner;
+                }
+            }
+            if(replace){
+                output.remove(duplicate);
+                //System.out.println("replaced");
+                output.add(p);
+            }else if(add){
+                output.add(p);
+                //System.out.println("added");
+            }else{
+                //System.out.println("retained");
+            }
+        }
+        //System.out.println(output.size());
+        return output;
+    }
 
-	private static boolean betterThan(ReconstructedParticle p,
-			ReconstructedParticle p2) {
-		if(p.getTracks().size() == 0)
-			return false;
-		if(p.getTracks().size() == 1 && p.getTracks().size() == 0)
-			return true;
-		if(TrackType.isGBL(p.getTracks().get(0).getType()) && !TrackType.isGBL(p2.getTracks().get(0).getType()))
-				return true;
-		
-		if(p.getTracks().get(0).getChi2() < p2.getTracks().get(0).getChi2()){
-			return true;
-		}
-		return false;
-	}
+    private static boolean betterThan(ReconstructedParticle p,
+            ReconstructedParticle p2) {
+        if(p.getTracks().size() == 0)
+            return false;
+        if(p.getTracks().size() == 1 && p.getTracks().size() == 0)
+            return true;
+        if(TrackType.isGBL(p.getTracks().get(0).getType()) && !TrackType.isGBL(p2.getTracks().get(0).getType()))
+                return true;
+        
+        if(p.getTracks().get(0).getChi2() < p2.getTracks().get(0).getChi2()){
+            return true;
+        }
+        return false;
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinning.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinning.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinning.java	Wed Mar  9 11:43:24 2016
@@ -24,277 +24,277 @@
 import hep.aida.ITreeFactory;
 
 public class ShowCustomBinning extends Canvas{
-	/**
-	 * show Rafo's fiducial cuts translated into rotated theta and phi, 
-	 * and overlay this with my bins in x and y.  
-	 * @param arg
-	 * @throws FileNotFoundException 
-	 */
-	public static void main(String arg[]) throws FileNotFoundException{
-		JFrame frame = new JFrame();
-		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-		Canvas c = new ShowCustomBinning(new File(arg[0]));
-		String outdir = arg[1];
-		frame.add(c);
-		frame.setSize(1200, 800);
-		frame.setVisible(true);
-		
-		
-		try {
-			BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
-			c.paint(im.getGraphics());
-			ImageIO.write(im, "PNG", new File(outdir +"/bins.png"));
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-		frame = new JFrame();
-		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-		c = new ShowCustomBinningXY(new File(arg[0]));
-		frame.add(c);
-		frame.setSize(1200, 615);
-		frame.setVisible(true);
-		
-		try {
-			BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
-			c.paint(im.getGraphics());
-			ImageIO.write(im, "PNG", new File(outdir + "/bins_xy.png"));
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	public void paint(Graphics g){
-		g.setFont(new Font(Font.DIALOG, Font.PLAIN, 24));
-		
-		drawEcalOutline(g);
-		drawFidEcalOutline(g);
-		drawCustomBinRectangles(g);
-		g.setColor(Color.BLACK);
-		drawXAxis(g);
-		drawYAxis(g);
-	}
-	
-	void drawFidEcalOutline(Graphics g){
-		g.setColor(Color.GRAY);
-		double x_edge_low = -262.74;
-		double x_edge_high = 347.7;
-		double y_edge_low = 33.54;
-		double y_edge_high = 75.18;
-
-		double x_gap_low = -106.66;
-		double x_gap_high = 42.17;
-		double y_gap_high = 47.18;
-		double x1,y1, x2, y2;
-		double nPoints = 500;
-		for(int i = 0; i< nPoints-1; i++){
-			x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
-			x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
-			y1 = y_edge_low;
-			y2 = y1;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
-			y1 = y2 = y_edge_low;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			
-			x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
-			x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
-			y1 = y2 = y_gap_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
-			y1 = y2 = y_edge_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-		}
-		drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
-		
-
-		drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
-	
-	}
-	
-	void drawEcalOutline(Graphics g){
-		/*double x_edge_low = -262.74;
-		double x_edge_high = 347.7;
-		double y_edge_low = 33.54;
-		double y_edge_high = 75.18;
-
-		double x_gap_low = -106.66;
-		double x_gap_high = 42.17;
-		double y_gap_high = 47.18;*/
-		
-		g.setColor(Color.BLACK);
-		double x_edge_low = -269.56;
-		double x_edge_high = 354.52;
-		double y_edge_low = 26.72;
-		double y_edge_high = 82;
-
-		double x_gap_low = -99.84;
-		double x_gap_high = 33.35;
-		double y_gap_high = 40.36;
-		double x1,y1, x2, y2;
-		double nPoints = 500;
-		for(int i = 0; i< nPoints-1; i++){
-			x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
-			x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
-			y1 = y_edge_low;
-			y2 = y1;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
-			y1 = y2 = y_edge_low;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			
-			x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
-			x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
-			y1 = y2 = y_gap_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
-			y1 = y2 = y_edge_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-		}
-		drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
-		
-
-		drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
-	}
-	
-	CustomBinning binning;
-	
-	ShowCustomBinning(File file) throws FileNotFoundException{
-		this.binning = new CustomBinning(file);
-		print(this.binning);
-	}
-	Color altBin1 = new Color(0, 0, 128);
-	Color altBin2 = new Color(0,128,0);
-	Color fillBin1 = new Color(196, 196, 255);
-	Color fillBin2 = new Color(196,255,196);
-	void drawCustomBinRectangles(Graphics g){
-		for(int i = 0; i<binning.nTheta; i++){
-			g.setColor(i%2 == 0 ? altBin1 : altBin2);
-			for(int j = 0; j<binning.phiMax[i].length; j++){
-				double phi1 = binning.phiMax[i][j];
-				double phi2 = binning.phiMin[i][j];
-				double theta1 = binning.thetaMin[i];
-				double theta2 = binning.thetaMax[i];
-				
-				int x =getX(theta1)+1, y = getY(phi1), w =  getX(theta2)-getX(theta1), h = getY(phi2)-getY(phi1);
-
-				g.setColor(i%2 == 0 ? fillBin1 : fillBin2);
-				g.fillRect(x, y, w, h);
-				g.setColor(i%2 == 0 ? altBin1 : altBin2);
-				g.drawRect(x, y, w, h);
-				 x =getX(theta1)+1; y = getY(-phi2); w =  getX(theta2)-getX(theta1); h = getY(-phi1)-getY(-phi2);
-				 g.setColor(i%2 == 0 ? fillBin1 : fillBin2);
-					g.fillRect(x, y, w, h);
-					g.setColor(i%2 == 0 ? altBin1 : altBin2);
-					g.drawRect(x, y, w, h);
-			}
-			
-		}
-	}
-	void drawXAxis(Graphics g){
-		//x axis
-		g.drawString("θ", getX(.28), getY(0) - 40);
-		g.drawLine(getX(0), getY(0), getX(.28), getY(0));
-		for(int i = 0; i< 28; i++){
-			if(i%5 == 0 && i != 0){
-				g.drawString(i/100.+"", getX(i/100.)-15, getY(0)-20);
-				g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-15);
-			}
-			g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-5);
-		}
-	}
-	void drawYAxis(Graphics g){
-		g.drawString("φ", getX(0)+70, getY(3));
-		g.drawLine(getX(0), getY(-3), getX(0), getY(3));
-		for(int i = -30; i<= 30; i++){
-			if(i%5 == 0 && i != 0){
-				g.drawString(i/10.+"", getX(0)+20, getY(i/10.) + 5);
-
-				g.drawLine(getX(0), getY(i/10.), getX(0) + 15, getY(i/10.));
-			}
-			if(i == 0){
-				//g.drawString(i/10.+"", getX(0)+10, getY(i/10.) - 15);
-			}
-			g.drawLine(getX(0), getY(i/10.), getX(0) + 5, getY(i/10.));
-		}
-	}
-	
-	
-	void drawEcalFaceLine(Graphics g, double x1, double y1, double x2, double y2){
-
-		double[] polar1 = EcalUtil.getThetaPhiSpherical(x1, y1);
-		double[] polar2 = EcalUtil.getThetaPhiSpherical(x2, y2);
-		g.drawLine(getX(polar1[0]), getY(polar1[1]), getX(polar2[0]), getY(polar2[1]));
-		
-	}
-	int getX(double theta){
-		return (int)(this.getWidth()*theta/.3)+left_margin;
-	}
-	int left_margin = 20;
-	int getY(double phi){
-		return (int)(this.getHeight()*(3.2-phi)/6.4);
-	}
-	static void print(CustomBinning binning){
-		System.out.println("  Bin \\# &	$\\theta_{\\textrm{min}}$ &	$\\theta_{\\textrm{max}}$ & $\\phi_{\\textrm{min 1}}$ &	$\\phi_{\\textrm{max 1}}$ & $\\phi_{\\textrm{min 2}}$ & $\\phi_{\\textrm{max 2}}$ & Solid angle  \\\\");
-		for(int i = 0; i<binning.nTheta; i++){
-			if(binning.phiMax[i].length == 1)
-				System.out.printf("%d & %.0f & %.0f & %.0f & %.0f & -- & -- & %.0f \\\\\n",
-					i+1,
-					binning.thetaMin[i]*1000,
-					binning.thetaMax[i]*1000,
-					binning.phiMin[i][0]*1000,
-					binning.phiMax[i][0]*1000.,
-					binning.getSteradians(i)*1e6);
-			if(binning.phiMax[i].length == 2)
-				System.out.printf("%d & %.0f & %.0f & %.0f & %.0f & %.0f & %.0f & %.0f \\\\\n",
-					i+1,
-					binning.thetaMin[i]*1000,
-					binning.thetaMax[i]*1000,
-					binning.phiMin[i][0]*1000,
-					binning.phiMax[i][0]*1000,
-					binning.phiMin[i][1]*1000,
-					binning.phiMax[i][1]*1000,
-					binning.getSteradians(i)*1e6);
-		}
-		System.out.println("total " + binning.getTotSteradians()*1e6 + " microsteradians");
-	} 
+    /**
+     * show Rafo's fiducial cuts translated into rotated theta and phi, 
+     * and overlay this with my bins in x and y.  
+     * @param arg
+     * @throws FileNotFoundException 
+     */
+    public static void main(String arg[]) throws FileNotFoundException{
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        Canvas c = new ShowCustomBinning(new File(arg[0]));
+        String outdir = arg[1];
+        frame.add(c);
+        frame.setSize(1200, 800);
+        frame.setVisible(true);
+        
+        
+        try {
+            BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
+            c.paint(im.getGraphics());
+            ImageIO.write(im, "PNG", new File(outdir +"/bins.png"));
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        c = new ShowCustomBinningXY(new File(arg[0]));
+        frame.add(c);
+        frame.setSize(1200, 615);
+        frame.setVisible(true);
+        
+        try {
+            BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
+            c.paint(im.getGraphics());
+            ImageIO.write(im, "PNG", new File(outdir + "/bins_xy.png"));
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    public void paint(Graphics g){
+        g.setFont(new Font(Font.DIALOG, Font.PLAIN, 24));
+        
+        drawEcalOutline(g);
+        drawFidEcalOutline(g);
+        drawCustomBinRectangles(g);
+        g.setColor(Color.BLACK);
+        drawXAxis(g);
+        drawYAxis(g);
+    }
+    
+    void drawFidEcalOutline(Graphics g){
+        g.setColor(Color.GRAY);
+        double x_edge_low = -262.74;
+        double x_edge_high = 347.7;
+        double y_edge_low = 33.54;
+        double y_edge_high = 75.18;
+
+        double x_gap_low = -106.66;
+        double x_gap_high = 42.17;
+        double y_gap_high = 47.18;
+        double x1,y1, x2, y2;
+        double nPoints = 500;
+        for(int i = 0; i< nPoints-1; i++){
+            x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
+            x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
+            y1 = y_edge_low;
+            y2 = y1;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
+            y1 = y2 = y_edge_low;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            
+            x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
+            x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
+            y1 = y2 = y_gap_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
+            y1 = y2 = y_edge_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+        }
+        drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
+        
+
+        drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
+    
+    }
+    
+    void drawEcalOutline(Graphics g){
+        /*double x_edge_low = -262.74;
+        double x_edge_high = 347.7;
+        double y_edge_low = 33.54;
+        double y_edge_high = 75.18;
+
+        double x_gap_low = -106.66;
+        double x_gap_high = 42.17;
+        double y_gap_high = 47.18;*/
+        
+        g.setColor(Color.BLACK);
+        double x_edge_low = -269.56;
+        double x_edge_high = 354.52;
+        double y_edge_low = 26.72;
+        double y_edge_high = 82;
+
+        double x_gap_low = -99.84;
+        double x_gap_high = 33.35;
+        double y_gap_high = 40.36;
+        double x1,y1, x2, y2;
+        double nPoints = 500;
+        for(int i = 0; i< nPoints-1; i++){
+            x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
+            x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
+            y1 = y_edge_low;
+            y2 = y1;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
+            y1 = y2 = y_edge_low;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            
+            x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
+            x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
+            y1 = y2 = y_gap_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
+            y1 = y2 = y_edge_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+        }
+        drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
+        
+
+        drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
+    }
+    
+    CustomBinning binning;
+    
+    ShowCustomBinning(File file) throws FileNotFoundException{
+        this.binning = new CustomBinning(file);
+        print(this.binning);
+    }
+    Color altBin1 = new Color(0, 0, 128);
+    Color altBin2 = new Color(0,128,0);
+    Color fillBin1 = new Color(196, 196, 255);
+    Color fillBin2 = new Color(196,255,196);
+    void drawCustomBinRectangles(Graphics g){
+        for(int i = 0; i<binning.nTheta; i++){
+            g.setColor(i%2 == 0 ? altBin1 : altBin2);
+            for(int j = 0; j<binning.phiMax[i].length; j++){
+                double phi1 = binning.phiMax[i][j];
+                double phi2 = binning.phiMin[i][j];
+                double theta1 = binning.thetaMin[i];
+                double theta2 = binning.thetaMax[i];
+                
+                int x =getX(theta1)+1, y = getY(phi1), w =  getX(theta2)-getX(theta1), h = getY(phi2)-getY(phi1);
+
+                g.setColor(i%2 == 0 ? fillBin1 : fillBin2);
+                g.fillRect(x, y, w, h);
+                g.setColor(i%2 == 0 ? altBin1 : altBin2);
+                g.drawRect(x, y, w, h);
+                 x =getX(theta1)+1; y = getY(-phi2); w =  getX(theta2)-getX(theta1); h = getY(-phi1)-getY(-phi2);
+                 g.setColor(i%2 == 0 ? fillBin1 : fillBin2);
+                    g.fillRect(x, y, w, h);
+                    g.setColor(i%2 == 0 ? altBin1 : altBin2);
+                    g.drawRect(x, y, w, h);
+            }
+            
+        }
+    }
+    void drawXAxis(Graphics g){
+        //x axis
+        g.drawString("θ", getX(.28), getY(0) - 40);
+        g.drawLine(getX(0), getY(0), getX(.28), getY(0));
+        for(int i = 0; i< 28; i++){
+            if(i%5 == 0 && i != 0){
+                g.drawString(i/100.+"", getX(i/100.)-15, getY(0)-20);
+                g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-15);
+            }
+            g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-5);
+        }
+    }
+    void drawYAxis(Graphics g){
+        g.drawString("φ", getX(0)+70, getY(3));
+        g.drawLine(getX(0), getY(-3), getX(0), getY(3));
+        for(int i = -30; i<= 30; i++){
+            if(i%5 == 0 && i != 0){
+                g.drawString(i/10.+"", getX(0)+20, getY(i/10.) + 5);
+
+                g.drawLine(getX(0), getY(i/10.), getX(0) + 15, getY(i/10.));
+            }
+            if(i == 0){
+                //g.drawString(i/10.+"", getX(0)+10, getY(i/10.) - 15);
+            }
+            g.drawLine(getX(0), getY(i/10.), getX(0) + 5, getY(i/10.));
+        }
+    }
+    
+    
+    void drawEcalFaceLine(Graphics g, double x1, double y1, double x2, double y2){
+
+        double[] polar1 = EcalUtil.getThetaPhiSpherical(x1, y1);
+        double[] polar2 = EcalUtil.getThetaPhiSpherical(x2, y2);
+        g.drawLine(getX(polar1[0]), getY(polar1[1]), getX(polar2[0]), getY(polar2[1]));
+        
+    }
+    int getX(double theta){
+        return (int)(this.getWidth()*theta/.3)+left_margin;
+    }
+    int left_margin = 20;
+    int getY(double phi){
+        return (int)(this.getHeight()*(3.2-phi)/6.4);
+    }
+    static void print(CustomBinning binning){
+        System.out.println("  Bin \\# & $\\theta_{\\textrm{min}}$ & $\\theta_{\\textrm{max}}$ & $\\phi_{\\textrm{min 1}}$ & $\\phi_{\\textrm{max 1}}$ & $\\phi_{\\textrm{min 2}}$ & $\\phi_{\\textrm{max 2}}$ & Solid angle  \\\\");
+        for(int i = 0; i<binning.nTheta; i++){
+            if(binning.phiMax[i].length == 1)
+                System.out.printf("%d & %.0f & %.0f & %.0f & %.0f & -- & -- & %.0f \\\\\n",
+                    i+1,
+                    binning.thetaMin[i]*1000,
+                    binning.thetaMax[i]*1000,
+                    binning.phiMin[i][0]*1000,
+                    binning.phiMax[i][0]*1000.,
+                    binning.getSteradians(i)*1e6);
+            if(binning.phiMax[i].length == 2)
+                System.out.printf("%d & %.0f & %.0f & %.0f & %.0f & %.0f & %.0f & %.0f \\\\\n",
+                    i+1,
+                    binning.thetaMin[i]*1000,
+                    binning.thetaMax[i]*1000,
+                    binning.phiMin[i][0]*1000,
+                    binning.phiMax[i][0]*1000,
+                    binning.phiMin[i][1]*1000,
+                    binning.phiMax[i][1]*1000,
+                    binning.getSteradians(i)*1e6);
+        }
+        System.out.println("total " + binning.getTotSteradians()*1e6 + " microsteradians");
+    } 
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java	Wed Mar  9 11:43:24 2016
@@ -8,241 +8,241 @@
 import java.io.FileNotFoundException;
 
 public class ShowCustomBinningXY extends ShowCustomBinning{
-	ShowCustomBinningXY(File file) throws FileNotFoundException
-	{
-		super(file);
-	}
-	@Override
-	void drawCustomBinRectangles(Graphics g){
-		for(int i = 0; i<binning.nTheta; i++){
-			g.setColor(i%2 == 0 ? altBin1 : altBin2);
-			for(int j = 0; j<binning.phiMax[i].length; j++){
-				double phi1 = binning.phiMax[i][j];
-				double phi2 = binning.phiMin[i][j];
-				double theta1 = binning.thetaMin[i];
-				double theta2 = binning.thetaMax[i];
-
-				double nK = 10;
-				for(int sign = -1; sign <=1; sign +=2){
-
-					Polygon p = new Polygon();
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta1, sign*(phi1+(phi2-phi1)*k/nK), theta1, sign*(phi1+(phi2-phi1)*(k+1)/nK),g,p);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta1 + (theta2-theta1)*k/nK, sign*phi2, theta1 + (theta2-theta1)*(k+1)/nK, sign*phi2,g,p);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta2, sign*(phi2+(phi1-phi2)*k/nK), theta2, sign*(phi2+(phi1-phi2)*(k+1)/nK),g, p);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta2 + (theta1-theta2)*k/nK, sign*phi1, theta2 + (theta1-theta2)*(k+1)/nK, sign*phi1,g, p);
-					}
-					
-					closePolarFigure(g, i%2 == 0 ? altBin1 : altBin2, i%2 == 0 ? fillBin1 : fillBin2, p);
-				}
-
-			}
-		}
-	}
-	private void drawLineFromPolar(double theta1, double phi1, double theta2,
-			double phi2, Graphics g, Polygon p) {
-		double[] xy1 = toXY(theta1, phi1);
-		double[] xy2 = toXY(theta2, phi2);
-
-		if(p == null)
-			p = new Polygon();
-		/*g.drawLine(getX(xy1[0]), 
-				getY(xy1[1]), 
-				getX(xy2[0]),
-				getY(xy2[1]));*/
-		p.addPoint(getX(xy2[0]), getY(xy2[1]));
-	}
-	private void closePolarFigure(Graphics g, Color outlineColor, Color fillColor, Polygon p){
-		g.setColor(fillColor);
-		g.fillPolygon(p);
-		g.setColor(outlineColor);
-		g.drawPolygon(p);
-		
-	}
-	double xtilt =  .0294;
-	double ytilt = -.00082;
-	double[] toXY(double theta, double phi){
-		double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(xtilt)+Math.cos(theta)*Math.sin(xtilt);
-		double uy = Math.sin(phi)*Math.sin(theta);
-		double uz = Math.cos(theta)*Math.cos(xtilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(xtilt);
-		
-		double temp = Math.cos(ytilt)*uy+Math.sin(ytilt)*uz;
-		uz = Math.cos(ytilt)*uz-Math.sin(ytilt)*uy;
-		uy = temp;
-		
-		double pxpz = ux/uz;
-		double pypz = uy/uz;
-		return new double[]{pxpz, pypz};
-	}
-	int getX(double pxpz){
-		//return (int)((pxpz -(-.16))/(.34-(-.16))*getWidth());
-		return (int)((.32-pxpz)/(.32-(-.18))*getWidth()); 
-	}
-	int getY(double pypz){
-		return getHeight()-(int)((pypz -(-.125))/(.125-(-.125))*getHeight()); 
-	}
-	void drawFidEcalOutline(Graphics g){
-		g.setColor(Color.GRAY);
-		double x_edge_low = -262.74;
-		double x_edge_high = 347.7;
-		double y_edge_low = 33.54;
-		double y_edge_high = 75.18;
-
-		double x_gap_low = -106.66;
-		double x_gap_high = 42.17;
-		double y_gap_high = 47.18;
-		double x1,y1, x2, y2;
-		double nPoints = 500;
-		for(int i = 0; i< nPoints-1; i++){
-			x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
-			x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
-			y1 = y_edge_low;
-			y2 = y1;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
-			y1 = y2 = y_edge_low;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			
-			x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
-			x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
-			y1 = y2 = y_gap_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
-			x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
-			y1 = y2 = y_edge_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-		}
-		drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
-		
-
-		drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
-	
-	}
-	
-	void drawEcalOutline(Graphics g){
-		g.setColor(Color.BLACK);
-		double x_edge_low = -269.56;
-		double x_edge_high = 354.52;
-		double y_edge_low = 26.72;
-		double y_edge_high = 82;
-
-		double x_gap_low = -99.84;
-		double x_gap_high = 33.35;
-		double y_gap_high = 40.36;
-		double x1,y1, x2, y2;
-			x1 = x_gap_high;
-			x2 = x_edge_high;
-			y1 = y_edge_low;
-			y2 = y1;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			x1 = x_edge_low;
-			x2 = x_gap_low;
-			y1 = y2 = y_edge_low;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			
-			
-			x1 = x_gap_low;
-			x2 = x_gap_high;
-			y1 = y2 = y_gap_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-			
-			x1 = x_edge_low;
-			x2 = x_edge_high;
-			y1 = y2 = y_edge_high;
-			drawEcalFaceLine(g, x1, y1, x2, y2);
-			drawEcalFaceLine(g, x1, -y1, x2, -y2);
-		
-		drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
-		
-
-		drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
-		drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
-
-		drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
-		drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
-	}
-	void drawEcalFaceLine(Graphics g, double x1, double y1, double x2, double y2){
-
-		double[] h1 = EcalUtil.toHollysCoordinates(x1, y1, 1.057, 11);
-		double[] h2 =  EcalUtil.toHollysCoordinates(x2, y2, 1.057, 11);
-		g.drawLine(getX(Math.tan(h1[1])), getY(Math.tan(h1[0])), getX(Math.tan(h2[1])), getY(Math.tan(h2[0])));
-		
-	}
-	
-	void drawXAxis(Graphics g){
-		//x axis
-		g.drawString("px/pz", getX(.30)-10, getY(0) - 45);
-		g.drawLine(getX(-.15), getY(0), getX(.30), getY(0));
-		for(int i = -15; i<= 30; i++){
-			if(i%5 == 0 && i != 0){
-				g.drawString(i/100.+"", getX(i/100.)-15, getY(0)-20);
-				g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-15);
-			}
-			g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-5);
-		}
-	}
-	void drawYAxis(Graphics g){
-		g.drawString("py/pz", getX(0), getY(.1)-20);
-		g.drawLine(getX(0), getY(-.1), getX(0), getY(.1));
-		for(int i = -10; i<= 10; i++){
-			if(i%5 == 0 && i != 0){
-				g.drawString(i/100.+"", getX(0)+15, getY(i/100.) + 5);
-
-				g.drawLine(getX(0), getY(i/100.), getX(0) + 10, getY(i/100.));
-			}
-			if(i == 0){
-				//g.drawString(i/10.+"", getX(0)+10, getY(i/10.) - 15);
-			}
-			g.drawLine(getX(0), getY(i/100.), getX(0) + 5, getY(i/100.));
-		}
-	}
-	public void paint(Graphics g){
-		super.paint(g);
-		drawBeamspot(g);
-	}
-	
-	void drawBeamspot(Graphics g){
-		g.setColor(Color.red);
-		int x = getX(xtilt), y = getY(ytilt);
-		g.drawLine(x+10, y, x-10, y);
-		g.drawLine(x+10, y+1, x-10, y+1);
-		g.drawLine(x+10, y-1, x-10, y-1);
-		g.drawLine(x, y-10, x, y+10);
-		g.drawLine(x+1, y-10, x+1, y+10);
-		g.drawLine(x-1, y-10, x-1, y+10);
-	}
+    ShowCustomBinningXY(File file) throws FileNotFoundException
+    {
+        super(file);
+    }
+    @Override
+    void drawCustomBinRectangles(Graphics g){
+        for(int i = 0; i<binning.nTheta; i++){
+            g.setColor(i%2 == 0 ? altBin1 : altBin2);
+            for(int j = 0; j<binning.phiMax[i].length; j++){
+                double phi1 = binning.phiMax[i][j];
+                double phi2 = binning.phiMin[i][j];
+                double theta1 = binning.thetaMin[i];
+                double theta2 = binning.thetaMax[i];
+
+                double nK = 10;
+                for(int sign = -1; sign <=1; sign +=2){
+
+                    Polygon p = new Polygon();
+                    for(int k = 0; k< nK; k++){
+                        drawLineFromPolar(theta1, sign*(phi1+(phi2-phi1)*k/nK), theta1, sign*(phi1+(phi2-phi1)*(k+1)/nK),g,p);
+                    }
+                    for(int k = 0; k< nK; k++){
+                        drawLineFromPolar(theta1 + (theta2-theta1)*k/nK, sign*phi2, theta1 + (theta2-theta1)*(k+1)/nK, sign*phi2,g,p);
+                    }
+                    for(int k = 0; k< nK; k++){
+                        drawLineFromPolar(theta2, sign*(phi2+(phi1-phi2)*k/nK), theta2, sign*(phi2+(phi1-phi2)*(k+1)/nK),g, p);
+                    }
+                    for(int k = 0; k< nK; k++){
+                        drawLineFromPolar(theta2 + (theta1-theta2)*k/nK, sign*phi1, theta2 + (theta1-theta2)*(k+1)/nK, sign*phi1,g, p);
+                    }
+                    
+                    closePolarFigure(g, i%2 == 0 ? altBin1 : altBin2, i%2 == 0 ? fillBin1 : fillBin2, p);
+                }
+
+            }
+        }
+    }
+    private void drawLineFromPolar(double theta1, double phi1, double theta2,
+            double phi2, Graphics g, Polygon p) {
+        double[] xy1 = toXY(theta1, phi1);
+        double[] xy2 = toXY(theta2, phi2);
+
+        if(p == null)
+            p = new Polygon();
+        /*g.drawLine(getX(xy1[0]), 
+                getY(xy1[1]), 
+                getX(xy2[0]),
+                getY(xy2[1]));*/
+        p.addPoint(getX(xy2[0]), getY(xy2[1]));
+    }
+    private void closePolarFigure(Graphics g, Color outlineColor, Color fillColor, Polygon p){
+        g.setColor(fillColor);
+        g.fillPolygon(p);
+        g.setColor(outlineColor);
+        g.drawPolygon(p);
+        
+    }
+    double xtilt =  .0294;
+    double ytilt = -.00082;
+    double[] toXY(double theta, double phi){
+        double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(xtilt)+Math.cos(theta)*Math.sin(xtilt);
+        double uy = Math.sin(phi)*Math.sin(theta);
+        double uz = Math.cos(theta)*Math.cos(xtilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(xtilt);
+        
+        double temp = Math.cos(ytilt)*uy+Math.sin(ytilt)*uz;
+        uz = Math.cos(ytilt)*uz-Math.sin(ytilt)*uy;
+        uy = temp;
+        
+        double pxpz = ux/uz;
+        double pypz = uy/uz;
+        return new double[]{pxpz, pypz};
+    }
+    int getX(double pxpz){
+        //return (int)((pxpz -(-.16))/(.34-(-.16))*getWidth());
+        return (int)((.32-pxpz)/(.32-(-.18))*getWidth()); 
+    }
+    int getY(double pypz){
+        return getHeight()-(int)((pypz -(-.125))/(.125-(-.125))*getHeight()); 
+    }
+    void drawFidEcalOutline(Graphics g){
+        g.setColor(Color.GRAY);
+        double x_edge_low = -262.74;
+        double x_edge_high = 347.7;
+        double y_edge_low = 33.54;
+        double y_edge_high = 75.18;
+
+        double x_gap_low = -106.66;
+        double x_gap_high = 42.17;
+        double y_gap_high = 47.18;
+        double x1,y1, x2, y2;
+        double nPoints = 500;
+        for(int i = 0; i< nPoints-1; i++){
+            x1 = x_gap_high+i/nPoints*(x_edge_high-x_gap_high);
+            x2 = x_gap_high+(i+1)/nPoints*(x_edge_high-x_gap_high);
+            y1 = y_edge_low;
+            y2 = y1;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            x1 = x_edge_low+i/nPoints*(x_gap_low-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_gap_low-x_edge_low);
+            y1 = y2 = y_edge_low;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            
+            x1 = x_gap_low+i/nPoints*(x_gap_high-x_gap_low);
+            x2 = x_gap_low+(i+1)/nPoints*(x_gap_high-x_gap_low);
+            y1 = y2 = y_gap_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            x1 = x_edge_low+i/nPoints*(x_edge_high-x_edge_low);
+            x2 = x_edge_low+(i+1)/nPoints*(x_edge_high-x_edge_low);
+            y1 = y2 = y_edge_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+        }
+        drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
+        
+
+        drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
+    
+    }
+    
+    void drawEcalOutline(Graphics g){
+        g.setColor(Color.BLACK);
+        double x_edge_low = -269.56;
+        double x_edge_high = 354.52;
+        double y_edge_low = 26.72;
+        double y_edge_high = 82;
+
+        double x_gap_low = -99.84;
+        double x_gap_high = 33.35;
+        double y_gap_high = 40.36;
+        double x1,y1, x2, y2;
+            x1 = x_gap_high;
+            x2 = x_edge_high;
+            y1 = y_edge_low;
+            y2 = y1;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            x1 = x_edge_low;
+            x2 = x_gap_low;
+            y1 = y2 = y_edge_low;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            
+            
+            x1 = x_gap_low;
+            x2 = x_gap_high;
+            y1 = y2 = y_gap_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+            
+            x1 = x_edge_low;
+            x2 = x_edge_high;
+            y1 = y2 = y_edge_high;
+            drawEcalFaceLine(g, x1, y1, x2, y2);
+            drawEcalFaceLine(g, x1, -y1, x2, -y2);
+        
+        drawEcalFaceLine(g, x_gap_low, y_edge_low, x_gap_low, y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, y_edge_low, x_gap_high, y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, y_edge_low, x_edge_low, y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, y_edge_low, x_edge_high, y_edge_high);
+        
+
+        drawEcalFaceLine(g, x_gap_low, -y_edge_low, x_gap_low, -y_gap_high);
+        drawEcalFaceLine(g, x_gap_high, -y_edge_low, x_gap_high, -y_gap_high);
+
+        drawEcalFaceLine(g, x_edge_low, -y_edge_low, x_edge_low, -y_edge_high);
+        drawEcalFaceLine(g, x_edge_high, -y_edge_low, x_edge_high, -y_edge_high);
+    }
+    void drawEcalFaceLine(Graphics g, double x1, double y1, double x2, double y2){
+
+        double[] h1 = EcalUtil.toHollysCoordinates(x1, y1, 1.057, 11);
+        double[] h2 =  EcalUtil.toHollysCoordinates(x2, y2, 1.057, 11);
+        g.drawLine(getX(Math.tan(h1[1])), getY(Math.tan(h1[0])), getX(Math.tan(h2[1])), getY(Math.tan(h2[0])));
+        
+    }
+    
+    void drawXAxis(Graphics g){
+        //x axis
+        g.drawString("px/pz", getX(.30)-10, getY(0) - 45);
+        g.drawLine(getX(-.15), getY(0), getX(.30), getY(0));
+        for(int i = -15; i<= 30; i++){
+            if(i%5 == 0 && i != 0){
+                g.drawString(i/100.+"", getX(i/100.)-15, getY(0)-20);
+                g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-15);
+            }
+            g.drawLine(getX(i/100.), getY(0), getX(i/100.), getY(0)-5);
+        }
+    }
+    void drawYAxis(Graphics g){
+        g.drawString("py/pz", getX(0), getY(.1)-20);
+        g.drawLine(getX(0), getY(-.1), getX(0), getY(.1));
+        for(int i = -10; i<= 10; i++){
+            if(i%5 == 0 && i != 0){
+                g.drawString(i/100.+"", getX(0)+15, getY(i/100.) + 5);
+
+                g.drawLine(getX(0), getY(i/100.), getX(0) + 10, getY(i/100.));
+            }
+            if(i == 0){
+                //g.drawString(i/10.+"", getX(0)+10, getY(i/10.) - 15);
+            }
+            g.drawLine(getX(0), getY(i/100.), getX(0) + 5, getY(i/100.));
+        }
+    }
+    public void paint(Graphics g){
+        super.paint(g);
+        drawBeamspot(g);
+    }
+    
+    void drawBeamspot(Graphics g){
+        g.setColor(Color.red);
+        int x = getX(xtilt), y = getY(ytilt);
+        g.drawLine(x+10, y, x-10, y);
+        g.drawLine(x+10, y+1, x-10, y+1);
+        g.drawLine(x+10, y-1, x-10, y-1);
+        g.drawLine(x, y-10, x, y+10);
+        g.drawLine(x+1, y-10, x+1, y+10);
+        g.drawLine(x-1, y-10, x-1, y+10);
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java	Wed Mar  9 11:43:24 2016
@@ -12,45 +12,45 @@
 import java.io.IOException;
 
 public class FitAllProfiles {
-	static IAnalysisFactory af = IAnalysisFactory.create();
-	static IFitFactory ff = af.createFitFactory();
-	
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		
-		ITree tree = af.createTreeFactory().create(arg[0]); 
-		IPlotter p = af.createPlotterFactory().create();
-		p.createRegions(3,2);
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"));
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"));
-		plotAndFit(p, 2, (IProfile1D)tree.find("pypz vs diff"));
-		plotAndFit(p, 3, (IProfile1D)tree.find("pxpz vs diff"));
-		
-		p.show();
-	}
-	public static void plotAndFit(IPlotter p, int r, IHistogram1D h){
-		p.region(r).plot(h);
-		IFitResult fit = ff.createFitter().fit(h, "g");
-		IFunction func = fit.fittedFunction();
-		System.out.println("\n" + h.title());
-		String names[] = func.parameterNames();
-		double params[] = func.parameters();
-		for(int i = 0; i< names.length; i++){
-			System.out.printf("%s: %f\n", names[i], params[i]);
-		}
-		p.region(r).plot(func);
-		
-	}
-	public static void plotAndFit(IPlotter p, int r, IProfile1D h){
-		p.region(r).plot(h);
-		IFitResult fit = ff.createFitter().fit(h, "p4");
-		IFunction func = fit.fittedFunction();
-		System.out.println("\n" + h.title());
-		String names[] = func.parameterNames();
-		double params[] = func.parameters();
-		for(int i = 0; i< names.length; i++){
-			System.out.printf("%s: %f\t", names[i], params[i]);
-		}
-		p.region(r).plot(func);
-		
-	}
+    static IAnalysisFactory af = IAnalysisFactory.create();
+    static IFitFactory ff = af.createFitFactory();
+    
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        
+        ITree tree = af.createTreeFactory().create(arg[0]); 
+        IPlotter p = af.createPlotterFactory().create();
+        p.createRegions(3,2);
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"));
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"));
+        plotAndFit(p, 2, (IProfile1D)tree.find("pypz vs diff"));
+        plotAndFit(p, 3, (IProfile1D)tree.find("pxpz vs diff"));
+        
+        p.show();
+    }
+    public static void plotAndFit(IPlotter p, int r, IHistogram1D h){
+        p.region(r).plot(h);
+        IFitResult fit = ff.createFitter().fit(h, "g");
+        IFunction func = fit.fittedFunction();
+        System.out.println("\n" + h.title());
+        String names[] = func.parameterNames();
+        double params[] = func.parameters();
+        for(int i = 0; i< names.length; i++){
+            System.out.printf("%s: %f\n", names[i], params[i]);
+        }
+        p.region(r).plot(func);
+        
+    }
+    public static void plotAndFit(IPlotter p, int r, IProfile1D h){
+        p.region(r).plot(h);
+        IFitResult fit = ff.createFitter().fit(h, "p4");
+        IFunction func = fit.fittedFunction();
+        System.out.println("\n" + h.title());
+        String names[] = func.parameterNames();
+        double params[] = func.parameters();
+        for(int i = 0; i< names.length; i++){
+            System.out.printf("%s: %f\t", names[i], params[i]);
+        }
+        p.region(r).plot(func);
+        
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java	Wed Mar  9 11:43:24 2016
@@ -8,67 +8,67 @@
 import hep.aida.*;
 
 public class FitMollerPyPzGraphs {
-	static IAnalysisFactory af = IAnalysisFactory.create();
-	static IFitFactory ff = af.createFitFactory();
-	
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		
-		ITree tree = af.createTreeFactory().create(arg[0]); 
-		/*IPlotter p = af.createPlotterFactory().create();
-		p.createRegions(4,2);
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"), "uy all", "uy");
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"), "ux all", "ux");
-		plotAndFit(p, 2, (IHistogram1D)tree.find("pypz bot"), "uy (bot)", "uy");
-		plotAndFit(p, 3, (IHistogram1D)tree.find("pxpz bot"), "ux (bot)", "ux");
-		plotAndFit(p, 4, (IHistogram1D)tree.find("pypz mid"), "uy (mid)", "uy");
-		plotAndFit(p, 5, (IHistogram1D)tree.find("pxpz mid"), "ux (mid)", "ux");
-		plotAndFit(p, 6, (IHistogram1D)tree.find("pypz top"), "uy (top)", "uy");
-		plotAndFit(p, 7, (IHistogram1D)tree.find("pxpz top"), "ux (top)", "ux");
+    static IAnalysisFactory af = IAnalysisFactory.create();
+    static IFitFactory ff = af.createFitFactory();
+    
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        
+        ITree tree = af.createTreeFactory().create(arg[0]); 
+        /*IPlotter p = af.createPlotterFactory().create();
+        p.createRegions(4,2);
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"), "uy all", "uy");
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"), "ux all", "ux");
+        plotAndFit(p, 2, (IHistogram1D)tree.find("pypz bot"), "uy (bot)", "uy");
+        plotAndFit(p, 3, (IHistogram1D)tree.find("pxpz bot"), "ux (bot)", "ux");
+        plotAndFit(p, 4, (IHistogram1D)tree.find("pypz mid"), "uy (mid)", "uy");
+        plotAndFit(p, 5, (IHistogram1D)tree.find("pxpz mid"), "ux (mid)", "ux");
+        plotAndFit(p, 6, (IHistogram1D)tree.find("pypz top"), "uy (top)", "uy");
+        plotAndFit(p, 7, (IHistogram1D)tree.find("pxpz top"), "ux (top)", "ux");
 
-		StyleUtil.setSize(p, 1000, 500);
-		p.show();*/
-		
+        StyleUtil.setSize(p, 1000, 500);
+        p.show();*/
+        
 
-		IPlotter p;
-		p = af.createPlotterFactory().create();
-		p.region(0).plot((IHistogram1D) tree.find("diff"));
-		StyleUtil.stylize(p.region(0), "pz top - pz bottom (GeV)", "#");
-		p.show();
-		
-		p = af.createPlotterFactory().create();
-		p.createRegions(2, 1);
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz bot"), "bot", "uy");
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz bot"), "bot", "ux");
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz mid"), "mid", "uy");
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz mid"), "mid", "ux");
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz top"), "top", "uy");
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz top"), "top", "ux");
-		StyleUtil.setSize(p, 1000, 500);
-		p.show();
-		
-	}
-	public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
-		p.region(r).plot(h);
-		h.setTitle(title);
-		StyleUtil.noFillHistogramBars(p.region(r));
-		IFitResult fit = ff.createFitter().fit(h, "g");
-		StyleUtil.stylize(p.region(r), title, xAxis, "#");
-		IFunction func = fit.fittedFunction();
-		System.out.println("\n" + h.title());
-		String names[] = func.parameterNames();
-		double params[] = func.parameters();
-		for(int i = 0; i< names.length; i++){
-			System.out.printf("%s: %f\t", names[i], params[i]);
-		}
-		//System.out.println(Arrays.toString(fit.);
-		
-		p.region(r).plot(func);
-		StyleUtil.stylize(p.region(r), title, xAxis, "#");
-		p.region(r).style().statisticsBoxStyle().setVisible(true);
-		p.region(r).style().legendBoxStyle().setVisible(false);
-		//System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
-		//p.show();
-	}
-	
-	
+        IPlotter p;
+        p = af.createPlotterFactory().create();
+        p.region(0).plot((IHistogram1D) tree.find("diff"));
+        StyleUtil.stylize(p.region(0), "pz top - pz bottom (GeV)", "#");
+        p.show();
+        
+        p = af.createPlotterFactory().create();
+        p.createRegions(2, 1);
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pypz bot"), "bot", "uy");
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz bot"), "bot", "ux");
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pypz mid"), "mid", "uy");
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz mid"), "mid", "ux");
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pypz top"), "top", "uy");
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz top"), "top", "ux");
+        StyleUtil.setSize(p, 1000, 500);
+        p.show();
+        
+    }
+    public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
+        p.region(r).plot(h);
+        h.setTitle(title);
+        StyleUtil.noFillHistogramBars(p.region(r));
+        IFitResult fit = ff.createFitter().fit(h, "g");
+        StyleUtil.stylize(p.region(r), title, xAxis, "#");
+        IFunction func = fit.fittedFunction();
+        System.out.println("\n" + h.title());
+        String names[] = func.parameterNames();
+        double params[] = func.parameters();
+        for(int i = 0; i< names.length; i++){
+            System.out.printf("%s: %f\t", names[i], params[i]);
+        }
+        //System.out.println(Arrays.toString(fit.);
+        
+        p.region(r).plot(func);
+        StyleUtil.stylize(p.region(r), title, xAxis, "#");
+        p.region(r).style().statisticsBoxStyle().setVisible(true);
+        p.region(r).style().legendBoxStyle().setVisible(false);
+        //System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
+        //p.show();
+    }
+    
+    
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java	Wed Mar  9 11:43:24 2016
@@ -16,299 +16,299 @@
 import org.lcsim.util.aida.AIDA;
 
 public class MollerBeamtiltAnalysis extends Driver{
-	@Override
-	public void process(EventHeader event){
-		List<Vertex> mollers = event.get(Vertex.class, "TargetConstrainedMollerVertices");
-		for(Vertex v : mollers){
-			if(!passesCuts(v))
-				continue;
-			ReconstructedParticle m = v.getAssociatedParticle();
-			ReconstructedParticle top;
-			ReconstructedParticle bottom;
-			if(m.getParticles().get(0).getMomentum().y()>0){
-				top = m.getParticles().get(0);
-				bottom = m.getParticles().get(1);
-			}else{
-				top = m.getParticles().get(1);
-				bottom = m.getParticles().get(0);
-			}
-
-			double pypz = m.getMomentum().y()/m.getMomentum().z();
-			double pxpz = m.getMomentum().x()/m.getMomentum().z();
-			//double pypz = (top.getMomentum().y()+bottom.getMomentum().y())/(top.getMomentum().z()+bottom.getMomentum().z());
-			//double pxpz = (top.getMomentum().x()+bottom.getMomentum().x())/(top.getMomentum().z()+bottom.getMomentum().z());
-
-			hpypz.fill(pypz);
-			hpxpz.fill(pxpz);
-
-
-			double diff = top.getMomentum().z()-bottom.getMomentum().z();
-			double sum = m.getMomentum().z();//top.getMomentum().z()+bottom.getMomentum().z();
-			double mass = m.getMass();
-
-			if(diff > -.05 && diff < .05){
-				hpypz_mid.fill(pypz);
-				hpxpz_mid.fill(pxpz);
-			}
-
-			if(diff > .2 && diff < .3){
-				hpypz_topHighE.fill(pypz);
-				hpxpz_topHighE.fill(pxpz);
-			}
-
-			if(diff > -.3 && diff < -.2){
-				hpypz_botHighE.fill(pypz);
-				hpxpz_botHighE.fill(pxpz);
-			}
-
-
-			this.diff.fill(diff);
-			this.sum.fill(sum);
-			this.mass.fill(mass);
-			pypz_vs_diff.fill(diff,pypz );
-			pxpz_vs_diff.fill(diff, pxpz );
-
-
-
-			pxpz_vs_sum.fill(sum, pxpz );
-			pypz_vs_sum.fill(sum, pypz );
-
-			pxpz_vs_mass.fill(mass, pxpz );
-			pypz_vs_mass.fill(mass, pypz );
-			timediff.fill(top.getClusters().get(0).getCalorimeterHits().get(0).getTime()
-					-bottom.getClusters().get(0).getCalorimeterHits().get(0).getTime());
-			/*if(moreEnergetic.getMomentum().y() > 0)
-			{
-				pypz_tophighE.fill(pypz);
-				pxpz_tophighE.fill(pxpz);
-			}
-			if(moreEnergetic.getMomentum().y() < 0)
-			{
-				pypz_bottomhighE.fill(pypz);
-				pxpz_bottomhighE.fill(pxpz);
-			}*/
-		}
-	}
-
-	double _maxVtxChi2 = 15;
-	double _maxTrkChi2 = 30;
-	double _maxMass = .037;
-	double _minMass = .030;
-	double _minPz = 1.0;
-	double _maxPz = 1.1;
-	boolean passesCuts(Vertex vertex){
-		ReconstructedParticle m = vertex.getAssociatedParticle();
-		if(!TrackType.isGBL(m.getType()))
-			return false;
-		if(m.getMomentum().z() > _maxPz || m.getMomentum().z() < _minPz)
-			return false;
-		if(m.getMass() > _maxMass || m.getMass() < _minMass)
-			return false;
-
-		if(m.getParticles().get(0).getCharge() != -1 
-				|| m.getParticles().get(1).getCharge() != -1 )
-			return false;
-
-		if(vertex.getChi2() > _maxVtxChi2)
-			return false;
-
-
-		if(m.getParticles().get(0).getClusters().size() == 0)
-			return false;
-		if(m.getParticles().get(1).getClusters().size() == 0)
-			return false;
-
-		if(m.getParticles().get(0).getTracks().get(0).getChi2() > _maxTrkChi2)
-			return false;
-		if(m.getParticles().get(1).getTracks().get(0).getChi2() > _maxTrkChi2)
-			return false;
-		return true;
-	}
-
-	IHistogram1D hpypz, hpxpz, diff, sum, mass,
-	hpypz_topHighE, hpxpz_topHighE,
-	hpypz_botHighE, hpxpz_botHighE,
-	hpypz_mid, hpxpz_mid;
-
-	boolean display = false;
-
-
-
-
-	public double getMaxVtxChi2() {
-		return _maxVtxChi2;
-	}
-
-
-	public void setMaxVtxChi2(double _maxVtxChi2) {
-		this._maxVtxChi2 = _maxVtxChi2;
-	}
-
-
-	public double getMaxTrkChi2() {
-		return _maxTrkChi2;
-	}
-
-
-	public void setMaxTrkChi2(double _maxTrkChi2) {
-		this._maxTrkChi2 = _maxTrkChi2;
-	}
-
-
-	public double getMaxMass() {
-		return _maxMass;
-	}
-
-
-	public void setMaxMass(double _maxMass) {
-		this._maxMass = _maxMass;
-	}
-
-
-	public double getMinMass() {
-		return _minMass;
-	}
-
-
-	public void setMinMass(double _minMass) {
-		this._minMass = _minMass;
-	}
-
-
-	public double getMinPz() {
-		return _minPz;
-	}
-
-
-	public void setMinPz(double _minPz) {
-		this._minPz = _minPz;
-	}
-
-
-	public double getMaxPz() {
-		return _maxPz;
-	}
-
-
-	public void setMaxPz(double _maxPz) {
-		this._maxPz = _maxPz;
-	}
-
-
-	public boolean getDisplay() {
-		return display;
-	}
-
-
-	public void setDisplay(boolean display) {
-		this.display = display;
-	}
-
-	IHistogram1D vtx_x, vtx_y, timediff;
-
-	IProfile1D pxpz_vs_diff, pypz_vs_diff, pxpz_vs_sum, pypz_vs_sum,
-	pxpz_vs_mass, pypz_vs_mass;
-
-
-	//IHistogram1D pypz_tophighE, pxpz_tophighE;
-	//IHistogram1D pypz_bottomhighE, pxpz_bottomhighE;
-	@Override
-	public void startOfData(){
-		AIDA aida = AIDA.defaultInstance();
-		hpypz = aida.histogram1D("pypz", 60, -.005,.005);
-		hpxpz = aida.histogram1D("pxpz", 60, .025,.035);
-
-
-		hpypz_mid = aida.histogram1D("pypz mid", 60, -.005,.005);
-		hpxpz_mid = aida.histogram1D("pxpz mid", 60, .025,.035);
-
-		hpypz_topHighE = aida.histogram1D("pypz top", 30, -.005,.005);
-		hpxpz_topHighE = aida.histogram1D("pxpz top", 30, .025,.035);
-
-		hpypz_botHighE = aida.histogram1D("pypz bot", 30, -.005,.005);
-		hpxpz_botHighE = aida.histogram1D("pxpz bot", 30, .025,.035);
-
-
-		pxpz_vs_diff = aida.profile1D("pxpz vs diff", 25, -.60, .60);
-		pypz_vs_diff = aida.profile1D("pypz vs diff", 25, -.60, .60);
-
-		diff = aida.histogram1D("diff", 50, -.60, .60);
-
-		sum = aida.histogram1D("sum", 50, 1.0, 1.1);
-
-		pxpz_vs_sum = aida.profile1D("pxpz vs sum", 25, 1.0, 1.1);
-		pypz_vs_sum = aida.profile1D("pypz vs sum", 25, 1.0, 1.1);
-
-		pxpz_vs_mass = aida.profile1D("pxpz vs mass", 25, .03, .037);
-		pypz_vs_mass = aida.profile1D("pypz vs mass", 25, .03, .037);
-
-		//vtx_x = aida.histogram1D("vtx x", 60, -1, 1);
-		//vtx_y = aida.histogram1D("vtx y", 60, -1, 1);
-		mass = aida.histogram1D("mass", 60, .030, .037);
-		timediff = aida.histogram1D("time diff", 60, -6, 6);
-
-
-		/*pypz_tophighE = aida.histogram1D("topHighE pypz", 60, -.005,.005);
-		pxpz_tophighE = aida.histogram1D("topHighE pxpz", 60,  .025,.035);
-		pypz_bottomhighE = aida.histogram1D("bottomHighE pypz", 60, -.005,.005);
-		pxpz_bottomhighE = aida.histogram1D("bottomHighE pxpz", 60, .025,.035);*/
-		if(display){
-			IPlotter p = aida.analysisFactory().createPlotterFactory().create();
-			StyleUtil.setSize(p, 1300, 900);
-			//p.createRegions(3, 2);
-			p.createRegions(4, 3);
-
-			p.region(0).plot(hpypz);
-			p.region(1).plot(hpxpz);
-			p.region(2).plot(timediff);
-			p.region(3).plot(pypz_vs_diff);
-			p.region(4).plot(pxpz_vs_diff);
-			p.region(5).plot(diff);
-			p.region(6).plot(pypz_vs_sum);
-			p.region(7).plot(pxpz_vs_sum);
-			p.region(8).plot(sum);
-
-			p.region(9).plot(pypz_vs_mass);
-			p.region(10).plot(pxpz_vs_mass);
-			p.region(11).plot(mass);
-			/*p.region(2).plot(pypz_tophighE);
-		p.region(3).plot(pxpz_tophighE);
-		p.region(4).plot(pypz_bottomhighE);
-		p.region(5).plot(pxpz_bottomhighE);*/
-			StyleUtil.stylize(p.region(0),"py/pz", "py/pz", "#");
-			StyleUtil.stylize(p.region(1),"px/pz", "px/pz", "#");
-			StyleUtil.stylize(p.region(2),"time diff (t-b)", "diff (ns)", "#");
-			StyleUtil.stylize(p.region(3),"py/pz vs diff", "diff (GeV)", "py/pz");
-			StyleUtil.stylize(p.region(4),"px/pz vs diff", "diff (GeV)", "px/pz");
-			StyleUtil.stylize(p.region(5),"diff", "diff (GeV)", "#");
-
-			StyleUtil.stylize(p.region(6),"py/pz vs sum", "sum (GeV)", "py/pz");
-			StyleUtil.stylize(p.region(7),"px/pz vs sum", "sum (GeV)", "px/pz");
-			StyleUtil.stylize(p.region(8),"sum", "sum (GeV)", "#");
-
-			StyleUtil.stylize(p.region(9),"py/pz vs mass", "mass (GeV)", "py/pz");
-			StyleUtil.stylize(p.region(10),"px/pz vs mass", "mass (GeV)", "px/pz");
-			StyleUtil.stylize(p.region(11),"mass", "mass (GeV)", "#");
-
-			p.show();
-
-			IPlotter p2 = aida.analysisFactory().createPlotterFactory().create();
-
-			p2.createRegions(2, 1);
-
-
-			p2.region(0).plot(hpypz_botHighE);
-			p2.region(1).plot(hpxpz_botHighE);
-			p2.region(0).plot(hpypz_mid);
-			p2.region(1).plot(hpxpz_mid);
-			p2.region(0).plot(hpypz_topHighE);
-			p2.region(1).plot(hpxpz_topHighE);
-
-			StyleUtil.stylize(p2.region(0),"py/pz", "py/pz", "#");
-			StyleUtil.stylize(p2.region(1),"px/pz", "py/pz", "#");
-			StyleUtil.noFillHistogramBars(p2.region(0));
-			StyleUtil.noFillHistogramBars(p2.region(1));
-			p2.show();
-		}
-	}
+    @Override
+    public void process(EventHeader event){
+        List<Vertex> mollers = event.get(Vertex.class, "TargetConstrainedMollerVertices");
+        for(Vertex v : mollers){
+            if(!passesCuts(v))
+                continue;
+            ReconstructedParticle m = v.getAssociatedParticle();
+            ReconstructedParticle top;
+            ReconstructedParticle bottom;
+            if(m.getParticles().get(0).getMomentum().y()>0){
+                top = m.getParticles().get(0);
+                bottom = m.getParticles().get(1);
+            }else{
+                top = m.getParticles().get(1);
+                bottom = m.getParticles().get(0);
+            }
+
+            double pypz = m.getMomentum().y()/m.getMomentum().z();
+            double pxpz = m.getMomentum().x()/m.getMomentum().z();
+            //double pypz = (top.getMomentum().y()+bottom.getMomentum().y())/(top.getMomentum().z()+bottom.getMomentum().z());
+            //double pxpz = (top.getMomentum().x()+bottom.getMomentum().x())/(top.getMomentum().z()+bottom.getMomentum().z());
+
+            hpypz.fill(pypz);
+            hpxpz.fill(pxpz);
+
+
+            double diff = top.getMomentum().z()-bottom.getMomentum().z();
+            double sum = m.getMomentum().z();//top.getMomentum().z()+bottom.getMomentum().z();
+            double mass = m.getMass();
+
+            if(diff > -.05 && diff < .05){
+                hpypz_mid.fill(pypz);
+                hpxpz_mid.fill(pxpz);
+            }
+
+            if(diff > .2 && diff < .3){
+                hpypz_topHighE.fill(pypz);
+                hpxpz_topHighE.fill(pxpz);
+            }
+
+            if(diff > -.3 && diff < -.2){
+                hpypz_botHighE.fill(pypz);
+                hpxpz_botHighE.fill(pxpz);
+            }
+
+
+            this.diff.fill(diff);
+            this.sum.fill(sum);
+            this.mass.fill(mass);
+            pypz_vs_diff.fill(diff,pypz );
+            pxpz_vs_diff.fill(diff, pxpz );
+
+
+
+            pxpz_vs_sum.fill(sum, pxpz );
+            pypz_vs_sum.fill(sum, pypz );
+
+            pxpz_vs_mass.fill(mass, pxpz );
+            pypz_vs_mass.fill(mass, pypz );
+            timediff.fill(top.getClusters().get(0).getCalorimeterHits().get(0).getTime()
+                    -bottom.getClusters().get(0).getCalorimeterHits().get(0).getTime());
+            /*if(moreEnergetic.getMomentum().y() > 0)
+            {
+                pypz_tophighE.fill(pypz);
+                pxpz_tophighE.fill(pxpz);
+            }
+            if(moreEnergetic.getMomentum().y() < 0)
+            {
+                pypz_bottomhighE.fill(pypz);
+                pxpz_bottomhighE.fill(pxpz);
+            }*/
+        }
+    }
+
+    double _maxVtxChi2 = 15;
+    double _maxTrkChi2 = 30;
+    double _maxMass = .037;
+    double _minMass = .030;
+    double _minPz = 1.0;
+    double _maxPz = 1.1;
+    boolean passesCuts(Vertex vertex){
+        ReconstructedParticle m = vertex.getAssociatedParticle();
+        if(!TrackType.isGBL(m.getType()))
+            return false;
+        if(m.getMomentum().z() > _maxPz || m.getMomentum().z() < _minPz)
+            return false;
+        if(m.getMass() > _maxMass || m.getMass() < _minMass)
+            return false;
+
+        if(m.getParticles().get(0).getCharge() != -1 
+                || m.getParticles().get(1).getCharge() != -1 )
+            return false;
+
+        if(vertex.getChi2() > _maxVtxChi2)
+            return false;
+
+
+        if(m.getParticles().get(0).getClusters().size() == 0)
+            return false;
+        if(m.getParticles().get(1).getClusters().size() == 0)
+            return false;
+
+        if(m.getParticles().get(0).getTracks().get(0).getChi2() > _maxTrkChi2)
+            return false;
+        if(m.getParticles().get(1).getTracks().get(0).getChi2() > _maxTrkChi2)
+            return false;
+        return true;
+    }
+
+    IHistogram1D hpypz, hpxpz, diff, sum, mass,
+    hpypz_topHighE, hpxpz_topHighE,
+    hpypz_botHighE, hpxpz_botHighE,
+    hpypz_mid, hpxpz_mid;
+
+    boolean display = false;
+
+
+
+
+    public double getMaxVtxChi2() {
+        return _maxVtxChi2;
+    }
+
+
+    public void setMaxVtxChi2(double _maxVtxChi2) {
+        this._maxVtxChi2 = _maxVtxChi2;
+    }
+
+
+    public double getMaxTrkChi2() {
+        return _maxTrkChi2;
+    }
+
+
+    public void setMaxTrkChi2(double _maxTrkChi2) {
+        this._maxTrkChi2 = _maxTrkChi2;
+    }
+
+
+    public double getMaxMass() {
+        return _maxMass;
+    }
+
+
+    public void setMaxMass(double _maxMass) {
+        this._maxMass = _maxMass;
+    }
+
+
+    public double getMinMass() {
+        return _minMass;
+    }
+
+
+    public void setMinMass(double _minMass) {
+        this._minMass = _minMass;
+    }
+
+
+    public double getMinPz() {
+        return _minPz;
+    }
+
+
+    public void setMinPz(double _minPz) {
+        this._minPz = _minPz;
+    }
+
+
+    public double getMaxPz() {
+        return _maxPz;
+    }
+
+
+    public void setMaxPz(double _maxPz) {
+        this._maxPz = _maxPz;
+    }
+
+
+    public boolean getDisplay() {
+        return display;
+    }
+
+
+    public void setDisplay(boolean display) {
+        this.display = display;
+    }
+
+    IHistogram1D vtx_x, vtx_y, timediff;
+
+    IProfile1D pxpz_vs_diff, pypz_vs_diff, pxpz_vs_sum, pypz_vs_sum,
+    pxpz_vs_mass, pypz_vs_mass;
+
+
+    //IHistogram1D pypz_tophighE, pxpz_tophighE;
+    //IHistogram1D pypz_bottomhighE, pxpz_bottomhighE;
+    @Override
+    public void startOfData(){
+        AIDA aida = AIDA.defaultInstance();
+        hpypz = aida.histogram1D("pypz", 60, -.005,.005);
+        hpxpz = aida.histogram1D("pxpz", 60, .025,.035);
+
+
+        hpypz_mid = aida.histogram1D("pypz mid", 60, -.005,.005);
+        hpxpz_mid = aida.histogram1D("pxpz mid", 60, .025,.035);
+
+        hpypz_topHighE = aida.histogram1D("pypz top", 30, -.005,.005);
+        hpxpz_topHighE = aida.histogram1D("pxpz top", 30, .025,.035);
+
+        hpypz_botHighE = aida.histogram1D("pypz bot", 30, -.005,.005);
+        hpxpz_botHighE = aida.histogram1D("pxpz bot", 30, .025,.035);
+
+
+        pxpz_vs_diff = aida.profile1D("pxpz vs diff", 25, -.60, .60);
+        pypz_vs_diff = aida.profile1D("pypz vs diff", 25, -.60, .60);
+
+        diff = aida.histogram1D("diff", 50, -.60, .60);
+
+        sum = aida.histogram1D("sum", 50, 1.0, 1.1);
+
+        pxpz_vs_sum = aida.profile1D("pxpz vs sum", 25, 1.0, 1.1);
+        pypz_vs_sum = aida.profile1D("pypz vs sum", 25, 1.0, 1.1);
+
+        pxpz_vs_mass = aida.profile1D("pxpz vs mass", 25, .03, .037);
+        pypz_vs_mass = aida.profile1D("pypz vs mass", 25, .03, .037);
+
+        //vtx_x = aida.histogram1D("vtx x", 60, -1, 1);
+        //vtx_y = aida.histogram1D("vtx y", 60, -1, 1);
+        mass = aida.histogram1D("mass", 60, .030, .037);
+        timediff = aida.histogram1D("time diff", 60, -6, 6);
+
+
+        /*pypz_tophighE = aida.histogram1D("topHighE pypz", 60, -.005,.005);
+        pxpz_tophighE = aida.histogram1D("topHighE pxpz", 60,  .025,.035);
+        pypz_bottomhighE = aida.histogram1D("bottomHighE pypz", 60, -.005,.005);
+        pxpz_bottomhighE = aida.histogram1D("bottomHighE pxpz", 60, .025,.035);*/
+        if(display){
+            IPlotter p = aida.analysisFactory().createPlotterFactory().create();
+            StyleUtil.setSize(p, 1300, 900);
+            //p.createRegions(3, 2);
+            p.createRegions(4, 3);
+
+            p.region(0).plot(hpypz);
+            p.region(1).plot(hpxpz);
+            p.region(2).plot(timediff);
+            p.region(3).plot(pypz_vs_diff);
+            p.region(4).plot(pxpz_vs_diff);
+            p.region(5).plot(diff);
+            p.region(6).plot(pypz_vs_sum);
+            p.region(7).plot(pxpz_vs_sum);
+            p.region(8).plot(sum);
+
+            p.region(9).plot(pypz_vs_mass);
+            p.region(10).plot(pxpz_vs_mass);
+            p.region(11).plot(mass);
+            /*p.region(2).plot(pypz_tophighE);
+        p.region(3).plot(pxpz_tophighE);
+        p.region(4).plot(pypz_bottomhighE);
+        p.region(5).plot(pxpz_bottomhighE);*/
+            StyleUtil.stylize(p.region(0),"py/pz", "py/pz", "#");
+            StyleUtil.stylize(p.region(1),"px/pz", "px/pz", "#");
+            StyleUtil.stylize(p.region(2),"time diff (t-b)", "diff (ns)", "#");
+            StyleUtil.stylize(p.region(3),"py/pz vs diff", "diff (GeV)", "py/pz");
+            StyleUtil.stylize(p.region(4),"px/pz vs diff", "diff (GeV)", "px/pz");
+            StyleUtil.stylize(p.region(5),"diff", "diff (GeV)", "#");
+
+            StyleUtil.stylize(p.region(6),"py/pz vs sum", "sum (GeV)", "py/pz");
+            StyleUtil.stylize(p.region(7),"px/pz vs sum", "sum (GeV)", "px/pz");
+            StyleUtil.stylize(p.region(8),"sum", "sum (GeV)", "#");
+
+            StyleUtil.stylize(p.region(9),"py/pz vs mass", "mass (GeV)", "py/pz");
+            StyleUtil.stylize(p.region(10),"px/pz vs mass", "mass (GeV)", "px/pz");
+            StyleUtil.stylize(p.region(11),"mass", "mass (GeV)", "#");
+
+            p.show();
+
+            IPlotter p2 = aida.analysisFactory().createPlotterFactory().create();
+
+            p2.createRegions(2, 1);
+
+
+            p2.region(0).plot(hpypz_botHighE);
+            p2.region(1).plot(hpxpz_botHighE);
+            p2.region(0).plot(hpypz_mid);
+            p2.region(1).plot(hpxpz_mid);
+            p2.region(0).plot(hpypz_topHighE);
+            p2.region(1).plot(hpxpz_topHighE);
+
+            StyleUtil.stylize(p2.region(0),"py/pz", "py/pz", "#");
+            StyleUtil.stylize(p2.region(1),"px/pz", "py/pz", "#");
+            StyleUtil.noFillHistogramBars(p2.region(0));
+            StyleUtil.noFillHistogramBars(p2.region(1));
+            p2.show();
+        }
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java	Wed Mar  9 11:43:24 2016
@@ -15,51 +15,51 @@
 import org.hps.users.spaul.StyleUtil;
 
 public class MollerBeamtiltFitter {
-	static IAnalysisFactory af = IAnalysisFactory.create();
-	static IFitFactory ff = af.createFitFactory();
-	static IPlotterFactory pf = af.createPlotterFactory();
-	
-	public static void main(String arg[]) throws IllegalArgumentException, IOException{
-		
-		ITree tree = af.createTreeFactory().create(arg[0]); 
-		
+    static IAnalysisFactory af = IAnalysisFactory.create();
+    static IFitFactory ff = af.createFitFactory();
+    static IPlotterFactory pf = af.createPlotterFactory();
+    
+    public static void main(String arg[]) throws IllegalArgumentException, IOException{
+        
+        ITree tree = af.createTreeFactory().create(arg[0]); 
+        
 
-		IPlotter p;
-		
-		p = pf.create();
-		p.createRegions(2, 1);
+        IPlotter p;
+        
+        p = pf.create();
+        p.createRegions(2, 1);
 
-		plotAndFit(p, 0, (IHistogram1D)tree.find("pxpz"), "ux", "ux");
-		plotAndFit(p, 1, (IHistogram1D)tree.find("pypz"), "uy", "uy");
-		StyleUtil.setSize(p, 1000, 500);
-		p.show();
-		
-	}
-	public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
-		p.region(r).plot(h);
-		h.setTitle(title);
-		
-		double xmin = h.mean()-2*h.rms();
-		double xmax = h.mean()+2*h.rms();
-		String range = String.format("range=\"(%f,%f)\"", xmin, xmax);
-		//range = "";
-		IFitResult fit = ff.createFitter().fit(h, "g", range);
-		IFunction func = fit.fittedFunction();
-		System.out.println("\n" + h.title());
-		String names[] = func.parameterNames();
-		double params[] = func.parameters();
-		for(int i = 0; i< names.length; i++){
-			System.out.printf("%s: %f\t", names[i], params[i]);
-		}
-		//System.out.println(Arrays.toString(fit.);
-		IPlotterStyle style = p.region(r).style();
-		style.dataStyle().outlineStyle().setColor("blue");
-		p.region(r).plot(func, style);
-		StyleUtil.noFillHistogramBars(p.region(r));
-		StyleUtil.stylize(p.region(r), title, xAxis, "#");
-		p.region(r).style().statisticsBoxStyle().setVisible(true);
-		p.region(r).style().legendBoxStyle().setVisible(false);
-		//System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
-		//p.show();
-	}
+        plotAndFit(p, 0, (IHistogram1D)tree.find("pxpz"), "ux", "ux");
+        plotAndFit(p, 1, (IHistogram1D)tree.find("pypz"), "uy", "uy");
+        StyleUtil.setSize(p, 1000, 500);
+        p.show();
+        
+    }
+    public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
+        p.region(r).plot(h);
+        h.setTitle(title);
+        
+        double xmin = h.mean()-2*h.rms();
+        double xmax = h.mean()+2*h.rms();
+        String range = String.format("range=\"(%f,%f)\"", xmin, xmax);
+        //range = "";
+        IFitResult fit = ff.createFitter().fit(h, "g", range);
+        IFunction func = fit.fittedFunction();
+        System.out.println("\n" + h.title());
+        String names[] = func.parameterNames();
+        double params[] = func.parameters();
+        for(int i = 0; i< names.length; i++){
+            System.out.printf("%s: %f\t", names[i], params[i]);
+        }
+        //System.out.println(Arrays.toString(fit.);
+        IPlotterStyle style = p.region(r).style();
+        style.dataStyle().outlineStyle().setColor("blue");
+        p.region(r).plot(func, style);
+        StyleUtil.noFillHistogramBars(p.region(r));
+        StyleUtil.stylize(p.region(r), title, xAxis, "#");
+        p.region(r).style().statisticsBoxStyle().setVisible(true);
+        p.region(r).style().legendBoxStyle().setVisible(false);
+        //System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
+        //p.show();
+    }
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java	Wed Mar  9 11:43:24 2016
@@ -8,8 +8,8 @@
 
 public class MollerStdhepTest 
 {
-	public static void main(String arg[]) throws IOException
-	{
-		
-	}
+    public static void main(String arg[]) throws IOException
+    {
+        
+    }
 }

Modified: java/trunk/util/src/main/java/org/hps/util/ConvertToStdhep.java
 =============================================================================
--- java/trunk/util/src/main/java/org/hps/util/ConvertToStdhep.java	(original)
+++ java/trunk/util/src/main/java/org/hps/util/ConvertToStdhep.java	Wed Mar  9 11:43:24 2016
@@ -502,10 +502,10 @@
     }*/
 
     static private double getDecayLength(double gamma){
-    	Random generator = new Random();
-    	double a = generator.nextDouble();
-    	double l = -gamma*_declength*Math.log(1-a);
-    	return l; 
+        Random generator = new Random();
+        double a = generator.nextDouble();
+        double l = -gamma*_declength*Math.log(1-a);
+        return l; 
     }
     
     /*
@@ -724,7 +724,7 @@
                     double gamma = ApEnergy / ApMass;
                     if (expDecay) {
                         decLen = getDecayLength(gamma);
-                    	// decLen = getDecayLength(maxWght, gamma);
+                        // decLen = getDecayLength(maxWght, gamma);
                     }
                     if (flatDecay) {
                         decLen = generator.nextDouble() * maxLen;

Modified: java/trunk/util/src/main/java/org/hps/util/DumpLHEEventsToASCII.java
 =============================================================================
--- java/trunk/util/src/main/java/org/hps/util/DumpLHEEventsToASCII.java	(original)
+++ java/trunk/util/src/main/java/org/hps/util/DumpLHEEventsToASCII.java	Wed Mar  9 11:43:24 2016
@@ -108,7 +108,7 @@
         String sigyString = String.valueOf(sigy);
         eptString = convertDecimal(eptString);
         if (cl.hasOption("t")) {
-	    trident=true;
+        trident=true;
         }
         if (cl.hasOption("m")) {
             massString = cl.getOptionValue("m");
@@ -475,7 +475,7 @@
             throw new RuntimeException("Unexpected entry for number of particles");
         }
         int nhep = nums.get(0).intValue();
-	//        System.out.println("Number of particles for event " + nevhep + ": " + nhep);
+    //        System.out.println("Number of particles for event " + nevhep + ": " + nhep);
 
         double decLen = 0;
         double maxWght = 0;
@@ -503,14 +503,14 @@
             if (vals.size() != 13) {
                 throw new RuntimeException("Unexpected entry for a particle");
             }
-	    idhepTmp = vals.get(0).intValue();
-//	    System.out.println(idhepTmp);
+        idhepTmp = vals.get(0).intValue();
+//      System.out.println(idhepTmp);
             if (vals.get(1).intValue() == 9) {//apparently, vertices aren't counted in nhep
-		nhep++;
-	    }
+        nhep++;
+        }
 
             if (vals.get(1).intValue() == 1) {//ignore initial  & intermediate state particles
-		//		System.out.println("Ok...good"+idhepTmp);
+        //      System.out.println("Ok...good"+idhepTmp);
 
 
 
@@ -523,8 +523,8 @@
                         phepRec[j] = vals.get(j + 6);
                     if (idhepTmp == -623){
                         phepNuc[j] = vals.get(j + 6);
-			//			System.out.println("Found the recoil nucleus");
-		    }
+            //          System.out.println("Found the recoil nucleus");
+            }
                 }
 
 

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use