Skip to content

Commit b1d6e4c

Browse files
ftouchtebaltzell
authored andcommitted
Add new entries in AHDC::Track, KFTrack and Hits
1 parent a854a60 commit b1d6e4c

File tree

4 files changed

+154
-4
lines changed

4 files changed

+154
-4
lines changed

etc/bankdefs/hipo4/alert.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@
193193
"name": "time",
194194
"type": "D",
195195
"info": "time (ns) is leadingEdgeTime from AHDC::adc minus t0 from calibration"
196+
}, {
197+
"name": "trackId",
198+
"type": "I",
199+
"info": "track id, is -1 if not associated to a Track"
196200
}
197201
]
198202
}, {
@@ -238,6 +242,10 @@
238242
"info": "Reco Tracks",
239243
"entries": [
240244
{
245+
"name": "trackId",
246+
"type": "I",
247+
"info": "track id"
248+
}, {
241249
"name": "x",
242250
"type": "F",
243251
"info": "x position in mm"
@@ -261,6 +269,34 @@
261269
"name": "pz",
262270
"type": "F",
263271
"info": "pz in MeV"
272+
}, {
273+
"name": "n_hits",
274+
"type": "I",
275+
"info": "number of hits"
276+
}, {
277+
"name": "sum_adc",
278+
"type": "I",
279+
"info": "Sum of adc (adc)"
280+
}, {
281+
"name": "path",
282+
"type": "F",
283+
"info": "Length of the track (mm)"
284+
}, {
285+
"name": "dEdx",
286+
"type": "F",
287+
"info": "Deposited energy per path (adc/mm)"
288+
}, {
289+
"name": "p_drift",
290+
"type": "F",
291+
"info": "Momentum in the drift region (MeV)"
292+
}, {
293+
"name": "chi2",
294+
"type": "F",
295+
"info": "Sum of squared residuals (mm^2)"
296+
}, {
297+
"name": "sum_residuals",
298+
"type": "F",
299+
"info": "Sum of residuals (mm)"
264300
}
265301
]
266302
}, {
@@ -270,6 +306,10 @@
270306
"info": "Reco Kalman Filter Tracks",
271307
"entries": [
272308
{
309+
"name": "trackId",
310+
"type": "I",
311+
"info": "track id"
312+
}, {
273313
"name": "x",
274314
"type": "F",
275315
"info": "x position in mm"
@@ -293,6 +333,34 @@
293333
"name": "pz",
294334
"type": "F",
295335
"info": "pz in MeV"
336+
}, {
337+
"name": "n_hits",
338+
"type": "I",
339+
"info": "number of hits"
340+
}, {
341+
"name": "sum_adc",
342+
"type": "I",
343+
"info": "Sum of adc (adc)"
344+
}, {
345+
"name": "path",
346+
"type": "F",
347+
"info": "Length of the track (mm)"
348+
}, {
349+
"name": "dEdx",
350+
"type": "F",
351+
"info": "Deposited energy per path (adc/mm)"
352+
}, {
353+
"name": "p_drift",
354+
"type": "F",
355+
"info": "Momentum in the drift region (MeV)"
356+
}, {
357+
"name": "chi2",
358+
"type": "F",
359+
"info": "Sum of squared residuals (mm^2)"
360+
}, {
361+
"name": "sum_residuals",
362+
"type": "F",
363+
"info": "Sum of residuals (mm)"
296364
}
297365
]
298366
}, {

reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Banks/RecoBankWriter.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public DataBank fillAHDCHitsBank(DataEvent event, ArrayList<Hit> hitList) {
2727
bank.setDouble("residual", i, hitList.get(i).getResidual());
2828
bank.setDouble("residual_prefit", i, hitList.get(i).getResidualPrefit());
2929
bank.setDouble("time", i, hitList.get(i).getTime());
30+
bank.setInt("trackId", i, hitList.get(i).getTrackId());
3031
}
3132

3233
return bank;
@@ -97,12 +98,20 @@ public DataBank fillAHDCTrackBank(DataEvent event, ArrayList<Track> tracks) {
9798
double py = track.get_py();
9899
double pz = track.get_pz();
99100

101+
bank.setInt("trackId", row, (int) track.get_trackId());
100102
bank.setFloat("x", row, (float) x);
101103
bank.setFloat("y", row, (float) y);
102104
bank.setFloat("z", row, (float) z);
103105
bank.setFloat("px", row, (float) px);
104106
bank.setFloat("py", row, (float) py);
105107
bank.setFloat("pz", row, (float) pz);
108+
bank.setInt("n_hits", row, (int) track.get_n_hits());
109+
bank.setInt("sum_adc", row, (int) track.get_sum_adc());
110+
bank.setFloat("path", row, (float) track.get_path());
111+
bank.setFloat("dEdx", row, (float) track.get_dEdx());
112+
bank.setFloat("p_drift", row, (float) track.get_p_drift());
113+
bank.setFloat("chi2", row, (float) track.get_chi2());
114+
bank.setFloat("sum_residuals", row, (float) track.get_sum_residuals());
106115

107116
row++;
108117
}
@@ -125,12 +134,20 @@ public DataBank fillAHDCKFTrackBank(DataEvent event, ArrayList<Track> tracks) {
125134
double py = track.getPy0_kf();
126135
double pz = track.getPz0_kf();
127136

137+
bank.setInt("trackId", row, (int) track.get_trackId());
128138
bank.setFloat("x", row, (float) x);
129139
bank.setFloat("y", row, (float) y);
130140
bank.setFloat("z", row, (float) z);
131141
bank.setFloat("px", row, (float) px);
132142
bank.setFloat("py", row, (float) py);
133143
bank.setFloat("pz", row, (float) pz);
144+
bank.setInt("n_hits", row, (int) track.get_n_hits_kf());
145+
bank.setInt("sum_adc", row, (int) track.get_sum_adc_kf());
146+
bank.setFloat("path", row, (float) track.get_path_kf());
147+
bank.setFloat("dEdx", row, (float) track.get_dEdx_kf());
148+
bank.setFloat("p_drift", row, (float) track.get_p_drift_kf());
149+
bank.setFloat("chi2", row, (float) track.get_chi2_kf());
150+
bank.setFloat("sum_residuals", row, (float) track.get_sum_residuals_kf());
134151

135152
row++;
136153
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class Hit implements Comparable<Hit> {
2020
private double y;
2121
private double residual_prefit;
2222
private double residual;
23+
private int trackId;
2324

2425
//updated constructor with ADC
2526
public Hit(int _Id, int _Super_layer, int _Layer, int _Wire, double _Doca, double _ADC, double _Time) {
@@ -33,6 +34,7 @@ public Hit(int _Id, int _Super_layer, int _Layer, int _Wire, double _Doca, doubl
3334
wirePosition();
3435
this.residual_prefit = 0.0;
3536
this.residual = 0.0;
37+
this.trackId = -1; // not defined yet
3638
}
3739

3840
private void wirePosition() {
@@ -68,8 +70,8 @@ private void wirePosition() {
6870
R_layer = R_layer + DR_layer * (this.layerId-1);
6971
double alphaW_layer = Math.toRadians(round / (numWires));
7072
//should it be at z = 0? in which case, we need to account for the positive or negative stereo angle...
71-
double wx = R_layer * Math.cos(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1)));
72-
double wy = R_layer * Math.sin(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1)));
73+
double wx = -R_layer * Math.sin(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1)));
74+
double wy = -R_layer * Math.cos(alphaW_layer * (this.wireId-1) + 0.5*thster * (Math.pow(-1, this.superLayerId-1)));
7375

