Skip to content

Commit 0a13c11

Browse files
committed
add pair killing
1 parent b4d07bb commit 0a13c11

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequence.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,34 @@ protected final boolean analyze() {
388388
return integrity && geninit;
389389
}
390390

391+
private final int rejectPairs() {
392+
int n = 0;
393+
for (int ii=0; ii<this.states.size(); ii++) {
394+
if (this.states.get(ii).getSwStatus()!=0 || this.states.get(ii).getHwStatus()!=0
395+
|| this.states.get(ii).getHelicity() == HelicityBit.UDF) {
396+
if (this.states.get(ii).getPairSync() == HelicityBit.PLUS) {
397+
if (ii<this.states.size()-1) {
398+
this.states.get(ii+1).addSwStatusMask(HelicityState.Mask.KILLPAIR);
399+
this.states.get(ii).addSwStatusMask(HelicityState.Mask.KILLPAIR);
400+
n++;
401+
}
402+
}
403+
else if (ii>0) {
404+
this.states.get(ii-1).addSwStatusMask(HelicityState.Mask.KILLPAIR);
405+
this.states.get(ii).addSwStatusMask(HelicityState.Mask.KILLPAIR);
406+
n++;
407+
}
408+
}
409+
}
410+
if (this.states.get(0).getPairSync() == HelicityBit.MINUS) {
411+
this.states.get(0).addSwStatusMask(HelicityState.Mask.KILLPAIR);
412+
}
413+
if (this.states.get(this.states.size()-1).getPairSync() == HelicityBit.PLUS) {
414+
this.states.get(this.states.size()-1).addSwStatusMask(HelicityState.Mask.KILLPAIR);
415+
}
416+
return n;
417+
}
418+
391419
/**
392420
* Perform integrity checking on the sequence.
393421
* @return whether the integrity checking succeeded
@@ -461,7 +489,8 @@ else if (seconds > (1.0+0.5)/this.helicityClock) {
461489
"\nQUARTET ERRORS: "+quartetErrors+
462490
"\nBIGGAP ERRORS: "+bigGapErrors+
463491
"\nSMALLGAP ERRORS: "+smallGapErrors+
464-
"\nGENERATOR ERRORS: "+generatorErrors
492+
"\nGENERATOR ERRORS: "+generatorErrors+
493+
"\nKILLPAIR ERRORS: "+rejectPairs()
465494
);
466495

467496
return (hwpErrors+syncErrors+quartetErrors+bigGapErrors+smallGapErrors+generatorErrors) == 0;

common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicityState.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static class Mask {
2525
public static final int PATTERN =0x4;
2626
public static final int BIGGAP =0x8;
2727
public static final int SMALLGAP =0x10;
28+
public static final int KILLPAIR =0x12;
2829
}
2930

3031
// FIXME: these should go in CCDB

0 commit comments

Comments
 (0)