hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -N HelicalTrackHitResidualsDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HelicalTrackHitResidualsDriver.java 17 Oct 2012 22:52:29 -0000 1.1
@@ -0,0 +1,301 @@
+package org.lcsim.hps.users.phansson;
+
+import hep.aida.*;
+import hep.aida.ref.plotter.PlotterRegion;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.*;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
+import org.lcsim.fit.helicaltrack.MultipleScatter;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.monitoring.AIDAFrame;
+import org.lcsim.hps.recon.tracking.SvtUtils;
+import org.lcsim.hps.recon.tracking.TrackUtils;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class HelicalTrackHitResidualsDriver extends Driver {
+
+ private AIDA aida = AIDA.defaultInstance();
+ int totalTracks=0;
+ int totalTracksProcessed=0;
+ private String outputPlotFileName="";
+ private String trackCollectionName="MatchedTracks";
+ private boolean hideFrame = false;
+ private boolean _debug = false;
+ private TrackUtils _trackUtils = new TrackUtils();
+
+ private AIDAFrame plotterFrame;
+ ICloud1D[] _h_resz_track_top = new ICloud1D[5];
+ ICloud1D[] _h_resz_track_bottom = new ICloud1D[5];
+ ICloud1D[] _h_resy_track_top = new ICloud1D[5];
+ ICloud1D[] _h_resy_track_bottom = new ICloud1D[5];
+ IDataPointSet dps_hth_y_b;
+ IDataPointSet dps_hth_y_t;
+ IDataPointSet dps_hth_z_b;
+ IDataPointSet dps_hth_z_t;
+ IPlotter _plotter_resz_top;
+ IPlotter _plotter_resy_top;
+ IPlotter _plotter_resz_bottom;
+ IPlotter _plotter_resy_bottom;
+ IPlotter _plotter_mean_res;
+
+
+
+
+ public void setDebug(boolean v) {
+ this._debug = v;
+ }
+
+ public void setTrackCollectionName(String trackCollectionName) {
+ this.trackCollectionName = trackCollectionName;
+ }
+
+ public void setOutputPlotFileName(String filename) {
+ outputPlotFileName = filename;
+ }
+
+ public void setHideFrame(boolean hide) {
+ hideFrame = hide;
+ }
+
+ public HelicalTrackHitResidualsDriver() {
+
+ }
+
+
+
+ @Override
+ public void detectorChanged(Detector detector) {
+
+ Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
+ Hep3Vector _bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y());
+
+ makePlots();
+
+
+ }
+
+
+
+ @Override
+ public void process(EventHeader event) {
+
+ List<Track> tracklist = new ArrayList<Track>();
+ if(event.hasCollection(Track.class,this.trackCollectionName)) {
+ tracklist = event.get(Track.class, this.trackCollectionName);
+ if(_debug) {
+ System.out.println(this.getClass().getSimpleName() + ": Number of Tracks = " + tracklist.size());
+ }
+ }
+
+
+ for (Track track : tracklist) {
+ SeedTrack st = (SeedTrack) track;
+ SeedCandidate seed = st.getSeedCandidate();
+ HelicalTrackFit trk = seed.getHelix();
+ List<TrackerHit> hitsOnTrack = track.getTrackerHits();
+ for(TrackerHit hit : hitsOnTrack) {
+ HelicalTrackHit hth = (HelicalTrackHit) hit;
+ Map<String,Double> res_track = _trackUtils.calculateTrackHitResidual(hth, trk, false);
+ //Map<String,Double> res_trackgen = _trackUtils.calculateTrackHitResidual(hth, trkgen, false);
+ boolean isTop = false;
+ if(SvtUtils.getInstance().isTopLayer((SiSensor)((RawTrackerHit)hth.getRawHits().get(0)).getDetectorElement())) {
+ isTop = true;
+ }
+ int layer = hth.Layer();
+ System.out.println(this.getClass().getSimpleName() + ": residual for hit at " + hth.toString() + " and layer " + layer);
+ if(layer%2==0) {
+ System.out.println(this.getClass().getSimpleName() + ": HTH layer is not odd!" + layer);
+ System.exit(1);
+ }
+ int layer_idx = (layer-1)/2;
+ if(isTop) {
+ this._h_resz_track_top[layer_idx].fill(res_track.get("resz"));
+ this._h_resy_track_top[layer_idx].fill(res_track.get("resy"));
+ } else {
+ this._h_resz_track_bottom[layer_idx].fill(res_track.get("resz"));
+ this._h_resy_track_bottom[layer_idx].fill(res_track.get("resy"));
+ }
+
+ if(Math.abs(res_track.get("resy"))>0.02) {
+ System.out.println(this.getClass().getSimpleName() + ": this has large y res = " + res_track.get("resy"));
+ System.exit(1);
+ }
+
+ }
+
+ }
+ totalTracks++;
+ totalTracksProcessed++;
+
+
+
+ if(totalTracks%50==0) this.updatePlots();
+
+
+
+ }
+
+ public void endOfData() {
+ this.updatePlots();
+ //try {
+ System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Found = "+totalTracks);
+ System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = "+totalTracksProcessed);
+// } catch (IOException ex) {
+// Logger.getLogger(CmpGenToFittedTracksDriver.class.getName()).log(Level.SEVERE, null, ex);
+// }
+ if (!"".equals(outputPlotFileName))
+ try {
+ aida.saveAs(outputPlotFileName);
+ } catch (IOException ex) {
+ Logger.getLogger(TrigRateDriver.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex);
+ }
+
+ }
+
+
+ private void makePlots() {
+
+ _plotter_resz_top = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_resz_top.setTitle("res z top");
+ _plotter_resz_top.createRegions(5,1);
+ _plotter_resy_top = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_resy_top.setTitle("res y top");
+ _plotter_resy_top.createRegions(5,1);
+ for(int i=1;i<6;++i) {
+ _h_resz_track_top[i-1] = aida.cloud1D("h_resz_track_top_layer"+i);
+ _h_resy_track_top[i-1] = aida.cloud1D("h_resy_track_top_layer"+i);
+ _plotter_resz_top.region(i-1).plot(_h_resz_track_top[i-1]);
+ _plotter_resy_top.region(i-1).plot(_h_resy_track_top[i-1]);
+ }
+
+ _plotter_resz_bottom = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_resz_bottom.setTitle("res z bottom");
+ _plotter_resz_bottom.createRegions(5,1);
+ _plotter_resy_bottom = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_resy_bottom.setTitle("res y bottom");
+ _plotter_resy_bottom.createRegions(5,1);
+ for(int i=1;i<6;++i) {
+ _h_resz_track_bottom[i-1] = aida.cloud1D("h_resz_track_bottom_layer"+i);
+ _h_resy_track_bottom[i-1] = aida.cloud1D("h_resy_track_bottom_layer"+i);
+ _plotter_resz_bottom.region(i-1).plot(_h_resz_track_bottom[i-1]);
+ _plotter_resy_bottom.region(i-1).plot(_h_resy_track_bottom[i-1]);
+
+ }
+
+ _plotter_mean_res = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_mean_res.setTitle("Mean res y");
+ _plotter_mean_res.createRegions(2,2);
+
+ IDataPointSetFactory dpsf = aida.analysisFactory().createDataPointSetFactory(null);
+
+ dps_hth_y_b = dpsf.create("dps_hth_y_b", "Mean of y residual bottom",2);
+ dps_hth_y_t = dpsf.create("dps_hth_y_t", "Mean of y residual top",2);
+ _plotter_mean_res.region(0).plot(dps_hth_y_b);
+ //_plotter_mean_res.region(0).plot(dps_hth_y_t);
+
+ dps_hth_z_b = dpsf.create("dps_hth_z_b", "Mean of z residual bottom",2);
+ dps_hth_z_t = dpsf.create("dps_hth_z_t", "Mean of z residual top",2);
+ _plotter_mean_res.region(1).plot(dps_hth_z_b);
+ //_plotter_mean_res.region(1).plot(dps_hth_z_t);
+
+ ((PlotterRegion)_plotter_mean_res.region(0)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) _plotter_mean_res.region(0)).getPlot().setAllowPopupMenus(true);
+ ((PlotterRegion)_plotter_mean_res.region(1)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) _plotter_mean_res.region(1)).getPlot().setAllowPopupMenus(true);
+
+
+ plotterFrame = new AIDAFrame();
+ plotterFrame.setTitle("HTH Residuals");
+ plotterFrame.addPlotter(_plotter_resz_top);
+ plotterFrame.addPlotter(_plotter_resz_bottom);
+ plotterFrame.addPlotter(_plotter_resy_top);
+ plotterFrame.addPlotter(_plotter_resy_bottom);
+ plotterFrame.addPlotter(_plotter_mean_res);
+ plotterFrame.pack();
+ plotterFrame.setVisible(!hideFrame);
+
+ }
+
+
+ void updatePlots() {
+ dps_hth_y_t.clear();
+ dps_hth_z_t.clear();
+ dps_hth_z_b.clear();
+ dps_hth_z_t.clear();
+
+ for(int i=1;i<6;++i) {
+
+ double mean = this._h_resy_track_bottom[i-1].mean();
+ double stddev = this._h_resy_track_bottom[i-1].rms();
+ double N = this._h_resy_track_bottom[i-1].entries();
+ double error = N >0 ? stddev/Math.sqrt(N) : 0;
+ dps_hth_y_b.addPoint();
+ dps_hth_y_b.point(i-1).coordinate(1).setValue(mean);
+ dps_hth_y_b.point(i-1).coordinate(1).setErrorPlus(error);
+ dps_hth_y_b.point(i-1).coordinate(0).setValue(i);
+ dps_hth_y_b.point(i-1).coordinate(0).setErrorPlus(0);
+
+ mean = this._h_resy_track_top[i-1].mean();
+ stddev = this._h_resy_track_top[i-1].rms();
+ N = this._h_resy_track_top[i-1].entries();
+ error = N >0 ? stddev/Math.sqrt(N) : 0;
+ dps_hth_y_t.addPoint();
+ dps_hth_y_t.point(i-1).coordinate(1).setValue(mean);
+ dps_hth_y_t.point(i-1).coordinate(1).setErrorPlus(error);
+ dps_hth_y_t.point(i-1).coordinate(0).setValue(i);
+ dps_hth_y_t.point(i-1).coordinate(0).setErrorPlus(0);
+
+ mean = this._h_resz_track_top[i-1].mean();
+ stddev = this._h_resz_track_top[i-1].rms();
+ N = this._h_resz_track_top[i-1].entries();
+ error = N >0 ? stddev/Math.sqrt(N) : 0;
+ dps_hth_z_t.addPoint();
+ dps_hth_z_t.point(i-1).coordinate(1).setValue(mean);
+ dps_hth_z_t.point(i-1).coordinate(1).setErrorPlus(error);
+ dps_hth_z_t.point(i-1).coordinate(0).setValue(i);
+ dps_hth_z_t.point(i-1).coordinate(0).setErrorPlus(0);
+
+ mean = this._h_resz_track_bottom[i-1].mean();
+ stddev = this._h_resz_track_bottom[i-1].rms();
+ N = this._h_resz_track_bottom[i-1].entries();
+ error = N >0 ? stddev/Math.sqrt(N) : 0;
+ dps_hth_z_b.addPoint();
+ dps_hth_z_b.point(i-1).coordinate(1).setValue(mean);
+ dps_hth_z_b.point(i-1).coordinate(1).setErrorPlus(error);
+ dps_hth_z_b.point(i-1).coordinate(0).setValue(i);
+ dps_hth_z_b.point(i-1).coordinate(0).setErrorPlus(0);
+
+
+
+
+
+ }
+
+
+
+
+ }
+
+
+}
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -N CmpGenToFittedTracksDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CmpGenToFittedTracksDriver.java 17 Oct 2012 22:52:29 -0000 1.1
@@ -0,0 +1,193 @@
+package org.lcsim.hps.users.phansson;
+
+import hep.aida.ICloud1D;
+import hep.aida.ICloud2D;
+import hep.aida.IPlotter;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.monitoring.AIDAFrame;
+import org.lcsim.hps.recon.tracking.TrackUtils;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class CmpGenToFittedTracksDriver extends Driver {
+
+ private AIDA aida = AIDA.defaultInstance();
+ int totalTracks=0;
+ int totalTracksProcessed=0;
+ private String outputPlotFileName="";
+ private boolean hideFrame = false;
+ private boolean _debug = false;
+ private TrackUtils _trackUtils = new TrackUtils();
+
+ private AIDAFrame plotterFrame;
+ ICloud1D _h_chi2;
+ ICloud1D _h_ntracksdiff;
+ ICloud1D _h_d0_diff;
+ ICloud2D _h_d0xy_diff;
+ ICloud1D _h_z0_diff;
+ ICloud1D _h_phi0_diff;
+ ICloud1D _h_R_diff;
+ ICloud1D _h_slope_diff;
+ IPlotter _plotter_trackparamdiff;
+ IPlotter _plotter_others;
+
+
+
+
+ public void setDebug(boolean v) {
+ this._debug = v;
+ }
+
+ public void setOutputPlotFileName(String filename) {
+ outputPlotFileName = filename;
+ }
+
+ public void setHideFrame(boolean hide) {
+ hideFrame = hide;
+ }
+
+ public CmpGenToFittedTracksDriver() {
+
+ }
+
+
+
+ @Override
+ public void detectorChanged(Detector detector) {
+
+ Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
+ Hep3Vector _bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y());
+
+ makePlots();
+
+
+ }
+
+
+
+ @Override
+ public void process(EventHeader event) {
+
+ List<HelicalTrackFit> tracklistgen = new ArrayList<HelicalTrackFit>();
+ if(event.hasCollection(HelicalTrackFit.class,"MCParticle_HelicalTrackFit")) {
+ tracklistgen = event.get(HelicalTrackFit.class, "MCParticle_HelicalTrackFit");
+ if(_debug) {
+ System.out.println(this.getClass().getSimpleName() + ": Number of generated Tracks = " + tracklistgen.size());
+ }
+ }
+
+ List<Track> tracklist = new ArrayList<Track>();
+ if(event.hasCollection(Track.class,"MatchedTracks")) {
+ tracklist = event.get(Track.class, "MatchedTracks");
+ if(_debug) {
+ System.out.println(this.getClass().getSimpleName() + ": Number of Tracks = " + tracklist.size());
+ }
+ }
+
+ _h_ntracksdiff.fill(tracklistgen.size()-tracklist.size());
+
+ if(tracklistgen.size()!=tracklist.size()) {
+ if(this._debug) System.out.println(this.getClass().getSimpleName() + ": tracklistgen.size() = " + tracklistgen.size() + " tracklist.size()=" + tracklist.size());
+ return;
+ }
+ for (HelicalTrackFit trkgen : tracklistgen) {
+ for (Track track : tracklist) {
+ SeedTrack st = (SeedTrack) track;
+ SeedCandidate seed = st.getSeedCandidate();
+ HelicalTrackFit trk = seed.getHelix();
+ List<TrackerHit> hitsOnTrack = track.getTrackerHits();
+ //if(Math.signum(trkgen.R())!=Math.signum(trk.R())) continue;
+ this._h_d0_diff.fill(trkgen.dca()-trk.dca());
+ this._h_d0xy_diff.fill(trkgen.dca(),trk.dca());
+ this._h_R_diff.fill(trkgen.R()-trk.R());
+ this._h_phi0_diff.fill(trkgen.phi0()-trk.phi0());
+ this._h_z0_diff.fill(trkgen.z0()-trk.z0());
+ this._h_slope_diff.fill(trkgen.slope()-trk.slope());
+ this._h_chi2.fill(trk.chisqtot());
+ }
+ totalTracks++;
+ totalTracksProcessed++;
+
+ }
+
+
+
+
+ }
+
+ public void endOfData() {
+ //try {
+ System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Found = "+totalTracks);
+ System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = "+totalTracksProcessed);
+// } catch (IOException ex) {
+// Logger.getLogger(CmpGenToFittedTracksDriver.class.getName()).log(Level.SEVERE, null, ex);
+// }
+ if (!"".equals(outputPlotFileName))
+ try {
+ aida.saveAs(outputPlotFileName);
+ } catch (IOException ex) {
+ Logger.getLogger(TrigRateDriver.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex);
+ }
+
+ }
+
+
+ private void makePlots() {
+
+
+ _h_chi2 = aida.cloud1D("chi2");
+ _h_ntracksdiff = aida.cloud1D("ntracksdiff");
+ _h_R_diff = aida.cloud1D("R_diff");
+ _h_d0_diff = aida.cloud1D("d0_diff");
+ _h_d0xy_diff = aida.cloud2D("d0xy_diff");
+ _h_phi0_diff = aida.cloud1D("phi0_diff");
+ _h_slope_diff = aida.cloud1D("slope_diff");
+ _h_z0_diff = aida.cloud1D("z0_diff");
+ _plotter_trackparamdiff = aida.analysisFactory().createPlotterFactory().create();
+ _plotter_trackparamdiff.setTitle("Params diff");
+ _plotter_trackparamdiff.createRegions(2,3);
+ _plotter_trackparamdiff.region(0).plot(_h_R_diff);
+ _plotter_trackparamdiff.region(1).plot(_h_d0_diff);
+ _plotter_trackparamdiff.region(2).plot(_h_phi0_diff);
+ _plotter_trackparamdiff.region(3).plot(_h_z0_diff);
+ _plotter_trackparamdiff.region(4).plot(_h_slope_diff);
+ _plotter_trackparamdiff.region(5).plot(_h_d0xy_diff);
+
+ this._plotter_others = aida.analysisFactory().createPlotterFactory().create();
+ this._plotter_others.setTitle("Other");
+ this._plotter_others.createRegions(1,2);
+ this._plotter_others.region(0).plot(this._h_ntracksdiff);
+ this._plotter_others.region(1).plot(this._h_chi2);
+
+
+
+
+
+ plotterFrame = new AIDAFrame();
+ plotterFrame.setTitle("Compare Generated and Fitted Tracks");
+ plotterFrame.addPlotter(_plotter_trackparamdiff);
+ plotterFrame.addPlotter(_plotter_others);
+ plotterFrame.pack();
+ plotterFrame.setVisible(!hideFrame);
+
+ }
+
+
+}
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.4 -r1.5
--- ParticleHelixProducer.java 13 Oct 2012 02:58:02 -0000 1.4
+++ ParticleHelixProducer.java 17 Oct 2012 22:52:29 -0000 1.5
@@ -1,42 +1,28 @@
package org.lcsim.hps.users.phansson;
-import org.lcsim.hps.recon.tracking.*;
-import hep.aida.*;
-import hep.physics.matrix.SymmetricMatrix;
+import hep.aida.ICloud1D;
+import hep.aida.IPlotter;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Matrix;
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import org.lcsim.constants.Constants;
-import org.lcsim.hps.users.mgraham.*;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.IReadout;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.detector.Transform3D;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.tracker.silicon.*;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseRawTrackerHit;
import org.lcsim.event.util.ParticleTypeClassifier;
import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
import org.lcsim.fit.helicaltrack.HelixParamCalculator;
-import org.lcsim.fit.helicaltrack.MultipleScatter;
import org.lcsim.geometry.Detector;
import org.lcsim.hps.analysis.ecal.HPSMCParticlePlotsDriver;
-import org.lcsim.hps.recon.tracking.*;
-import org.lcsim.hps.users.meeg.NoiselessReadoutChip;
-import org.lcsim.hps.users.phansson.WTrack;
-import org.lcsim.hps.users.phansson.WTrackUtils;
-import org.lcsim.recon.tracking.digitization.sisim.*;
+import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
+import org.lcsim.hps.recon.tracking.TrackUtils;
+import org.lcsim.hps.recon.tracking.TrackerHitUtils;
+import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType.CoordinateSystem;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
-import org.lcsim.util.lcio.LCIOUtil;
/**
*
@@ -45,7 +31,10 @@
public class ParticleHelixProducer extends Driver {
private boolean debug = false;
+ private boolean hideFrame = true;
private boolean saveSingleTrack = false;
+ private boolean noTopTracks = true;
+ private boolean noBottomTracks = false;
private int _totalTracks = 0;
TrackUtils trackUtils = new TrackUtils();
TrackerHitUtils trackerhitutils = new TrackerHitUtils();
@@ -72,6 +61,18 @@
this.debug = debug;
}
+ public void setHideFrame(boolean hide) {
+ this.hideFrame = hide;
+ }
+
+ public void setNoTopTracks(boolean doTop) {
+ this.noTopTracks = doTop;
+ }
+
+ public void setNoBottomTracks(boolean doBot) {
+ this.noBottomTracks = doBot;
+ }
+
public void setSaveSingleTrack(boolean single) {
this.saveSingleTrack = single;
}
@@ -94,7 +95,11 @@
// Call sub-Driver's detectorChanged methods.
super.detectorChanged(detector);
-
+
+ if(this.noTopTracks && this.noBottomTracks) {
+ System.out.println(this.getClass().getSimpleName() + ": ERROR you need to produce top or bottom tracks!");
+ System.exit(1);
+ }
Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
_bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y());
@@ -115,7 +120,7 @@
plotter_trkparams.region(3).plot(h_d0);
plotter_trkparams.region(4).plot(h_slope);
plotter_trkparams.region(5).plot(h_z0);
- plotter_trkparams.show();
+ if(!this.hideFrame) plotter_trkparams.show();
}
@@ -150,11 +155,24 @@
if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small momentum p=" + p.toString());
continue;
}
- if(Math.abs( Math.atan(p.y()/p.z()) ) < 0.01) {
+
+ double thetay = Math.atan(p.y()/p.z());
+
+ if(Math.abs(thetay) < 0.01) {
if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small thetay =" + Math.abs( Math.atan(p.y()/p.z()) ));
continue;
}
+ if(this.noTopTracks && thetay > 0.0) {
+ if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had negative thetay ("+thetay+") and we only want top tracks");
+ continue;
+ }
+ if(this.noBottomTracks && thetay < 0.0) {
+ if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had positive thetay ("+thetay+") and we only want bottom tracks");
+ continue;
+ }
+
+
//propagate to start of field region if needed
double dz = 0-org.z();
if(dz>0) {