Skip to content

Commit 8154e7e

Browse files
tongtongcaobaltzell
authored andcommitted
Add a new item called as indexTDC into HitBasedTrkg::Hits
1 parent 9936211 commit 8154e7e

File tree

8 files changed

+70
-8
lines changed

8 files changed

+70
-8
lines changed

etc/bankdefs/hipo4/dc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"info": "reconstructed hits using DC wire positions",
77
"entries": [
88
{"name":"id", "type":"S", "info":"id of the hit"},
9+
{"name": "indexTDC", "type":"S", "info":"inex in the bank DC::TDC"},
910
{"name":"status", "type":"S", "info":"id of the hit"},
1011
{"name":"sector", "type":"B", "info":"DC sector"},
1112
{"name":"superlayer", "type":"B", "info":"DC superlayer (1...6)"},

reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class HitReader {
4444
private int run = 0;
4545
private long tiTimeStamp = 0;
4646
private DataEvent event = null;
47-
47+
4848
private IndexedTable tt = null;
4949
private IndexedTable reverseTT = null;
5050
private IndexedTable dcrbjitters = null;
@@ -341,6 +341,7 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis,
341341
hit.calc_CellSize(detector);
342342
double posError = hit.get_CellSize() / Math.sqrt(12.);
343343
hit.set_DocaErr(posError);
344+
hit.set_IndexTDC(index);
344345
this._DCHits.add(hit);
345346
}
346347
}

reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/RecoBankWriter.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,48 @@ public void updateListsWithClusterInfo(List<FittedHit> fhits,
5555
fhits.removeAll(rmHits);
5656
fhits.addAll(addHits);
5757
}
58+
59+
public DataBank fillHitsBank(DataEvent event, List<FittedHit> hitlist) {
60+
String name = bankNames.getHitsBank();
61+
62+
int rejCnt = 0;
63+
for (int i = 0; i < hitlist.size(); i++) {
64+
// if (hitlist.get(i).get_Id() == -1 /*|| hitlist.get(i).get_Id()==0*/) { //PASS1
65+
if (hitlist.get(i).get_Id() == -1 || hitlist.get(i).get_Id()==0) {
66+
rejCnt++;
67+
}
68+
}
69+
DataBank bank = event.createBank(name, hitlist.size()-rejCnt);
70+
rejCnt=0;
71+
for (int i = 0; i < hitlist.size(); i++) {
72+
// if (hitlist.get(i).get_Id() == -1 /*|| hitlist.get(i).get_Id()==0*/) { //PASS1
73+
if (hitlist.get(i).get_Id() == -1 || hitlist.get(i).get_Id()==0) {
74+
rejCnt++;
75+
continue;
76+
}
77+
bank.setShort("id", i-rejCnt, (short) hitlist.get(i).get_Id());
78+
bank.setShort("indexTDC", i-rejCnt, (short) hitlist.get(i).get_IndexTDC());
79+
bank.setShort("status", i-rejCnt, (short) hitlist.get(i).get_QualityFac());
80+
bank.setByte("superlayer", i-rejCnt, (byte) hitlist.get(i).get_Superlayer());
81+
bank.setByte("layer", i-rejCnt, (byte) hitlist.get(i).get_Layer());
82+
bank.setByte("sector", i-rejCnt, (byte) hitlist.get(i).get_Sector());
83+
bank.setShort("wire", i-rejCnt, (short) hitlist.get(i).get_Wire());
84+
bank.setFloat("docaError", i-rejCnt, (float) hitlist.get(i).get_DocaErr());
85+
bank.setFloat("trkDoca", i-rejCnt, (float) hitlist.get(i).get_ClusFitDoca());
86+
bank.setFloat("LocX", i-rejCnt, (float) hitlist.get(i).get_lX());
87+
bank.setFloat("LocY", i-rejCnt, (float) hitlist.get(i).get_lY());
88+
bank.setFloat("X", i-rejCnt, (float) hitlist.get(i).get_X());
89+
bank.setFloat("Z", i-rejCnt, (float) hitlist.get(i).get_Z());
90+
bank.setByte("LR", i-rejCnt, (byte) hitlist.get(i).get_LeftRightAmb());
91+
bank.setShort("clusterID", i-rejCnt, (short) hitlist.get(i).get_AssociatedClusterID());
92+
bank.setInt("TDC",i-rejCnt,hitlist.get(i).get_TDC());
93+
bank.setByte("jitter",i, (byte) hitlist.get(i).getJitter());
94+
95+
}
96+
97+
return bank;
98+
99+
}
58100

