From 4ca57556e51297c6d71880e2420ec1263e2180ac Mon Sep 17 00:00:00 2001 From: tongtongcao Date: Tue, 25 Feb 2025 11:24:21 -0500 Subject: [PATCH 1/2] cancel SNR and change limit of total DC hits from raw hits to hits after denoising --- .../java/org/jlab/rec/dc/banks/HitReader.java | 39 ++++------------ .../org/jlab/service/dc/DCHBClustering.java | 29 +++--------- .../java/org/jlab/service/dc/DCHBEngine.java | 45 +++++++------------ 3 files changed, 31 insertions(+), 82 deletions(-) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java index faa907a8cf..2860a748b9 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java @@ -205,30 +205,16 @@ private int getJitter(int sector, int layer, int wire, int order) { } return jitter; } - - public void fetch_DCHits(DataEvent event, Clas12NoiseAnalysis noiseAnalysis, - NoiseReductionParameters parameters, - Clas12NoiseResult results) { - this.initialize(event); - this.fetch_DCHits(noiseAnalysis, parameters, results); - } - + /** * reads the hits using clas-io methods to get the EvioBank for the DC and * fill the values to instantiate the DChit and MChit classes.This methods * fills the DChit list of hits. - * - * @param noiseAnalysis - * @param parameters - * @param results */ - private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis, - NoiseReductionParameters parameters, - Clas12NoiseResult results) { - + public void fetch_DCHits(DataEvent event) { + this.initialize(event); + _DCHits = new ArrayList<>(); - - IndexedList noise = new IndexedList<>(4); RawDataBank bankDGTZ = new RawDataBank(bankNames.getTdcBank(), OrderGroups.NODENOISE); bankDGTZ.read(event); @@ -236,7 +222,7 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis, // event selection, including cut on max number of hits if( run <= 0 || tiTimeStamp < 0 || - bankDGTZ.rows()==0 || bankDGTZ.rows()>Constants.MAXHITS ) { + bankDGTZ.rows()==0) { return; } else { @@ -251,11 +237,6 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis, superlayer[i] = (bankDGTZ.getByte("layer", i)-1)/6 + 1; wire[i] = bankDGTZ.getShort("component", i); } - results.clear(); - noiseAnalysis.clear(); - noiseAnalysis.findNoise(sector, superlayer, layer, wire, results); - for(int i=0; i Constants.MAXHITS) return; + this.set_NumTDCBankRows(bankFiltered.rows()); for (int i = 0; i < bankFiltered.rows(); i++) { int sector = bankFiltered.getByte("sector", i); @@ -279,12 +263,7 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis, if (wirestat != null) { if (wirestat.getIntValue("status", sector, layer+(superlayer-1)*6, wire) != 0) passHit = false; - } - - if(noise.hasItem(sector, superlayer, layer, wire)) { - if(noise.getItem(sector, superlayer, layer, wire)) - passHit = false; - } + } if (passHit && wire != -1 && !(superlayer == 0)) { diff --git a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBClustering.java b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBClustering.java index 978ae61e2f..f6d0e5f7ab 100644 --- a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBClustering.java +++ b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBClustering.java @@ -1,9 +1,5 @@ package org.jlab.service.dc; -import cnuphys.snr.NoiseReductionParameters; -import cnuphys.snr.clas12.Clas12NoiseAnalysis; -import cnuphys.snr.clas12.Clas12NoiseResult; - import java.util.List; import org.jlab.clas.swimtools.Swim; import org.jlab.io.base.DataEvent; @@ -45,27 +41,16 @@ public boolean processDataEvent(DataEvent event) { // get Field Swim dcSwim = new Swim(); /* 2 */ - // init SNR - Clas12NoiseResult results = new Clas12NoiseResult(); + ClusterFitter cf = new ClusterFitter(); /* 3 */ - Clas12NoiseAnalysis noiseAnalysis = new Clas12NoiseAnalysis(); + ClusterCleanerUtilities ct = new ClusterCleanerUtilities(); /* 4 */ - NoiseReductionParameters parameters = - new NoiseReductionParameters( - 2, - Constants.SNR_LEFTSHIFTS, - Constants.SNR_RIGHTSHIFTS); + RecoBankWriter rbc = new RecoBankWriter(this.getBanks()); /* 5 */ - ClusterFitter cf = new ClusterFitter(); + HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector); /* 6 */ - ClusterCleanerUtilities ct = new ClusterCleanerUtilities(); + hitRead.fetch_DCHits(event); /* 7 */ - RecoBankWriter rbc = new RecoBankWriter(this.getBanks()); - /* 8 */ - HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector); - /* 9 */ - hitRead.fetch_DCHits(event, noiseAnalysis, parameters, results); - /* 10 */ //I) get the hits List hits = hitRead.get_DCHits(Constants.getInstance().SECTORSELECT); //II) process the hits @@ -73,7 +58,7 @@ public boolean processDataEvent(DataEvent event) { if (hits.isEmpty()) { return true; } - /* 11 */ + /* 8 */ //2) find the clusters from these hits ClusterFinder clusFinder = new ClusterFinder(); List clusters = clusFinder.FindHitBasedClusters(hits, @@ -84,7 +69,7 @@ public boolean processDataEvent(DataEvent event) { return true; } else { List fhits = rbc.createRawHitList(hits); - /* 13 */ + /* 9 */ rbc.updateListsWithClusterInfo(fhits, clusters); event.appendBanks(rbc.fillHitsBank(event, fhits), rbc.fillHBClustersBank(event, clusters) diff --git a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBEngine.java b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBEngine.java index eae796665e..c25bc4f479 100644 --- a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBEngine.java +++ b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCHBEngine.java @@ -1,9 +1,5 @@ package org.jlab.service.dc; -import cnuphys.snr.NoiseReductionParameters; -import cnuphys.snr.clas12.Clas12NoiseAnalysis; -import cnuphys.snr.clas12.Clas12NoiseResult; - import java.util.ArrayList; import java.util.List; @@ -69,28 +65,17 @@ public boolean processDataEvent(DataEvent event) { // get Field Swim dcSwim = new Swim(); /* 2 */ - // init SNR - Clas12NoiseResult results = new Clas12NoiseResult(); - /* 3 */ - Clas12NoiseAnalysis noiseAnalysis = new Clas12NoiseAnalysis(); - /* 4 */ - NoiseReductionParameters parameters = - new NoiseReductionParameters( - 2, - Constants.SNR_LEFTSHIFTS, - Constants.SNR_RIGHTSHIFTS); - /* 5 */ ClusterFitter cf = new ClusterFitter(); - /* 6 */ + /* 3 */ ClusterCleanerUtilities ct = new ClusterCleanerUtilities(); - /* 7 */ + /* 4 */ RecoBankWriter rbc = new RecoBankWriter(this.getBanks()); - /* 8 */ + /* 5 */ HitReader hitRead = new HitReader(this.getBanks(), this.getRawBankOrders(), super.getConstantsManager(), Constants.getInstance().dcDetector); - /* 9 */ - hitRead.fetch_DCHits(event, noiseAnalysis, parameters, results); + /* 6 */ + hitRead.fetch_DCHits(event); - /* 10 */ + /* 7 */ //I) get the hits List hits = hitRead.get_DCHits(); //II) process the hits @@ -98,7 +83,7 @@ public boolean processDataEvent(DataEvent event) { if (hits.isEmpty()) { return true; } - /* 11 */ + /* 8 */ //2) find the clusters from these hits ClusterFinder clusFinder = new ClusterFinder(); List clusters = clusFinder.FindHitBasedClusters(hits, @@ -108,17 +93,17 @@ public boolean processDataEvent(DataEvent event) { if (clusters.isEmpty()) { return true; } - /* 12 */ + /* 9 */ List fhits = rbc.createRawHitList(hits); - /* 13 : assign cluster IDs to hits: if hit is associated to two clusters, the second survives*/ + /* 10 : assign cluster IDs to hits: if hit is associated to two clusters, the second survives*/ rbc.updateListsWithClusterInfo(fhits, clusters); - /* 14 */ + /* 11 */ //3) find the segments from the fitted clusters SegmentFinder segFinder = new SegmentFinder(); List segments = segFinder.get_Segments(clusters, event, Constants.getInstance().dcDetector, false); - /* 15 */ + /* 12 */ // need 6 segments to make a trajectory if (segments.isEmpty()) { rbc.fillAllHBBanks(event, @@ -142,7 +127,7 @@ public boolean processDataEvent(DataEvent event) { } } segments.removeAll(rmSegs); - /* 16 */ + /* 13 */ CrossMaker crossMake = new CrossMaker(); List crosses = crossMake.find_Crosses(segments, Constants.getInstance().dcDetector); if (crosses.isEmpty()) { @@ -154,7 +139,7 @@ public boolean processDataEvent(DataEvent event) { null); return true; } - /* 17 */ + /* 14 */ CrossListFinder crossLister = new CrossListFinder(); CrossList crosslist = crossLister.candCrossLists(event, crosses, @@ -163,14 +148,14 @@ public boolean processDataEvent(DataEvent event) { Constants.getInstance().dcDetector, null, dcSwim, false); - /* 18 */ + /* 15 */ //6) find the list of track candidates TrackCandListFinder trkcandFinder = new TrackCandListFinder(Constants.HITBASE); List trkcands = trkcandFinder.getTrackCands(crosslist, Constants.getInstance().dcDetector, Swimmer.getTorScale(), dcSwim, false); - /* 19 */ + /* 16 */ // track found int trkId = 1; From fac270bcecbea4508d3d7d78da41a7f0c3556649 Mon Sep 17 00:00:00 2001 From: tongtongcao Date: Mon, 24 Mar 2025 15:01:56 -0400 Subject: [PATCH 2/2] remove unused codes --- .../java/org/jlab/rec/dc/banks/HitReader.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java index 2860a748b9..02162955c5 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/banks/HitReader.java @@ -215,38 +215,13 @@ public void fetch_DCHits(DataEvent event) { this.initialize(event); _DCHits = new ArrayList<>(); - - RawDataBank bankDGTZ = new RawDataBank(bankNames.getTdcBank(), OrderGroups.NODENOISE); - bankDGTZ.read(event); - - // event selection, including cut on max number of hits - if( run <= 0 || - tiTimeStamp < 0 || - bankDGTZ.rows()==0) { - return; - } - else { - int rows = bankDGTZ.rows(); - int[] sector = new int[rows]; - int[] layer = new int[rows]; - int[] superlayer = new int[rows]; - int[] wire = new int[rows]; - for (int i = 0; i < rows; i++) { - sector[i] = bankDGTZ.getByte("sector", i); - layer[i] = (bankDGTZ.getByte("layer", i)-1)%6 + 1; - superlayer[i] = (bankDGTZ.getByte("layer", i)-1)/6 + 1; - wire[i] = bankDGTZ.getShort("component", i); - } - } - -// DataBank bankDGTZ = event.getBank(bankNames.getTdcBank()); this.getDCRBJitters(Constants.getInstance().isSWAPDCRBBITS()); RawDataBank bankFiltered = new RawDataBank(bankNames.getTdcBank(), rawBankOrders); bankFiltered.read(event); - if(bankFiltered.rows() > Constants.MAXHITS) return; + if(run <= 0 || tiTimeStamp < 0 || bankFiltered.rows() > Constants.MAXHITS) return; this.set_NumTDCBankRows(bankFiltered.rows()); for (int i = 0; i < bankFiltered.rows(); i++) {