Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN | |||
RunMPAlignment.java | +10 | -10 | 1.6 -> 1.7 |
MPAlignmentParameters.java | +97 | -102 | 1.10 -> 1.11 |
+107 | -112 |
Added debug output.
diff -u -r1.6 -r1.7 --- RunMPAlignment.java 29 Sep 2012 00:55:56 -0000 1.6 +++ RunMPAlignment.java 9 Oct 2012 01:17:35 -0000 1.7 @@ -114,7 +114,7 @@
if(event.hasCollection(Track.class,"MatchedTracks")) { tracklist = event.get(Track.class, "MatchedTracks"); if(_debug) {
- System.out.println("Number of Tracks = " + tracklist.size());
+ System.out.println(this.getClass().getSimpleName() + ": Number of Tracks = " + tracklist.size());
} }
@@ -133,21 +133,21 @@
List<HelicalTrackStrip> strips = null; if(event.hasCollection(HelicalTrackStrip.class, "HelicalTrackStrips")) { strips = event.get(HelicalTrackStrip.class, "HelicalTrackStrips");
- if(_debug) System.out.println("Event has " + strips.size() + "HelicalTrackStrips");
+ if(_debug) System.out.println(this.getClass().getSimpleName() + ": Event has " + strips.size() + " HelicalTrackStrips");
} List<SiTrackerHit> trackerHits = null; if(event.hasCollection(SiTrackerHit.class, "StripClusterer_SiTrackerHitStrip1D")) { trackerHits = event.get(SiTrackerHit.class, "StripClusterer_SiTrackerHitStrip1D");
- if(_debug) System.out.println("Event has " + trackerHits.size() + "SiTrackerHit");
+ if(_debug) System.out.println(this.getClass().getSimpleName() + ": Event has " + trackerHits.size() + " SiTrackerHit");
} for (Track trk : tracklist) {
- //if(trk.getCharge()<0) continue;
+ //if(trk.getCharge()>0) continue;
//if(trk.getTrackStates().get(0).getMomentum()[0]>0.8) continue; totalTracks++;
@@ -174,8 +174,8 @@
public void endOfData() { ap.updatePlots(); try {
- System.out.println("Total Number of Tracks Found = "+totalTracks); - System.out.println("Total Number of Tracks Processed = "+totalTracksProcessed);
+ System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Found = "+totalTracks); + System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = "+totalTracksProcessed);
ap.closeFile(); } catch (IOException ex) { Logger.getLogger(RunMPAlignment.class.getName()).log(Level.SEVERE, null, ex);
@@ -202,11 +202,11 @@
} } if(hitsOnWrongSide) {
- System.out.println("TRACK w/ both halves hit (: chi2 "+track.getChi2()+", pX "+track.getPX()+", pY "+track.getPY()+", pZ "+track.getPZ()+")"); - System.out.printf("Hits: ");
+ System.out.println(this.getClass().getSimpleName() + ": TRACK w/ both halves hit (: chi2 "+track.getChi2()+", pX "+track.getPX()+", pY "+track.getPY()+", pZ "+track.getPZ()+")"); + System.out.printf(this.getClass().getSimpleName() + ": Hits: ");
for (TrackerHit hit : hitsOnTrack) { double[] pos = hit.getPosition();
- System.out.printf("(%.2f,%.2f,%.2f)", pos[0],pos[1],pos[2]);
+ System.out.printf(this.getClass().getSimpleName() + ": (%.2f,%.2f,%.2f)", pos[0],pos[1],pos[2]);
} System.out.println(""); }
@@ -226,7 +226,7 @@
if (line.contains("#")) continue; String[] vec = line.split("\\s+"); if(vec.length!=5) {
- System.out.println("Error: residual limits line has wrong format -> " + line);
+ System.out.println(this.getClass().getSimpleName() + ": Error: residual limits line has wrong format -> " + line);
System.exit(1); } try {
diff -u -r1.10 -r1.11 --- MPAlignmentParameters.java 29 Sep 2012 00:55:56 -0000 1.10 +++ MPAlignmentParameters.java 9 Oct 2012 01:17:35 -0000 1.11 @@ -91,6 +91,10 @@
IDataPointSet dps_pull_hth_y_t; IDataPointSet dps_pull_hth_z_b; IDataPointSet dps_pull_hth_z_t;
+ IPlotter plotter_resuydiff; + IPlotter plotter_resuydiff_b; + IDataPointSet[] dps_resuydiff_t = new IDataPointSet[10]; + IDataPointSet[] dps_resuydiff_b = new IDataPointSet[10];
@@ -143,6 +147,7 @@
String half = hitsOnTrack.get(0).getPosition()[2]>0 ? "top" : "bottom"; pWriter.printf("TRACK %s (%d)\n",half,itrack); aida.histogram1D("Track Chi2 "+ half).fill(track.getChi2());
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": Loop over " + hitsOnTrack.size() + " hitsOnTrack");
for (TrackerHit hit : hitsOnTrack) { HelicalTrackHit htc = (HelicalTrackHit) hit; double msdrphi = msmap.get(htc).drphi();
@@ -153,7 +158,10 @@
List<HelicalTrackStrip> clusterlist = cross.getStrips(); TrackDirection trkdir = HelixUtils.CalculateTrackDirection(_trk, sHit); cross.setTrackDirection(trkdir, _trk.covariance());
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": Loop over " + clusterlist.size() + " clusterlist for this hitontrack");
for (HelicalTrackStrip cl : clusterlist) {
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": cluster size " + cl.rawhits().size()); + //if(cl.rawhits().size()>1) continue;
if(type=="GLOBAL") { //CalculateLocalDerivativesGLOBAL(cl);
@@ -649,6 +657,7 @@
private void CalculateResidual(HelicalTrackStrip strip, double msdrdphi, double msdz) {
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": CalculateResidual");
Hep3Vector u = strip.u(); Hep3Vector v = strip.v();
@@ -670,6 +679,18 @@
Hep3Matrix trkToStrip = this.trackerHitUtil.getTrackToStripRotation(strip); Hep3Vector vdiff = VecOp.mult(trkToStrip, vdiffTrk); //Hep3Vector mserrrot = VecOp.mult(trkToStrip, mserr);
+ + int idiffbin = (int)Math.floor((vdiffTrk.y())/10); + if(idiffbin<-7) { + idiffbin = -7; + System.out.println("WARNING vdiffTrk.y() = " + vdiffTrk.y() + " merge to -> idiffbin= " + idiffbin); + } + if(idiffbin>6) { + idiffbin = 6; + System.out.println("WARNING vdiffTrk.y() = " + vdiffTrk.y() + " merge to -> idiffbin= " + idiffbin); + } + +
double umc = vdiff.x(); double vmc = vdiff.y(); double wmc = vdiff.z();
@@ -680,31 +701,23 @@
double vError = (strip.vmax() - strip.vmin()) / Math.sqrt(12); double wmeas = 0; double wError = 10.0/Math.sqrt(12); //0.001;
- //System.out.println("strip error="+uError+"; ms error ="+msuError); - _resid[0] = umeas - umc; - _error[0] = Math.sqrt(uError * uError + msuError * msuError); - _resid[1] = vmeas - vmc; - _error[1] = vError; - _resid[2] = wmeas - wmc; - _error[2] = wError;
+ //if(idiffbin==0) { + _resid[0] = umeas - umc; + _error[0] = Math.sqrt(uError * uError + msuError * msuError); + _resid[1] = vmeas - vmc; + _error[1] = vError; + _resid[2] = wmeas - wmc; + _error[2] = wError; + if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": idiffbin= " + idiffbin + " resid[0]=" + _resid[0]); + //} else { + // _resid[0] = 9999999.9; + //}
+ //Calcualte the distance from the center of the sensor
String side = corigin.z()>0. ? "top" : "bottom";
- int idiffbin = (int)Math.floor((vdiffTrk.y())/10); - if(idiffbin<-7) { - idiffbin = -7; - System.out.println("WARNING vdiffTrk.y() = " + vdiffTrk.y() + " merge to -> idiffbin= " + idiffbin); - //System.exit(-1); - } - if(idiffbin>6) { - idiffbin = 6; - System.out.println("WARNING vdiffTrk.y() = " + vdiffTrk.y() + " merge to -> idiffbin= " + idiffbin); - //System.exit(-1); - } - - aida.histogram1D("res_u_vs_ydiff_"+idiffbin+"_layer_" + strip.layer() + "_" + side).fill(umeas - umc); - //aida.histogram1D("res_u_ydiff_"+idiffbin+"_layer" + strip.layer() + "_" + side).fill(umeas-umc); -
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": idiffbin= " + idiffbin + " filling ydiff bist with " + _resid[0]); + aida.histogram1D("res_u_vs_ydiff_"+idiffbin+"_layer_" + strip.layer() + "_" + side).fill(_resid[0]);
if (_DEBUG) { System.out.println("---- " + this.getClass().getSimpleName() + " CalculateResidual ----");
@@ -1087,39 +1100,7 @@
}
- public double[] getResidual(Track track, int layer) { - double[] res = new double[7]; - SeedTrack st = (SeedTrack) track; - SeedCandidate seed = st.getSeedCandidate(); - Map<HelicalTrackHit, MultipleScatter> msmap = seed.getMSMap(); - _trk = seed.getHelix(); - List<TrackerHit> hitsOnTrack = track.getTrackerHits(); - for (TrackerHit hit : hitsOnTrack) { - HelicalTrackHit htc = (HelicalTrackHit) hit; - double sHit = _trk.PathMap().get(htc); - HelicalTrackCross cross = (HelicalTrackCross) htc; - List<HelicalTrackStrip> clusterlist = cross.getStrips(); - TrackDirection trkdir = HelixUtils.CalculateTrackDirection(_trk, sHit); - double msdrphi = msmap.get(htc).drphi(); - double msdz = msmap.get(htc).dz(); - cross.setTrackDirection(trkdir, _trk.covariance()); - for (HelicalTrackStrip cl : clusterlist) { - if (cl.layer() == layer) { - CalculateResidual(cl, msdrphi, msdz); - res[0] = _resid[0]; - res[1] = _resid[1]; - res[2] = _resid[2]; - res[3] = _error[0]; - res[4] = _error[1]; - res[5] = _error[2]; - res[6] = layer; - if(hit.getPosition()[2]<0)res[6]=layer+10; - } - } - } - return res; - - }
+
/* public void AddTarget(double beamdy, double beamdz) { double[][] dfdp = new double[3][1];
@@ -1156,39 +1137,11 @@
} */
- private void PrintStripResiduals(HelicalTrackStrip strip) { - if (_DEBUG) { - System.out.printf("Strip Layer = %4d\n", strip.layer()); - System.out.printf("Residuals (u,v,w) : %5.5e %5.5e %5.5e\n", _resid[0], _resid[1], _resid[2]); - System.out.printf("Errors (u,v,w) : %5.5e %5.5e %5.5e\n", _error[0], _error[1], _error[2]); - String[] q = {"d0", "z0", "slope", "phi0", "R"}; - System.out.println("track parameter derivatives"); - for (int i = 0; i < _nlc; i++) { - System.out.printf("%s %5.5e %5.5e %5.5e\n", q[i], _dfdq.e(0, i), _dfdq.e(1, i), _dfdq.e(2, i)); - } - //String[] p = {"u-displacement"}; - System.out.println("global parameter derivatives"); - for (GlobalParameter gl : _glp) { - System.out.printf("%s %5.5e %5.5e %5.5e %5d %10s\n", "", gl.dfdp(0), gl.dfdp(1), gl.dfdp(2), gl.getLabel(),gl.getName()); - //System.out.printf("%s %5.5e %5.5e %5.5e %5d\n", p[j], _dfdp.e(0, j), _dfdp.e(1, j), _dfdp.e(2, j), _globalLabel[j]); - } - - } - pWriter.printf("%4d\n", strip.layer()); - pWriter.printf("%5.5e %5.5e %5.5e\n", _resid[0], _resid[1], _resid[2]); - pWriter.printf("%5.5e %5.5e %5.5e\n", _error[0], _error[1], _error[2]); - for (int i = 0; i < _nlc; i++) { - pWriter.printf("%5.5e %5.5e %5.5e\n", _dfdq.e(0, i), _dfdq.e(1, i), _dfdq.e(2, i)); - } - for (GlobalParameter gl: _glp) { - if(gl.active()){ - pWriter.printf("%5.5e %5.5e %5.5e %5d\n", gl.dfdp(0), gl.dfdp(1), gl.dfdp(2), gl.getLabel()); - } - } - }
+
private void PrintStripResidualsNew(HelicalTrackStrip strip) { if (_DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ": PrintStripResidualsNew");
int s = 1; if(strip.origin().z()>0) s = 0; System.out.printf("Strip Layer = %4d\n", strip.layer());
@@ -1256,20 +1209,21 @@
} }
+ if( _resid[j] < 9999999 ) { + if (_DEBUG) System.out.println(this.getClass().getSimpleName() + ": filling ures with " + _resid[j]); + aida.histogram1D("res_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_resid[j]); + aida.histogram1D("reserr_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_error[j]); + aida.histogram1D("respull_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_resid[j]/_error[j]); + +// double phi0 = _trk.phi0(); +// double R = _trk.R(); +// double xint = trackUtil.calculateHelixInterceptXPlane(_trk, strip); +// //double xint = strip.origin().x(); +// double pathLength = HelixUtils.PathToXPlane(_trk, xint, smax, _nlc).get(0); +// double phi = -s/R + phi0;
- aida.histogram1D("res_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_resid[j]); - aida.histogram1D("reserr_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_error[j]); - aida.histogram1D("respull_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_resid[j]/_error[j]); - - double phi0 = _trk.phi0(); - double R = _trk.R(); - double xint = trackUtil.calculateHelixInterceptXPlane(_trk, strip); - //double xint = strip.origin().x(); - double pathLength = HelixUtils.PathToXPlane(_trk, xint, smax, _nlc).get(0); - double phi = -s/R + phi0; - - aida.histogram2D("respull_slope_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_trk.slope(),_resid[j]/_error[j]); -
+ aida.histogram2D("respull_slope_"+d[j]+"_layer" + strip.layer() + "_" + side).fill(_trk.slope(),_resid[j]/_error[j]); + }
} }
@@ -1830,19 +1784,31 @@
plotterFrameSummary.addPlotter(plotter_prf);
- IPlotter plotter_resuydiff = af.createPlotterFactory().create();
+ plotter_resuydiff = af.createPlotterFactory().create();
plotter_resuydiff.createRegions(5,2,0);
- plotter_resuydiff.setTitle("res u vs ydiff"); -
+ plotter_resuydiff.setTitle("res u vs ydiff"); + plotter_resuydiff_b = af.createPlotterFactory().create(); + plotter_resuydiff_b.createRegions(5,2,0); + plotter_resuydiff_b.setTitle("distr: res u vs ydiff");
for(int iLayer=1;iLayer<11;++iLayer) { for(int i=-7;i<7;++i) { IHistogram ht = aida.histogram1D("res_u_vs_ydiff_"+i+"_layer_"+iLayer+"_top",50,-0.5,0.5); IHistogram hb = aida.histogram1D("res_u_vs_ydiff_"+i+"_layer_"+iLayer+"_bottom",50,-0.5,0.5);
+ if(i==-4) plotter_resuydiff_b.region(iLayer-1).plot(ht); + else if(i==4||i==0) plotter_resuydiff_b.region(iLayer-1).plot(ht,"mode=overlay");
}
+ dps_resuydiff_t[iLayer-1] = dpsf.create("dps_resuydiff_layer_"+iLayer+"_t", "L"+iLayer+"u residual vs sensor v position (top)",2); + plotter_resuydiff.region(iLayer-1).plot(dps_resuydiff_t[iLayer-1]); + dps_resuydiff_b[iLayer-1] = dpsf.create("dps_resuydiff_layer_"+iLayer+"_b", "L"+iLayer+"u residual vs sensor v position (bot)",2); + plotter_resuydiff.region(iLayer-1).plot(dps_resuydiff_b[iLayer-1]); + plotter_resuydiff.style().statisticsBoxStyle().setVisible(false);
}
-
+ + +
plotterFrameSummary.addPlotter(plotter_resuydiff);
+ plotterFrameSummary.addPlotter(plotter_resuydiff_b);
@@ -2008,6 +1974,35 @@
}
+ + for(int iLayer=1;iLayer<11;++iLayer) { + dps_resuydiff_t[iLayer-1].clear(); + dps_resuydiff_b[iLayer-1].clear(); + for(int i=-7;i<7;++i) { + IHistogram1D h = aida.histogram1D("res_u_vs_ydiff_"+i+"_layer_"+iLayer+"_top"); + dps_resuydiff_t[iLayer-1].addPoint(); + dps_resuydiff_t[iLayer-1].point(i+7).coordinate(1).setValue(h.mean()); + double N = h.entries(); + double error = N>0 ? h.rms()/Math.sqrt(N) : 0; + double vdiff = -i*10.0+0.5; + dps_resuydiff_t[iLayer-1].point(i+7).coordinate(1).setValue(h.mean()); + dps_resuydiff_t[iLayer-1].point(i+7).coordinate(1).setErrorPlus(error); + dps_resuydiff_t[iLayer-1].point(i+7).coordinate(0).setValue(vdiff); + + IHistogram1D hb = aida.histogram1D("res_u_vs_ydiff_"+i+"_layer_"+iLayer+"_bottom"); + dps_resuydiff_b[iLayer-1].addPoint(); + dps_resuydiff_b[iLayer-1].point(i+7).coordinate(1).setValue(hb.mean()); + N = hb.entries(); + error = N>0 ? hb.rms()/Math.sqrt(N) : 0; + dps_resuydiff_b[iLayer-1].point(i+7).coordinate(1).setValue(hb.mean()); + dps_resuydiff_b[iLayer-1].point(i+7).coordinate(1).setErrorPlus(error); + dps_resuydiff_b[iLayer-1].point(i+7).coordinate(0).setValue(vdiff); + } + + } + + +
}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1