diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8d6ab22ac..5c46dbf34e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -303,27 +303,6 @@ jobs: - name: test run-groovy run: coatjava/bin/run-groovy validation/advanced-tests/test-run-groovy.groovy - dependency_analysis: - needs: [ build ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Set up JDK - uses: actions/setup-java@v5 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.java_distribution }} - cache: maven - - uses: actions/download-artifact@v7 - with: - name: build_ubuntu-latest - - name: untar build - run: tar xzvf coatjava.tar.gz - - name: print dependency tree - run: libexec/dependency-tree.sh - - name: dependency analysis - run: libexec/dependency-analysis.sh - # documentation ############################################################################# @@ -413,7 +392,6 @@ jobs: final: needs: - test_coatjava - - dependency_analysis - test_run-groovy - generate_documentation runs-on: ubuntu-latest diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml deleted file mode 100644 index 6c42d6d924..0000000000 --- a/.github/workflows/validation.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Validation - -on: - pull_request: - push: - branches: [ development ] - tags: [ '*' ] - workflow_dispatch: - -jobs: - validation: - uses: JeffersonLab/clas12-validation/.github/workflows/ci.yml@main - with: - matrix_evgen: >- - [ - "e_p", - "e_n", - "e_g", - "e_pC", - "eFT_K", - "e_gFT" - ] - matrix_config: >- - [ - "rgb_fall2019" - ] diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ed41cf162..b4cae92810 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,13 +60,6 @@ build: - coatjava.tar.gz - clara.tar.gz -.depana: - allow_failure: true - stage: build - script: - - libexec/dependency-tree.sh - - libexec/dependency-analysis.sh - download: stage: build script: diff --git a/README.md b/README.md index 41938c803b..90891ffd1b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # COATJAVA [![Build Status](https://github.com/jeffersonlab/coatjava/workflows/Coatjava-CI/badge.svg)](https://github.com/jeffersonlab/coatjava/actions) -[![Validation Status](https://github.com/JeffersonLab/coatjava/actions/workflows/validation.yml/badge.svg)](https://github.com/JeffersonLab/coatjava/actions/workflows/validation.yml) +[![ORCA](https://github.com/JeffersonLab/coatjava/actions/workflows/orca.yml/badge.svg)](https://github.com/JeffersonLab/coatjava/actions/workflows/orca.yml) [![Coverage](https://badgen.net/static/JaCoCo/coverage/purple)](https://jeffersonlab.github.io/coatjava/jacoco) | Table of Contents | | diff --git a/build-coatjava.sh b/build-coatjava.sh index b0f1f34017..dcb6bdf617 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -10,7 +10,6 @@ set -o pipefail ################################################################################ cleanBuild=false -anaDepends=false runSpotBugs=false downloadMaps=true downloadNets=true @@ -46,7 +45,6 @@ DATA RETRIEVAL OPTIONS TESTING OPTIONS --spotbugs also run spotbugs plugin --unittests also run unit tests - --depana run dependency analysis (only) --data download test data (requires option `--lfs`) MAVEN OPTIONS @@ -70,7 +68,10 @@ do --nonets) downloadNets=false ;; --unittests) runUnitTests=true ;; --clean) cleanBuild=true ;; - --depana) anaDepends=true ;; + --depana) + echo "ERROR: option \`$xx\` has been removed; dependency tree printout and analysis now happen automatically in the Maven build lifecycle" >&2 + exit 1 + ;; --quiet) mvnArgs+=(--quiet --batch-mode) wgetArgs+=(--quiet) @@ -86,7 +87,7 @@ do --clara) installClara=true ;; --data) downloadData=true ;; --xrootd) - echo "ERROR: option \`$xx\` is deprecated; use \`--help\` for guidance" >&2 + echo "ERROR: option \`$xx\` has been removed; use \`--help\` for guidance" >&2 exit 1 ;; -h|--help) @@ -149,13 +150,6 @@ if $cleanBuild || [ "$dataRetrieval" = "wipe" ]; then exit fi -# run dependency analysis and exit -if $anaDepends; then - libexec/dependency-analysis.sh - libexec/dependency-tree.sh - exit 0 -fi - ################################################################################ # download field maps, NN models, etc. @@ -324,9 +318,9 @@ cp external-dependencies/jclara-4.3-SNAPSHOT.jar $prefix_dir/lib/utils # build (and test) unset CLAS12DIR if $runUnitTests; then - $mvn install # also runs unit tests + $mvn install -DskipTests=false else - $mvn install -DskipTests + $mvn install fi # run spotbugs diff --git a/common-tools/clara-io/pom.xml b/common-tools/clara-io/pom.xml index 0d1ad3ccb8..9dcb63bf36 100644 --- a/common-tools/clara-io/pom.xml +++ b/common-tools/clara-io/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clara-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -44,25 +44,25 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-analysis/pom.xml b/common-tools/clas-analysis/pom.xml index 4452570f9a..7142fc283c 100644 --- a/common-tools/clas-analysis/pom.xml +++ b/common-tools/clas-analysis/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -38,49 +38,49 @@ org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-decay-tools/pom.xml b/common-tools/clas-decay-tools/pom.xml index 3853916231..33b067df2c 100644 --- a/common-tools/clas-decay-tools/pom.xml +++ b/common-tools/clas-decay-tools/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-decay-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,54 +21,54 @@ org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys swimmer - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-vtx - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-detector/pom.xml b/common-tools/clas-detector/pom.xml index 21484e9ecf..58d4a7f573 100644 --- a/common-tools/clas-detector/pom.xml +++ b/common-tools/clas-detector/pom.xml @@ -4,20 +4,20 @@ org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -43,19 +43,19 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-logging - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder.java index 0ee5a319a6..50b5c8f209 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder.java @@ -30,6 +30,9 @@ * @author gavalian */ public class CLASDecoder { + + // truncate EVIO waveforms longer than this: + final static int MAX_BANK_WF_LENGTH = 30; protected DetectorEventDecoder detectorDecoder = null; protected SchemaFactory schemaFactory = new SchemaFactory(); @@ -203,7 +206,7 @@ public Bank getDataBankWF(String name, DetectorType type) { b.putLong( 4, i, a.get(i).getADCData(0).getTimeStamp()); b.putInt("time", i, (int)a.get(i).getADCData(0).getTime()); DetectorDataDgtz.ADCData xxx = a.get(i).getADCData(0); - for (int j=0; jorg.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-io/pom.xml b/common-tools/clas-io/pom.xml index 70b41a6b4a..a2fef9a137 100644 --- a/common-tools/clas-io/pom.xml +++ b/common-tools/clas-io/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -50,7 +50,7 @@ org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-jcsg/pom.xml b/common-tools/clas-jcsg/pom.xml index 6247bb4f9f..7f1095ccde 100644 --- a/common-tools/clas-jcsg/pom.xml +++ b/common-tools/clas-jcsg/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -32,17 +32,17 @@ org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT java3d diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/MUVT/MUVTStripFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/MUVT/MUVTStripFactory.java index 59bc9230eb..1466e29c5b 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/MUVT/MUVTStripFactory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/MUVT/MUVTStripFactory.java @@ -24,8 +24,9 @@ public final class MUVTStripFactory extends MPGDTrapezoidStripFactory { /** * Build using an already-configured DatabaseConstantProvider. + * @param cp */ - public MUVTStripFactory(DatabaseConstantProvider cp, String variation) { + public MUVTStripFactory(DatabaseConstantProvider cp) { super(new MUVTConstants(cp)); diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTConstants.java index b8a271b257..4a5152aee1 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTConstants.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTConstants.java @@ -8,25 +8,53 @@ */ public final class URWTConstants extends MPGDTrapezoidConstants { - private URWTConstants() { + private final String variation; + + private URWTConstants(String variation) { super( "/test/urwt/", // CCDB base path "urwt_global", // global table name "urwt_material", // material table name "urwt" // detector nams ); + this.variation = variation; } public URWTConstants(int run, String variation) { - this(); + this(variation); DatabaseConstantProvider cp = new DatabaseConstantProvider(run, variation); this.load(cp); cp.disconnect(); } - public URWTConstants(DatabaseConstantProvider cp) { - this(); + public URWTConstants(DatabaseConstantProvider cp, String variation) { + this(variation); this.load(cp); } + + /** + * + * @param region + * @return + */ + @Override + public SectorDimensions getSectorActiveVolumeDimensions(int region) { + + if (variation != null && variation.toLowerCase().contains("proto")) { + + double halfThickness = this.getSectorThickness() / 2.0; + double tiltRad = Math.toRadians(THTILT); + + // da vertici (mm) + double halfLargeBase = 72.71785; + double halfSmallBase = 50.44350; + double halfHeight = 24.74554; + + return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad); + } + + return super.getSectorActiveVolumeDimensions(region); + } + } diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTGeant4Factory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTGeant4Factory.java index 31a0a13d32..e77db56138 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTGeant4Factory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTGeant4Factory.java @@ -15,40 +15,13 @@ */ public final class URWTGeant4Factory extends MPGDTrapezoidGeant4Factory { - private final String variation; public URWTGeant4Factory(DatabaseConstantProvider cp, String variation) { - super(new URWTConstants(cp)); - this.variation = variation; + super(new URWTConstants(cp, variation)); } public URWTGeant4Factory(int run, String variation) { super(new URWTConstants(run, variation)); - this.variation = variation; - } - - /** - * - * @param region - * @return - */ - @Override - public SectorDimensions getSectorActiveVolumeDimensions(int region) { - - if (variation != null && variation.toLowerCase().contains("proto")) { - - double halfThickness = this.getSectorThickness() / 2.0; - double tiltRad = Math.toRadians(C.THTILT); - - // da vertici (mm) - double halfLargeBase = 72.71785; - double halfSmallBase = 50.44350; - double halfHeight = 24.74554; - - return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad); - } - - return super.getSectorActiveVolumeDimensions(region); } /** diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTStripFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTStripFactory.java index 2c2a735388..9d634258e6 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTStripFactory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/URWT/URWTStripFactory.java @@ -25,9 +25,10 @@ public final class URWTStripFactory extends MPGDTrapezoidStripFactory { /** * Build using an already-configured DatabaseConstantProvider. * @param cp + * @param variation */ - public URWTStripFactory(DatabaseConstantProvider cp) { - super(new URWTConstants(cp)); + public URWTStripFactory(DatabaseConstantProvider cp, String variation) { + super(new URWTConstants(cp, variation)); for (Geant4Basic v : geo.getAllVolumes()) { if (v.getName() != null) { diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidConstants.java index 2857345d8a..8d039282b7 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidConstants.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidConstants.java @@ -1,5 +1,6 @@ package org.jlab.detector.geant4.v2.MPGD.trapezoid; +import eu.mihosoft.vrl.v3d.Vector3d; import org.jlab.detector.calib.utils.DatabaseConstantProvider; import java.util.LinkedHashMap; @@ -70,6 +71,17 @@ public class MPGDTrapezoidConstants { public static final double YENLARGEMENT = 0.15; // cm public static final double ZENLARGEMENT = 0.02; // cm + + + public static record SectorDimensions( + double halfThickness, + double halfHeight, + double halfLargeBase, + double halfSmallBase, + double tiltRad + ) { + } + // ------------------------------------------------------------------------ // Material description: (layer, component) -> parameters // ------------------------------------------------------------------------ @@ -221,4 +233,148 @@ public synchronized void getConstants(DatabaseConstantProvider cp) { .put(component, info); } } + + // ------------------------------------------------------------------------ + // Sector geometry helpers + // ------------------------------------------------------------------------ + /** + * Computes the total thickness (mm) of a sector by summing the thickness of + * all material volumes. + * + * @return + */ + public double getSectorThickness() { + return detectorStructure.values() + .stream() + .flatMap(componentMap -> componentMap.values().stream()) + .mapToDouble(info -> info.thickness) + .sum(); + } + + /** + * + * @param region + * @return + */ + public SectorDimensions getSectorActiveVolumeDimensions(int region) { + + double baseDistance = this.TGTDET + region * this.DZ; + + double sectorHeight = baseDistance + * (Math.tan(Math.toRadians(this.THMAX - this.THTILT)) + + Math.tan(Math.toRadians(this.THTILT - this.THMIN))); + + double halfThickness = this.getSectorThickness() / 2.0; + double halfHeight = sectorHeight / 2.0; + + // Distance from target to the bottom base along the tilted axis + double W2TGT = (this.TGTDET + region * this.DZ) + / Math.cos(Math.toRadians(this.THTILT - this.THMIN)); + + double YMIN = W2TGT * Math.sin(Math.toRadians(this.THMIN)); // distance from beamline (Y) + double h = sectorHeight * Math.cos(Math.toRadians(this.THTILT)); + double halfSmallBase = 0.5 * (YMIN * Math.tan(Math.toRadians(this.THOPEN) / 2)); + + double halfLargeBase = halfSmallBase + sectorHeight * Math.tan(Math.toRadians(this.THOPEN / 2.0)); + + double tiltRad = Math.toRadians(this.THTILT); + + double twidth_Check = 2 * halfLargeBase * Math.sin(Math.toRadians(this.THOPEN)); + + if (MPGDTrapezoidConstants.VERBOSE) { + System.out.printf("this.TWIDT=%.3f vs %.3f", this.TWIDTH, twidth_Check); + + System.out.printf("YMIN=%.3f", YMIN); + + System.out.printf( + "SectorDimensionsPhysical [%s] region=%d : height=%.3f | halfT=%.3f halfH=%.3f " + + "halfLarge=%.3f halfSmall=%.3f tilt(deg)=%.3f%n", + this.detectorName, region, sectorHeight, + halfThickness, halfHeight, + halfLargeBase, halfSmallBase, + this.THTILT + ); + } + + return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad); + } + + /** + * + * @param region + * @return + */ + public SectorDimensions getSectorContainerDimensions(int region) { + + SectorDimensions phys = getSectorActiveVolumeDimensions(region); + + double halfThickness = phys.halfThickness() + MPGDTrapezoidConstants.ZENLARGEMENT; + double halfHeight = phys.halfHeight() + MPGDTrapezoidConstants.YENLARGEMENT; + double halfLargeBase = phys.halfLargeBase() + MPGDTrapezoidConstants.XENLARGEMENT; + double halfSmallBase = phys.halfSmallBase() + MPGDTrapezoidConstants.XENLARGEMENT; + + return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, phys.tiltRad()); + } + + /** + * Computes the sector height (longitudinal extension in the RZ plane) for a + * given region. + * + * @param region + * @return + */ + public double getSectorHeight(int region) { + + double baseDistance = this.TGTDET + region * this.DZ; + + double sectorHeight = baseDistance + * (Math.tan(Math.toRadians(this.THMAX - this.THTILT)) + + Math.tan(Math.toRadians(this.THTILT - this.THMIN))); + + if (MPGDTrapezoidConstants.VERBOSE) { + System.out.printf( + "SectorHeight [%s] region=%d : baseDistance=%.3f THMIN=%.3f THMAX=%.3f THTILT=%.3f -> height=%.3f%n", + this.detectorName, + region, + baseDistance, + this.THMIN, this.THMAX, this.THTILT, + sectorHeight + ); + } + + return sectorHeight; + } + + /** + * Computes the barycenter coordinates of a given sector/region in the + * CLAS12 coordinate system. + * + * @param isector + * @param iregion + * @return + */ + public Vector3d getCenterCoordinate(int isector, int iregion) { + + Vector3d vCenter = new Vector3d(0, 0, 0); + + // Distance from target to the bottom base along the tilted axis + double W2TGT = (this.TGTDET + iregion * this.DZ) + / Math.cos(Math.toRadians(this.THTILT - this.THMIN)); + + double YMIN = W2TGT * Math.sin(Math.toRadians(this.THMIN)); // distance from beamline (Y) + double ZMIN = W2TGT * Math.cos(Math.toRadians(this.THMIN)); // Z of the bottom base + + SectorDimensions dimCont = this.getSectorContainerDimensions(iregion); + double sectorHeight = 2 * dimCont.halfHeight(); + + vCenter.x = 0.0; + vCenter.y = (sectorHeight / 2.0) * Math.cos(Math.toRadians(this.THTILT)) + YMIN; + vCenter.z = -(sectorHeight / 2.0) * Math.sin(Math.toRadians(this.THTILT)) + ZMIN; + + // Rotate to the correct sector around Z (assumes 6 sectors, 60° apart) + vCenter.rotateZ(-Math.toRadians(90.0 - isector * 60.0)); + + return vCenter; + } + } diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidGeant4Factory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidGeant4Factory.java index 82904ccb61..592e6910f6 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidGeant4Factory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidGeant4Factory.java @@ -5,6 +5,7 @@ import org.jlab.detector.volume.G4Trap; import org.jlab.detector.volume.G4World; import org.jlab.detector.volume.Geant4Basic; +import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants.SectorDimensions; import java.util.Map; @@ -27,16 +28,6 @@ public class MPGDTrapezoidGeant4Factory extends Geant4Factory { */ protected final MPGDTrapezoidConstants C; - public static record SectorDimensions( - double halfThickness, - double halfHeight, - double halfLargeBase, - double halfSmallBase, - double tiltRad - ) { - - } - /** * @param constants detector constants (already configured with CCDB * paths/table names) @@ -68,149 +59,6 @@ protected final void init() { } } - // ------------------------------------------------------------------------ - // Sector geometry helpers - // ------------------------------------------------------------------------ - /** - * Computes the total thickness (mm) of a sector by summing the thickness of - * all material volumes. - * - * @return - */ - public double getSectorThickness() { - return C.getDetectorStructure().values() - .stream() - .flatMap(componentMap -> componentMap.values().stream()) - .mapToDouble(info -> info.thickness) - .sum(); - } - - /** - * - * @param region - * @return - */ - public SectorDimensions getSectorActiveVolumeDimensions(int region) { - - double baseDistance = C.TGTDET + region * C.DZ; - - double sectorHeight = baseDistance - * (Math.tan(Math.toRadians(C.THMAX - C.THTILT)) - + Math.tan(Math.toRadians(C.THTILT - C.THMIN))); - - double halfThickness = this.getSectorThickness() / 2.0; - double halfHeight = sectorHeight / 2.0; - - // Distance from target to the bottom base along the tilted axis - double W2TGT = (C.TGTDET + region * C.DZ) - / Math.cos(Math.toRadians(C.THTILT - C.THMIN)); - - double YMIN = W2TGT * Math.sin(Math.toRadians(C.THMIN)); // distance from beamline (Y) - double h = sectorHeight * Math.cos(Math.toRadians(C.THTILT)); - double halfSmallBase = 0.5 * (YMIN * Math.tan(Math.toRadians(C.THOPEN) / 2)); - - double halfLargeBase = halfSmallBase + sectorHeight * Math.tan(Math.toRadians(C.THOPEN / 2.0)); - - double tiltRad = Math.toRadians(C.THTILT); - - double twidth_Check = 2 * halfLargeBase * Math.sin(Math.toRadians(C.THOPEN)); - - if (MPGDTrapezoidConstants.VERBOSE) { - System.out.printf("C.TWIDT=%.3f vs %.3f", C.TWIDTH, twidth_Check); - - System.out.printf("YMIN=%.3f", YMIN); - - System.out.printf( - "SectorDimensionsPhysical [%s] region=%d : height=%.3f | halfT=%.3f halfH=%.3f " - + "halfLarge=%.3f halfSmall=%.3f tilt(deg)=%.3f%n", - C.detectorName, region, sectorHeight, - halfThickness, halfHeight, - halfLargeBase, halfSmallBase, - C.THTILT - ); - } - - return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad); - } - - /** - * - * @param region - * @return - */ - public SectorDimensions getSectorContainerDimensions(int region) { - - SectorDimensions phys = getSectorActiveVolumeDimensions(region); - - double halfThickness = phys.halfThickness() + MPGDTrapezoidConstants.ZENLARGEMENT; - double halfHeight = phys.halfHeight() + MPGDTrapezoidConstants.YENLARGEMENT; - double halfLargeBase = phys.halfLargeBase() + MPGDTrapezoidConstants.XENLARGEMENT; - double halfSmallBase = phys.halfSmallBase() + MPGDTrapezoidConstants.XENLARGEMENT; - - return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, phys.tiltRad()); - } - - /** - * Computes the sector height (longitudinal extension in the RZ plane) for a - * given region. - * - * @param region - * @return - */ - public double getSectorHeight(int region) { - - double baseDistance = C.TGTDET + region * C.DZ; - - double sectorHeight = baseDistance - * (Math.tan(Math.toRadians(C.THMAX - C.THTILT)) - + Math.tan(Math.toRadians(C.THTILT - C.THMIN))); - - if (MPGDTrapezoidConstants.VERBOSE) { - System.out.printf( - "SectorHeight [%s] region=%d : baseDistance=%.3f THMIN=%.3f THMAX=%.3f THTILT=%.3f -> height=%.3f%n", - C.detectorName, - region, - baseDistance, - C.THMIN, C.THMAX, C.THTILT, - sectorHeight - ); - } - - return sectorHeight; - } - - /** - * Computes the barycenter coordinates of a given sector/region in the - * CLAS12 coordinate system. - * - * @param isector - * @param iregion - * @return - */ - public Vector3d getCenterCoordinate(int isector, int iregion) { - - Vector3d vCenter = new Vector3d(0, 0, 0); - - // Distance from target to the bottom base along the tilted axis - double W2TGT = (C.TGTDET + iregion * C.DZ) - / Math.cos(Math.toRadians(C.THTILT - C.THMIN)); - - double YMIN = W2TGT * Math.sin(Math.toRadians(C.THMIN)); // distance from beamline (Y) - double ZMIN = W2TGT * Math.cos(Math.toRadians(C.THMIN)); // Z of the bottom base - - SectorDimensions dimCont = this.getSectorContainerDimensions(iregion); - double sectorHeight = 2 * dimCont.halfHeight(); - - vCenter.x = 0.0; - vCenter.y = (sectorHeight / 2.0) * Math.cos(Math.toRadians(C.THTILT)) + YMIN; - vCenter.z = -(sectorHeight / 2.0) * Math.sin(Math.toRadians(C.THTILT)) + ZMIN; - - // Rotate to the correct sector around Z (assumes 6 sectors, 60° apart) - vCenter.rotateZ(-Math.toRadians(90.0 - isector * 60.0)); - - return vCenter; - } - // ------------------------------------------------------------------------ // Sector + material volume construction // ------------------------------------------------------------------------ @@ -223,8 +71,8 @@ public Vector3d getCenterCoordinate(int isector, int iregion) { */ public Geant4Basic createSector(int isector, int iregion) { - SectorDimensions dimPhys = this.getSectorActiveVolumeDimensions(iregion); - SectorDimensions dimCont = this.getSectorContainerDimensions(iregion); + SectorDimensions dimPhys = C.getSectorActiveVolumeDimensions(iregion); + SectorDimensions dimCont = C.getSectorContainerDimensions(iregion); Geant4Basic sectorVolume = createSectorVolume(isector, iregion, dimCont); populateSectorWithDetectorStructure(sectorVolume, isector, iregion, dimPhys); @@ -250,7 +98,7 @@ protected Geant4Basic createSectorVolume(int isector, double sectorDX0 = dimSect.halfSmallBase(); double sectorTtilt = dimSect.tiltRad(); - Vector3d vCenter = this.getCenterCoordinate(isector, iregion); + Vector3d vCenter = C.getCenterCoordinate(isector, iregion); Geant4Basic sectorVolume = new G4Trap( "region_" + C.detectorName + "_" + (iregion + 1) + "_s" + (isector + 1), diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidStripFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidStripFactory.java index 283adf2b21..e8adb34945 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidStripFactory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MPGD/trapezoid/MPGDTrapezoidStripFactory.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants.SectorDimensions; /** * Base class implementing strip/surface/plane geometry for trapezoidal MPGD @@ -253,7 +254,7 @@ protected Vector3d toGlobalSensitive(int region, int sector, int layer, Vector3d // ------------------------------------------------------------------------ /** * Build StripConstants using: - XY trapezoid from - * geo.getSectorDimensionsPhysical(region) (NOT enlarged) - zReadoutLocal + * C.getSectorActiveVolumeDimensions(region) (NOT enlarged) - zReadoutLocal * from CCDB sensitive thickness (findReadoutZLocal) - pitch/width/stereo * from CCDB * @@ -263,8 +264,8 @@ protected Vector3d toGlobalSensitive(int region, int sector, int layer, Vector3d */ protected StripConstants buildStripConstants(int region, int layer) { - MPGDTrapezoidGeant4Factory.SectorDimensions phys - = geo.getSectorActiveVolumeDimensions(region - 1); + SectorDimensions phys + = C.getSectorActiveVolumeDimensions(region - 1); StripConstants sc = new StripConstants(); sc.yHalf = phys.halfHeight(); diff --git a/common-tools/clas-logging/pom.xml b/common-tools/clas-logging/pom.xml index 3bac5a595c..d42153a52b 100644 --- a/common-tools/clas-logging/pom.xml +++ b/common-tools/clas-logging/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-logging - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-math/pom.xml b/common-tools/clas-math/pom.xml index 3d0019dc74..1ba26e2200 100644 --- a/common-tools/clas-math/pom.xml +++ b/common-tools/clas-math/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-math - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-physics/pom.xml b/common-tools/clas-physics/pom.xml index 7dd79bd5c1..bbbd60ed91 100644 --- a/common-tools/clas-physics/pom.xml +++ b/common-tools/clas-physics/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-reco/pom.xml b/common-tools/clas-reco/pom.xml index 30e803cdef..7f8b211a89 100644 --- a/common-tools/clas-reco/pom.xml +++ b/common-tools/clas-reco/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -50,43 +50,43 @@ cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys swimmer - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-tracking/pom.xml b/common-tools/clas-tracking/pom.xml index 5634bffc0d..835e1ea5a8 100644 --- a/common-tools/clas-tracking/pom.xml +++ b/common-tools/clas-tracking/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -33,23 +33,23 @@ org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-utils/pom.xml b/common-tools/clas-utils/pom.xml index b7f80ec74f..fca61f16d2 100644 --- a/common-tools/clas-utils/pom.xml +++ b/common-tools/clas-utils/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -22,7 +22,7 @@ org.jlab.clas clas-logging - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java index d0e1f26b9f..9b6f34f68d 100644 --- a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java +++ b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.TreeMap; +import java.util.LinkedHashMap; import java.util.logging.Logger; import java.util.logging.Level; import org.jlab.logging.SplitLogManager; @@ -19,9 +19,9 @@ */ public class OptionParser { - private Map optionsDescriptors = new TreeMap<>(); - private Map requiredOptions = new TreeMap<>(); - private Map parsedOptions = new TreeMap<>(); + private Map optionsDescriptors = new LinkedHashMap<>(); + private Map requiredOptions = new LinkedHashMap<>(); + private Map parsedOptions = new LinkedHashMap<>(); private Set overridenOptions = new HashSet<>(); private List parsedInputList = new ArrayList<>(); private String program = "undefined"; @@ -129,13 +129,7 @@ public String getUsageString(){ } public void printUsage(){ - System.out.println("\n\n"); - System.out.println("*******************************************"); - System.out.println("* PROGRAM USAGE : by OptionParser *"); - System.out.println("*******************************************"); - System.out.println("\n\n"); System.out.println(this.getUsageString()); - System.out.println("\n\n"); } public void parse(String... args) { diff --git a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionValue.java b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionValue.java index b354151844..5ffcac4963 100644 --- a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionValue.java +++ b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionValue.java @@ -53,4 +53,8 @@ public boolean parse(List arguments){ arguments.remove(index); return true; } + + public boolean isDefault() { + return this.optionValue.equals(this.optionDefault); + } } diff --git a/common-tools/cnuphys/magfield/pom.xml b/common-tools/cnuphys/magfield/pom.xml index 8d494872b6..843e28760d 100644 --- a/common-tools/cnuphys/magfield/pom.xml +++ b/common-tools/cnuphys/magfield/pom.xml @@ -4,13 +4,13 @@ cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys clas12 - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/cnuphys/pom.xml b/common-tools/cnuphys/pom.xml index 13e80db741..5d3c0d47da 100644 --- a/common-tools/cnuphys/pom.xml +++ b/common-tools/cnuphys/pom.xml @@ -4,13 +4,13 @@ cnuphys clas12 - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT pom org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/cnuphys/snr/pom.xml b/common-tools/cnuphys/snr/pom.xml index 248cb77c51..3331057b14 100644 --- a/common-tools/cnuphys/snr/pom.xml +++ b/common-tools/cnuphys/snr/pom.xml @@ -4,13 +4,13 @@ cnuphys snr - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys clas12 - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/cnuphys/splot/pom.xml b/common-tools/cnuphys/splot/pom.xml index ac70bd5373..843b3084d1 100644 --- a/common-tools/cnuphys/splot/pom.xml +++ b/common-tools/cnuphys/splot/pom.xml @@ -4,13 +4,13 @@ cnuphys splot - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys clas12 - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/cnuphys/swimmer/pom.xml b/common-tools/cnuphys/swimmer/pom.xml index 3f93373dda..c84ab05e7d 100644 --- a/common-tools/cnuphys/swimmer/pom.xml +++ b/common-tools/cnuphys/swimmer/pom.xml @@ -4,26 +4,26 @@ cnuphys swimmer - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys clas12 - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys splot - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/coat-libs/pom.xml b/common-tools/coat-libs/pom.xml index e677ce799b..f0dc712f96 100644 --- a/common-tools/coat-libs/pom.xml +++ b/common-tools/coat-libs/pom.xml @@ -4,13 +4,13 @@ org.jlab.coat coat-libs - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -66,91 +66,91 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clara-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-logging - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-math - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-decay-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys snr - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -257,6 +257,15 @@ maven-deploy-plugin + + + org.apache.maven.plugins + maven-dependency-plugin + + true + + + diff --git a/common-tools/pom.xml b/common-tools/pom.xml index e840983921..42e9a842f2 100644 --- a/common-tools/pom.xml +++ b/common-tools/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT pom org.jlab.clas coatjava - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/common-tools/swim-tools/pom.xml b/common-tools/swim-tools/pom.xml index ad267d7634..f18005dde5 100644 --- a/common-tools/swim-tools/pom.xml +++ b/common-tools/swim-tools/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas common-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,37 +21,37 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys swimmer - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/etc/bankdefs/hipo4/alert.json b/etc/bankdefs/hipo4/alert.json index 8400034b57..64d4faeec1 100644 --- a/etc/bankdefs/hipo4/alert.json +++ b/etc/bankdefs/hipo4/alert.json @@ -65,6 +65,38 @@ {"name": "trackid", "type": "I", "info": "track id"}, {"name": "matched_atof_hit_id", "type": "I", "info": "id of the matched ATOF hit, -1 if no hit was matched"} ] + }, + { + "name": "ALERT::ai:prepid", + "group": 23000, + "item": 33, + "info": "ALERT AI-assisted PrePID to be used for Kalman Filter", + "entries": [ + {"name":"trackid", "type":"I", "info":"AHDC trackid"}, + {"name":"clusterid", "type":"I", "info":"ATOF cluster id"}, + {"name":"prepid", "type":"I", "info":"argmax PID"}, + {"name":"p2212", "type":"F", "info":"P(pid=2212)"}, + {"name":"p45", "type":"F", "info":"P(pid=45)"}, + {"name":"p46", "type":"F", "info":"P(pid=46)"}, + {"name":"p47", "type":"F", "info":"P(pid=47)"}, + {"name":"p49", "type":"F", "info":"P(pid=49)"} + ] + }, + { + "name": "ALERT::ai:pid", + "group": 23000, + "item": 34, + "info": "AI-assisted PID for ALERT", + "entries": [ + {"name":"trackid", "type":"I", "info":"AHDC trackid"}, + {"name":"clusterid", "type":"I", "info":"ATOF cluster id"}, + {"name":"pid", "type":"I", "info":"argmax PID"}, + {"name":"prob_2212", "type":"F", "info":"P(pid=2212)"}, + {"name":"prob_45", "type":"F", "info":"P(pid=45)"}, + {"name":"prob_46", "type":"F", "info":"P(pid=46)"}, + {"name":"prob_47", "type":"F", "info":"P(pid=47)"}, + {"name":"prob_49", "type":"F", "info":"P(pid=49)"} + ] }, { "name": "ATOF::hits", @@ -200,7 +232,7 @@ "name": "time", "type": "D", "info": "calibrated time (ns)" - }, { + }, { "name": "adc", "type": "I", "info": "calibrated ADC" @@ -440,5 +472,19 @@ {"name": "x", "type": "F", "info": "x info (mm)"}, {"name": "y", "type": "F", "info": "y info (mm)"} ] + }, + { + "name": "AHDC::docaclusters", + "group": 23000, + "item": 126, + "info": "Doca-refined cluster space points", + "entries": [ + {"name": "x", "type": "F", "info": "refined x (mm)"}, + {"name": "y", "type": "F", "info": "refined y (mm)"}, + {"name": "z", "type": "F", "info": "refined z (mm)"}, + {"name": "weight", "type": "F", "info": "refined point weight"}, + {"name": "pattern", "type": "I", "info": "hit pattern: 11,12,21,22"}, + {"name": "idx", "type": "I", "info": "index of original AHDC::clusters row"} + ] } ] diff --git a/etc/data/nnet b/etc/data/nnet index f43cee9e39..efa89e44d0 160000 --- a/etc/data/nnet +++ b/etc/data/nnet @@ -1 +1 @@ -Subproject commit f43cee9e391eb1db30f61f125ecc7f7d3f3cf37e +Subproject commit efa89e44d0c68e2107105cc39096b41d98bba590 diff --git a/libexec/dependency-analysis.sh b/libexec/dependency-analysis.sh deleted file mode 100755 index 9330057e2a..0000000000 --- a/libexec/dependency-analysis.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# analyze maven dependencies -# NOTE: skips `coat-libs`, since shaded JAR dependencies are "unused" according to `dependency:analyze` -set -euo pipefail -mvn dependency:analyze -DfailOnWarning=true -pl '!org.jlab.coat:coat-libs' --no-transfer-progress diff --git a/libexec/dependency-tree.sh b/libexec/dependency-tree.sh deleted file mode 100755 index 056976afdb..0000000000 --- a/libexec/dependency-tree.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# print the maven dependency tree -set -euo pipefail -mvn dependency:tree -Ddetail=true --no-transfer-progress diff --git a/pom.xml b/pom.xml index 75403d19eb..8e488499bf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jlab.clas coatjava - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT pom @@ -29,6 +29,18 @@ + + + skip-tests + + true + + + true + + + + @@ -251,6 +263,29 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.6.2 + + + enforce-java + + enforce + + + + + [21,) + + + + + + + + com.github.spotbugs spotbugs-maven-plugin @@ -260,6 +295,7 @@ + org.apache.maven.plugins maven-javadoc-plugin @@ -280,6 +316,7 @@ + org.apache.maven.plugins maven-compiler-plugin @@ -289,7 +326,6 @@ UTF-8 - org.apache.maven.plugins maven-resources-plugin @@ -299,6 +335,7 @@ + org.apache.maven.plugins maven-jar-plugin @@ -323,6 +360,35 @@ + + + org.apache.maven.plugins + maven-dependency-plugin + 3.10.0 + + + analyze + verify + + tree + analyze-only + + + true + + + ai.djl:model-zoo + ai.djl.pytorch:pytorch-model-zoo + ai.djl.pytorch:pytorch-engine + ai.djl.pytorch:pytorch-native-cpu + ai.djl.pytorch:pytorch-jni + + + + + + + org.apache.maven.plugins maven-enforcer-plugin @@ -347,6 +413,7 @@ + org.jacoco jacoco-maven-plugin diff --git a/reconstruction/ai/pom.xml b/reconstruction/ai/pom.xml index 15bc439eae..fc8fbefa32 100644 --- a/reconstruction/ai/pom.xml +++ b/reconstruction/ai/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-ai - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -18,19 +18,19 @@ org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/alert/pom.xml b/reconstruction/alert/pom.xml index da37a38210..7eca04c76c 100644 --- a/reconstruction/alert/pom.xml +++ b/reconstruction/alert/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-alert - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -30,54 +30,54 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile @@ -127,7 +127,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.9.0 + 3.10.0 copy-dependencies @@ -141,15 +141,6 @@ - - - ai.djl:model-zoo - ai.djl.pytorch:pytorch-model-zoo - ai.djl.pytorch:pytorch-engine - ai.djl.pytorch:pytorch-native-cpu - ai.djl.pytorch:pytorch-jni - - diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Banks/RecoBankWriter.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Banks/RecoBankWriter.java index 6adf5a1ce4..0218dec350 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Banks/RecoBankWriter.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Banks/RecoBankWriter.java @@ -5,11 +5,13 @@ import org.jlab.rec.ahdc.AI.InterCluster; import org.jlab.rec.ahdc.AI.TrackPrediction; import org.jlab.rec.ahdc.Cluster.Cluster; +import org.jlab.rec.ahdc.Cluster.DocaCluster; import org.jlab.rec.ahdc.Hit.Hit; import org.jlab.rec.ahdc.PreCluster.PreCluster; import org.jlab.rec.ahdc.Track.Track; import java.util.ArrayList; +import java.util.List; public class RecoBankWriter { @@ -120,6 +122,7 @@ public DataBank fillAHDCTrackBank(DataEvent event, ArrayList tracks) { return bank; } + /// Here the relavant informations of the tracks are filled in the Kalman Filter public DataBank fillAHDCKFTrackBank(DataEvent event, ArrayList tracks) { DataBank bank = event.createBank("AHDC::kftrack", tracks.size()); @@ -128,12 +131,12 @@ public DataBank fillAHDCKFTrackBank(DataEvent event, ArrayList tracks) { for (Track track : tracks) { if (track == null) continue; - double x = track.getX0_kf(); - double y = track.getY0_kf(); - double z = track.getZ0_kf(); - double px = track.getPx0_kf(); - double py = track.getPy0_kf(); - double pz = track.getPz0_kf(); + double x = track.get_X0(); + double y = track.get_Y0(); + double z = track.get_Z0(); + double px = track.get_px(); + double py = track.get_py(); + double pz = track.get_pz(); bank.setInt("trackid", row, (int) track.get_trackId()); bank.setFloat("x", row, (float) x); @@ -144,9 +147,9 @@ public DataBank fillAHDCKFTrackBank(DataEvent event, ArrayList tracks) { bank.setFloat("pz", row, (float) pz); bank.setInt("n_hits", row, (int) track.get_n_hits()); bank.setInt("sum_adc", row, (int) track.get_sum_adc()); - bank.setFloat("path", row, (float) track.get_path_kf()); - bank.setFloat("dEdx", row, (float) track.get_dEdx_kf()); - bank.setFloat("p_drift", row, (float) track.get_p_drift_kf()); + bank.setFloat("path", row, (float) track.get_path()); + bank.setFloat("dEdx", row, (float) track.get_dEdx()); + bank.setFloat("p_drift", row, (float) track.get_p_drift()); bank.setFloat("chi2", row, (float) track.get_chi2()); bank.setFloat("sum_residuals", row, (float) track.get_sum_residuals()); @@ -197,4 +200,22 @@ public DataBank fillInterClusterBank(DataEvent event, ArrayList in return bank; } + + public DataBank fillAHDCDocaClustersBank(DataEvent event, ArrayList docaclusters) { + + if (docaclusters == null || docaclusters.size() == 0) return null; + + DataBank bank = event.createBank("AHDC::docaclusters", docaclusters.size()); + + for (int i = 0; i < docaclusters.size(); i++) { + bank.setFloat("x", i, (float) docaclusters.get(i).get_X()); + bank.setFloat("y", i, (float) docaclusters.get(i).get_Y()); + bank.setFloat("z", i, (float) docaclusters.get(i).get_Z()); + bank.setFloat("weight", i, (float) docaclusters.get(i).get_Weight()); + bank.setInt("pattern", i, (int) docaclusters.get(i).get_Pattern()); + bank.setInt("idx", i, (int) docaclusters.get(i).get_ClusterIndex()); + } + + return bank; + } } diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaCluster.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaCluster.java new file mode 100644 index 0000000000..b9d0f1fd91 --- /dev/null +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaCluster.java @@ -0,0 +1,59 @@ +package org.jlab.rec.ahdc.Cluster; + +/** + * DocaCluster is a "refined" cluster space point built from + * the DOCA information of hits in the two PreClusters that + * compose a standard Cluster. + * + * One original Cluster can produce one or several DocaCluster + * objects, each with its own (x, y, z, weight). + */ +public class DocaCluster { + + // Refined space point + private double _X; + private double _Y; + private double _Z; + + // Weight for helix fit (relative weight of this point) + private double _Weight = 1.0; + + // Pattern of hit multiplicity: 11, 12, 21, 22, or 0 for "others" + private int _Pattern = 0; + + // Index of the original Cluster in the AHDC_Clusters list + private int _ClusterIndex = -1; + + public DocaCluster(double x, double y, double z, + double weight, int pattern, int clusterIndex) { + this._X = x; + this._Y = y; + this._Z = z; + this._Weight = weight; + this._Pattern = pattern; + this._ClusterIndex = clusterIndex; + } + + public double get_X() { return _X; } + public double get_Y() { return _Y; } + public double get_Z() { return _Z; } + public double get_Weight() { return _Weight; } + + public int get_Pattern() { return _Pattern; } + public int get_ClusterIndex() { return _ClusterIndex; } + + public void set_X(double x) { this._X = x; } + public void set_Y(double y) { this._Y = y; } + public void set_Z(double z) { this._Z = z; } + public void set_Weight(double weight) { this._Weight = weight; } + public void set_Pattern(int pattern) { this._Pattern = pattern; } + public void set_ClusterIndex(int idx) { this._ClusterIndex = idx; } + + @Override + public String toString() { + return String.format( + "DocaCluster{X=%.3f, Y=%.3f, Z=%.3f, w=%.3f, pattern=%d, idx=%d}", + _X, _Y, _Z, _Weight, _Pattern, _ClusterIndex + ); + } +} diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaClusterRefiner.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaClusterRefiner.java new file mode 100644 index 0000000000..8961ffed1b --- /dev/null +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/DocaCluster/DocaClusterRefiner.java @@ -0,0 +1,884 @@ +package org.jlab.rec.ahdc.Cluster; + +import org.jlab.rec.ahdc.Hit.Hit; +import org.jlab.rec.ahdc.PreCluster.PreCluster; + +import org.jlab.geom.prim.Line3D; +import org.jlab.geom.prim.Point3D; + +import java.util.ArrayList; +import java.util.List; +import java.util.Collections; + +/** + * Build refined cluster space points using DOCA circles. + * + * For each original Cluster (2 PreClusters with stereo angle), + * if the hit multiplicity is (1,1), (1,2)/(2,1) or (2,2), we + * construct new space points from circle-circle tangents. + * Otherwise we fall back to the original (x,y,z) with weight 1. + */ +public class DocaClusterRefiner { + + // --- internal small 2D helpers ------------------------------------------------ + + private static class Vec2 { + double x; + double y; + Vec2(double x, double y) { this.x = x; this.y = y; } + + Vec2 add(Vec2 o) { return new Vec2(this.x + o.x, this.y + o.y); } + Vec2 sub(Vec2 o) { return new Vec2(this.x - o.x, this.y - o.y); } + Vec2 scale(double s){ return new Vec2(this.x * s, this.y * s); } + } + + private static class Vec3 { + double x, y, z; + + Vec3(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + //plus + Vec3 add(Vec3 o) { + return new Vec3(this.x + o.x, this.y + o.y, this.z + o.z); + } + //minus + Vec3 sub(Vec3 o) { + return new Vec3(this.x - o.x, this.y - o.y, this.z - o.z); + } + //scale + Vec3 scale(double s) { + return new Vec3(this.x * s, this.y * s, this.z * s); + } + //Dot Product + double dot(Vec3 o) { + return this.x * o.x + this.y * o.y + this.z * o.z; + } + //Cross Product + Vec3 cross(Vec3 o) { + return new Vec3( + this.y * o.z - this.z * o.y, + this.z * o.x - this.x * o.z, + this.x * o.y - this.y * o.x + ); + } + @Override + public String toString() { + return String.format("Vec3(%.2f, %.2f, %.2f)", x, y, z); + } + } + + // line: n·x + c = 0, n is unit normal + private static class Line { + Vec2 n; + double c; + Line(Vec2 n, double c) { this.n = n; this.c = c; } + } + + // Given a common tangent line to two circles (c1,r1) and (c2,r2), + // compute the two tangent points on each circle. + private static Vec2[] tangentSegmentPoints(Vec2 c1, double r1, + Vec2 c2, double r2, + Line line) { + Vec2 n = line.n; + double c = line.c; + + // signed distance from centers to line + double d1 = n.x * c1.x + n.y * c1.y + c; + double d2 = n.x * c2.x + n.y * c2.y + c; + + // projection of centers onto the line (tangent points) + Vec2 t1 = new Vec2(c1.x - n.x * d1, c1.y - n.y * d1); + Vec2 t2 = new Vec2(c2.x - n.x * d2, c2.y - n.y * d2); + + return new Vec2[]{t1, t2}; + } + // Tangent lines + private static class Tangents { + Line[] internalLines = new Line[2]; + Line[] externalLines = new Line[2]; + boolean hasInternal = false; + boolean hasExternal = false; + } + //To see whether a point is on one side of a line or the other + private static double side_ql(Vec2 q, Line l) { + return l.n.x * q.x + l.n.y * q.y + l.c; + } + + /** + * Project the 3D DOCA of a hit onto the transverse (x,y) plane, + * by multiplying DOCA with cos(angle between wire direction and beamline). + * Beamline is assumed to be along the z-axis. + */ + private static double getProjectedDocaXY(Hit h) { + double doca = Math.abs(h.getDoca()); + Line3D wire = h.getLine(); + + // If the wire line is not available, fall back to full DOCA + if (wire == null) { + return doca; + } + + Point3D o = wire.origin(); + Point3D e = wire.end(); + + double dx = e.x() - o.x(); + double dy = e.y() - o.y(); + double dz = e.z() - o.z(); + + double len = Math.sqrt(dx * dx + dy * dy + dz * dz); + if (len < 1e-6) { + // degenerate line, also fall back + return doca; + } + + // unit vector along wire + double ux = dx / len; + double uy = dy / len; + double uz = dz / len; + + // beamline direction = (0,0,1), so cos(angle) = |uz| + double cosAlpha = Math.abs(uz); + + // projected DOCA radius in XY plane + return doca / cosAlpha; + } + + private static Vec3 getDirection(Hit h) { + Line3D wire = h.getLine(); + + Point3D o = wire.origin(); + Point3D e = wire.end(); + + double dx = e.x() - o.x(); + double dy = e.y() - o.y(); + double dz = e.z() - o.z(); + + double len = Math.sqrt(dx * dx + dy * dy + dz * dz); + + // unit vector along wire + double ux = dx / len; + double uy = dy / len; + double uz = dz / len; + + // beamline direction = (0,0,1), so cos(angle) = |uz| + double cosAlpha = Math.abs(uz); + + Vec3 u = new Vec3(ux, uy, uz); + + // projected DOCA radius in XY plane + return u; + } + + // Select up to maxN hits with the largest ADC from a hit list. + // This does NOT modify the original list in PreCluster. + private static ArrayList selectTopHitsByADC(ArrayList hits, int maxN) { + ArrayList result = new ArrayList<>(); + if (hits == null || hits.isEmpty() || maxN <= 0) { + return result; + } + + ArrayList copy = new ArrayList<>(hits); + + Collections.sort(copy, (h1, h2) -> Double.compare(h2.getADC(), h1.getADC())); + + int n = Math.min(maxN, copy.size()); + for (int i = 0; i < n; i++) { + result.add(copy.get(i)); + } + + return result; + } + + /** + * Build a 3D line by shifting the original wire line in the (x,y) plane + * so that its origin passes through the given tangent point (tx, ty), + * while keeping the same direction and z-coordinate at the origin. + */ + private static Line3D buildShiftedWireLine(Hit h, Vec2 tangentXY) { + Line3D wire = h.getLine(); + + Point3D o = wire.origin(); + Point3D e = wire.end(); + + double dx = e.x() - o.x(); + double dy = e.y() - o.y(); + double dz = e.z() - o.z(); + + // New origin: (tangent.x, tangent.y, original_z) + Point3D oShift = new Point3D(tangentXY.x, tangentXY.y, o.z()); + Point3D eShift = new Point3D(oShift.x() + dx, oShift.y() + dy, oShift.z() + dz); + + return new Line3D(oShift, eShift); + } + + /** + * Compute the midpoint of the shortest segment between two 3D lines. + * Returns null if the lines are (almost) parallel. + */ + private static Point3D midpointOfCommonPerpendicular(Line3D L1, Line3D L2) { + Point3D p1 = L1.origin(); + Point3D p2 = L2.origin(); + + double v1x = L1.end().x() - p1.x(); + double v1y = L1.end().y() - p1.y(); + double v1z = L1.end().z() - p1.z(); + + double v2x = L2.end().x() - p2.x(); + double v2y = L2.end().y() - p2.y(); + double v2z = L2.end().z() - p2.z(); + + // Normalize directions + double len1 = Math.sqrt(v1x*v1x + v1y*v1y + v1z*v1z); + double len2 = Math.sqrt(v2x*v2x + v2y*v2y + v2z*v2z); + if (len1 < 1e-6 || len2 < 1e-6) { + return null; + } + v1x /= len1; v1y /= len1; v1z /= len1; + v2x /= len2; v2y /= len2; v2z /= len2; + + // Solve for s,t that minimize |(p1 + s v1) - (p2 + t v2)|^2 + double w0x = p1.x() - p2.x(); + double w0y = p1.y() - p2.y(); + double w0z = p1.z() - p2.z(); + + double a = v1x*v1x + v1y*v1y + v1z*v1z; + double b = v1x*v2x + v1y*v2y + v1z*v2z; + double c = v2x*v2x + v2y*v2y + v2z*v2z; + double d = v1x*w0x + v1y*w0y + v1z*w0z; + double e = v2x*w0x + v2y*w0y + v2z*w0z; + + double denom = a*c - b*b; + if (Math.abs(denom) < 1e-6) { + // Lines nearly parallel, no stable unique common perpendicular + return null; + } + + double s = (b*e - c*d) / denom; + double t = (a*e - b*d) / denom; + + double q1x = p1.x() + s*v1x; + double q1y = p1.y() + s*v1y; + double q1z = p1.z() + s*v1z; + + double q2x = p2.x() + t*v2x; + double q2y = p2.y() + t*v2y; + double q2z = p2.z() + t*v2z; + + // Midpoint of the shortest segment + return new Point3D(0.5*(q1x + q2x), + 0.5*(q1y + q2y), + 0.5*(q1z + q2z)); + } + + private static final double STEREO_ANGLE_DEG = 20.0; + private static final double DELTA_Z = 300.0; + private static final double Z_OFFSET = 150.0; + + // ===================================================================== + // public API + // ===================================================================== + + /** + * Build a list of DocaCluster objects from the original list of Cluster. + * Each Cluster may generate multiple DocaCluster points. + */ + + public static ArrayList buildRefinedClusters(List clusters) { + + ArrayList out = new ArrayList<>(); + + if (clusters == null) return out; + + for (int idx = 0; idx < clusters.size(); idx++) { + Cluster cl = clusters.get(idx); + + ArrayList pcs = cl.get_PreClusters_list(); + if (pcs == null || pcs.size() != 2) { + // Fallback: one degenerate DocaCluster at original position + out.add(new DocaCluster(cl.get_X(), cl.get_Y(), cl.get_Z(), + 1.0, 0, idx)); + continue; + } + + PreCluster pc1 = pcs.get(0); + PreCluster pc2 = pcs.get(1); + + ArrayList hits1 = pc1.get_hits_list(); + ArrayList hits2 = pc2.get_hits_list(); + + // ----------------------------------------------------------------- + // NEW: reduce each precluster to at most 2 hits by keeping only + // the hits with the largest ADC. + // ----------------------------------------------------------------- + ArrayList effHits1 = selectTopHitsByADC(hits1, 2); + ArrayList effHits2 = selectTopHitsByADC(hits2, 2); + + int n1 = effHits1.size(); + int n2 = effHits2.size(); + + // Now we only need to handle (1,1), (1,2)/(2,1), (2,2). + // Any case with 0 hits falls back to the original cluster. + if (n1 == 1 && n2 == 1) { + + out.addAll(refine11(cl, + pc1, effHits1.get(0), + pc2, effHits2.get(0), + idx)); + + } else if (n1 == 1 && n2 == 2) { + + out.addAll(refine12(cl, + pc1, effHits1, + pc2, effHits2, + true, // pc1 is the single-hit side + idx)); + + } else if (n1 == 2 && n2 == 1) { + + out.addAll(refine12(cl, + pc2, effHits2, + pc1, effHits1, + false, // pc2 is the single-hit side + idx)); + + } else if (n1 == 2 && n2 == 2) { + + out.addAll(refine22(cl, + pc1, effHits1, + pc2, effHits2, + idx)); + + } else { + // At least one precluster ended up with 0 hits after selection: + // fall back to a single DocaCluster at the original position. + out.add(new DocaCluster(cl.get_X(), cl.get_Y(), cl.get_Z(), + 1.0, 0, idx)); + } + } + + return out; + } + // ===================================================================== + // (1,1) case + // ===================================================================== + + private static List refine11(Cluster oldCluster, + PreCluster pc1, Hit h1, + PreCluster pc2, Hit h2, + int clusterIndex) { + + List out = new ArrayList<>(); + //double Proj = Math.cos(Math.toRadians(10)); //project to xy plane + // Centers of the two DOCA circles from the two single hits + Vec2 c1 = new Vec2(h1.getX(), h1.getY()); + Vec2 c2 = new Vec2(h2.getX(), h2.getY()); + //double r1 = Math.abs(h1.getDoca()*Proj); + //double r2 = Math.abs(h2.getDoca()*Proj); + double r1 = getProjectedDocaXY(h1); + double r2 = getProjectedDocaXY(h2); + + // Compute internal and external tangents between the two circles + Tangents tans = computeTangents(c1, r1, c2, r2); + + // If we cannot build both internal and external tangents, + // fall back to a single midpoint with the original cluster Z + if (!tans.hasInternal || !tans.hasExternal) { + Vec2 mid = c1.add(c2).scale(0.5); + out.add(new DocaCluster(mid.x, mid.y, oldCluster.get_Z(), + 1.0, 11, clusterIndex)); + return out; + } + + // Collect the four tangent lines: 2 internal + 2 external + Line[] lines = new Line[]{ + tans.internalLines[0], + tans.internalLines[1], + tans.externalLines[0], + tans.externalLines[1] + }; + + // For each tangent line: + // - compute the two tangent points on the two circles; + // - take their midpoint as the DocaCluster (X,Y); + // - compute phi1, phi2 from the two tangent points and use + // computeZ(pc1,pc2,phi1,phi2) for Z; + // - assign weight 0.25 (we will renormalize if fewer than 4). + for (Line L : lines) { + if (L == null) continue; + + Vec2[] tpts = tangentSegmentPoints(c1, r1, c2, r2, L); + Vec2 t_on_pc1 = tpts[0]; + Vec2 t_on_pc2 = tpts[1]; + + // midpoint of the two tangent points -> DocaCluster position + //Vec2 mid = t_on_pc1.add(t_on_pc2).scale(0.5); + + // Build shifted 3D wires + Line3D wire1 = buildShiftedWireLine(h1, t_on_pc1); + Line3D wire2 = buildShiftedWireLine(h2, t_on_pc2); + + Point3D mid3D = midpointOfCommonPerpendicular(wire1, wire2); + if (mid3D == null) { + // If the lines are almost parallel, fall back to 2D midpoint + Vec2 mid2D = t_on_pc1.add(t_on_pc2).scale(0.5); + out.add(new DocaCluster(mid2D.x, mid2D.y, oldCluster.get_Z(), + 1.0, 11, clusterIndex)); + } else { + out.add(new DocaCluster(mid3D.x(), mid3D.y(), mid3D.z(), + 1.0, 11, clusterIndex)); + } + + // compute z using the phi of the two tangent points + //double phi1 = computePhiFromXY(t_on_pc1.x, t_on_pc1.y); + //double phi2 = computePhiFromXY(t_on_pc2.x, t_on_pc2.y); + //double z = computeZ(pc1, pc2, phi1, phi2); + + //out.add(new DocaCluster(mid.x, mid.y, z, + // 0.25, 11, clusterIndex)); + } + + // Safety: if some tangents failed and we ended up with 0 points, + // fall back to a single midpoint with original Z. + if (out.isEmpty()) { + Vec2 mid = c1.add(c2).scale(0.5); + out.add(new DocaCluster(mid.x, mid.y, oldCluster.get_Z(), + 1.0, 11, clusterIndex)); + return out; + } + + return out; + } + + // ===================================================================== + // (1,2) or (2,1) case + // ===================================================================== + + /** + * One precluster has 1 hit (singlePc, singleHits), the other has 2 hits (doublePc, doubleHits). + * singleIsFirst indicates whether in the original Cluster list ordering we had: + * - true : (pc1, pc2) = (singlePc, doublePc) + * - false : (pc1, pc2) = (doublePc, singlePc) + */ + private static List refine12(Cluster oldCluster, + PreCluster singlePc, ArrayList singleHits, + PreCluster doublePc, ArrayList doubleHits, + boolean singleIsFirst, + int clusterIndex) { + + List out = new ArrayList<>(); + //double Proj = Math.cos(Math.toRadians(10)); + if (singleHits.size() != 1 || doubleHits.size() != 2) { + return out; + } + + Hit hs = singleHits.get(0); + Hit h2a = doubleHits.get(0); + Hit h2b = doubleHits.get(1); + + Vec2 cs = new Vec2(hs.getX(), hs.getY()); + //double rs = Math.abs(hs.getDoca()*Proj); + double rs = getProjectedDocaXY(hs); + + + Vec2 c2a = new Vec2(h2a.getX(), h2a.getY()); + Vec2 c2b = new Vec2(h2b.getX(), h2b.getY()); + double costheta = Math.abs(getDirection(h2a).z); + Vec2 c2bp = new Vec2((h2b.getX()-h2a.getX())*costheta+h2a.getX(), (h2b.getY()-h2a.getY())*costheta+h2a.getY()); + double r2a = Math.abs(h2a.getDoca()); + double r2b = Math.abs(h2b.getDoca()); + //double r2a = getProjectedDocaXY(h2a); + //double r2b = getProjectedDocaXY(h2b); + + // 1) internal tangents intersection for the 2-hit precluster + Tangents tans2 = computeTangents(c2a, r2a, c2bp, r2b); + if (!tans2.hasInternal) { + // Fallback: use the average of all three centers + Vec2 avg = cs.add(c2a).add(c2b).scale(1.0 / 3.0); + out.add(new DocaCluster(avg.x, avg.y, oldCluster.get_Z(), + 1.0, singleIsFirst ? 12 : 21, clusterIndex)); + return out; + } + + Vec2 p2p = intersectLines(tans2.internalLines[0], tans2.internalLines[1]); + if (p2p == null) { + Vec2 avg = cs.add(c2a).add(c2b).scale(1.0 / 3.0); + out.add(new DocaCluster(avg.x, avg.y, oldCluster.get_Z(), + 1.0, singleIsFirst ? 12 : 21, clusterIndex)); + return out; + } + Vec2 p2 = new Vec2((p2p.x-h2a.getX())/costheta+h2a.getX(), (p2p.y-h2a.getY())/costheta+h2a.getY()); + + // 2) from p2 draw two tangents to the single-hit doca circle + List tangPoints = tangentPointsFromPointToCircle(p2, cs, rs); + if (tangPoints == null || tangPoints.size() < 2) { + // No tangents: fallback to p2 only + out.add(new DocaCluster(p2.x, p2.y, oldCluster.get_Z(), + 1.0, singleIsFirst ? 12 : 21, clusterIndex)); + return out; + } + Line line_cs_p2 = lineThroughPoints(cs, p2); + + Vec2 t1, t2;//tangPoints.get(0) & c2a on the same side + if (side_ql(tangPoints.get(0), line_cs_p2)*side_ql(c2a, line_cs_p2)>0){ + t1 = tangPoints.get(0); + t2 = tangPoints.get(1); + } + else { + t1 = tangPoints.get(1); + t2 = tangPoints.get(0); + } + + //Vec2 m1 = t1.add(p2).scale(0.5); // midpoint on the single-hit doca circle + //Vec2 m2 = t2.add(p2).scale(0.5); + + // 3) compute z using p2 (double precluster) and m (single precluster) + // with correct ordering of preclusters + //PreCluster pc1, pc2; + //Vec2 p1Geo, p2Geo; + //Vec2 p1Geo2; + //Vec2 p2Geo2; + //if (singleIsFirst) { + // original order: (pc1, pc2) = (singlePc, doublePc) + // pc1 = singlePc; + // pc2 = doublePc; + // p1Geo = t1; // single + // p2Geo = p2; // double + // p1Geo2 = t2; + // p2Geo2 = p2; + + //} else { + // original order: (pc1, pc2) = (doublePc, singlePc) + // pc1 = doublePc; + // pc2 = singlePc; + // p1Geo = p2; // double + // p2Geo = t1; // single + // p2Geo2 = t2; + // p1Geo2 = p2; + + //} + + //double phi1 = computePhiFromXY(p1Geo.x, p1Geo.y); + //double phi2 = computePhiFromXY(p2Geo.x, p2Geo.y); + //double phi1r = computePhiFromXY(p1Geo2.x, p1Geo2.y); + //double phi2r = computePhiFromXY(p2Geo2.x, p2Geo2.y); + //double zRef1 = computeZ(pc1, pc2, phi1, phi2); + //double zRef2 = computeZ(pc1, pc2, phi1r, phi2r); + + // 4) compute weights via distance to the two tangent lines + + Line L1 = tans2.internalLines[0]; + Line L2 = tans2.internalLines[1]; + double d1, d2; + if (side_ql(cs, L1)*side_ql(c2a, L1)<0){ + d1 = distancePointToLine(cs, L1); + d2 = distancePointToLine(cs, L2); + } + else { + d1 = distancePointToLine(cs, L2); + d2 = distancePointToLine(cs, L1); + } + + double r1 = Math.abs(d1 - rs); + double r2 = Math.abs(d2 - rs); + + double w1, w2; + if (r1 + r2 > 1e-9) { + // weight for p2, m + w1 = r2 / (r1 + r2); + w2 = r1 / (r1 + r2); + } else { + w1 = 0.5; + w2 = 0.5; + } + + int pattern = singleIsFirst ? 12 : 21; + + Line3D wires1 = buildShiftedWireLine(hs, t1); + Line3D wires2 = buildShiftedWireLine(hs, t2); + Line3D wired = buildShiftedWireLine(h2a, p2); + + Point3D mid3D1 = midpointOfCommonPerpendicular(wires1, wired); + if (mid3D1 == null) { + // If the lines are almost parallel, fall back to 2D midpoint + Vec2 mid2D1 = t1.add(p2).scale(0.5); + out.add(new DocaCluster(mid2D1.x, mid2D1.y, oldCluster.get_Z(), + 1.0, pattern, clusterIndex)); + } else { + out.add(new DocaCluster(mid3D1.x(), mid3D1.y(), mid3D1.z(), + 1.0, pattern, clusterIndex)); + } + + Point3D mid3D2 = midpointOfCommonPerpendicular(wires2, wired); + if (mid3D2 == null) { + // If the lines are almost parallel, fall back to 2D midpoint + Vec2 mid2D2 = t2.add(p2).scale(0.5); + out.add(new DocaCluster(mid2D2.x, mid2D2.y, oldCluster.get_Z(), + 1.0, pattern, clusterIndex)); + } else { + out.add(new DocaCluster(mid3D2.x(), mid3D2.y(), mid3D2.z(), + 1.0, pattern, clusterIndex)); + } + + // Two DocaCluster points: p2 and m + //out.add(new DocaCluster(m1.x, m1.y, zRef1, + // w1, pattern, clusterIndex)); + //out.add(new DocaCluster(m2.x, m2.y, zRef2, + // w2, pattern, clusterIndex)); + + return out; + } + + // ===================================================================== + // (2,2) case + // ===================================================================== + + private static List refine22(Cluster oldCluster, + PreCluster pc1, ArrayList hits1, + PreCluster pc2, ArrayList hits2, + int clusterIndex) { + + List out = new ArrayList<>(); + //double Proj = Math.cos(Math.toRadians(10)); + if (hits1.size() != 2 || hits2.size() != 2) return out; + + // precluster 1 + Hit h1a = hits1.get(0); + Hit h1b = hits1.get(1); + Vec2 c1a = new Vec2(h1a.getX(), h1a.getY()); + Vec2 c1b = new Vec2(h1b.getX(), h1b.getY()); + double costheta1 = Math.abs(getDirection(h1a).z); + Vec2 c1bp = new Vec2((h1b.getX()-h1a.getX())*costheta1+h1a.getX(), (h1b.getY()-h1a.getY())*costheta1+h1a.getY()); + double r1a = Math.abs(h1a.getDoca()); + double r1b = Math.abs(h1b.getDoca()); + //double r1a = Math.abs(h1a.getDoca()); + //double r1b = Math.abs(h1b.getDoca()); + + // precluster 2 + Hit h2a = hits2.get(0); + Hit h2b = hits2.get(1); + Vec2 c2a = new Vec2(h2a.getX(), h2a.getY()); + Vec2 c2b = new Vec2(h2b.getX(), h2b.getY()); + double costheta2 = Math.abs(getDirection(h2a).z); + Vec2 c2bp = new Vec2((h2b.getX()-h2a.getX())*costheta2+h2a.getX(), (h2b.getY()-h2a.getY())*costheta2+h2a.getY()); + double r2a = Math.abs(h2a.getDoca()); + double r2b = Math.abs(h2b.getDoca()); + //double r2a = getProjectedDocaXY(h2a); + //double r2b = getProjectedDocaXY(h2b); + + Tangents t1 = computeTangents(c1a, r1a, c1bp, r1b); + Tangents t2 = computeTangents(c2a, r2a, c2bp, r2b); + + if (!t1.hasInternal || !t2.hasInternal) { + // Fallback: average of hit centers + Vec2 avg = c1a.add(c1b).add(c2a).add(c2b).scale(0.25); + out.add(new DocaCluster(avg.x, avg.y, oldCluster.get_Z(), + 1.0, 22, clusterIndex)); + return out; + } + + Vec2 p1p = intersectLines(t1.internalLines[0], t1.internalLines[1]); + Vec2 p2p = intersectLines(t2.internalLines[0], t2.internalLines[1]); + if (p1p == null || p2p == null) { + Vec2 avg = c1a.add(c1b).add(c2a).add(c2b).scale(0.25); + out.add(new DocaCluster(avg.x, avg.y, oldCluster.get_Z(), + 1.0, 22, clusterIndex)); + return out; + } + Vec2 p1 = new Vec2((p1p.x-h1a.getX())/costheta1+h1a.getX(), (p1p.y-h1a.getY())/costheta1+h1a.getY()); + Vec2 p2 = new Vec2((p2p.x-h2a.getX())/costheta2+h2a.getX(), (p2p.y-h2a.getY())/costheta2+h2a.getY()); + + Line3D wire1 = buildShiftedWireLine(h1a, p1); + Line3D wire2 = buildShiftedWireLine(h2a, p2); + + Point3D mid3D = midpointOfCommonPerpendicular(wire1, wire2); + if (mid3D == null) { + // If the lines are almost parallel, fall back to 2D midpoint + Vec2 mid2D = p1.add(p2).scale(0.5); + out.add(new DocaCluster(mid2D.x, mid2D.y, oldCluster.get_Z(), + 1.0, 22, clusterIndex)); + } else { + out.add(new DocaCluster(mid3D.x(), mid3D.y(), mid3D.z(), + 1.0, 22, clusterIndex)); + } + + return out; + } + + // ===================================================================== + // geometry helpers + // ===================================================================== + + /** Compute internal and external tangents between two circles. */ + private static Tangents computeTangents(Vec2 c1, double r1, Vec2 c2, double r2) { + Tangents result = new Tangents(); + + Vec2 dc = c2.sub(c1); + double d2 = dc.x * dc.x + dc.y * dc.y; + double d = Math.sqrt(d2); + if (d < 1e-6) { + return result; // concentric: no real tangents + } + + Vec2 ex = new Vec2(dc.x / d, dc.y / d); + Vec2 ey = new Vec2(-ex.y, ex.x); + + // ---- external tangents (same side) ---- + double rExt = (r2 - r1) / d; + if (Math.abs(rExt) <= 1.0 - 1e-9) { + double hExt = Math.sqrt(1.0 - rExt * rExt); + + Vec2 n1_loc = new Vec2(rExt, +hExt); + Vec2 n2_loc = new Vec2(rExt, -hExt); + // normal vector component + Vec2 n1 = new Vec2( + ex.x * n1_loc.x + ey.x * n1_loc.y, + ex.y * n1_loc.x + ey.y * n1_loc.y + ); + Vec2 n2 = new Vec2( + ex.x * n2_loc.x + ey.x * n2_loc.y, + ex.y * n2_loc.x + ey.y * n2_loc.y + ); + //distance between c1 and tangent lines == r1 + double cLoc = r1; + double c1Line = cLoc - (n1.x * c1.x + n1.y * c1.y); + double c2Line = cLoc - (n2.x * c1.x + n2.y * c1.y); + + result.externalLines[0] = new Line(n1, c1Line); + result.externalLines[1] = new Line(n2, c2Line); + result.hasExternal = true; + } + + // ---- internal tangents (opposite side) ---- + double rIntEff = (-r2 - r1) / d; + if (Math.abs(rIntEff) <= 1.0 - 1e-9) { + double hInt = Math.sqrt(1.0 - rIntEff * rIntEff); + + Vec2 n3_loc = new Vec2(rIntEff, +hInt); + Vec2 n4_loc = new Vec2(rIntEff, -hInt); + + Vec2 n3 = new Vec2( + ex.x * n3_loc.x + ey.x * n3_loc.y, + ex.y * n3_loc.x + ey.y * n3_loc.y + ); + Vec2 n4 = new Vec2( + ex.x * n4_loc.x + ey.x * n4_loc.y, + ex.y * n4_loc.x + ey.y * n4_loc.y + ); + + double cLoc = r1; + double c3 = cLoc - (n3.x * c1.x + n3.y * c1.y); + double c4 = cLoc - (n4.x * c1.x + n4.y * c1.y); + + result.internalLines[0] = new Line(n3, c3); + result.internalLines[1] = new Line(n4, c4); + result.hasInternal = true; + } + + return result; + } + + /** Intersection of two lines n1·x + c1 = 0 and n2·x + c2 = 0. */ + private static Vec2 intersectLines(Line l1, Line l2) { + Vec2 n1 = l1.n; + Vec2 n2 = l2.n; + double c1 = l1.c; + double c2 = l2.c; + + double det = n1.x * n2.y - n1.y * n2.x; + if (Math.abs(det) < 1e-9) return null; + + double x = (c2 * n1.y - c1 * n2.y) / det; + double y = (n2.x * c1 - n1.x * c2) / det; + return new Vec2(x, y); + } + + /** Midpoint of the tangent segment between two circles for a given tangent line. */ + private static Vec2 midpointOfTangentSegment(Vec2 c1, double r1, + Vec2 c2, double r2, + Line line) { + Vec2 n = line.n; + double c = line.c; + + double d1 = n.x * c1.x + n.y * c1.y + c; + double d2 = n.x * c2.x + n.y * c2.y + c; + + Vec2 t1 = new Vec2(c1.x - n.x * d1, c1.y - n.y * d1); + Vec2 t2 = new Vec2(c2.x - n.x * d2, c2.y - n.y * d2); + + return t1.add(t2).scale(0.5); + } + + /** Tangent points from point p to circle (center c, radius r). */ + private static List tangentPointsFromPointToCircle(Vec2 p, Vec2 c, double r) { + Vec2 pc = p.sub(c); + double d2 = pc.x * pc.x + pc.y * pc.y; + double d = Math.sqrt(d2); + if (d < r + 1e-9) { + // p inside the circle, no real tangents + return null; + } + + // unit vector from center to point + Vec2 u = new Vec2(pc.x / d, pc.y / d); + + // decomposition: CT along u and perpendicular w + double l = r * r / d; + double h = r * Math.sqrt(1.0 - (r * r) / d2); + + Vec2 w1 = new Vec2(-u.y, u.x); + Vec2 w2 = new Vec2(u.y, -u.x); + + Vec2 t1 = c.add(u.scale(l)).add(w1.scale(h)); + Vec2 t2 = c.add(u.scale(l)).add(w2.scale(h)); + + List res = new ArrayList<>(2); + res.add(t1); + res.add(t2); + return res; + } + + private static Line lineThroughPoints(Vec2 p1, Vec2 p2) { + Vec2 v = p2.sub(p1); + double len = Math.sqrt(v.x * v.x + v.y * v.y); + if (len < 1e-9) { + return new Line(new Vec2(1.0, 0.0), -p1.x); + } + Vec2 n = new Vec2(-v.y / len, v.x / len); + double c = -(n.x * p1.x + n.y * p1.y); + return new Line(n, c); + } + + private static double distancePointToLine(Vec2 p, Line line) { + return Math.abs(line.n.x * p.x + line.n.y * p.y + line.c); + } + + /** Same φ definition as PreCluster: φ = mod(-π/2 - atan2(y,x), 2π). */ + private static double computePhiFromXY(double x, double y) { + double phi = -Math.PI / 2.0 - Math.atan2(y, x); + return mod(phi, 2.0 * Math.PI); + } + + private static double mod(double a, double b) { + return a - b * Math.floor(a / b); + } + + /** Compute Z using the same relation as Cluster constructor but with new φ values. */ + private static double computeZ(PreCluster pre1, PreCluster pre2, + double phi1, double phi2) { + + double theta = Math.toRadians(STEREO_ANGLE_DEG); + double term1 = theta * Math.pow(-1.0, pre1.get_Super_layer() - 1); + double term2 = theta * Math.pow(-1.0, pre2.get_Super_layer() - 1); + double denom = term1 - term2; + + if (Math.abs(denom) < 1e-9) { + // Should not happen with a valid stereo geometry + return 0.0; + } + + return ((phi2 - phi1) / denom) * DELTA_Z - Z_OFFSET; + } +} diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/HelixFit/HelixFitJava.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/HelixFit/HelixFitJava.java index 1b29535d51..1bd83fe934 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/HelixFit/HelixFitJava.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/HelixFit/HelixFitJava.java @@ -1,8 +1,15 @@ package org.jlab.rec.ahdc.HelixFit; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import org.jlab.rec.ahdc.Cluster.DocaCluster; + /** Helix Fit. * * This appears to be some code translation. @@ -14,6 +21,51 @@ public class HelixFitJava { /** \todo What does this method do * \what does its name even mean? */ + + private static class CircleParams { + double xc; + double yc; + double R; + boolean ok; + + CircleParams(boolean ok) { + this.ok = ok; + } + + CircleParams(double xc, double yc, double R) { + this.xc = xc; + this.yc = yc; + this.R = R; + this.ok = true; + } + } + + // circle through origin (0,0), p1, p2 + private static CircleParams circleThroughOrigin(double x1, double y1, + double x2, double y2) { + double det = x1 * y2 - x2 * y1; + if (Math.abs(det) < 1e-6) { + // points are colinear with origin, no unique circle + return new CircleParams(false); + } + double rhs1 = 0.5 * (x1 * x1 + y1 * y1); + double rhs2 = 0.5 * (x2 * x2 + y2 * y2); + + double xc = ( rhs1 * y2 - rhs2 * y1) / det; + double yc = (-rhs1 * x2 + rhs2 * x1) / det; + double R = Math.sqrt(xc * xc + yc * yc); + + if (R < 1e-3) return new CircleParams(false); + return new CircleParams(xc, yc, R); + } + + // wrap angle into [-pi, pi] + private static double wrapPi(double a) { + while (a > Math.PI) a -= 2.0 * Math.PI; + while (a < -Math.PI) a += 2.0 * Math.PI; + return a; + } + void rwsmav(double r[], double a[], double v[], int n) { // Author: Martin Poppe. r[n] = a[n,n]*v[n] @@ -828,6 +880,96 @@ C TAN(LAMBDA) {=DZ/DS}TAN(ANGLE TO X,Y PLANE) } + private HelixFitObject helix_fit_weighted(int PointNum, double[][] szPos, + double[] weights, int fit_track_to_beamline) + { + double Rho, A, B, Phi, Theta, X0, Y0, Z0, DCA, Chi2; + int kMaxHit = 200; + double PI = Math.acos(0.0)*2.0; + + int jj; + double my_phi; + double[] rf = new double[kMaxHit]; + double[] pf = new double[kMaxHit]; + double[] wfi = new double[kMaxHit]; + double[] zf = new double[kMaxHit]; + double[] wzf = new double[kMaxHit]; + + int iopt; + int npt; + double[] vv0 = new double[5]; + double[] ee0 = new double[15]; + double ch2ph = 0.0; + double ch2z = 0.0; + double[] del = new double[kMaxHit]; + double[] delz = new double[kMaxHit]; + + double phi0; + + if (PointNum >= kMaxHit) PointNum = kMaxHit - 1; + npt = PointNum; + + for (jj = 0; jj < npt; jj++) { + // r,phi,z coordinate + rf[jj] = Math.sqrt(szPos[jj][0]*szPos[jj][0] + szPos[jj][1]*szPos[jj][1]); + pf[jj] = Math.atan(szPos[jj][1]/szPos[jj][0]); //phi angle + + if (szPos[jj][1] > 0 && szPos[jj][0] < 0) pf[jj] += PI; + if (szPos[jj][1] < 0 && szPos[jj][0] < 0) pf[jj] += PI; + if (szPos[jj][1] < 0 && szPos[jj][0] > 0) pf[jj] += 2*PI; + if (pf[jj] > 2*PI) pf[jj] -= 2*PI; + + zf[jj] = szPos[jj][2]; + + double w = 1.0; + if (weights != null && jj < weights.length && weights[jj] > 0.0) { + w = weights[jj]; + } + // wfi, wzf are treated as 1/sigma^2; for now we directly use w. + wfi[jj] = w; + wzf[jj] = w; + } + + if (fit_track_to_beamline == 1) { + rf[npt] = 0.0001; + pf[npt] = 0.0; + zf[npt] = 0.0; + wfi[npt] = 1.0; + wzf[npt] = 0.0; // do not constrain z at the beamline point + npt++; + } + + iopt = 1; + rwfthc(npt, rf, pf, wfi, zf, wzf, iopt, vv0, ee0, ch2ph, ch2z, del, delz); + + // --- same reconstruction as original helix_fit --- + Rho = 1.0 / vv0[0]; + phi0 = vv0[2]; + + my_phi = phi0 + PI; + if (vv0[0] < 0.0) my_phi += PI; + if (my_phi > PI) my_phi -= 2.0*PI; + if (my_phi < -PI) my_phi += 2.0*PI; + + A = -Math.sin(my_phi)*(-vv0[3] + Math.abs(1.0/vv0[0])); + B = Math.cos(my_phi)*(-vv0[3] + Math.abs(1.0/vv0[0])); + + Phi = vv0[2]; + if (Phi > PI) Phi -= 2*PI; + if (Phi < -PI) Phi += 2*PI; + + Theta = PI/2.0 - Math.atan(vv0[1]); + + X0 = -Math.sin(my_phi)*(-vv0[3]); + Y0 = Math.cos(my_phi)*(-vv0[3]); + Z0 = vv0[4]; + + DCA = Math.abs(vv0[3]); + Chi2 = (npt > 5) ? (ch2ph + ch2z/(npt - 5)) : 9999.9; + + return new HelixFitObject(Rho, A, B, Phi, Theta, X0, Y0, Z0, DCA, Chi2); + } + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ public HelixFitObject HelixFit(int PointNum, double szPos[][], int fit_track_to_beamline)// double R, double A, double B, //double Phi_deg, double Theta_deg, double Z0, int fit_track_to_beamline ) @@ -855,4 +997,220 @@ public HelixFitObject HelixFit(int PointNum, double szPos[][], int fit_track_to_ return h; } +// Public weighted wrapper (similar to the original HelixFit) + public HelixFitObject HelixFitWeighted(int PointNum, double[][] szPos, + double[] weights, int fit_track_to_beamline) { + + double PI = Math.acos(0.0)*2.0; + + HelixFitObject h = helix_fit_weighted(PointNum, szPos, weights, fit_track_to_beamline); + + double Phi_deg = Math.toDegrees(h.get_Phi()); + if (Phi_deg >= 180) Phi_deg -= 360; + if (Phi_deg < -180) Phi_deg += 360; + + double Theta_deg = Math.toDegrees(h.get_Theta()); + + h.set_Phi(Phi_deg); + h.set_Theta(Theta_deg); + + return h; + } + + public HelixFitObject helix_fit_with_doca_selection(List docaClusters, + int fit_track_to_beamline) { + + HelixFitObject badFit = new HelixFitObject(0,0,0,0,0,0,0,0,0,9999.9); + + if (docaClusters == null || docaClusters.isEmpty()) { + return badFit; + } + + // ---------------------- Set clusterIndex layers ---------------------- + Map> layerMap = new HashMap<>(); + for (DocaCluster dc : docaClusters) { + int layer = dc.get_ClusterIndex(); + layerMap.computeIfAbsent(layer, k -> new ArrayList<>()).add(dc); + } + + if (layerMap.size() < 2) { + // Not enough layers to do inner/outer selection + // fall back to a simple unweighted helix fit with all docaClusters + int n = docaClusters.size(); + double[][] szPos = new double[n][3]; + for (int i = 0; i < n; i++) { + DocaCluster dc = docaClusters.get(i); + szPos[i][0] = dc.get_X(); + szPos[i][1] = dc.get_Y(); + szPos[i][2] = dc.get_Z(); + } + return helix_fit_weighted(n, szPos, null, fit_track_to_beamline); + } + + // sort layers to get inner/outer and in-between + List layers = new ArrayList<>(layerMap.keySet()); + Collections.sort(layers); + int innerLayer = layers.get(0); + int outerLayer = layers.get(layers.size() - 1); + + List innerList = layerMap.get(innerLayer); + List outerList = layerMap.get(outerLayer); + + if (innerList.isEmpty() || outerList.isEmpty()) { + // fall back + int n = docaClusters.size(); + double[][] szPos = new double[n][3]; + for (int i = 0; i < n; i++) { + DocaCluster dc = docaClusters.get(i); + szPos[i][0] = dc.get_X(); + szPos[i][1] = dc.get_Y(); + szPos[i][2] = dc.get_Z(); + } + return helix_fit_weighted(n, szPos, null, fit_track_to_beamline); + } + + // ---------------------- scan all (inner, outer) combinations ---------------------- + double bestChi2 = Double.POSITIVE_INFINITY; + Map bestChoiceByLayer = null; + + for (DocaCluster dcIn : innerList) { + double x1 = dcIn.get_X(); + double y1 = dcIn.get_Y(); + double z1 = dcIn.get_Z(); + + for (DocaCluster dcOut : outerList) { + double x2 = dcOut.get_X(); + double y2 = dcOut.get_Y(); + double z2 = dcOut.get_Z(); + + // circle through origin and the two docaClusters + CircleParams circ = circleThroughOrigin(x1, y1, x2, y2); + if (!circ.ok) continue; + + double xc = circ.xc; + double yc = circ.yc; + double R = circ.R; + + // angles around circle center for the two endpoints + double phi1 = Math.atan2(y1 - yc, x1 - xc); + double phi2 = Math.atan2(y2 - yc, x2 - xc); + double dphi21 = wrapPi(phi2 - phi1); + if (Math.abs(dphi21) < 1e-4) continue; + + // For this trial helix, compute chi2: + // for each layer choose the docaCluster with minimal weighted 3D residual. + double chi2 = 0.0; + Map choiceThisPair = new HashMap<>(); + + for (int layer : layers) { + List candList = layerMap.get(layer); + if (candList == null || candList.isEmpty()) { + chi2 = Double.POSITIVE_INFINITY; + break; + } + + double bestLayerValue = Double.POSITIVE_INFINITY; + DocaCluster bestLayerDc = null; + + for (DocaCluster dc : candList) { + double x = dc.get_X(); + double y = dc.get_Y(); + double z = dc.get_Z(); + + double phi = Math.atan2(y - yc, x - xc); + double dphi = wrapPi(phi - phi1); + double frac = dphi / dphi21; // s / s_total + + // predicted point on circle (same phi) + double xPred = xc + R * Math.cos(phi); + double yPred = yc + R * Math.sin(phi); + // linear z(s) + double zPred = z1 + (z2 - z1) * frac; + + double dx = x - xPred; + double dy = y - yPred; + double dz = z - zPred; + double res2 = dx * dx + dy * dy + dz * dz; + + double w = dc.get_Weight(); + if (w <= 0) w = 1.0; + + double value = w * res2; + + if (value < bestLayerValue) { + bestLayerValue = value; + bestLayerDc = dc; + } + } + + if (bestLayerDc == null) { + chi2 = Double.POSITIVE_INFINITY; + break; + } + + chi2 += bestLayerValue; + choiceThisPair.put(layer, bestLayerDc); + } + + if (chi2 < bestChi2) { + bestChi2 = chi2; + bestChoiceByLayer = choiceThisPair; + } + } + } + + // ---------------------- if no reasonable combination,return ---------------------- + if (bestChoiceByLayer == null || bestChoiceByLayer.isEmpty()) { + int n = docaClusters.size(); + double[][] szPos = new double[n][3]; + for (int i = 0; i < n; i++) { + DocaCluster dc = docaClusters.get(i); + szPos[i][0] = dc.get_X(); + szPos[i][1] = dc.get_Y(); + szPos[i][2] = dc.get_Z(); + } + return helix_fit_weighted(n, szPos, null, fit_track_to_beamline); + } + + // ---------------------- 4 points from best combination,then use original helix_fit ---------------------- + List bestLayers = new ArrayList<>(bestChoiceByLayer.keySet()); + Collections.sort(bestLayers); + + int nPoints = bestLayers.size(); + double[][] szPosSel = new double[nPoints][3]; + + for (int i = 0; i < nPoints; i++) { + int layer = bestLayers.get(i); + DocaCluster dc = bestChoiceByLayer.get(layer); + szPosSel[i][0] = dc.get_X(); + szPosSel[i][1] = dc.get_Y(); + szPosSel[i][2] = dc.get_Z(); + } + + // weights = null => all weights = 1.0 inside helix_fit_weighted + + double PI=Math.acos(0.0)*2; + //double Rho=0,Phi=0,Theta=0,X0=0,Y0=0,DCA=0,Chi2=0; + double Phi_deg; + double Theta_deg; + + HelixFitObject h = helix_fit_weighted(nPoints, szPosSel, null, fit_track_to_beamline);; + + Phi_deg=Math.toDegrees(h.get_Phi()); + if(Phi_deg >= 180){ + Phi_deg -= 360; + } + if(Phi_deg < -180){ + Phi_deg += 360; + } + Theta_deg=Math.toDegrees(h.get_Theta()); + h.set_Phi(Phi_deg); + h.set_Theta(Theta_deg); + + return h; + + } + } + + diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KalmanFilter.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KalmanFilter.java index 4d2840ee73..272857efbd 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KalmanFilter.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/KalmanFilter/KalmanFilter.java @@ -29,21 +29,23 @@ */ public class KalmanFilter { + public KalmanFilter(PDGParticle particle, int Niter) {this.particle = particle; this.Niter = Niter;} + public KalmanFilter(ArrayList tracks, DataEvent event, final double magfield, boolean IsMC) {propagation(tracks, event, magfield, IsMC);} - private final int Niter = 40; // number of iterations for the Kalman Filter + private PDGParticle particle; + private int Niter = 40; // number of iterations for the Kalman Filter private boolean IsVtxDefined = false; // implemented but not used yet private double[] vertex_resolutions = {0.09, 1e10}; // {error in r squared in mm^2, error in z squared in mm^2} // mm, CLAS and AHDC don't necessary have the same alignement (ZERO), this parameter may be subject to calibration private double clas_alignement = -54; - private void propagation(ArrayList tracks, DataEvent event, final double magfield, boolean IsMC) { + public void propagation(ArrayList tracks, DataEvent event, final double magfield, boolean IsMC) { try { double vz_constraint = 0; // to be linked to the electron vertex // Initialization --------------------------------------------------------------------- - final PDGParticle proton = PDGDatabase.getParticleById(2212); final int numberOfVariables = 6; final double tesla = 0.001; final double[] B = {0.0, 0.0, magfield / 10 * tesla}; @@ -74,10 +76,7 @@ private void propagation(ArrayList tracks, DataEvent event, final double } // Loop over tracks - int trackId = 0; for (Track track : tracks) { - trackId++; - track.set_trackId(trackId); // Initialize state vector double x0 = 0.0; double y0 = 0.0; @@ -93,7 +92,7 @@ private void propagation(ArrayList tracks, DataEvent event, final double // Start propagation Stepper stepper = new Stepper(y); - RungeKutta4 RK4 = new RungeKutta4(proton, numberOfVariables, B); + RungeKutta4 RK4 = new RungeKutta4(particle, numberOfVariables, B); Propagator propagator = new Propagator(RK4); // Initialization of the Kalman Fitter @@ -139,7 +138,7 @@ private void propagation(ArrayList tracks, DataEvent event, final double RealVector x_out = TrackFitter.getStateEstimationVector(); - track.setPositionAndMomentumForKF(x_out); + track.setPositionAndMomentumVec(x_out.toArray()); // Post fit propagation (no correction) to set the residuals KFitter PostFitPropagator = new KFitter(TrackFitter.getStateEstimationVector(), initialErrorCovariance, new Stepper(TrackFitter.getStateEstimationVector().toArray()), new Propagator(RK4), materialHashMap); @@ -158,7 +157,6 @@ private void propagation(ArrayList tracks, DataEvent event, final double double sum_residuals = 0; double chi2 = 0; for (Hit hit : AHDC_hits) { - hit.setTrackId(trackId); sum_adc += hit.getADC(); sum_residuals += hit.getResidual(); chi2 += Math.pow(hit.getResidual(),2)/hit.get_MeasurementNoise().getEntry(0,0); @@ -166,9 +164,9 @@ private void propagation(ArrayList tracks, DataEvent event, final double track.set_sum_adc(sum_adc); track.set_sum_residuals(sum_residuals); track.set_chi2(chi2/(AHDC_hits.size()-3)); - track.set_p_drift_kf(p_drift); - track.set_dEdx_kf(sum_adc/s); - track.set_path_kf(s); + track.set_p_drift(p_drift); + track.set_dEdx(sum_adc/s); + track.set_path(s); track.set_n_hits(AHDC_hits.size()); }//end of loop on track candidates } catch (Exception e) { @@ -176,5 +174,6 @@ private void propagation(ArrayList tracks, DataEvent event, final double //System.out.println("======> Kalman Filter Error"); } } - + void set_Niter(int Niter) {this.Niter = Niter;} + void set_particle(PDGParticle particle) {this.particle = particle;} } diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Track/Track.java b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Track/Track.java index 5d140c3c45..e9944b7846 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Track/Track.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Track/Track.java @@ -35,16 +35,7 @@ public class Track { private double dEdx = 0; ///< deposited energy per path length (adc/mm) private double p_drift = 0; ///< momentum in the drift region (MeV) private double path = 0; ///< length of the track (mm) - // AHDC::kftrack - private double x0_kf = 0; - private double y0_kf = 0; - private double z0_kf = 0; - private double px0_kf = 0; - private double py0_kf = 0; - private double pz0_kf = 0; - private double dEdx_kf = 0; ///< deposited energy per path length (adc/mm) - private double p_drift_kf = 0; ///< momentum in the drift region (MeV) - private double path_kf = 0; ///< length of the track (mm) + // AHDC::aiprediction private int predicted_ATOF_sector = -1; private int predicted_ATOF_layer = -1; @@ -93,15 +84,6 @@ public void setPositionAndMomentumVec(double[] x) { this.pz0 = x[5]; } - public void setPositionAndMomentumForKF(RealVector x) { - this.x0_kf = x.getEntry(0); - this.y0_kf = x.getEntry(1); - this.z0_kf = x.getEntry(2); - this.px0_kf = x.getEntry(3); - this.py0_kf = x.getEntry(4); - this.pz0_kf = x.getEntry(5); - } - private void generateHitList() { for (Cluster cluster : _Clusters) { for (PreCluster preCluster : cluster.get_PreClusters_list()) { @@ -174,31 +156,6 @@ public double get_pz() { return pz0; } - public double getX0_kf() { - return x0_kf; - } - - public double getY0_kf() { - return y0_kf; - } - - public double getZ0_kf() { - return z0_kf; - } - - public double getPx0_kf() { - return px0_kf; - } - - public double getPy0_kf() { - return py0_kf; - } - - public double getPz0_kf() { - return pz0_kf; - } - - // Same for Track and KFTrack public void set_trackId(int _trackId) { trackId = _trackId; // set trackId for clusters @@ -209,6 +166,10 @@ public void set_trackId(int _trackId) { for(InterCluster interCluster : this._InterClusters) { interCluster.setTrackId(_trackId); } + // set trackId for hits + for (Hit hit : this.hits) { + hit.setTrackId(_trackId); + } } public void set_n_hits(int _n_hits) { n_hits = _n_hits;} public void set_sum_adc(int _sum_adc) { sum_adc = _sum_adc;} @@ -226,14 +187,6 @@ public void set_trackId(int _trackId) { public double get_dEdx() {return dEdx;} public double get_p_drift() {return p_drift;} public double get_path() {return path;} - - // AHDC::kftrack - public void set_dEdx_kf(double _dEdx_kf) { dEdx_kf = _dEdx_kf;} - public void set_p_drift_kf(double _p_drift_kf) { p_drift_kf = _p_drift_kf;} - public void set_path_kf(double _path_kf) { path_kf = _path_kf;} - public double get_dEdx_kf() {return dEdx_kf;} - public double get_p_drift_kf() {return p_drift_kf;} - public double get_path_kf() {return path_kf;} // AHDC::aiprediction public void set_predicted_ATOF_sector(int s) {predicted_ATOF_sector = s;} diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/ModelPrePID.java b/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/ModelPrePID.java new file mode 100644 index 0000000000..4f91f4deed --- /dev/null +++ b/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/ModelPrePID.java @@ -0,0 +1,104 @@ +package org.jlab.rec.alert.AIPID; + +import ai.djl.MalformedModelException; +import ai.djl.inference.Predictor; +import ai.djl.ndarray.NDArray; +import ai.djl.ndarray.NDList; +import ai.djl.ndarray.NDManager; +import ai.djl.ndarray.types.Shape; +import ai.djl.repository.zoo.Criteria; +import ai.djl.repository.zoo.ModelNotFoundException; +import ai.djl.repository.zoo.ZooModel; +import ai.djl.training.util.ProgressBar; +import ai.djl.translate.TranslateException; +import ai.djl.translate.Translator; +import ai.djl.translate.TranslatorContext; + +import org.jlab.utils.CLASResources; + +import java.io.IOException; +import java.nio.file.Paths; +import java.util.logging.Logger; + +public class ModelPrePID { + + static final Logger LOGGER = Logger.getLogger(ModelPrePID.class.getName()); + // Must match training class order + private static final int[] CLASS_IDS = new int[]{2212, 45, 46, 47, 49}; + + private final ZooModel model; + + public ModelPrePID() { + + Translator my_translator = new Translator<>() { + + @Override + public NDList processInput(TranslatorContext ctx, float[] floats) { + NDManager manager = ctx.getNDManager(); + + // IMPORTANT: model expects (batch, 23). Provide (1, 23). + NDArray x = manager.create(floats, new Shape(1, 23)); + return new NDList(x); + } + + @Override + public float[] processOutput(TranslatorContext ctx, NDList ndList) { + NDArray logits = ndList.get(0); // (1,5) + NDArray probs = logits.softmax(1); // (1,5) + + float[] p = probs.toFloatArray(); // length 5 (row-major) + + // argmax + int bestIdx = 0; + float best = p[0]; + for (int k = 1; k < 5; k++) { + if (p[k] > best) { best = p[k]; bestIdx = k; } + } + int prepid = CLASS_IDS[bestIdx]; + + // Return: prepid + probabilities in fixed class order + return new float[]{ + (float) prepid, + p[0], p[1], p[2], p[3], p[4] + }; + } + }; + + System.setProperty("ai.djl.pytorch.num_interop_threads", "1"); + System.setProperty("ai.djl.pytorch.num_threads", "1"); + System.setProperty("ai.djl.pytorch.graph_optimizer", "false"); + + String path = CLASResources.getResourcePath("etc/data/nnet/rg-l/model_PrePID/"); + + Criteria criteria = Criteria.builder() + .setTypes(float[].class, float[].class) + .optModelPath(Paths.get(path)) + .optEngine("PyTorch") + .optTranslator(my_translator) + .optProgress(new ProgressBar()) + .build(); + + try { + model = criteria.loadModel(); + } catch (IOException | ModelNotFoundException | MalformedModelException e) { + throw new RuntimeException(e); + } + } + + public ZooModel getModel() { + return model; + } + + /** Returns float[]{prepid} where prepid in {2212,45,46,47,49}. + * @param features23 + * @return + * @throws ai.djl.translate.TranslateException */ + public float[] prediction(float[] features23) throws TranslateException { + if (features23 == null || features23.length != 23) { + LOGGER.warning("PrePID input must be float[23]"); + return null; + } + Predictor predictor = model.newPredictor(); + return predictor.predict(features23); + } +} diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/PrePIDResult.java b/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/PrePIDResult.java new file mode 100644 index 0000000000..cf50e4d665 --- /dev/null +++ b/reconstruction/alert/src/main/java/org/jlab/rec/alert/AIPID/PrePIDResult.java @@ -0,0 +1,19 @@ +package org.jlab.rec.alert.AIPID; + +public class PrePIDResult { + public final int trackid; + public final int clusterid; + public final int prepid; + public final float p2212, p45, p46, p47, p49; + + public PrePIDResult(int trackid, int clusterid, int prepid, float p2212, float p45, float p46, float p47, float p49) { + this.trackid = trackid; + this.clusterid = clusterid; + this.prepid = prepid; + this.p2212 = p2212; + this.p45 = p45; + this.p46 = p46; + this.p47 = p47; + this.p49 = p49; + } +} diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/alert/banks/RecoBankWriter.java b/reconstruction/alert/src/main/java/org/jlab/rec/alert/banks/RecoBankWriter.java index 3d654b7433..a6c8c756b5 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/alert/banks/RecoBankWriter.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/alert/banks/RecoBankWriter.java @@ -1,9 +1,11 @@ package org.jlab.rec.alert.banks; import java.util.ArrayList; +import java.util.List; import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.alert.projections.TrackProjection; +//import org.jlab.rec.alert.AIpid.PIDResult; import ai.djl.util.Pair; @@ -89,6 +91,31 @@ public int appendTrackMatchingAIBank(DataEvent event, ArrayList results) { + + DataBank bank = event.createBank("ALERT::ai:prepid", results.size()); + if (bank == null) { + System.err.println("COULD NOT CREATE A ALERT::ai:prepid BANK!!!!!!"); + return 1; + } + + for (int i = 0; i < results.size(); i++) { + org.jlab.rec.alert.AIPID.PrePIDResult r = results.get(i); + bank.setInt("trackid", i, r.trackid); + bank.setInt("clusterid", i, r.clusterid); + bank.setInt("prepid", i, r.prepid); + bank.setFloat("p2212", i, r.p2212); + bank.setFloat("p45", i, r.p45); + bank.setFloat("p46", i, r.p46); + bank.setFloat("p47", i, r.p47); + bank.setFloat("p49", i, r.p49); + } + + event.appendBank(bank); + return 0; + } + /** * @param args the command line arguments diff --git a/reconstruction/alert/src/main/java/org/jlab/service/ahdc/AHDCEngine.java b/reconstruction/alert/src/main/java/org/jlab/service/ahdc/AHDCEngine.java index b7cbb1b01c..2ecda96c28 100644 --- a/reconstruction/alert/src/main/java/org/jlab/service/ahdc/AHDCEngine.java +++ b/reconstruction/alert/src/main/java/org/jlab/service/ahdc/AHDCEngine.java @@ -10,12 +10,13 @@ import org.jlab.rec.ahdc.Banks.RecoBankWriter; import org.jlab.rec.ahdc.Cluster.Cluster; import org.jlab.rec.ahdc.Cluster.ClusterFinder; +import org.jlab.rec.ahdc.Cluster.DocaClusterRefiner; +import org.jlab.rec.ahdc.Cluster.DocaCluster; import org.jlab.rec.ahdc.Distance.Distance; import org.jlab.rec.ahdc.HelixFit.HelixFitJava; import org.jlab.rec.ahdc.Hit.Hit; import org.jlab.rec.ahdc.Hit.HitReader; import org.jlab.rec.ahdc.HoughTransform.HoughTransform; -import org.jlab.rec.ahdc.KalmanFilter.KalmanFilter; import org.jlab.rec.ahdc.KalmanFilter.MaterialMap; import org.jlab.rec.ahdc.PreCluster.PreCluster; import org.jlab.rec.ahdc.PreCluster.PreClusterFinder; @@ -100,7 +101,7 @@ else if (Objects.equals(this.getEngineConfigString("Mode"), ModeTrackFinding.CV_ this.getConstantsManager().setVariation("default"); - this.registerOutputBank("AHDC::hits","AHDC::preclusters","AHDC::clusters","AHDC::track","AHDC::kftrack","AHDC::mc","AHDC::ai:prediction"); + this.registerOutputBank("AHDC::hits","AHDC::preclusters","AHDC::clusters","AHDC::track","AHDC::mc","AHDC::ai:prediction"); return true; } @@ -110,8 +111,6 @@ else if (Objects.equals(this.getEngineConfigString("Mode"), ModeTrackFinding.CV_ @Override public boolean processDataEvent(DataEvent event) { - double magfield = 50.0; // what is this? The full magnetic field strength in kGauss (factor * 50kGauss) - if(event.hasBank("MC::Particle")) simulation = true; ahdcExtractor.update(30, null, event, "AHDC::wf", "AHDC::adc"); @@ -119,7 +118,6 @@ public boolean processDataEvent(DataEvent event) { if (event.hasBank("RUN::config")) { DataBank bank = event.getBank("RUN::config"); int newRun = bank.getInt("run", 0); - float magfieldfactor = bank.getFloat("solenoid", 0); if (newRun <= 0) { LOGGER.warning("AHDCEngine: got run <= 0 in RUN::config, skipping event."); return false; @@ -130,10 +128,6 @@ public boolean processDataEvent(DataEvent event) { CalibrationConstantsLoader.Load(newRun, this.getConstantsManager()); Run = newRun; } - - /// What is this? The field value in the RUN::config bank is a scaling factor (between -1 and 1) of the full field - /// The kalman filter use the field in kG not Tesla - magfield = 50 * magfieldfactor; } @@ -222,26 +216,22 @@ else if (modeTrackFinding == ModeTrackFinding.CV_Hough) { //AHDC_Tracks.add(new Track(AHDC_Hits)); // V) Global fit + int trackid = 0; + ArrayList all_docaClusters = new ArrayList<>(); for (Track track : AHDC_Tracks) { - int nbOfPoints = track.get_Clusters().size(); - - double[][] szPos = new double[nbOfPoints][3]; - - int j = 0; - for (Cluster cluster : track.get_Clusters()) { - szPos[j][0] = cluster.get_X(); - szPos[j][1] = cluster.get_Y(); - szPos[j][2] = cluster.get_Z(); - j++; + trackid++; + track.set_trackId(trackid); + List originalClusters = track.get_Clusters(); + ArrayList docaClusters = DocaClusterRefiner.buildRefinedClusters(originalClusters); + all_docaClusters.addAll(docaClusters); + if (docaClusters == null || docaClusters.size() < 3) { + // not enough points, skip helix fit + continue; } - HelixFitJava h = new HelixFitJava(); - track.setPositionAndMomentum(h.HelixFit(nbOfPoints, szPos, 1)); + track.setPositionAndMomentum(h.helix_fit_with_doca_selection(docaClusters, 1)); } - // VI) Kalman Filter - KalmanFilter kalmanFitter = new KalmanFilter(AHDC_Tracks, event, magfield, simulation); - // VII) Write bank RecoBankWriter writer = new RecoBankWriter(); @@ -253,7 +243,7 @@ else if (modeTrackFinding == ModeTrackFinding.CV_Hough) { } DataBank recoClusterBank = writer.fillClustersBank(event, AHDC_Clusters); DataBank recoTracksBank = writer.fillAHDCTrackBank(event, AHDC_Tracks); - DataBank recoKFTracksBank = writer.fillAHDCKFTrackBank(event, AHDC_Tracks); + DataBank clustersDocaBank = writer.fillAHDCDocaClustersBank(event, all_docaClusters); ArrayList all_interclusters = new ArrayList<>(); for (Track track : AHDC_Tracks) { @@ -262,12 +252,13 @@ else if (modeTrackFinding == ModeTrackFinding.CV_Hough) { DataBank recoInterClusterBank = writer.fillInterClusterBank(event, all_interclusters); // DataBank AIPredictionBanks = writer.fillAIPrediction(event, predictions); + //event.removeBanks("AHDC::hits","AHDC::preclusters","AHDC::clusters","AHDC::track","AHDC::kftrack","AHDC::mc","AHDC::ai:prediction"); event.appendBank(recoHitsBank); event.appendBank(recoPreClusterBank); event.appendBank(recoClusterBank); event.appendBank(recoTracksBank); - event.appendBank(recoKFTracksBank); event.appendBank(recoInterClusterBank); + event.appendBank(clustersDocaBank); // event.appendBank(AIPredictionBanks); if (simulation) { diff --git a/reconstruction/alert/src/main/java/org/jlab/service/alert/ALERTEngine.java b/reconstruction/alert/src/main/java/org/jlab/service/alert/ALERTEngine.java index a5cdc2518e..5465ec29d8 100644 --- a/reconstruction/alert/src/main/java/org/jlab/service/alert/ALERTEngine.java +++ b/reconstruction/alert/src/main/java/org/jlab/service/alert/ALERTEngine.java @@ -1,9 +1,13 @@ package org.jlab.service.alert; +import ai.djl.repository.zoo.ZooModel; +import ai.djl.translate.TranslateException; +import java.io.File; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicInteger; -import java.io.File; +import org.jlab.clas.reco.ReconstructionEngine; +import org.jlab.clas.swimtools.Swim; import org.jlab.detector.calib.utils.DatabaseConstantProvider; import org.jlab.geom.base.Detector; import org.jlab.geom.detector.alert.ATOF.AlertTOFFactory; @@ -11,17 +15,24 @@ import org.jlab.io.base.DataEvent; import org.jlab.io.hipo.HipoDataSource; import org.jlab.io.hipo.HipoDataSync; - -import org.jlab.clas.reco.ReconstructionEngine; -import org.jlab.clas.swimtools.Swim; - import org.jlab.rec.alert.TrackMatchingAI.ModelTrackMatching; - +import org.jlab.rec.alert.AIPID.ModelPrePID; import org.jlab.rec.alert.banks.RecoBankWriter; import org.jlab.rec.alert.projections.TrackProjector; import org.jlab.rec.atof.hit.ATOFHit; +import org.jlab.rec.ahdc.KalmanFilter.KalmanFilter; +import org.jlab.rec.ahdc.Hit.Hit; +import org.jlab.geom.detector.alert.AHDC.AlertDCDetector; +import org.jlab.geom.detector.alert.AHDC.AlertDCFactory; +import org.jlab.rec.ahdc.Track.Track; +import org.jlab.clas.pdg.PDGDatabase; +import org.jlab.clas.pdg.PDGParticle; +import java.util.logging.Logger; + + import ai.djl.util.Pair; +import org.jlab.rec.alert.AIPID.PrePIDResult; /** @@ -45,8 +56,9 @@ public class ALERTEngine extends ReconstructionEngine { * */ private RecoBankWriter rbc; - + static final Logger LOGGER = Logger.getLogger(ModelPrePID.class.getName()); Detector ATOF; // ALERT ATOF detector + private AlertDCDetector AHDC; // ALERT AHDC detector /** * Current run number being processed. @@ -57,6 +69,7 @@ public class ALERTEngine extends ReconstructionEngine { private double b; //Magnetic field private ModelTrackMatching modelTrackMatching; + private ModelPrePID modelPrePID; public void setB(double B) { this.b = B; @@ -83,10 +96,12 @@ public boolean init() { rbc = new RecoBankWriter(); modelTrackMatching = new ModelTrackMatching(); + modelPrePID = new ModelPrePID(); AlertTOFFactory factory = new AlertTOFFactory(); DatabaseConstantProvider cp = new DatabaseConstantProvider(11, "default"); ATOF = factory.createDetectorCLAS(cp); + AHDC = (new AlertDCFactory()).createDetectorCLAS(new DatabaseConstantProvider()); if(this.getEngineConfigString("Mode")!=null) { //if (Objects.equals(this.getEngineConfigString("Mode"), Mode.AI_Track_Finding.name())) @@ -116,9 +131,9 @@ public boolean processDataEvent(DataEvent event) { return true; } - DataBank bank = event.getBank("RUN::config"); + DataBank runBank = event.getBank("RUN::config"); - int newRun = bank.getInt("run", 0); + int newRun = runBank.getInt("run", 0); if (newRun == 0) { return true; } @@ -214,6 +229,164 @@ public boolean processDataEvent(DataEvent event) { } } rbc.appendTrackMatchingAIBank(event, matched_ATOF_hit_id); + + // --------------------------------------------------------------------------------------- + // PrePID using AI (AHDC::track + ATOF::clusters matched via ALERT::ai:projections) + // --------------------------------------------------------------------------------------- + if (event.hasBank("ALERT::ai:projections") && event.hasBank("AHDC::track") && event.hasBank("ATOF::hits")) { + + DataBank bankProj = event.getBank("ALERT::ai:projections"); + DataBank bankTrk = event.getBank("AHDC::track"); + DataBank bankHit = event.getBank("ATOF::hits"); + + ArrayList prepid_results = new ArrayList<>(); + + for (int i = 0; i < bankProj.rows(); i++) { + + int trackid = bankProj.getInt("trackid", i); + int hitid = bankProj.getInt("matched_atof_hit_id", i); // TODO: Fix to hit_id instead of clusterid + + // TODO: refactor this to replace this with single line + int trkRow = -1; + for (int r = 0; r < bankTrk.rows(); r++) { + if (bankTrk.getInt("trackid", r) == trackid) { trkRow = r; break; } + } + if (trkRow < 0) continue; + + int hitRow = -1; + for (int r = 0; r < bankHit.rows(); r++) { + if (bankHit.getInt("id", r) == hitid) { hitRow = r; break; } + } + if (hitRow < 0) continue; + + // Build feature vector float[23] in the exact training order + float[] x = new float[23]; + + // AHDC::track (13) + x[0] = bankTrk.getFloat("x", trkRow); + x[1] = bankTrk.getFloat("y", trkRow); + x[2] = bankTrk.getFloat("z", trkRow); + x[3] = bankTrk.getFloat("px", trkRow); + x[4] = bankTrk.getFloat("py", trkRow); + x[5] = bankTrk.getFloat("pz", trkRow); + x[6] = bankTrk.getInt("n_hits", trkRow); + x[7] = bankTrk.getInt("sum_adc", trkRow); + x[8] = bankTrk.getFloat("path", trkRow); + x[9] = bankTrk.getFloat("dEdx", trkRow); + x[10] = bankTrk.getFloat("p_drift", trkRow); + x[11] = bankTrk.getFloat("chi2", trkRow); + x[12] = bankTrk.getFloat("sum_residuals", trkRow); + + /*// ATOF::clusters (10) + x[13] = bankClu.getInt("n_bar", cluRow); + x[14] = bankClu.getInt("n_wedge", cluRow); + x[15] = bankClu.getFloat("time", cluRow); + x[16] = bankClu.getFloat("x", cluRow); + x[17] = bankClu.getFloat("y", cluRow); + x[18] = bankClu.getFloat("z", cluRow); + x[19] = bankClu.getFloat("energy", cluRow); + x[20] = bankClu.getFloat("pathlength", cluRow); + x[21] = bankClu.getFloat("inpathlength", cluRow); + x[22] = bankClu.getInt("projID", cluRow);*/ + + // ATOF::Hits (Temporarily updating to the same 10 slots as ATOF Clusters would have if it worked) + x[13] = 0f; + x[14] = 0f; + x[15] = bankHit.getFloat("time", hitRow); + x[16] = bankHit.getFloat("x", hitRow); + x[17] = bankHit.getFloat("y", hitRow); + x[18] = bankHit.getFloat("z", hitRow); + x[19] = bankHit.getFloat("energy", hitRow); + x[20] = 0f; + x[21] = 0f; + x[22] = 0f; + + try { + float[] pred = modelPrePID.prediction(x); + int prepid = (int) pred[0]; + prepid_results.add(new PrePIDResult(trackid, hitid, prepid, pred[1], pred[2], pred[3], pred[4], pred[5])); + } catch (TranslateException ex) { + LOGGER.warning(() -> "Exception in ALERTEngine PrePID: " + ex); + } + } + + rbc.appendPrePIDBank(event, prepid_results); + } + + + + /////////////////////////////////////////// + /// Kalmam Filter + /// /////////////////////////////////////// + + // read the list of tracks/hits from the banks AHDC::track and AHDC::hits + if (!event.hasBank("AHDC::track")) {return false;} + DataBank trackBank = event.getBank("AHDC::track"); + DataBank hitBank = event.getBank("AHDC::hits"); + ArrayList AHDC_tracks = new ArrayList<>(); + for (int row = 0; row < trackBank.rows(); row++) { + int trackid = trackBank.getInt("trackid", row); + ArrayList AHDC_hits = new ArrayList<>(); + for (int hit_row = 0; hit_row < hitBank.rows(); hit_row++) { + if(trackid == hitBank.getInt("trackid", hit_row)) { + int id = hitBank.getShort("id", hit_row); + int superlayer = hitBank.getByte("superlayer", hit_row); + int layer = hitBank.getByte("layer", hit_row); + int wire = hitBank.getInt("wire", hit_row); + int adc = hitBank.getInt("adc", hit_row); + double doca = hitBank.getDouble("doca", hit_row); + double time = hitBank.getDouble("time", hit_row); + double tot = hitBank.getDouble("timeOverThreshold", hit_row); + // warning : adc is the calibrated one, we need the adc for the Kalman filter + Hit hit = new Hit(id, superlayer, layer, wire, doca, adc, time); + hit.setWirePosition(AHDC); + hit.setTrackId(trackid); + hit.setADC(adc); + hit.setToT(tot); + AHDC_hits.add(hit); + } + } + AHDC_tracks.add(new Track(AHDC_hits)); + // Initialise the position and the momentum using the information of the AHDC::track + // position : mm + // momentum : MeV + double x = trackBank.getFloat("x", row); + double y = trackBank.getFloat("y", row); + double z = trackBank.getFloat("z", row); + double px = trackBank.getFloat("px", row); + double py = trackBank.getFloat("py", row); + double pz = trackBank.getFloat("pz", row); + double[] vec = {x, y, z, px, py, pz}; + AHDC_tracks.get(row).setPositionAndMomentumVec(vec); + AHDC_tracks.get(row).set_trackId(trackid); + } + // intialise the Kalman Filter + double magfieldfactor = runBank.getFloat("solenoid", 0); + double magfield = 50*magfieldfactor; + boolean IsMC = event.hasBank("MC::Particle"); + PDGParticle proton = PDGDatabase.getParticleById(2212); + int Niter = 40; + KalmanFilter KF = new KalmanFilter(proton, Niter); + /////////////////////////////////////////////////////// + // first propagation : each AHDC_tracks will be fitted + /////////////////////////////////////////////////////// + KF.propagation(AHDC_tracks, event, magfield, IsMC); + ///////////////////////////////////////////// + // write the AHDC::kftrack bank in the event + ///////////////////////////////////////////// + org.jlab.rec.ahdc.Banks.RecoBankWriter ahdc_writer = new org.jlab.rec.ahdc.Banks.RecoBankWriter(); + DataBank recoKFTracksBank = ahdc_writer.fillAHDCKFTrackBank(event, AHDC_tracks); + event.appendBank(recoKFTracksBank); + // update the AHDC::hits bank : fill the residuals + event.removeBank("AHDC::hits"); + ArrayList AHDC_hits = new ArrayList<>(); + for (Track track : AHDC_tracks) { + AHDC_hits.addAll(track.getHits()); + } + DataBank recoKFHitsBank = ahdc_writer.fillAHDCHitsBank(event, AHDC_hits); + event.appendBank(recoKFHitsBank); // remark: only hits assocuated to a track are saved + + return true; } diff --git a/reconstruction/band/pom.xml b/reconstruction/band/pom.xml index 5f0d743bd6..7a6d067ff2 100644 --- a/reconstruction/band/pom.xml +++ b/reconstruction/band/pom.xml @@ -4,35 +4,35 @@ org.jlab.clas12.detector clas12detector-band - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/bg/pom.xml b/reconstruction/bg/pom.xml index b003f52081..e9f8e32378 100644 --- a/reconstruction/bg/pom.xml +++ b/reconstruction/bg/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-bg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -18,19 +18,19 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/calib/pom.xml b/reconstruction/calib/pom.xml index 45f08aad8d..231af02812 100644 --- a/reconstruction/calib/pom.xml +++ b/reconstruction/calib/pom.xml @@ -6,13 +6,13 @@ org.jlab.clas12.detector clas12detector-calib - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -20,19 +20,19 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/cnd/pom.xml b/reconstruction/cnd/pom.xml index 8f0f0784f3..e939fc56ad 100644 --- a/reconstruction/cnd/pom.xml +++ b/reconstruction/cnd/pom.xml @@ -4,45 +4,45 @@ org.jlab.clas12.detector clas12detector-cnd - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-cvt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/cvt/pom.xml b/reconstruction/cvt/pom.xml index 848d1be668..4107935e26 100644 --- a/reconstruction/cvt/pom.xml +++ b/reconstruction/cvt/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-cvt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -26,63 +26,63 @@ cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-eb - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test jar diff --git a/reconstruction/dc/pom.xml b/reconstruction/dc/pom.xml index ce6e005afb..bef1dde4f5 100644 --- a/reconstruction/dc/pom.xml +++ b/reconstruction/dc/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-dc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -33,69 +33,69 @@ cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ai - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-math - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys snr - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.plugins @@ -105,7 +105,7 @@ org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT junit diff --git a/reconstruction/eb/pom.xml b/reconstruction/eb/pom.xml index 19bb016cd3..47e4bd700b 100644 --- a/reconstruction/eb/pom.xml +++ b/reconstruction/eb/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-eb - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,74 +21,74 @@ cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-dc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ec - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-tof - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-htcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ltcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT junit diff --git a/reconstruction/ec/pom.xml b/reconstruction/ec/pom.xml index 092b1e64c2..3103548b4a 100644 --- a/reconstruction/ec/pom.xml +++ b/reconstruction/ec/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-ec - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,38 +21,38 @@ org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT test org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT junit diff --git a/reconstruction/fmt/pom.xml b/reconstruction/fmt/pom.xml index 0c2767ca6e..7b647a7402 100644 --- a/reconstruction/fmt/pom.xml +++ b/reconstruction/fmt/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-fmt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,37 +21,37 @@ org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/ft/pom.xml b/reconstruction/ft/pom.xml index 11170a70bd..c94d5d83fd 100644 --- a/reconstruction/ft/pom.xml +++ b/reconstruction/ft/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-ft - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,32 +21,32 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/htcc/pom.xml b/reconstruction/htcc/pom.xml index 58c26d7795..f0af19be03 100644 --- a/reconstruction/htcc/pom.xml +++ b/reconstruction/htcc/pom.xml @@ -4,35 +4,35 @@ org.jlab.clas12.detector clas12detector-htcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/ltcc/pom.xml b/reconstruction/ltcc/pom.xml index 16c903e9b1..5fe165c2f0 100644 --- a/reconstruction/ltcc/pom.xml +++ b/reconstruction/ltcc/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-ltcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -30,27 +30,27 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/mc/pom.xml b/reconstruction/mc/pom.xml index bdc70318f1..57edc41a65 100644 --- a/reconstruction/mc/pom.xml +++ b/reconstruction/mc/pom.xml @@ -4,35 +4,35 @@ org.jlab.clas12.detector clas12detector-mc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/mltn/pom.xml b/reconstruction/mltn/pom.xml index 8c230111a3..c539c483e5 100644 --- a/reconstruction/mltn/pom.xml +++ b/reconstruction/mltn/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-mltn - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -38,13 +38,13 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/pom.xml b/reconstruction/pom.xml index 392e2b1c7d..8482f1f3e1 100644 --- a/reconstruction/pom.xml +++ b/reconstruction/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT pom org.jlab.clas coatjava - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/postproc/pom.xml b/reconstruction/postproc/pom.xml index 226316fc99..025e1d347c 100644 --- a/reconstruction/postproc/pom.xml +++ b/reconstruction/postproc/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-postproc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -18,19 +18,19 @@ org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-analysis - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/raster/pom.xml b/reconstruction/raster/pom.xml index d6d68befea..fbcc88b349 100644 --- a/reconstruction/raster/pom.xml +++ b/reconstruction/raster/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-raster - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,22 +21,22 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/recoil/pom.xml b/reconstruction/recoil/pom.xml index 000728e92f..f72b408df4 100644 --- a/reconstruction/recoil/pom.xml +++ b/reconstruction/recoil/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-recoil - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,27 +21,27 @@ org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/rich/pom.xml b/reconstruction/rich/pom.xml index eeedba524f..fd921d577a 100644 --- a/reconstruction/rich/pom.xml +++ b/reconstruction/rich/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-rich - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,37 +21,37 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/rtpc/pom.xml b/reconstruction/rtpc/pom.xml index 6afcc4de59..533f56cf85 100644 --- a/reconstruction/rtpc/pom.xml +++ b/reconstruction/rtpc/pom.xml @@ -4,20 +4,20 @@ org.jlab.clas12.detector clas12detector-rtpc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT cnuphys magfield - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.apache.commons @@ -26,33 +26,33 @@ org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-tracking - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT compile org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/swaps/pom.xml b/reconstruction/swaps/pom.xml index 299f7d38ba..c0fe6cce72 100644 --- a/reconstruction/swaps/pom.xml +++ b/reconstruction/swaps/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-swaps - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -18,19 +18,19 @@ org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/tof/pom.xml b/reconstruction/tof/pom.xml index a256be6056..97028718e9 100644 --- a/reconstruction/tof/pom.xml +++ b/reconstruction/tof/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-tof - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -18,43 +18,43 @@ org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-physics - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-utils - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/uber/pom.xml b/reconstruction/uber/pom.xml index 8e82e5d469..9b6755564a 100644 --- a/reconstruction/uber/pom.xml +++ b/reconstruction/uber/pom.xml @@ -4,110 +4,110 @@ org.jlab.clas12.detector clas12detector-uber - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-dc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ec - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-tof - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-htcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ltcc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-ft - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-cnd - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-band - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-cvt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-raster - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-vtx - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-calib - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-rtpc - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-rich - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-eb - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-mltn - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas12.detector clas12detector-fmt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT diff --git a/reconstruction/urwt/pom.xml b/reconstruction/urwt/pom.xml index bdbd74fdfb..6368af7deb 100644 --- a/reconstruction/urwt/pom.xml +++ b/reconstruction/urwt/pom.xml @@ -4,13 +4,13 @@ org.jlab.clas12.detector clas12detector-urwt - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT @@ -21,27 +21,27 @@ org.jlab.clas clas-detector - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-jcsg - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT clas12detector-urwt diff --git a/reconstruction/vtx/pom.xml b/reconstruction/vtx/pom.xml index 0eaedb8d42..06840daf40 100644 --- a/reconstruction/vtx/pom.xml +++ b/reconstruction/vtx/pom.xml @@ -4,41 +4,41 @@ org.jlab.clas12.detector clas12detector-vtx - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar org.jlab.clas12 reconstruction - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas swim-tools - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT jar cnuphys swimmer - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-reco - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-io - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT org.jlab.clas clas-geometry - 13.7.0-SNAPSHOT + 13.7.1-SNAPSHOT