Skip to content

Commit a0d4aaa

Browse files
committed
fixed once and for all the convention for hit sign:
sign >0 if phi_expected state > phi_wire
1 parent 0857a10 commit a0d4aaa

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/Hit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public double distance(Point3D point3D) {
192192
}
193193

194194
public double distance(Point3D point3D, int sign) {
195-
if(sign!=0)
195+
//if(sign!=0)
196196
//System.out.println(" r " + this.r + " phi " + this.phi + " doca " + this.doca + " sign " + sign + " distance " + this.line3D.distance(point3D).length() + " (sign 0) " + this.line3D_plus.distance(point3D).length() + " (sign+) " + this.line3D_minus.distance(point3D).length() + " (sign-) ");
197197
if(sign>0)return this.line3D_plus.distance(point3D).length();
198198
if(sign<0)return this.line3D_minus.distance(point3D).length();

reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KFitter.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ public void correct(Indicator indicator) {
9191
h = h_beam(stateEstimation);//3x1
9292
z = indicator.hit.get_Vector_beam();//0!
9393
} else {
94-
boolean goodsign = true;
95-
if(indicator.hit.getSign()!=0){
96-
double dphi = Math.atan2(stateEstimation.getEntry(1), stateEstimation.getEntry(0))-indicator.hit.phi(stateEstimation.getEntry(2));//
97-
if(dphi*indicator.hit.getSign()<0)goodsign = false;
98-
//System.out.println(" r " + indicator.hit.r() + " phi " + indicator.hit.phi() + " phi wire (-zl/2) " + indicator.hit.phi(-150.0) + " phi wire (0) " + indicator.hit.phi(0.0) + " phi wire (+zl/2) " + indicator.hit.phi(150.) + " phi wire (z) " + indicator.hit.phi(stateEstimation.getEntry(2)) + " phi state " + Math.atan2(stateEstimation.getEntry(1), stateEstimation.getEntry(0)) + " sign " + indicator.hit.getSign() + " good? " + goodsign );
99-
}
94+
//System.out.println(" hit r " + indicator.hit.r() + " hit phi " + indicator.hit.phi() + " phi wire (-zl/2) " + indicator.hit.phi(-150.0) + " phi wire (0) " + indicator.hit.phi(0.0) + " phi wire (+zl/2) " + indicator.hit.phi(150.) + " state x " + stateEstimation.getEntry(0) + " state y " + stateEstimation.getEntry(1) + " state z " + stateEstimation.getEntry(2) );
95+
boolean goodsign = true;
96+
if(indicator.hit.getSign()!=0){
97+
double dphi = Math.atan2(stateEstimation.getEntry(1), stateEstimation.getEntry(0))-indicator.hit.phi(stateEstimation.getEntry(2));
98+
if(dphi*indicator.hit.getSign()<0)goodsign = false;
99+
//System.out.println(" hit r " + indicator.hit.r() + " phi wire (z) " + indicator.hit.phi(stateEstimation.getEntry(2)) + " phi state " + Math.atan2(stateEstimation.getEntry(1), stateEstimation.getEntry(0)) + " sign " + indicator.hit.getSign() + " good? " + goodsign );
100+
}
100101
measurementNoise = indicator.hit.get_MeasurementNoise(goodsign);//1x1
101102
//measurementNoise = indicator.hit.get_MeasurementNoise();//1x1
102103
measurementMatrix = H(stateEstimation, indicator);//6x1

reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KalmanFilter.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,44 +90,45 @@ private void propagation(ArrayList<Track> tracks, DataEvent event) {
9090
// Initialization hit
9191
ArrayList<org.jlab.rec.ahdc.Hit.Hit> AHDC_hits = tracks.get(0).getHits();
9292
ArrayList<Hit> KF_hits = new ArrayList<>();
93-
//System.out.println(" px " + px0 + " py " + py0 +" pz " + pz0 +" vz " + z0 + " number of hits: " + AHDC_hits.size() + " MC hits? " + sim_hits.size());
93+
//System.out.println(" px " + y[3] + " py " + y[4] +" pz " + y[5] +" vz " + y[2] + " number of hits: " + AHDC_hits.size() + " MC hits? " + sim_hits.size());
9494
for (org.jlab.rec.ahdc.Hit.Hit AHDC_hit : AHDC_hits) {
9595
Hit hit = new Hit(AHDC_hit.getSuperLayerId(), AHDC_hit.getLayerId(), AHDC_hit.getWireId(), AHDC_hit.getNbOfWires(), AHDC_hit.getRadius(), AHDC_hit.getDoca());
9696
hit.setADC(AHDC_hit.getADC());
9797
hit.setHitIdx(AHDC_hit.getId());
9898
hit.setSign(0);
99+
//System.out.println( " r = " + hit.r() + " hit.phi " + hit.phi() +" hit.doca = " + hit.getDoca() );
99100
// Do delete hit with same radius
100101
boolean phi_rollover = false;
101102
boolean aleardyHaveR = false;
102103
for (Hit o: KF_hits){
103104
if (o.r() == hit.r()){
104105
aleardyHaveR = true;
105-
106+
//sign+ means (phi track - phi wire) > 0
106107
if(o.phi()>hit.phi()){
107108
if(Math.abs(o.phi()-hit.phi())< 2*Math.toRadians(360./o.getNumWires()) ){
108-
o.setSign(+1);
109-
hit.setSign(-1);
109+
o.setSign(-1);
110+
hit.setSign(+1);
110111
}else{
111112
phi_rollover = true;
112-
hit.setSign(+1);
113-
o.setSign(-1);
113+
hit.setSign(-1);
114+
o.setSign(+1);
114115
}
115116
}else{
116117
if(Math.abs(o.phi()-hit.phi())< 2*Math.toRadians(360./o.getNumWires()) ){
117-
hit.setSign(+1);
118-
o.setSign(-1);
118+
hit.setSign(-1);
119+
o.setSign(+1);
119120
}else{
120121
phi_rollover = true;
121-
o.setSign(+1);
122-
hit.setSign(-1);
122+
o.setSign(-1);
123+
hit.setSign(+1);
123124
}
124125
}
125126
//System.out.println( " r = " + o.r() + " o.phi = " + o.phi() + " o.doca = " + o.getDoca()*o.getSign() + " hit.phi " + hit.phi() +" hit.doca = " + hit.getDoca()*hit.getSign() + " angle between wires: " + Math.toRadians(360./hit.getNumWires()) + " >= ? angle covered by docas: " + Math.atan( (o.getDoca()+hit.getDoca())/o.r() ) );
126127
}
127128
}
128129
//if(!aleardyHaveR)KF_hits.add(hit);
129130
if (phi_rollover){
130-
KF_hits.add(KF_hits.size()-1, hit);
131+
KF_hits.add(KF_hits.size()-1, hit);
131132
}else{
132133
KF_hits.add(hit);
133134
}

0 commit comments

Comments
 (0)