11package org .jlab .service .ahdc ;
22
33import org .jlab .clas .reco .ReconstructionEngine ;
4- import org .jlab .clas .tracking .kalmanfilter .Material ;
54import org .jlab .io .base .DataBank ;
65import org .jlab .io .base .DataEvent ;
76import org .jlab .io .hipo .HipoDataSource ;
1716import org .jlab .rec .ahdc .Hit .Hit ;
1817import org .jlab .rec .ahdc .Hit .HitReader ;
1918import org .jlab .rec .ahdc .HoughTransform .HoughTransform ;
20- import org .jlab .rec .ahdc .KalmanFilter .MaterialMap ;
2119import org .jlab .rec .ahdc .PreCluster .PreCluster ;
2220import org .jlab .rec .ahdc .PreCluster .PreClusterFinder ;
2321import org .jlab .rec .ahdc .Track .Track ;
4341public class AHDCEngine extends ReconstructionEngine {
4442 static final Logger LOGGER = Logger .getLogger (AHDCEngine .class .getName ());
4543
46- private boolean simulation ;
47-
48- /// Material Map used by Kalman filter
49- private HashMap <String , Material > materialMap ;
44+ private boolean simulation = false ;
5045
5146 private ModelTrackFinding modelTrackFinding ;
5247 private ModeTrackFinding modeTrackFinding = ModeTrackFinding .AI_Track_Finding ;
@@ -76,9 +71,6 @@ public boolean init(ModeTrackFinding m) {
7671 public boolean init () {
7772
7873 factory = (new AlertDCFactory ()).createDetectorCLAS (new DatabaseConstantProvider ());
79- simulation = false ;
80-
81- if (materialMap == null ) materialMap = MaterialMap .generateMaterials ();
8274
8375 String modeConfig = this .getEngineConfigString ("Mode" );
8476 if (modeConfig != null ) modeTrackFinding = ModeTrackFinding .valueOf (modeConfig );
@@ -92,10 +84,8 @@ public boolean init() {
9284 tableMap .put ("/calibration/alert/ahdc/time_over_threshold" , 3 );
9385
9486 requireConstants (tableMap );
95-
96- this .getConstantsManager ().setVariation ("default" );
97-
98- this .registerOutputBank ("AHDC::hits" ,"AHDC::preclusters" ,"AHDC::clusters" ,"AHDC::track" ,"AHDC::mc" ,"AHDC::ai:prediction" );
87+ this .getConstantsManager ().setVariation ("default" );
88+ this .registerOutputBank ("AHDC::hits" ,"AHDC::preclusters" ,"AHDC::clusters" ,"AHDC::track" ,"AHDC::mc" ,"AHDC::ai:prediction" ,"AHDC::interclusters" ,"AHDC::docaclusters" );
9989
10090 return true ;
10191 }
@@ -147,14 +137,15 @@ public boolean processDataEvent(DataEvent event) {
147137 // Otherwise, the conventional methods (Hough Transform or distance) use clusters.
148138
149139 // Safety check: if too many hits, rely on conventional track finding
140+ ModeTrackFinding effectiveMode = modeTrackFinding ;
150141 if (AHDC_Hits .size () > MAX_HITS_FOR_AI ) {
151142 LOGGER .info ("Too many AHDC_Hits in AHDC::adc, rely on conventional track finding for this event" );
152- modeTrackFinding = ModeTrackFinding .CV_Distance ;
143+ effectiveMode = ModeTrackFinding .CV_Distance ;
153144 }
154145
155146 ArrayList <Track > AHDC_Tracks = new ArrayList <>();
156147
157- if (modeTrackFinding == ModeTrackFinding .AI_Track_Finding ) {
148+ if (effectiveMode == ModeTrackFinding .AI_Track_Finding ) {
158149 // 1) Create inter-clusters from pre-clusters
159150 PreClustering preClustering = new PreClustering ();
160151 ArrayList <InterCluster > inter_clusters = preClustering .mergePreclusters (AHDC_PreClusters );
@@ -193,12 +184,12 @@ public boolean processDataEvent(DataEvent event) {
193184 ArrayList <Cluster > AHDC_Clusters = clusterfinder .get_AHDCClusters ();
194185
195186 // 2) Find tracks using the selected conventional method
196- if (modeTrackFinding == ModeTrackFinding .CV_Distance ) {
187+ if (effectiveMode == ModeTrackFinding .CV_Distance ) {
197188 Distance distance = new Distance ();
198189 distance .find_track (AHDC_Clusters );
199190 AHDC_Tracks = distance .get_AHDCTracks ();
200191 }
201- else if (modeTrackFinding == ModeTrackFinding .CV_Hough ) {
192+ else if (effectiveMode == ModeTrackFinding .CV_Hough ) {
202193 HoughTransform houghtransform = new HoughTransform ();
203194 houghtransform .find_tracks (AHDC_Clusters );
204195 AHDC_Tracks = houghtransform .get_AHDCTracks ();
0 commit comments