Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,65 +205,24 @@ 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) {

_DCHits = new ArrayList<>();

IndexedList<Boolean> noise = new IndexedList<>(4);
public void fetch_DCHits(DataEvent event) {
this.initialize(event);

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 || bankDGTZ.rows()>Constants.MAXHITS ) {
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);
}
results.clear();
noiseAnalysis.clear();
noiseAnalysis.findNoise(sector, superlayer, layer, wire, results);
for(int i=0; i<rows; i++)
noise.add(results.noise[i], sector[i], superlayer[i], layer[i], wire[i]);
}

// DataBank bankDGTZ = event.getBank(bankNames.getTdcBank());
_DCHits = new ArrayList<>();

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

RawDataBank bankFiltered = new RawDataBank(bankNames.getTdcBank(), rawBankOrders);
bankFiltered.read(event);

if(run <= 0 || tiTimeStamp < 0 || bankFiltered.rows() > Constants.MAXHITS) return;

this.set_NumTDCBankRows(bankFiltered.rows());
for (int i = 0; i < bankFiltered.rows(); i++) {
int sector = bankFiltered.getByte("sector", i);
Expand All @@ -279,12 +238,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)) {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -45,35 +41,24 @@ 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<Hit> hits = hitRead.get_DCHits(Constants.getInstance().SECTORSELECT);
//II) process the hits
//1) exit if hit list is empty
if (hits.isEmpty()) {
return true;
}
/* 11 */
/* 8 */
//2) find the clusters from these hits
ClusterFinder clusFinder = new ClusterFinder();
List<FittedCluster> clusters = clusFinder.FindHitBasedClusters(hits,
Expand All @@ -84,7 +69,7 @@ public boolean processDataEvent(DataEvent event) {
return true;
} else {
List<FittedHit> fhits = rbc.createRawHitList(hits);
/* 13 */
/* 9 */
rbc.updateListsWithClusterInfo(fhits, clusters);
event.appendBanks(rbc.fillHitsBank(event, fhits),
rbc.fillHBClustersBank(event, clusters)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -69,36 +65,25 @@ 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<Hit> hits = hitRead.get_DCHits();
//II) process the hits
//1) exit if hit list is empty
if (hits.isEmpty()) {
return true;
}
/* 11 */
/* 8 */
//2) find the clusters from these hits
ClusterFinder clusFinder = new ClusterFinder();
List<FittedCluster> clusters = clusFinder.FindHitBasedClusters(hits,
Expand All @@ -108,17 +93,17 @@ public boolean processDataEvent(DataEvent event) {
if (clusters.isEmpty()) {
return true;
}
/* 12 */
/* 9 */
List<FittedHit> 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<Segment> 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,
Expand All @@ -142,7 +127,7 @@ public boolean processDataEvent(DataEvent event) {
}
}
segments.removeAll(rmSegs);
/* 16 */
/* 13 */
CrossMaker crossMake = new CrossMaker();
List<Cross> crosses = crossMake.find_Crosses(segments, Constants.getInstance().dcDetector);
if (crosses.isEmpty()) {
Expand All @@ -154,7 +139,7 @@ public boolean processDataEvent(DataEvent event) {
null);
return true;
}
/* 17 */
/* 14 */
CrossListFinder crossLister = new CrossListFinder();

CrossList crosslist = crossLister.candCrossLists(event, crosses,
Expand All @@ -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<Track> trkcands = trkcandFinder.getTrackCands(crosslist,
Constants.getInstance().dcDetector,
Swimmer.getTorScale(),
dcSwim, false);
/* 19 */
/* 16 */

// track found
int trkId = 1;
Expand Down