59101
public DataBank fillHBHitsBank(DataEvent event, List<FittedHit> hitlist) {
60102
String name = bankNames.getHitsBank();
@@ -831,6 +873,7 @@ public List<FittedHit> createRawHitList(List<Hit> hits) {
831873
hit.get_Layer(), hit.get_Wire(), hit.get_TDC(), hit.getJitter(),
832874
hit.get_Id());
833875
fhit.set_Id(hit.get_Id());
876+
fhit.set_IndexTDC(hit.get_IndexTDC());
834877
fhit.set_DocaErr(hit.get_DocaErr());
835878
fhits.add(fhit);
836879
}

reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterFinder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ public List<FittedCluster> FindHitBasedClusters(List<Hit> allhits, ClusterCleane
265265
fhit.set_AssociatedClusterID(clus.get_Id());
266266
else{
267267
try{
268-
FittedHit newHit = fhit.clone();
268+
FittedHit newHit = fhit.clone();
269+
newHit.set_IndexTDC(fhit.get_IndexTDC());
269270
newHit.set_Id(idSharedHits++);
270271
newHit.set_AssociatedClusterID(clus.get_Id());
271272
rmHits.add(fhit);

reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/FittedCluster.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public FittedCluster(Cluster rawCluster) {
3535
fhit.set_DocaErr(rawCluster.get(i).get_DocaErr());
3636
fhit.set_CellSize(rawCluster.get(i).get_CellSize());
3737
fhit.set_Id(rawCluster.get(i).get_Id());
38+
fhit.set_IndexTDC(rawCluster.get(i).get_IndexTDC());
3839

3940
this.add(fhit);
4041
}

reconstruction/dc/src/main/java/org/jlab/rec/dc/hit/FittedHit.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ public FittedHit clone() throws CloneNotSupportedException {
11121112
hitClone.set_CellSize(this.get_CellSize());
11131113
hitClone.set_AssociatedClusterID(this.get_AssociatedClusterID());
11141114
hitClone.set_AssociatedHBTrackID(this.get_AssociatedHBTrackID());
1115+
hitClone.set_IndexTDC(this.get_IndexTDC());
11151116
hitClone.betaFlag = this.betaFlag;
11161117

11171118
return hitClone;

reconstruction/dc/src/main/java/org/jlab/rec/dc/hit/Hit.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class Hit implements Comparable<Hit> {
2121
private int _Id;
2222
private double _cellSize;
2323
private double _DocaErr;
24+
private int _indexTDC = -1;
2425
// class implements Comparable interface to allow for sorting a collection of hits by wire number values
2526
public int NNTrkId;
2627
public int NNClusId;
@@ -49,6 +50,22 @@ public Hit(int sector, int superlayer, int layer, int wire, int TDC, int jitter,
4950

5051
}
5152

53+
54+
/**
55+
*
56+
* @return index in DC::TDC bank
57+
*/
58+
public int get_IndexTDC(){
59+
return _indexTDC;
60+
}
61+
62+
/**
63+
*
64+
* @param index in DC::TDC bank
65+
*/
66+
public void set_IndexTDC(int index){
67+
this._indexTDC = index;
68+
}
5269

5370
/**
5471
*

reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBClustering.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,9 @@ public boolean processDataEvent(DataEvent event) {
8686
List<FittedHit> fhits = rbc.createRawHitList(hits);
8787
/* 13 */
8888
rbc.updateListsWithClusterInfo(fhits, clusters);
89-
rbc.fillAllHBBanks(event,
90-
fhits,
91-
clusters,
92-
null,
93-
null,
94-
null);
89+
event.appendBanks(rbc.fillHitsBank(event, fhits),
90+
rbc.fillHBClustersBank(event, clusters)
91+
);
9592
}
9693

9794
return true;

0 commit comments

Comments
 (0)