Skip to content

Commit 0453f3c

Browse files
zyzhangjlabZeyu Zhangftouchte
authored
add programs to use doca to refine positions of clusters, then use them in helixfitting. (#1105)
Co-authored-by: Zeyu Zhang <zyzhang@ifarm2401.jlab.org> Co-authored-by: Felix Touchte Codjo <119527892+ftouchte@users.noreply.github.com>
1 parent d87c559 commit 0453f3c

File tree

6 files changed

+1348
-13
lines changed

6 files changed

+1348
-13
lines changed

etc/bankdefs/hipo4/alert.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
"name": "time",
201201
"type": "D",
202202
"info": "calibrated time (ns)"
203-
}, {
203+
}, {
204204
"name": "adc",
205205
"type": "I",
206206
"info": "calibrated ADC"
@@ -440,5 +440,19 @@
440440
{"name": "x", "type": "F", "info": "x info (mm)"},
441441
{"name": "y", "type": "F", "info": "y info (mm)"}
442442
]
443+
},
444+
{
445+
"name": "AHDC::docaclusters",
446+
"group": 23000,
447+
"item": 126,
448+
"info": "Doca-refined cluster space points",
449+
"entries": [
450+
{"name": "x", "type": "F", "info": "refined x (mm)"},
451+
{"name": "y", "type": "F", "info": "refined y (mm)"},
452+
{"name": "z", "type": "F", "info": "refined z (mm)"},
453+
{"name": "weight", "type": "F", "info": "refined point weight"},
454+
{"name": "pattern", "type": "I", "info": "hit pattern: 11,12,21,22"},
455+
{"name": "idx", "type": "I", "info": "index of original AHDC::clusters row"}
456+
]
443457
}
444458
]

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
import org.jlab.rec.ahdc.AI.InterCluster;
66
import org.jlab.rec.ahdc.AI.TrackPrediction;
77
import org.jlab.rec.ahdc.Cluster.Cluster;
8+
import org.jlab.rec.ahdc.Cluster.DocaCluster;
89
import org.jlab.rec.ahdc.Hit.Hit;
910
import org.jlab.rec.ahdc.PreCluster.PreCluster;
1011
import org.jlab.rec.ahdc.Track.Track;
1112

1213
import java.util.ArrayList;
14+
import java.util.List;
1315

1416
public class RecoBankWriter {
1517

@@ -198,4 +200,22 @@ public DataBank fillInterClusterBank(DataEvent event, ArrayList<InterCluster> in
198200

199201
return bank;
200202
}
203+
204+
public DataBank fillAHDCDocaClustersBank(DataEvent event, ArrayList<DocaCluster> docaclusters) {
205+
206+
if (docaclusters == null || docaclusters.size() == 0) return null;
207+
208+
DataBank bank = event.createBank("AHDC::docaclusters", docaclusters.size());
209+
210+
for (int i = 0; i < docaclusters.size(); i++) {
211+
bank.setFloat("x", i, (float) docaclusters.get(i).get_X());
212+
bank.setFloat("y", i, (float) docaclusters.get(i).get_Y());
213+
bank.setFloat("z", i, (float) docaclusters.get(i).get_Z());
214+
bank.setFloat("weight", i, (float) docaclusters.get(i).get_Weight());
215+
bank.setInt("pattern", i, (int) docaclusters.get(i).get_Pattern());
216+
bank.setInt("idx", i, (int) docaclusters.get(i).get_ClusterIndex());
217+
}
218+
219+
return bank;
220+
}
201221
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.jlab.rec.ahdc.Cluster;
2+
3+
/**
4+
* DocaCluster is a "refined" cluster space point built from
5+
* the DOCA information of hits in the two PreClusters that
6+
* compose a standard Cluster.
7+
*
8+
* One original Cluster can produce one or several DocaCluster
9+
* objects, each with its own (x, y, z, weight).
10+
*/
11+
public class DocaCluster {
12+
13+
// Refined space point
14+
private double _X;
15+
private double _Y;
16+
private double _Z;
17+
18+
// Weight for helix fit (relative weight of this point)
19+
private double _Weight = 1.0;
20+
21+
// Pattern of hit multiplicity: 11, 12, 21, 22, or 0 for "others"
22+
private int _Pattern = 0;
23+
24+
// Index of the original Cluster in the AHDC_Clusters list
25+
private int _ClusterIndex = -1;
26+
27+
public DocaCluster(double x, double y, double z,
28+
double weight, int pattern, int clusterIndex) {
29+
this._X = x;
30+
this._Y = y;
31+
this._Z = z;
32+
this._Weight = weight;
33+
this._Pattern = pattern;
34+
this._ClusterIndex = clusterIndex;
35+
}
36+
37+
public double get_X() { return _X; }
38+
public double get_Y() { return _Y; }
39+
public double get_Z() { return _Z; }
40+
public double get_Weight() { return _Weight; }
41+
42+
public int get_Pattern() { return _Pattern; }
43+
public int get_ClusterIndex() { return _ClusterIndex; }
44+
45+
public void set_X(double x) { this._X = x; }
46+
public void set_Y(double y) { this._Y = y; }
47+
public void set_Z(double z) { this._Z = z; }
48+
public void set_Weight(double weight) { this._Weight = weight; }
49+
public void set_Pattern(int pattern) { this._Pattern = pattern; }
50+
public void set_ClusterIndex(int idx) { this._ClusterIndex = idx; }
51+
52+
@Override
53+
public String toString() {
54+
return String.format(
55+
"DocaCluster{X=%.3f, Y=%.3f, Z=%.3f, w=%.3f, pattern=%d, idx=%d}",
56+
_X, _Y, _Z, _Weight, _Pattern, _ClusterIndex
57+
);
58+
}
59+
}

0 commit comments

Comments
 (0)