Skip to content

Commit 8cf49e9

Browse files
authored
Merge branch 'development' into dc-remove-strings
2 parents e507b96 + 9a05b5b commit 8cf49e9

2 files changed

Lines changed: 33 additions & 22 deletions

File tree

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private void readHeaderBank(Integer crate, EvioNode node, EvioDataEvent event){
245245
int[] intData = ByteDataTransformer.toIntArray(node.getStructureBuffer(true));
246246
this.runNumber = intData[3];
247247
this.eventNumber = intData[4];
248-
if(intData[5]!=0) this.unixTime = intData[5];
248+
this.unixTime = intData[5];
249249
this.helicityLevel3=HelicityBit.DNE.value();
250250
if(intData.length>7) {
251251
if ( (intData[7] & 0x1) == 0) {

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

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.jlab.geom.prim.Line3D;
88
import org.jlab.geom.prim.Point3D;
99
import org.jlab.geom.prim.Vector3D;
10-
import org.jlab.rec.dc.hit.FittedHit;
1110
import org.jlab.rec.dc.track.fit.basefit.LineFitPars;
1211
import org.jlab.rec.dc.track.fit.basefit.LineFitter;
1312
import org.jlab.rec.dc.Constants;
@@ -40,7 +39,9 @@ public static enum CoordSys {
4039
private final List<Double> ex = new ArrayList<>();
4140
private final List<Double> ey = new ArrayList<>();
4241
private final double stereo = Constants.COS6;
43-
42+
43+
private String CoordinateSystem; // LC= local, TSC = tilted Sector
44+
4445
public ClusterFitter() {}
4546

4647
public void reset() {
@@ -57,6 +58,7 @@ public void SetFitArray(FittedCluster clus, CoordSys system) {
5758

5859
Collections.sort(clus);
5960
reset();
61+
6062
for (int i = 0; i < clus.size(); i++) {
6163
if (system.equals(CoordSys.LC)) {
6264
coordinateSystem = CoordSys.LC; // local coordinate grid Delta_z = 1
@@ -246,26 +248,31 @@ public FittedCluster BestClusterSelector(List<FittedCluster> clusters, CoordSys
246248
FittedCluster BestCluster = null;
247249
double bestChisq = 999999999.;
248250

249-
for (FittedCluster clusCand : clusters) {
250-
if(isBrickWall(clusCand)) {
251+
int size = clusters.size();
252+
for (int i=0; i<size; i++) {
253+
FittedCluster cluster = clusters.get(i);
254+
if (isBrickWall(cluster)) {
251255
int LRSum=0;
252-
for(FittedHit hit : clusCand) {
253-
LRSum+=hit.get_LeftRightAmb();
256+
int size2 = cluster.size();
257+
for (int j=0; j<size2; j++) {
258+
LRSum += cluster.get(j).get_LeftRightAmb();
254259
}
255-
if(LRSum!=0)
260+
if (LRSum != 0) {
256261
continue;
262+
}
257263
}
258-
SetFitArray(clusCand, system); // set the array of measurements according to the system used in the analysis
264+
// set the array of measurements according to the system used in the analysis
265+
SetFitArray(cluster, system);
259266
// do the fit and get the chisq
260-
Fit(clusCand, true);
267+
Fit(cluster, true);
261268
if (FitPars == null) {
262269
continue;
263270
}
264271
double chisq = FitPars.chisq();
265272

266273
if (chisq < bestChisq) {
267274
bestChisq = chisq;
268-
BestCluster = clusCand;
275+
BestCluster = cluster;
269276
}
270277
}
271278

@@ -302,18 +309,22 @@ private Point3D get_PointOnLine(double d, double the_slope,
302309
*/
303310
private boolean isBrickWall(FittedCluster clusCand) {
304311
boolean isBW = true;
305-
int sumWireNum = 0;
306-
if(clusCand.size()!=6)
307-
isBW=false;
308-
309-
for(FittedHit hit : clusCand) {
310-
sumWireNum+=hit.get_Wire();
312+
if (clusCand.size() != 6) {
313+
isBW = false;
314+
}
315+
else {
316+
int sumWireNum = 0;
317+
int size = clusCand.size();
318+
for (int i=0; i<size; i++) {
319+
sumWireNum += clusCand.get(i).get_Wire();
320+
}
321+
for (int i=0; i<size; i++) {
322+
if (clusCand.get(i).get_Wire()*size != sumWireNum) {
323+
isBW = false;
324+
break;
325+
}
326+
}
311327
}
312-
for(FittedHit hit : clusCand) {
313-
if(hit.get_Wire()*clusCand.size()!=sumWireNum)
314-
isBW = false;
315-
}
316328
return isBW;
317329
}
318-
319330
}

0 commit comments

Comments
 (0)