Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,10 @@
<version>3.6.1</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.20.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.15.0</version>
<version>1.15.0</version> <!-- WARNING: if changed, check the `org.apache.commons:commons-lang3` version; see `docs/dependency_conflicts.md` -->
</dependency>

<dependency>
Expand Down Expand Up @@ -203,7 +197,7 @@

<dependency>
<groupId>j4ml</groupId>
<artifactId>j4ml-neuroph</artifactId>
<artifactId>j4ml-neuroph</artifactId> <!-- WARNING: if changed, check the `org.apache.commons:commons-lang3` version; see `docs/dependency_conflicts.md` -->
<version>0.9-SNAPSHOT</version>
</dependency>

Expand Down Expand Up @@ -281,6 +275,18 @@
<version>0.40</version> <!-- WARNING: if changed, see `docs/dependency_conflicts.md` -->
</dependency>

<!--
resolve convergence conflict of `org.apache.commons:commons-lang3` by choosing the latest used by
- j4ml:j4ml-neuroph:0.9-SNAPSHOT consumes com.github.neuroph:neuroph-core:2.98 which uses version 3.3.2
- org.apache.commons:commons-text:1.15.0 uses version 3.20.0
- see `docs/dependency_conflicts.md` for more info
-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.20.0</version> <!-- WARNING: if changed, see `docs/dependency_conflicts.md` -->
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
5 changes: 0 additions & 5 deletions reconstruction/alert/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-reco</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.jlab.rec.alert.AI;

import org.apache.commons.lang3.mutable.MutableBoolean;

import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

/**
* The TrackConstruction class is responsible for constructing all possible track
Expand Down Expand Up @@ -81,18 +81,18 @@ private double mod(double x, double y) {
* @param number_of_track_candidates The current count of track candidates.
* @return A list of all possible combinations of integers from {@code v1} and {@code v2}.
*/
private ArrayList<ArrayList<Integer>> cartesianProduct(ArrayList<ArrayList<Integer>> v1, ArrayList<Integer> v2, MutableBoolean too_much_track_candidates, int number_of_track_candidates) {
private ArrayList<ArrayList<Integer>> cartesianProduct(ArrayList<ArrayList<Integer>> v1, ArrayList<Integer> v2, AtomicBoolean too_much_track_candidates, int number_of_track_candidates) {
ArrayList<ArrayList<Integer>> result = new ArrayList<>();
for (ArrayList<Integer> i : v1) {
if (too_much_track_candidates.booleanValue()) break;
if (too_much_track_candidates.get()) break;
for (int j : v2) {
if (too_much_track_candidates.booleanValue()) break;
if (too_much_track_candidates.get()) break;
ArrayList<Integer> n = new ArrayList<>(i);
n.add(j);
result.add(n);

if (number_of_track_candidates + result.size() >= MAX_NUMBER_OF_TRACK_CANDIDATES) {
too_much_track_candidates.setValue(true);
too_much_track_candidates.set(true);
break;
}
}
Expand Down Expand Up @@ -155,8 +155,7 @@ else if (interClusters.get(all_superpreclusters.get(i)).getPreclusters().get(0).
superpreclusters_s5.add(all_superpreclusters.get(i));
}

MutableBoolean too_much_track_candidates = new MutableBoolean(); // Need to be a mutable boolean to be able to change it in the cartesian_product method
too_much_track_candidates.setFalse();
AtomicBoolean too_much_track_candidates = new AtomicBoolean(false); // Needs to be mutable so cartesianProduct can set it

// Find all possible combinations of superpreclusters on different superlayers
ArrayList<ArrayList<Integer>> combinations_s1_s2 = cartesianProduct(new ArrayList<>(List.of(superpreclusters_s1)), superpreclusters_s2, too_much_track_candidates, number_of_track_candidates);
Expand All @@ -166,7 +165,7 @@ else if (interClusters.get(all_superpreclusters.get(i)).getPreclusters().get(0).

// Keep track of the number of track candidates
number_of_track_candidates += combinations_s1_s2_s3_s4_s5.size();
if (too_much_track_candidates.booleanValue()) sucess = false; // If the number of track candidates exceeds the maximum limit, set success to false
if (too_much_track_candidates.get()) sucess = false; // If the number of track candidates exceeds the maximum limit, set success to false

// Add all track candidates to the list of all track candidates
// And switch back from index to superprecluster
Expand Down
Loading