Skip to content

Commit bdb51ba

Browse files
committed
Update DC reconstruction at the denoisinng level (#499)
* cancel SNR and change limit of total DC hits from raw hits to hits after denoising * remove unused codes
1 parent 000af6e commit bdb51ba

File tree

3 files changed

+30
-106
lines changed

3 files changed

+30
-106
lines changed

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

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -205,65 +205,24 @@ private int getJitter(int sector, int layer, int wire, int order) {
205205
}
206206
return jitter;
207207
}
208-
209-
public void fetch_DCHits(DataEvent event, Clas12NoiseAnalysis noiseAnalysis,
210-
NoiseReductionParameters parameters,
211-
Clas12NoiseResult results) {
212-
this.initialize(event);
213-
this.fetch_DCHits(noiseAnalysis, parameters, results);
214-
}
215-
208+
216209
/**
217210
* reads the hits using clas-io methods to get the EvioBank for the DC and
218211
* fill the values to instantiate the DChit and MChit classes.This methods
219212
* fills the DChit list of hits.
220-
*
221-
* @param noiseAnalysis
222-
* @param parameters
223-
* @param results
224213
*/
225-
private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis,
226-
NoiseReductionParameters parameters,
227-
Clas12NoiseResult results) {
228-
229-
_DCHits = new ArrayList<>();
230-
231-
IndexedList<Boolean> noise = new IndexedList<>(4);
214+
public void fetch_DCHits(DataEvent event) {
215+
this.initialize(event);
232216

233-
RawDataBank bankDGTZ = new RawDataBank(bankNames.getTdcBank(), OrderGroups.NODENOISE);
234-
bankDGTZ.read(event);
235-
236-
// event selection, including cut on max number of hits
237-
if( run <= 0 ||
238-
tiTimeStamp < 0 ||
239-
bankDGTZ.rows()==0 || bankDGTZ.rows()>Constants.MAXHITS ) {
240-
return;
241-
}
242-
else {
243-
int rows = bankDGTZ.rows();
244-
int[] sector = new int[rows];
245-
int[] layer = new int[rows];
246-
int[] superlayer = new int[rows];
247-
int[] wire = new int[rows];
248-
for (int i = 0; i < rows; i++) {
249-
sector[i] = bankDGTZ.getByte("sector", i);
250-
layer[i] = (bankDGTZ.getByte("layer", i)-1)%6 + 1;
251-
superlayer[i] = (bankDGTZ.getByte("layer", i)-1)/6 + 1;
252-
wire[i] = bankDGTZ.getShort("component", i);
253-
}
254-
results.clear();
255-
noiseAnalysis.clear();
256-
noiseAnalysis.findNoise(sector, superlayer, layer, wire, results);
257-
for(int i=0; i<rows; i++)
258-
noise.add(results.noise[i], sector[i], superlayer[i], layer[i], wire[i]);
259-
}
260-
261-
// DataBank bankDGTZ = event.getBank(bankNames.getTdcBank());
217+
_DCHits = new ArrayList<>();
262218

263219
this.getDCRBJitters(Constants.getInstance().isSWAPDCRBBITS());
264220

265221
RawDataBank bankFiltered = new RawDataBank(bankNames.getTdcBank(), rawBankOrders);
266222
bankFiltered.read(event);
223+
224+
if(run <= 0 || tiTimeStamp < 0 || bankFiltered.rows() > Constants.MAXHITS) return;
225+
267226
this.set_NumTDCBankRows(bankFiltered.rows());
268227
for (int i = 0; i < bankFiltered.rows(); i++) {
269228
int sector = bankFiltered.getByte("sector", i);
@@ -279,12 +238,7 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis,
279238
if (wirestat != null) {
280239
if (wirestat.getIntValue("status", sector, layer+(superlayer-1)*6, wire) != 0)
281240
passHit = false;
282-
}
283-
284-
if(noise.hasItem(sector, superlayer, layer, wire)) {
285-
if(noise.getItem(sector, superlayer, layer, wire))
286-
passHit = false;
287-
}
241+
}
288242

289243
if (passHit && wire != -1 && !(superlayer == 0)) {
290244

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.jlab.service.dc;
22

3-
import cnuphys.snr.NoiseReductionParameters;
4-
import cnuphys.snr.clas12.Clas12NoiseAnalysis;
5-
import cnuphys.snr.clas12.Clas12NoiseResult;
6-
73
import java.util.List;
84
import org.jlab.clas.swimtools.Swim;
95
import org.jlab.io.base.DataEvent;
@@ -45,35 +41,24 @@ public boolean processDataEvent(DataEvent event) {
4541
// get Field
4642
Swim dcSwim = new Swim();
4743
/* 2 */
48-
// init SNR
49-
Clas12NoiseResult results = new Clas12NoiseResult();
44+
ClusterFitter cf = new ClusterFitter();
5045
/* 3 */
51-
Clas12NoiseAnalysis noiseAnalysis = new Clas12NoiseAnalysis();
46+
ClusterCleanerUtilities ct = new ClusterCleanerUtilities();
5247
/* 4 */
53-
NoiseReductionParameters parameters =
54-
new NoiseReductionParameters(
55-
2,
56-
Constants.SNR_LEFTSHIFTS,
57-
Constants.SNR_RIGHTSHIFTS);
48+
RecoBankWriter rbc = new RecoBankWriter(this.getBanks());
5849
/* 5 */
59-
ClusterFitter cf = new ClusterFitter();
50+
HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector);
6051
/* 6 */
61-
ClusterCleanerUtilities ct = new ClusterCleanerUtilities();
52+
hitRead.fetch_DCHits(event);
6253
/* 7 */
63-
RecoBankWriter rbc = new RecoBankWriter(this.getBanks());
64-
/* 8 */
65-
HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector);
66-
/* 9 */
67-
hitRead.fetch_DCHits(event, noiseAnalysis, parameters, results);
68-
/* 10 */
6954
//I) get the hits
7055
List<Hit> hits = hitRead.get_DCHits(Constants.getInstance().SECTORSELECT);
7156
//II) process the hits
7257
//1) exit if hit list is empty
7358
if (hits.isEmpty()) {
7459
return true;
7560
}
76-
/* 11 */
61+
/* 8 */
7762
//2) find the clusters from these hits
7863
ClusterFinder clusFinder = new ClusterFinder();
7964
List<FittedCluster> clusters = clusFinder.FindHitBasedClusters(hits,
@@ -84,7 +69,7 @@ public boolean processDataEvent(DataEvent event) {
8469
return true;
8570
} else {
8671
List<FittedHit> fhits = rbc.createRawHitList(hits);
87-
/* 13 */
72+
/* 9 */
8873
rbc.updateListsWithClusterInfo(fhits, clusters);
8974
event.appendBanks(rbc.fillHitsBank(event, fhits),
9075
rbc.fillHBClustersBank(event, clusters)

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

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.jlab.service.dc;
22

3-
import cnuphys.snr.NoiseReductionParameters;
4-
import cnuphys.snr.clas12.Clas12NoiseAnalysis;
5-
import cnuphys.snr.clas12.Clas12NoiseResult;
6-
73
import java.util.ArrayList;
84
import java.util.List;
95

@@ -69,36 +65,25 @@ public boolean processDataEvent(DataEvent event) {
6965
// get Field
7066
Swim dcSwim = new Swim();
7167
/* 2 */
72-
// init SNR
73-
Clas12NoiseResult results = new Clas12NoiseResult();
74-
/* 3 */
75-
Clas12NoiseAnalysis noiseAnalysis = new Clas12NoiseAnalysis();
76-
/* 4 */
77-
NoiseReductionParameters parameters =
78-
new NoiseReductionParameters(
79-
2,
80-
Constants.SNR_LEFTSHIFTS,
81-
Constants.SNR_RIGHTSHIFTS);
82-
/* 5 */
8368
ClusterFitter cf = new ClusterFitter();
84-
/* 6 */
69+
/* 3 */
8570
ClusterCleanerUtilities ct = new ClusterCleanerUtilities();
86-
/* 7 */
71+
/* 4 */
8772
RecoBankWriter rbc = new RecoBankWriter(this.getBanks());
88-
/* 8 */
73+
/* 5 */
8974
HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector);
90-
/* 9 */
91-
hitRead.fetch_DCHits(event, noiseAnalysis, parameters, results);
75+
/* 6 */
76+
hitRead.fetch_DCHits(event);
9277

93-
/* 10 */
78+
/* 7 */
9479
//I) get the hits
9580
List<Hit> hits = hitRead.get_DCHits();
9681
//II) process the hits
9782
//1) exit if hit list is empty
9883
if (hits.isEmpty()) {
9984
return true;
10085
}
101-
/* 11 */
86+
/* 8 */
10287
//2) find the clusters from these hits
10388
ClusterFinder clusFinder = new ClusterFinder();
10489
List<FittedCluster> clusters = clusFinder.FindHitBasedClusters(hits,
@@ -108,17 +93,17 @@ public boolean processDataEvent(DataEvent event) {
10893
if (clusters.isEmpty()) {
10994
return true;
11095
}
111-
/* 12 */
96+
/* 9 */
11297
List<FittedHit> fhits = rbc.createRawHitList(hits);
113-
/* 13 : assign cluster IDs to hits: if hit is associated to two clusters, the second survives*/
98+
/* 10 : assign cluster IDs to hits: if hit is associated to two clusters, the second survives*/
11499
rbc.updateListsWithClusterInfo(fhits, clusters);
115-
/* 14 */
100+
/* 11 */
116101
//3) find the segments from the fitted clusters
117102
SegmentFinder segFinder = new SegmentFinder();
118103
List<Segment> segments = segFinder.get_Segments(clusters,
119104
event,
120105
Constants.getInstance().dcDetector, false);
121-
/* 15 */
106+
/* 12 */
122107
// need 6 segments to make a trajectory
123108
if (segments.isEmpty()) {
124109
rbc.fillAllHBBanks(event,
@@ -142,7 +127,7 @@ public boolean processDataEvent(DataEvent event) {
142127
}
143128
}
144129
segments.removeAll(rmSegs);
145-
/* 16 */
130+
/* 13 */
146131
CrossMaker crossMake = new CrossMaker();
147132
List<Cross> crosses = crossMake.find_Crosses(segments, Constants.getInstance().dcDetector);
148133
if (crosses.isEmpty()) {
@@ -154,7 +139,7 @@ public boolean processDataEvent(DataEvent event) {
154139
null);
155140
return true;
156141
}
157-
/* 17 */
142+
/* 14 */
158143
CrossListFinder crossLister = new CrossListFinder();
159144

160145
CrossList crosslist = crossLister.candCrossLists(event, crosses,
@@ -163,14 +148,14 @@ public boolean processDataEvent(DataEvent event) {
163148
Constants.getInstance().dcDetector,
164149
null,
165150
dcSwim, false);
166-
/* 18 */
151+
/* 15 */
167152
//6) find the list of track candidates
168153
TrackCandListFinder trkcandFinder = new TrackCandListFinder(Constants.HITBASE);
169154
List<Track> trkcands = trkcandFinder.getTrackCands(crosslist,
170155
Constants.getInstance().dcDetector,
171156
Swimmer.getTorScale(),
172157
dcSwim, false);
173-
/* 19 */
158+
/* 16 */
174159

175160
// track found
176161
int trkId = 1;

0 commit comments

Comments
 (0)