hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.9 -r1.10
--- MPAlignmentParameters.java 28 Sep 2012 22:12:04 -0000 1.9
+++ MPAlignmentParameters.java 29 Sep 2012 00:55:56 -0000 1.10
@@ -687,6 +687,25 @@
_error[1] = vError;
_resid[2] = wmeas - wmc;
_error[2] = wError;
+
+
+ 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() + " CalculateResidual ----");
System.out.println("Strip Origin: ");
@@ -777,37 +796,38 @@
if(simTrackerHits!=null && simTrackerHits.size()>0) {
List<SimTrackerHit> simHits = trackerHitUtil.stripClusterToSimHits(strip, simTrackerHits,true);
- //Should only be one!
- if(simHits.size()>1) {
- System.out.println(this.getClass().getSimpleName() + " ERROR multiple simhits for this strip");
- System.exit(1);
- }
- if(_DEBUG) System.out.println( simHits.size() + " sim hits for this raw hit at: ");
- SimTrackerHit simHit =simHits.get(0);
- if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " sim hit position in JLab frame" + simHit.getPositionVec().toString());
- //Transformation between the JLAB and tracking coordinate systems
- Hep3Matrix detToTrackMatrix = trackerHitUtil.detToTrackRotationMatrix();
- Hep3Vector simHitPos = VecOp.mult(detToTrackMatrix, simHit.getPositionVec());
- if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " sim hit position in tracking frame" + simHitPos.toString());
-
- String side = strip.origin().z()>0 ? "top" : "bottom";
- Hep3Vector stripPosition = trackerHitUtil.getClusterPosition(strip,true);
- aida.histogram1D("simhitstripres_z_layer" + strip.layer() + "_" + side).fill(simHitPos.z()-stripPosition.z());
- aida.histogram1D("simhitstripres_y_layer" + strip.layer() + "_" + side).fill(simHitPos.y()-stripPosition.y());
- aida.histogram1D("simhitstripres_x_layer" + strip.layer() + "_" + side).fill(simHitPos.x()-stripPosition.x());
-
- //Transform the sim hit to do a u residual
- Hep3Vector vDiffSimTrk = VecOp.sub(simHitPos, corigin);
- //Rotate this into the local sensor frame
- Hep3Vector vdiffSim = VecOp.mult(trkToStrip, vDiffSimTrk);
- double umc_sim = vdiffSim.x();
- double vmc_sim = vdiffSim.y();
- double wmc_sim = vdiffSim.z();
- aida.histogram1D("simhitstripres_u_layer" + strip.layer() + "_" + side).fill(umeas - umc_sim);
- aida.histogram1D("simhitstripres_v_layer" + strip.layer() + "_" + side).fill(vmeas - vmc_sim);
- aida.histogram1D("simhitstripres_w_layer" + strip.layer() + "_" + side).fill(wmeas - wmc_sim);
-
+ if(simHits.size()>0) {
+ //Should only be one!
+ if(simHits.size()>1) {
+ System.out.println(this.getClass().getSimpleName() + " ERROR multiple simhits for this strip");
+ System.exit(1);
+ }
+ if(_DEBUG) System.out.println( simHits.size() + " sim hits for this raw hit at: ");
+ SimTrackerHit simHit =simHits.get(0);
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " sim hit position in JLab frame" + simHit.getPositionVec().toString());
+ //Transformation between the JLAB and tracking coordinate systems
+ Hep3Matrix detToTrackMatrix = trackerHitUtil.detToTrackRotationMatrix();
+ Hep3Vector simHitPos = VecOp.mult(detToTrackMatrix, simHit.getPositionVec());
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " sim hit position in tracking frame" + simHitPos.toString());
+
+ String side = strip.origin().z()>0 ? "top" : "bottom";
+ Hep3Vector stripPosition = trackerHitUtil.getClusterPosition(strip,true);
+ aida.histogram1D("simhitstripres_z_layer" + strip.layer() + "_" + side).fill(simHitPos.z()-stripPosition.z());
+ aida.histogram1D("simhitstripres_y_layer" + strip.layer() + "_" + side).fill(simHitPos.y()-stripPosition.y());
+ aida.histogram1D("simhitstripres_x_layer" + strip.layer() + "_" + side).fill(simHitPos.x()-stripPosition.x());
+
+ //Transform the sim hit to do a u residual
+ Hep3Vector vDiffSimTrk = VecOp.sub(simHitPos, corigin);
+ //Rotate this into the local sensor frame
+ Hep3Vector vdiffSim = VecOp.mult(trkToStrip, vDiffSimTrk);
+ double umc_sim = vdiffSim.x();
+ double vmc_sim = vdiffSim.y();
+ double wmc_sim = vdiffSim.z();
+ aida.histogram1D("simhitstripres_u_layer" + strip.layer() + "_" + side).fill(umeas - umc_sim);
+ aida.histogram1D("simhitstripres_v_layer" + strip.layer() + "_" + side).fill(vmeas - vmc_sim);
+ aida.histogram1D("simhitstripres_w_layer" + strip.layer() + "_" + side).fill(wmeas - wmc_sim);
+ }
} else {
if(_DEBUG) System.out.println("No simTrackerHit collection");
@@ -828,9 +848,18 @@
// double msdrdphi = 0;
double msdz = 0;
+ if (_DEBUG) {
+ System.out.println("---- " + this.getClass().getSimpleName() + " CalculateResidualSimHits ----");
+ }
+ if(strips==null) {
+ if (_DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ": list of strips is null");
+ }
+ return;
+ }
if (_DEBUG) {
- System.out.println("---- " + this.getClass().getSimpleName() + " CalculateResidualSimHits for " + strips.size() + " strips ----");
+ System.out.println(this.getClass().getSimpleName() + ": " + strips.size() + " strips");
}
for(HelicalTrackStrip strip : strips) {
//Rotate into tracking frame
@@ -881,17 +910,14 @@
// aida.histogram1D("simallhitstripres_u_layer" + strip.layer() + "_" + side).fill(umeas - umc_sim);
// aida.histogram1D("simallhitstripres_v_layer" + strip.layer() + "_" + side).fill(vmeas - vmc_sim);
// aida.histogram1D("simallhitstripres_w_layer" + strip.layer() + "_" + side).fill(wmeas - wmc_sim);
- } else {
- System.out.println(this.getClass().getSimpleName() + " ERROR no simhits for this strip");
- System.exit(1);
-
- }
+ }
} else {
if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " No simTrackerHit collection");
}
+ /*
if(strip1dhits!=null && strip1dhits.size()>0) {
List<SiTrackerHit> siHits = this.trackerHitUtil.stripClusterToSiHits(strip, strip1dhits, false);
if(siHits.size()>0) {
@@ -933,6 +959,8 @@
if(_DEBUG) System.out.println("No SiTrackerHitStrip1D matched to this strip");
}
+ */
+
}
@@ -1481,8 +1509,12 @@
plotter_respull_slope.style().dataStyle().fillStyle().setParameter("colorMapScheme","rainbow");
((PlotterRegion) plotter_respull_slope.region(region)).getPlot().setAllowPopupMenus(true);
+ for(int idiff=-10;idiff<10;++idiff) {
+ IHistogram hvdiff = aida.histogram1D("res_"+direction[d]+"_ydiff_"+idiff+"_layer" + (iLayer) + "_" + side[s] , 50, xbins_u_res[iLayer-1][0], xbins_u_res[iLayer-1][1]);
}
+
+ }
//plotter_res.show();
plotterFrame.addPlotter(plotter_res);
@@ -1790,10 +1822,31 @@
dps_pull_hth_z_b = dpsf.create("dps_pull_hth_z_b", "Mean of z pulls bottom",2);
plotter_prf.region(5).plot(dps_pull_hth_z_b);
+ for(int region=0;region<6;++region) {
+ ((PlotterRegion) plotter_prf.region(region)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) plotter_prf.region(region)).getPlot().setAllowPopupMenus(true);
+ }
+
plotterFrameSummary.addPlotter(plotter_prf);
-
+ IPlotter plotter_resuydiff = af.createPlotterFactory().create();
+ plotter_resuydiff.createRegions(5,2,0);
+ plotter_resuydiff.setTitle("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);
+ }
+ }
+
+
+ plotterFrameSummary.addPlotter(plotter_resuydiff);
+
+
+
+
plotterFrame.pack();
plotterFrame.setVisible(!hideFrame);