7476
//System.out.println(" superlayer " + this.superLayerId + " layer " + this.layerId + " wire " + this.wireId + " R_layer " + R_layer + " wx " + wx + " wy " + wy);
7577

@@ -161,4 +163,13 @@ public void setResidualPrefit(double resid) {
161163
public double getTime() {
162164
return time;
163165
}
166+
167+
public int getTrackId() {
168+
return trackId;
169+
}
170+
171+
public void setTrackId(int _trackId) {
172+
this.trackId = _trackId;
173+
}
174+
164175
}

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

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,36 @@ public class Track {
1515
private List<Cluster> _Clusters = new ArrayList<>();
1616
private boolean _Used = false;
1717
private final ArrayList<Hit> hits = new ArrayList<>();
18-
18+
19+
private int trackId = -1; ///< id of the track
20+
// AHDC::Track
1921
private double x0 = 0;
2022
private double y0 = 0;
2123
private double z0 = 0;
2224
private double px0 = 0;
2325
private double py0 = 0;
2426
private double pz0 = 0;
25-
27+
private double dEdx = 0; ///< deposited energy per path length (adc/mm)
28+
private double p_drift = 0; ///< momentum in the drift region (MeV)
29+
private int n_hits = 0; ///< number of hits
30+
private double path = 0; ///< length of the track (mm)
31+
private int sum_adc = 0; ///< sum of adc (adc)
32+
private double chi2 = 0; ///< sum of residuals^2 (mm^2)
33+
private double sum_residuals = 0; ///< sum of residuals (mm)
34+
// AHDC::KFTrack
2635
private double x0_kf = 0;
2736
private double y0_kf = 0;
2837
private double z0_kf = 0;
2938
private double px0_kf = 0;
3039
private double py0_kf = 0;
3140
private double pz0_kf = 0;
41+
private double dEdx_kf = 0; ///< deposited energy per path length (adc/mm)
42+
private double p_drift_kf = 0; ///< momentum in the drift region (MeV)
43+
private int n_hits_kf = 0; ///< number of hits
44+
private double path_kf = 0; ///< length of the track (mm)
45+
private int sum_adc_kf = 0; ///< sum of adc (adc)
46+
private double chi2_kf = 0; ///< sum of residuals^2 (mm^2)
47+
private double sum_residuals_kf = 0; ///< sum of residuals (mm)
3248

3349
public Track(List<Cluster> clusters) {
3450
this._Clusters = clusters;
@@ -161,4 +177,42 @@ public double getPy0_kf() {
161177
public double getPz0_kf() {
162178
return pz0_kf;
163179
}
180+
181+
public void set_trackId(int _trackId) { trackId = _trackId;}
182+
public int get_trackId() {return trackId;}
183+
// AHDC::Track
184+
public void set_dEdx(double _dEdx) { dEdx = _dEdx;}
185+
public void set_p_drift(double _p_drift) { p_drift = _p_drift;}
186+
public void set_n_hits(int _n_hits) { n_hits = _n_hits;}
187+
public void set_path(double _path) { path = _path;}
188+
public void set_sum_adc(int _sum_adc) { sum_adc = _sum_adc;}
189+
public void set_chi2(double _chi2) { chi2 = _chi2;}
190+
public void set_sum_residuals(double _sum_residuals) { sum_residuals = _sum_residuals;}
191+
192+
public double get_dEdx() {return dEdx;}
193+
public double get_p_drift() {return p_drift;}
194+
public int get_n_hits() {return n_hits;}
195+
public double get_path() {return path;}
196+
public int get_sum_adc() {return sum_adc;}
197+
public double get_chi2() {return chi2;}
198+
public double get_sum_residuals() {return sum_residuals;}
199+
200+
// AHDC::KFTrack
201+
202+
public void set_dEdx_kf(double _dEdx_kf) { dEdx_kf = _dEdx_kf;}
203+
public void set_p_drift_kf(double _p_drift_kf) { p_drift_kf = _p_drift_kf;}
204+
public void set_n_hits_kf(int _n_hits_kf) { n_hits_kf = _n_hits_kf;}
205+
public void set_path_kf(double _path_kf) { path_kf = _path_kf;}
206+
public void set_sum_adc_kf(int _sum_adc_kf) { sum_adc_kf = _sum_adc_kf;}
207+
public void set_chi2_kf(double _chi2_kf) { chi2_kf = _chi2_kf;}
208+
public void set_sum_residuals_kf(double _sum_residuals_kf) { sum_residuals_kf = _sum_residuals_kf;}
209+
210+
public double get_dEdx_kf() {return dEdx_kf;}
211+
public double get_p_drift_kf() {return p_drift_kf;}
212+
public int get_n_hits_kf() {return n_hits_kf;}
213+
public double get_path_kf() {return path_kf;}
214+
public int get_sum_adc_kf() {return sum_adc_kf;}
215+
public double get_chi2_kf() {return chi2_kf;}
216+
public double get_sum_residuals_kf() {return sum_residuals_kf;}
217+
164218
}

0 commit comments

Comments
 (0)