diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java index 895faeb015..95a4d52584 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java @@ -26,7 +26,9 @@ public class ATOFHit { private String type; private boolean isInACluster; private int associatedClusterIndex; + private double meanTimeAligned; int idTDC; + public int getSector() { return sector; @@ -79,6 +81,14 @@ public void setTot(int tot) { public double getTime() { return time; } + + public double getStartTime() { + return this.startTime; + } + + public double getMeanTimeAligned(){ + return this.meanTimeAligned; + } public void setTime(double time) { this.time = time; @@ -198,12 +208,12 @@ public final int convertTdcToTime() { //Time offsets double[] timeOffsets = CalibrationConstantsLoader.ATOF_TIME_OFFSETS.get(key); double[] timeOffsetsRef = CalibrationConstantsLoader.ATOF_TIME_OFFSETS.get(referenceModuleKey); - + this.meanTimeAligned = timeOffsetsRef[0]; //The names below correspond to the CCDB entries //They will most probably evolve //For now let's say t0 is used to store the bar-to-bar and wedge-to-wedge alignments double t0 = timeOffsets[0]; - double tChannelToChannelPhiAlignment = (t0 - timeOffsetsRef[0]); + double tChannelToChannelPhiAlignment = (t0 - this.meanTimeAligned); if(this.type=="bar up" || this.type=="bar down") //bar alignment is done with the sum of the two times tChannelToChannelPhiAlignment=tChannelToChannelPhiAlignment/2.; diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/BarHit.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/BarHit.java index fd46440c27..39bc582078 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/BarHit.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/BarHit.java @@ -21,6 +21,27 @@ public class BarHit extends ATOFHit { public ATOFHit getHitUp() { return hitUp; } + + /** + * Computes bar time sum and check if it is around + * the value the hits were aligned to. For now, + * 40ns cut. When calibrations are final, it should + * be refined to reflect the resolution. + * + */ + public boolean isInTime() { + double timeShift = 0; + //For FT electron for which the startTime is set at -1000 + //We need to shift where the cut is applied + if(this.hitUp.getStartTime()<0) timeShift = 2180; + if(Math.abs( + this.hitUp.getTime()+this.hitDown.getTime() + -timeShift + -this.hitUp.getMeanTimeAligned()) + <40) + return true; + return false; + } public void setHitUp(ATOFHit hit_up) { this.hitUp = hit_up; diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/HitFinder.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/HitFinder.java index 20e1864234..a4db3aa43e 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/HitFinder.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/HitFinder.java @@ -5,6 +5,7 @@ import org.jlab.geom.base.Detector; import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; +import org.jlab.rec.alert.constants.CalibrationConstantsLoader; /** * The {@code HitFinder} class finds hits in the atof. @@ -124,12 +125,9 @@ public void findHits(DataEvent event, Detector atof, float startTime) { //Matching the hits: if same module and different order, they make up a bar hit if (this_hit_up.matchBar(this_hit_down)) { //Bar hits are matched to ahdc tracks and listed - if (countMatches > 0) { - //If the up hit was already involved in a match, do not make an additionnal match - //Chosing to ignore double matches for now because it happened for <1% of events in cosmic runs - continue; - } BarHit this_bar_hit = new BarHit(this_hit_down, this_hit_up); + //Only add bar hits for which the time sum is in time + if(!this_bar_hit.isInTime()) continue; this.barHits.add(this_bar_hit); countMatches++; }