Skip to content

Commit 5470c93

Browse files
mathieuouillontongtongcao
authored andcommitted
Fix: AHDC: use ahdcExtractor to process simulation (#607)
* Add ahdcExtractor in AHDCEngine to be able to process simulation. * Add simulation flag in HitReader to bypass criteria for a hit in simulation.
1 parent 409e97c commit 5470c93

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/HitReader.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ public class HitReader {
1212

1313
private ArrayList<Hit> _AHDCHits;
1414
private ArrayList<TrueHit> _TrueAHDCHits;
15+
private boolean sim = false;
1516

16-
public HitReader(DataEvent event, AlertDCDetector detector, boolean simulation) {
17+
public HitReader(DataEvent event, AlertDCDetector detector, boolean simulation) {
18+
sim = simulation;
1719
fetch_AHDCHits(event, detector);
1820
if (simulation) fetch_TrueAHDCHits(event);
1921
}
@@ -52,7 +54,7 @@ public final void fetch_AHDCHits(DataEvent event, AlertDCDetector detector) {
5254
double ped_max = rawHitCuts[7];
5355
//System.out.println("t_min : " + t_min + " t_max : " + t_max + " tot_min : " + tot_min + " tot_max : " + tot_max + " adc_min : " + adc_min + " adc_max : " + adc_max + " ped_min : " + ped_min + " ped_max : " + ped_max);
5456
// Apply these cuts
55-
if ((adc >= adc_min) && (adc <= adc_max) && (leadingEdgeTime >= t_min) && (leadingEdgeTime <= t_max) && (timeOverThreshold >= tot_min) && (timeOverThreshold <= tot_max) && (adcOffset >= ped_min) && (adcOffset <= ped_max)) {
57+
if (((adc >= adc_min) && (adc <= adc_max) && (leadingEdgeTime >= t_min) && (leadingEdgeTime <= t_max) && (timeOverThreshold >= tot_min) && (timeOverThreshold <= tot_max) && (adcOffset >= ped_min) && (adcOffset <= ped_max)) || sim) {
5658
// Retrieve others CCDB
5759
double[] timeOffsets = CalibrationConstantsLoader.AHDC_TIME_OFFSETS.get( key_value );
5860
double[] time2distance = CalibrationConstantsLoader.AHDC_TIME_TO_DISTANCE.get( 10101 ); // the time to distance table has only one row ! (10101 is its only key)

reconstruction/alert/src/main/java/org/jlab/service/ahdc/AHDCEngine.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.jlab.geom.detector.alert.AHDC.AlertDCDetector;
2929
import org.jlab.geom.detector.alert.AHDC.AlertDCFactory;
3030
import org.jlab.rec.constants.CalibrationConstantsLoader;
31+
import org.jlab.detector.pulse.ModeAHDC;
3132

3233
/** AHDCEngine reconstruction service.
3334
*
@@ -61,7 +62,8 @@ public class AHDCEngine extends ReconstructionEngine {
6162
private Mode mode = Mode.CV_Track_Finding;
6263

6364
private AlertDCDetector factory = null;
64-
65+
private ModeAHDC ahdcExtractor = new ModeAHDC();
66+
6567
public AHDCEngine() {
6668
super("ALERT", "ouillon", "1.0.1");
6769
}
@@ -124,6 +126,9 @@ public boolean processDataEvent(DataEvent event) {
124126
simulation = true;
125127
}
126128

129+
// TODO: this code should perhaps be in the if statement MC::Particle
130+
ahdcExtractor.update(30, null, event, "AHDC::wf", "AHDC::adc");
131+
127132
if (event.hasBank("RUN::config")) {
128133
DataBank bank = event.getBank("RUN::config");
129134
runNo = bank.getInt("run", 0);

0 commit comments

Comments
 (0)