From f9b8ff48ba04bdf555a492903133faa8b80a1fe6 Mon Sep 17 00:00:00 2001
From: Nathan Baltzell
Date: Thu, 11 Jun 2026 09:53:14 -0400
Subject: [PATCH 1/2] fix package names, remove unused imports
---
.../jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java | 3 ---
.../jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java | 3 ---
.../detector/geant4/v2/recoil/trk/RtrkGeant4Factory.java | 8 --------
.../java/org/jlab/service/recoil/tof/ClusterFinder.java | 6 +-----
.../main/java/org/jlab/service/recoil/tof/HitFinder.java | 2 +-
.../main/java/org/jlab/service/recoil/tof/Parameters.java | 3 +--
.../java/org/jlab/service/recoil/tof/RTOFCluster.java | 8 +-------
.../main/java/org/jlab/service/recoil/tof/RTOFHit.java | 3 +--
.../main/java/org/jlab/service/recoil/tof/RTOFRawHit.java | 5 +----
.../java/org/jlab/service/recoil/tof/RecoBankWriter.java | 6 +-----
10 files changed, 7 insertions(+), 40 deletions(-)
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
index 3ec69f6283..534905fd6c 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
@@ -1,9 +1,6 @@
package org.jlab.detector.geant4.v2.recoil.tof;
-
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
-import org.jlab.geom.prim.Point3D;
-
public class RTOFConstants {
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
index 6e0a78e98f..45ae3c5704 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
@@ -1,9 +1,6 @@
package org.jlab.detector.geant4.v2.recoil.trk;
-
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
-import org.jlab.geom.prim.Point3D;
-
public class RtrkConstants {
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkGeant4Factory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkGeant4Factory.java
index 7d42c037fb..0b61bbc992 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkGeant4Factory.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkGeant4Factory.java
@@ -2,18 +2,10 @@
import eu.mihosoft.vrl.v3d.Vector3d;
import org.jlab.detector.geant4.v2.Geant4Factory;
-import org.jlab.detector.volume.G4Trap;
import org.jlab.detector.volume.G4World;
import org.jlab.detector.volume.G4Box;
-import org.jlab.detector.volume.G4Trd;
import org.jlab.detector.volume.Geant4Basic;
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
-import org.jlab.geom.prim.Line3D;
-import org.jlab.geom.prim.Point3D;
-import org.jlab.geom.prim.Plane3D;
-import org.jlab.geom.prim.Vector3D;
-import org.jlab.geometry.prim.Line3d;
-import org.jlab.geometry.prim.Straight;
/**
* Generate GEANT4 volume for the RECOIL tracker
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/ClusterFinder.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/ClusterFinder.java
index 930c3e447b..1463331cf2 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/ClusterFinder.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/ClusterFinder.java
@@ -1,11 +1,7 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
import java.util.ArrayList;
import org.jlab.io.base.DataEvent;
-import org.jlab.rec.recoil.tof.Parameters;
-import org.jlab.rec.recoil.tof.RTOFRawHit;
-import org.jlab.rec.recoil.tof.RTOFHit;
-import org.jlab.rec.recoil.tof.HitFinder;
/**
* The {@code ClusterFinder} class builds clusters in the recoil tof
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
index 87b8971264..67619066ed 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
@@ -1,4 +1,4 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
index cb396207ba..fdb5f13979 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
@@ -1,5 +1,4 @@
-package org.jlab.rec.recoil.tof;
-import org.jlab.detector.geant4.v2.recoil.tof.RTOFConstants;
+package org.jlab.service.recoil.tof;
/**
*
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
index 68dd4cd2fe..cee0b3e877 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
@@ -1,13 +1,7 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
import java.util.ArrayList;
-import org.jlab.geom.prim.Line3D;
-import org.jlab.geom.prim.Point3D;
-import org.jlab.io.base.DataBank;
import org.jlab.io.base.DataEvent;
-import org.jlab.rec.recoil.tof.Parameters;
-import org.jlab.rec.recoil.tof.RTOFRawHit;
-import org.jlab.rec.recoil.tof.RTOFHit;
/**
* The {@code RTOFCluster} represents clusters in the recoil tof
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
index fc15104086..581559d6d9 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
@@ -1,6 +1,5 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
-import org.jlab.rec.recoil.tof.Parameters;
import org.jlab.detector.geant4.v2.recoil.tof.RTOFConstants;
/**
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
index ab88a1f023..3998dc5674 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
@@ -1,8 +1,5 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
-import org.jlab.geom.base.*;
-import org.jlab.geom.prim.Point3D;
-import org.jlab.rec.recoil.tof.Parameters;
import org.jlab.detector.geant4.v2.recoil.tof.RTOFConstants;
/**
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
index bf8b729ea1..aa036bcc4f 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
@@ -1,12 +1,8 @@
-package org.jlab.rec.recoil.tof;
+package org.jlab.service.recoil.tof;
import java.util.ArrayList;
import org.jlab.io.base.DataBank;
import org.jlab.io.base.DataEvent;
-import org.jlab.rec.recoil.tof.RTOFCluster;
-import org.jlab.rec.recoil.tof.RTOFRawHit;
-import org.jlab.rec.recoil.tof.RTOFHit;
-
/**
* The {@code RecoBankWriter} writes the banks needed for the recoil tof
From 9da88bbf12b14077b244341d7f83082f74fcd9ca Mon Sep 17 00:00:00 2001
From: Nathan Baltzell
Date: Thu, 11 Jun 2026 10:03:40 -0400
Subject: [PATCH 2/2] fix formatting, remove empty mains
---
.../geant4/v2/recoil/tof/RTOFConstants.java | 13 +-
.../v2/recoil/tof/RTOFGeant4Factory.java | 155 ++++---
.../geant4/v2/recoil/trk/RtrkConstants.java | 109 ++---
.../v2/recoil/trk/RtrkGeant4Factory.java | 249 ++++++-----
.../v2/recoil/trk/RtrkStripFactory.java | 394 +++++++++---------
.../service/recoil/tof/ClusterFinder.java | 62 ++-
.../jlab/service/recoil/tof/HitFinder.java | 24 +-
.../jlab/service/recoil/tof/Parameters.java | 6 +-
.../jlab/service/recoil/tof/RTOFCluster.java | 76 ++--
.../org/jlab/service/recoil/tof/RTOFHit.java | 102 +++--
.../jlab/service/recoil/tof/RTOFRawHit.java | 248 ++++++-----
.../service/recoil/tof/RecoBankWriter.java | 37 +-
.../jlab/service/recoil/trk/RtrkCluster.java | 55 ++-
.../service/recoil/trk/RtrkConstants.java | 5 +-
.../jlab/service/recoil/trk/RtrkCross.java | 23 +-
.../jlab/service/recoil/trk/RtrkEngine.java | 95 ++---
.../jlab/service/recoil/trk/RtrkStrip.java | 88 ++--
17 files changed, 824 insertions(+), 917 deletions(-)
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
index 534905fd6c..5ef906db7b 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java
@@ -22,12 +22,10 @@ public class RTOFConstants {
public final static double LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
public final static double THICKNESS = 0.5; // cm
-
public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
{
-
- load(cp );
- return cp;
+ load(cp );
+ return cp;
}
/**
@@ -35,14 +33,11 @@ public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
* Please use a DatabaseConstantProvider to access CCDB and load the following tables:
* @param cp a ConstantProvider that has loaded the necessary tables
*/
-
public static synchronized void load( DatabaseConstantProvider cp )
{
- //WIDTH = NCOLUMNS * BAR_WIDTH;
+ //WIDTH = NCOLUMNS * BAR_WIDTH;
//LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
//THICKNESS = 0.5; // cm
}
-}
-
-
+}
\ No newline at end of file
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFGeant4Factory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFGeant4Factory.java
index e1d238ee29..82926db40a 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFGeant4Factory.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFGeant4Factory.java
@@ -9,7 +9,7 @@
/**
* Generate GEANT4 volume for the RECOIL TOF detector
- *
+ *
* @author Nilanga Wickramaarachchi
*/
public final class RTOFGeant4Factory extends Geant4Factory {
@@ -24,121 +24,106 @@ public RTOFGeant4Factory( DatabaseConstantProvider cp) {
}
public void init(DatabaseConstantProvider cp) {
-
motherVolume = new G4World("root");
-
- for (int isector = 0; isector < nSectors; isector++) {
- Geant4Basic sectorVolume = createSector(isector, nRows, nCols);
-
- sectorVolume.setName("recoil_tof_sector" + (isector + 1));
- sectorVolume.setMother(motherVolume);
- }
+ for (int isector = 0; isector < nSectors; isector++) {
+ Geant4Basic sectorVolume = createSector(isector, nRows, nCols);
+ sectorVolume.setName("recoil_tof_sector" + (isector + 1));
+ sectorVolume.setMother(motherVolume);
+ }
}
-
-
+
public Vector3d getCenterCoordinate(int isector)
{
int is=isector;
Vector3d vCenter = new Vector3d(0, 0, 0);
-
- vCenter.x = (-1+is*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
- vCenter.y = 0;
- vCenter.z =RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
+ vCenter.x = (-1+is*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
+ vCenter.y = 0;
+ vCenter.z =RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
return vCenter;
}
-
-
public Geant4Basic createSector(int isector, int nRows, int nCols ) {
-
+
double hlx = RTOFConstants.WIDTH/2+1;
double hly = RTOFConstants.LENGTH/2+1;
- double hlz = RTOFConstants.THICKNESS/2+1;
-
+ double hlz = RTOFConstants.THICKNESS/2+1;
+
Vector3d vCenter = this.getCenterCoordinate(isector);
-
- Geant4Basic sectorVolume = new G4Box("recoil_tof_sector" + (isector + 1), hlx, hly, hlz);
-
- if(isector==0) sectorVolume.rotate("yxz",Math.toRadians((RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
- if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
+
+ Geant4Basic sectorVolume = new G4Box("recoil_tof_sector" + (isector + 1), hlx, hly, hlz);
+
+ if(isector==0) sectorVolume.rotate("yxz",Math.toRadians((RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
+ if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
sectorVolume.translate(vCenter.x, vCenter.y, vCenter.z);
sectorVolume.setId(isector + 1, 0, 0);
-
+
// Bars construction
- for (int row = 0; row < nRows; row++) {
- for (int col = 0; col < nCols; col++) {
-
- Geant4Basic barVolume = this.createBar(isector, row, col);
-
+ for (int row = 0; row < nRows; row++) {
+ for (int col = 0; col < nCols; col++) {
+
+ Geant4Basic barVolume = this.createBar(isector, row, col);
+
barVolume.setName("bar_sector" + (isector + 1) + "_row" + (row + 1) + "_column" + (col + 1));
-
- barVolume.setMother(sectorVolume);
-
- barVolume.setId(isector + 1, row +1, col+1, 0);
- }
- }
-
+
+ barVolume.setMother(sectorVolume);
+
+ barVolume.setId(isector + 1, row +1, col+1, 0);
+ }
+ }
+
return sectorVolume;
}
-
public Geant4Basic createBar(int iSector, int iRow, int iCol) {
- int nCols = RTOFConstants.NCOLUMNS;
-
- double barDX = RTOFConstants.BAR_WIDTH/2;
- double barDY;
-
- if (iRow == (nRows - 1) / 2) barDY = RTOFConstants.SHORT_BAR_LENGTH/2;
- else barDY = RTOFConstants.LONG_BAR_LENGTH/2;
-
- double barDZ = RTOFConstants.BAR_THICKNESS/2;
+ int nCols = RTOFConstants.NCOLUMNS;
+
+ double barDX = RTOFConstants.BAR_WIDTH/2;
+ double barDY;
+
+ if (iRow == (nRows - 1) / 2) barDY = RTOFConstants.SHORT_BAR_LENGTH/2;
+ else barDY = RTOFConstants.LONG_BAR_LENGTH/2;
+
+ double barDZ = RTOFConstants.BAR_THICKNESS/2;
+
+ Geant4Basic barVolume = new G4Box("bar_sector" + (iSector + 1) + "_row" + (iRow + 1) + "_column" + (iCol + 1), barDX, barDY, barDZ);
+
+ // Constants for positioning
+ double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
+ double x_spacing = RTOFConstants.BAR_WIDTH;
+ double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
+ double dy_long = RTOFConstants.LONG_BAR_LENGTH;
+ double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
+
+ //Position calculation
+ double z_pos = 0;
+ double x_pos = x_start + (iCol * x_spacing);
- Geant4Basic barVolume = new G4Box("bar_sector" + (iSector + 1) + "_row" + (iRow + 1) + "_column" + (iCol + 1), barDX, barDY, barDZ);
-
- // Constants for positioning
- double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
- double x_spacing = RTOFConstants.BAR_WIDTH;
- double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
- double dy_long = RTOFConstants.LONG_BAR_LENGTH;
- double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
-
- //Position calculation
- double z_pos = 0;
- double x_pos = x_start + (iCol * x_spacing);
-
double y_pos;
- if(iRow < (nRows - 1) / 2)
- {
- y_pos = y_start + (iRow * dy_long);
- }
- else if (iRow == (nRows - 1) / 2) // middle row
- {
- y_pos = 0;
- }
- else
- {
- y_pos = y_start + (iRow -1) * dy_long + dy_short;
- }
-
- barVolume.setPosition(x_pos, y_pos, z_pos);
-
- return barVolume;
+ if (iRow < (nRows - 1) / 2) {
+ y_pos = y_start + (iRow * dy_long);
+ }
+ else if (iRow == (nRows - 1) / 2) {// middle row
+ y_pos = 0;
+ }
+ else {
+ y_pos = y_start + (iRow -1) * dy_long + dy_short;
+ }
+
+ barVolume.setPosition(x_pos, y_pos, z_pos);
+
+ return barVolume;
}
-
-
-
public static void main(String[] args) {
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, "default");
-
+
RTOFConstants.connect(cp);
RTOFGeant4Factory factory = new RTOFGeant4Factory(cp);
-
+
factory.getAllVolumes().forEach(volume -> {
System.out.println(volume.gemcString());
});
-
- }
-}
+ }
+}
\ No newline at end of file
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
index 45ae3c5704..83585b4d5f 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkConstants.java
@@ -1,105 +1,106 @@
package org.jlab.detector.geant4.v2.recoil.trk;
-import org.jlab.detector.calib.utils.DatabaseConstantProvider;
+import org.jlab.detector.calib.utils.DatabaseConstantProvider;
public class RtrkConstants {
-
+
private final static String CCDBPATH = "/geometry/recoil/trk/";
- public final static int NMAXREGIONS = 3; //max number of regions
- public final static int NREGIONS = 3; //number of regions
+ public final static int NMAXREGIONS = 3; //max number of regions
+ public final static int NREGIONS = 3; //number of regions
public final static int NSECTORS = 2; //number of sectors
public final static int NLAYERS = 2; //number of layers
public final static int NCHAMBERS = 1; //number of chambers in a sector
-
+
public final static double HORIZONTHAL_OPENING_ANGLE = 34.;
public final static double VERTICAL_OPENING_ANGLE = 50.;
public final static double RADIUS[] = {33.5,55.5,79.5};
public final static double WIDTH[] = new double[NMAXREGIONS];
public final static double HEIGHT[] = new double[NMAXREGIONS];
-
+
public final static double THTILT = 0; // theta tilt (deg)
/* public final static double XENLARGEMENT = 0.5; // cm
public final static double YENLARGEMENT = 1.; // cm
public final static double ZENLARGEMENT = 0.1; // cm
-
+
// Sector geometrical parameters
public final static double THOPEN = 34.; // opening angle between endplate planes (deg)
public final static double THTILT = 0; // theta tilt (deg)
public final static double THMIN = 4.694; // polar angle to the base of first chamber (deg)
public final static double SECTORHEIGHT = 146.21; //height of each sector (cm)
public final static double DX0CHAMBER0 = 5.197; // halfbase of chamber 1 (cm)*/
-
+
// Chamber volumes and materials (units are cm)
- public final static double[] CHAMBERVOLUMESTHICKNESS = {0.0025, 0.0005,0.3, // window
- 0.0025, 0.0005,0.4, // cathode
- 0.0005, 0.005, 0.0005, // uRWell + DlC
- 0.0005, 0.005, 0.0005, // Capacitive sharing layer1
- 0.0005, 0.005, 0.0005, // Capacitive sharing layer2
- 0.005, 0.0005,0.005, 0.005, 0.0005,0.005, 0.005, // Readout
- 0.0127, 0.3, 0.0125}; // support
- public final static String[] CHAMBERVOLUMESNAME = {"window_kapton", "window_Al", "window_gas",
- "cathode_kapton", "cathode_Al", "cathode_gas",
- "muRwell_Cu", "muRwell_kapton", "muRwell_dlc",
- "capa_sharing_layer1_glue","capa_sharing_layer1_Cr","capa_sharing_layer1_kapton",
- "capa_sharing_layer2_glue","capa_sharing_layer2_Cr","capa_sharing_layer2_kapton",
- "readout1_glue", "readout1_Cu", "readout1_kapton", "readout2_glue", "readout2_Cu", "readout2_kapton", "readout3_glue",
- "support_skin1_g10", "support_honeycomb_nomex", "support_skin2_g10"};
-
- // URWELL position in the CLAS12 frame
- /* public final static double TGT2DC0 = 228.078; // cm
- // public final static double URWELL2DC0 = 2; // cm
+ public final static double[] CHAMBERVOLUMESTHICKNESS = {
+ 0.0025, 0.0005,0.3, // window
+ 0.0025, 0.0005,0.4, // cathode
+ 0.0005, 0.005, 0.0005, // uRWell + DlC
+ 0.0005, 0.005, 0.0005, // Capacitive sharing layer1
+ 0.0005, 0.005, 0.0005, // Capacitive sharing layer2
+ 0.005, 0.0005,0.005, 0.005, 0.0005,0.005, 0.005, // Readout
+ 0.0127, 0.3, 0.0125}; // support
+ public final static String[] CHAMBERVOLUMESNAME = {
+ "window_kapton", "window_Al", "window_gas",
+ "cathode_kapton", "cathode_Al", "cathode_gas",
+ "muRwell_Cu", "muRwell_kapton", "muRwell_dlc",
+ "capa_sharing_layer1_glue","capa_sharing_layer1_Cr","capa_sharing_layer1_kapton",
+ "capa_sharing_layer2_glue","capa_sharing_layer2_Cr","capa_sharing_layer2_kapton",
+ "readout1_glue", "readout1_Cu", "readout1_kapton", "readout2_glue", "readout2_Cu", "readout2_kapton", "readout3_glue",
+ "support_skin1_g10", "support_honeycomb_nomex", "support_skin2_g10"};
+
+ // URWELL position in the CLAS12 frame
+ /* public final static double TGT2DC0 = 228.078; // cm
+ // public final static double URWELL2DC0 = 2; // cm
public final static double URWELL2DC0[] = new double[NMAXREGIONS];
public final static double DIST2TGT[] = new double[NMAXREGIONS];
- public final static double W2TGT[] = new double[NMAXREGIONS];;
+ public final static double W2TGT[] = new double[NMAXREGIONS];;
public final static double YMIN[] = new double[NMAXREGIONS];
public final static double ZMIN[] = new double[NMAXREGIONS];*/
public final static double PITCH = 0.1 ; // cm
public final static double STEREOANGLE = 90; // deg
-
- /*
- * @return String a path to a directory in CCDB of the format {@code "/geometry/detector/"}
- */
+
+ /*
+ * @return String a path to a directory in CCDB of the format {@code "/geometry/detector/"}
+ */
public static String getCcdbPath()
{
- return CCDBPATH;
+ return CCDBPATH;
}
-
- /**
+
+ /**
* Loads the the necessary tables for the URWELL geometry for a given DatabaseConstantProvider.
- *
+ *
* @return DatabaseConstantProvider the same thing
*/
public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
{
- // cp.loadTable( CCDBPATH +"RWELL");
-
- load(cp );
- return cp;
+ // cp.loadTable( CCDBPATH +"RWELL");
+
+ load(cp );
+ return cp;
}
-
+
/**
* Reads all the necessary constants from CCDB into static variables.
* Please use a DatabaseConstantProvider to access CCDB and load the following tables:
* @param cp a ConstantProvider that has loaded the necessary tables
*/
-
public static synchronized void load( DatabaseConstantProvider cp )
{
- // read constants from svt table
+ // read constants from svt table
// NREGIONS = cp.getInteger( CCDBPATH+"svt/nRegions", 0 );
-
- for (int i=0; i (volume.getName().contains(volumeName)))
- .findAny()
- .orElse(null);
+
+ // volumeName = "rg" + r + "_s" + s + "_r" + re + "_c" + c + "_cathode_gas";
+ volumeName = "rg" + r + "_s" + s + "_c" + c + "_cathode_gas";
+ return this.getAllVolumes().stream()
+ .filter(volume -> (volume.getName().contains(volumeName)))
+ .findAny()
+ .orElse(null);
}
-
+
/**
* Returns the sector volume for the given sector number
- *
+ *
* @param sector (1-6)
* @return the sector volume
*/
public Geant4Basic getSectorVolume(int region, int sector) {
-
+
int r = region;
int s = sector;
-
+
String volName = "region_Rtrk_" + r + "_s" + s;
return this.getAllVolumes().stream()
- .filter(volume -> (volume.getName().contains(volName)))
- .findAny()
- .orElse(null);
+ .filter(volume -> (volume.getName().contains(volName)))
+ .findAny()
+ .orElse(null);
}
public static void main(String[] args) {
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, "default");
-
RtrkConstants.connect(cp);
-
RtrkGeant4Factory factory = new RtrkGeant4Factory(cp, 1);
-
factory.getAllVolumes().forEach(volume -> {
System.out.println(volume.gemcString());
});
-
- }
+ }
}
diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkStripFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkStripFactory.java
index 9158336800..73be7ed32f 100644
--- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkStripFactory.java
+++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/trk/RtrkStripFactory.java
@@ -15,11 +15,11 @@
/**
* Creates and handles the URWELL detector strips as 3D lines
- *
+ *
* @author bondi, niccolai
*/
public final class RtrkStripFactory {
-
+
private RtrkGeant4Factory factory;
private IndexedList globalStrips = new IndexedList(3);
private IndexedList localStrips = new IndexedList(3);
@@ -34,7 +34,7 @@ public RtrkStripFactory() {
/**
* Create the strip factory based on constants from CCDB.
- * Currently constants are defined in the RtrkConstants class.
+ * Currently constants are defined in the RtrkConstants class.
* They will be moved to CCDB when finalized).
* @param cp database provide
*/
@@ -49,7 +49,7 @@ public RtrkStripFactory(DatabaseConstantProvider cp) {
public void init(DatabaseConstantProvider cp) {
this.init(cp, 1);
}
-
+
/**
* Create the strip factory based on constants from CCDB.
* Currently constants are defined in the RtrkConstants class.
@@ -68,44 +68,44 @@ public RtrkStripFactory(DatabaseConstantProvider cp, int regions) {
*/
public void init(DatabaseConstantProvider cp, int regions) {
factory = new RtrkGeant4Factory(cp, regions);
- nRegions = Math.min(RtrkConstants.NMAXREGIONS, regions);
- nSectors = RtrkConstants.NSECTORS;
- nChambers = RtrkConstants.NCHAMBERS;
- nLayers = RtrkConstants.NLAYERS;
+ nRegions = Math.min(RtrkConstants.NMAXREGIONS, regions);
+ nSectors = RtrkConstants.NSECTORS;
+ nChambers = RtrkConstants.NCHAMBERS;
+ nLayers = RtrkConstants.NLAYERS;
this.fillStripLists();
- // this.fillPlaneLists();
+ // this.fillPlaneLists();
}
-
+
/**
* Calculates the total number of strips in a sector
- *
+ *
* @return the strip number
*/
public int getNStripSector() {
int nStrips = 0;
for (int i = 0; i < nChambers; i++) {
- for (int j = 0; j < nRegions; j++) {
- nStrips += getNStripChamber(i,j);
- }
- }
+ for (int j = 0; j < nRegions; j++) {
+ nStrips += getNStripChamber(i,j);
+ }
+ }
return nStrips;
}
-
+
/**
* Calculates the number of strips in the given chamber
- *
+ *
* @param ichamber (0, 1, 2)
* @return the strip number (1-N)
*/
public int getNStripChamber(int ichamber, int regions) {
-
- int iregion = regions;
- int chamber = ichamber;
+
+ int iregion = regions;
+ int chamber = ichamber;
double[] dim = factory.getChamber_daughter_Dimensions(iregion,chamber);
-
+
double yHalf = dim[1];
- double xHalf = dim[0];
-
+ double xHalf = dim[0];
+
// C-------------D //
// ------------- //
// ------------- //
@@ -113,56 +113,56 @@ public int getNStripChamber(int ichamber, int regions) {
/**
* * number of strip in AB**
*/
-
- int nAB = (int) (2 * xHalf / RtrkConstants.PITCH);
- int nAC = (int) (2 * yHalf / RtrkConstants.PITCH);
-
- int nStrips = nAB + nAC;
-
+
+ int nAB = (int) (2 * xHalf / RtrkConstants.PITCH);
+ int nAC = (int) (2 * yHalf / RtrkConstants.PITCH);
+
+ int nStrips = nAB + nAC;
+
return nStrips;
}
-
+
/**
* Provides the index of the chamber containing the strip with the given ID
- *
+ *
* @param strip (1 to N)
* @return the chamber index (0, 1, 2)
*/
public int getChamberIndex(int strip) {
int nStripTotal = 0;
-
+
for(int i=0; i strip ID chamber (from 1 to getNStripChamber)
int nStripTotal = 0;
if (chamberIndex > 0) {
for (int i = 0; i < chamberIndex; i++) {
- for (int j = 0; j < nRegions; j++) {
- nStripTotal += this.getNStripChamber(i,j);
- }
- }
+ for (int j = 0; j < nRegions; j++) {
+ nStripTotal += this.getNStripChamber(i,j);
+ }
+ }
}
-
- //Strip ID: from 1 to getNStripChamber
+
+ //Strip ID: from 1 to getNStripChamber
int cStrip = strip - nStripTotal;
return cStrip;
}
-
+
/**
* Builds the given strip line in the CLAS12 frame
* @param sector (1-6)
@@ -171,79 +171,79 @@ private int getLocalStripId(int strip) {
* @return the 3D strip line as a Line3d
*/
private Line3d createStrip(int sector, int region, int layer, int strip) {
-
+
int chamberIndex = getChamberIndex(strip);
int cStrip = this.getLocalStripId(strip);
-
+
// CHAMBER reference frame
// new numeration with stri ID_strip=0 crossing (0,0,0) of chamber
double[] dim = factory.getChamber_daughter_Dimensions(region-1,chamberIndex);
double yHalf = dim[1];
- double xHalf = dim[0];
-
- double DY = -xHalf; //v strip
-
+ double xHalf = dim[0];
+
+ double DY = -xHalf; //v strip
+
// Y coordinate of the intersection point between the x=0 and the strip line crossing for B
-
- if (layer % 2 != 0) { //u strip
- DY = -yHalf;
- }
- // ID of the strip
- int nS = (int) (DY / RtrkConstants.PITCH);
+
+ if (layer % 2 != 0) { //u strip
+ DY = -yHalf;
+ }
+ // ID of the strip
+ int nS = (int) (DY / RtrkConstants.PITCH);
int nCStrip = nS + (cStrip - 1);
- double c = nCStrip * RtrkConstants.PITCH;
-
- // Take 2 points in the strip straight line. They needs to define Line object
+ double c = nCStrip * RtrkConstants.PITCH;
+
+ // Take 2 points in the strip straight line. They needs to define Line object
//u strips
double oX = -xHalf;
double oY = c;
double oZ = 0;
-
+
double eX = xHalf;
double eY = c;
double eZ = 0;
-
+
if (layer % 2 == 0) { //v strips
- oX = c;
- oY = -yHalf;
- oZ = 0;
-
- eX = c;
- eY = yHalf;
- eZ = 0;
- }
-
- Vector3d origin = new Vector3d(oX, oY, oZ);
- Vector3d end = new Vector3d(eX, eY, eZ);
-
+ oX = c;
+ oY = -yHalf;
+ oZ = 0;
+
+ eX = c;
+ eY = yHalf;
+ eZ = 0;
+ }
+
+ Vector3d origin = new Vector3d(oX, oY, oZ);
+ Vector3d end = new Vector3d(eX, eY, eZ);
+
// Get Chamber Volume
Geant4Basic chamberVolume = factory.getChamberVolume(sector, region, chamberIndex+1, layer);
-
- // 2 point defined before wrt the GLOBAL frame
+
+ // 2 point defined before wrt the GLOBAL frame
Vector3d globalOrigin = chamberVolume.getGlobalTransform().transform(origin);
-
+
Vector3d globalEnd = chamberVolume.getGlobalTransform().transform(end);
-
+
Straight line = new Line3d(globalOrigin, globalEnd);
-
+
// CHECK intersections between line and volume
chamberVolume.makeSensitive();
List Hits = chamberVolume.getIntersections(line);
-
+
if (Hits.size() >= 1) {
-
- Vector3d TestOrigin = Hits.get(0).origin();
- Vector3d TestEnd = Hits.get(0).end();
-
+
+ Vector3d TestOrigin = Hits.get(0).origin();
+ Vector3d TestEnd = Hits.get(0).end();
+
return new Line3d(Hits.get(0).origin(), Hits.get(0).end());
-
+
} else {
return null;
}
}
-
- /**
+
+ /**
* Provides the given strip line in the Chamber local frame
* @param region (1-2)
* @param sector (1-6)
@@ -251,19 +251,19 @@ private Line3d createStrip(int sector, int region, int layer, int strip) {
* @param strip (1-N)
* @return the 3D strip line as a Line3d
*/
-
private Line3d getChamberStrip(int region, int sector, int chamber, int layer, int strip) {
-
- Line3d globalStrip = createStrip(sector, region, layer, strip);
- Geant4Basic chamberVolume = factory.getChamberVolume(sector, region, chamber, layer);
-
- Vector3d origin = chamberVolume.getGlobalTransform().invert().transform(globalStrip.origin());
- Vector3d end = chamberVolume.getGlobalTransform().invert().transform(globalStrip.end());
-
- Line3d localStrip = new Line3d(origin, end);
-
- return localStrip;
+
+ Line3d globalStrip = createStrip(sector, region, layer, strip);
+ Geant4Basic chamberVolume = factory.getChamberVolume(sector, region, chamber, layer);
+
+ Vector3d origin = chamberVolume.getGlobalTransform().invert().transform(globalStrip.origin());
+ Vector3d end = chamberVolume.getGlobalTransform().invert().transform(globalStrip.end());
+
+ Line3d localStrip = new Line3d(origin, end);
+
+ return localStrip;
}
+
/**
* Provides the given strip line in the sector local frame
* @param sector (1-6)
@@ -272,20 +272,18 @@ private Line3d getChamberStrip(int region, int sector, int chamber, int layer, i
* @return the 3D strip line as a Line3d
*/
private Line3d getLocalStrip(int region, int sector, int layer, int strip) {
-
-
+
Line3d globalStrip = createStrip(sector, region, layer, strip);
Geant4Basic sVolume = factory.getSectorVolume(region, sector);
-
+
Vector3d origin = sVolume.getGlobalTransform().invert().transform(globalStrip.origin());
Vector3d end = sVolume.getGlobalTransform().invert().transform(globalStrip.end());
-
+
Line3d localStrip = new Line3d(origin, end);
-
+
return localStrip;
}
-
private void fillStripLists() {
for(int ir=0; ir-xHalf && c-yHalf && c-xHalf && c-yHalf && c-xHalf && c-yHalf && c-xHalf && c-yHalf && c clusters;
-
+
/**
* Sets the list of clusters.
*
@@ -28,7 +28,7 @@ public class ClusterFinder {
public void setClusters(ArrayList clusters) {
this.clusters = clusters;
}
-
+
/**
* Gets the list of clusters.
*
@@ -38,7 +38,7 @@ public void setClusters(ArrayList clusters) {
public ArrayList getClusters() {
return clusters;
}
-
+
/**
* Cluster hits around a given hit, based on the time and geometric
@@ -78,23 +78,23 @@ public void clusterHits(int i, ArrayList hits, RTOFRaw
}
// Check the distance between the hits
double delta_T = Math.abs(this_hit.getTime() - other_hit.getTime());
- //The y distance is a distance in cm
+ //The y distance is a distance in cm
Boolean condition_y;
- double delta_Y = Math.abs(this_hit.getY() - other_hit.getY());
- condition_y = (delta_Y <= sigma_y.doubleValue());
-
+ double delta_Y = Math.abs(this_hit.getY() - other_hit.getY());
+ condition_y = (delta_Y <= sigma_y.doubleValue());
+
//If hit is within limits, it is clustered
- if (condition_y) {
- if (delta_T < sigma_t) {
- other_hit.setIsInACluster(true);
- other_hit.setAssociatedClusterIndex(cluster_id);
- this_cluster_hits.add(other_hit);
- }
- }
- }
+ if (condition_y) {
+ if (delta_T < sigma_t) {
+ other_hit.setIsInACluster(true);
+ other_hit.setAssociatedClusterIndex(cluster_id);
+ this_cluster_hits.add(other_hit);
+ }
+ }
+ }
}
-
-
+
+
/**
* Builds clusters in the {@link DateEvent} using hits found and stored in a
* {@link HitFinder}.
@@ -108,14 +108,14 @@ public void clusterHits(int i, ArrayList hits, RTOFRaw
*
*/
public void makeClusters(HitFinder hitfinder, double sigma_y, double sigma_t, DataEvent event) {
-
+
//A list of clusters is built for each event
clusters.clear();
int cluster_id = 1;
-
+
//Getting the list of hits, they must have been ordered by energy already
ArrayList rtof_hits = hitfinder.getRTOFHits();
-
+
//Loop through all bar hits
for (int i_bar = 0; i_bar < rtof_hits.size(); i_bar++) {
RTOFHit this_rtof_hit = rtof_hits.get(i_bar);
@@ -123,21 +123,21 @@ public void makeClusters(HitFinder hitfinder, double sigma_y, double sigma_t, Da
if (this_rtof_hit.getIsInACluster()) {
continue;
}
-
+
ArrayList this_cluster_rtof_hits = new ArrayList<>();
this_rtof_hit.setIsInACluster(true);
this_rtof_hit.setAssociatedClusterIndex(cluster_id);
this_cluster_rtof_hits.add(this_rtof_hit);
-
+
//Matching bar hits in clusters
clusterHits(i_bar, rtof_hits, this_rtof_hit, sigma_y, sigma_t, cluster_id, this_cluster_rtof_hits);
-
+
RTOFCluster cluster = new RTOFCluster(this_cluster_rtof_hits, event);
clusters.add(cluster);
cluster_id++;
}
}
-
+
/**
* Builds clusters in the {@link DataEvent} using hits found and stored in a
* {@link HitFinder}.
@@ -150,20 +150,14 @@ public void makeClusters(HitFinder hitfinder, double sigma_y, double sigma_t, Da
*/
public void makeClusters(DataEvent event, HitFinder hitfinder) {
makeClusters(hitfinder,
- Parameters.SIGMA_Y_CLUSTERING,
- Parameters.SIGMA_T_CLUSTERING, event);
+ Parameters.SIGMA_Y_CLUSTERING,
+ Parameters.SIGMA_T_CLUSTERING, event);
}
-
+
/**
* Default constructor that initializes the list clusters as new empty list.
*/
public ClusterFinder() {
clusters = new ArrayList<>();
}
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
index 67619066ed..d79024693c 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/HitFinder.java
@@ -15,31 +15,31 @@
*
*
*
- * @author pilleux, Nilanga Wickramaarachchi
+ * @author pilleux, Nilanga Wickramaarachchi
*/
public class HitFinder {
-
+
/**
* list of rtof hits
*/
private ArrayList rtofHits;
-
+
/**
* Default constructor that initializes the list of hits as new empty lists.
*/
public HitFinder() {
this.rtofHits = new ArrayList<>();
}
-
+
// Getter and Setter for rtofHits
public ArrayList getRTOFHits() {
return rtofHits;
}
-
+
public void setRTOFHits(ArrayList rtof_hits) {
this.rtofHits = rtof_hits;
}
-
+
/**
*
* @param event the {@link DataEvent} containing hits.
@@ -64,13 +64,13 @@ public void findHits(DataEvent event) {
int order = bank.getShort("order", i);
int tdc = bank.getShort("TDC", i);
int tot = bank.getShort("ToT", i);
-
+
//Building a Hit
RTOFRawHit hit = new RTOFRawHit(sector, layer, component, order, tdc, tot);
if (hit.getEnergy() < 0.01) {
continue; //energy threshold
}
-
+
//Sorting the hits into upstream and downstream bar hits
//Lists are built for up/down bar to match them after
if (null == hit.getType()) {
@@ -86,7 +86,7 @@ public void findHits(DataEvent event) {
}
}
}//End loop through all hits
-
+
//Starting loop through up hits in the bar
for (int i_up = 0; i_up < hit_up.size(); i_up++) {
RTOFRawHit this_hit_up = hit_up.get(i_up);
@@ -110,10 +110,4 @@ public void findHits(DataEvent event) {
//Once all has been listed, hits are sorted by energy
Collections.sort(this.rtofHits, (hit1, hit2) -> Double.compare(hit2.getEnergy(), hit1.getEnergy()));
}
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
index fdb5f13979..c6b8f7f9fc 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/Parameters.java
@@ -5,12 +5,12 @@
* @author npilleux, Nilanga Wickramaarachchi
*/
public class Parameters {
-
+
public static final double VEFF = 20.0;//cm/ns
public static final double TDC2TIME = 0.015625;//ns per channel bin
public static final double ATT_L = 160.0;//cm
public static final double TOT2ENERGY = 1.956 * 0.5 /1000;//to MeV
-
+
//public static double SIGMA_Y_TRACK_MATCHING_BAR = 20.0;//in cm
public static double SIGMA_Y_CLUSTERING = 4.0;//in cm
public static double SIGMA_T_CLUSTERING = 100;// in ns
@@ -21,5 +21,5 @@ public class Parameters {
public static void main(String[] args) {
// TODO code application logic here
}
-
+
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
index cee0b3e877..a5cf256a59 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFCluster.java
@@ -11,96 +11,95 @@
* them.
*
*
- * @author pilleux, Nilanga Wickramaarachchi
+ * @author pilleux, Nilanga Wickramaarachchi
*/
public class RTOFCluster {
-
+
/**
* list of hits in the bars.
*/
ArrayList rtofHits;
/**
- * cluster properties:position [cm], time [ns], energy[MeV],
+ * cluster properties:position [cm], time [ns], energy[MeV],
* type of the maximum hit (to set resolutions) and index and sector of the maximum hit.
*/
double x, y, z, time, energy;
String typeMaxHit;
int indexMaxHit, sectorMaxHit;
-
+
public ArrayList getRTOFHits() {
return rtofHits;
}
-
+
public void setRTOFHits(ArrayList rtof_hits) {
this.rtofHits = rtof_hits;
}
-
+
public double getX() {
return x;
}
-
+
public void setX(double x) {
this.x = x;
}
-
+
public double getY() {
return y;
}
-
+
public void setY(double y) {
this.y = y;
}
-
+
public double getZ() {
return z;
}
-
+
public void setZ(double z) {
this.z = z;
}
-
+
public double getTime() {
return time;
}
-
+
public void setTime(double time) {
this.time = time;
}
-
+
public double getEnergy() {
return energy;
}
-
+
public void setEnergy(double energy) {
this.energy = energy;
}
-
-
+
+
public String getTypeMaxHit() {
return typeMaxHit;
}
-
+
public void setTypeMaxHit(String typeMaxHit) {
this.typeMaxHit = typeMaxHit;
}
-
+
public int getIndexMaxHit() {
return indexMaxHit;
}
-
+
public void setIndexMaxHit(int indexMaxHit) {
this.indexMaxHit = indexMaxHit;
}
-
+
public int getSectorMaxHit() {
return sectorMaxHit;
}
-
+
public void setSectorMaxHit(int sectorMaxHit) {
this.sectorMaxHit = sectorMaxHit;
}
-
-
+
/**
* Compute the cluster properties.
*
@@ -114,7 +113,7 @@ public final void computeClusterProperties() {
this.energy = 0;
double max_energy = -1;
RTOFRawHit max_energy_hit = new RTOFRawHit();
-
+
for (int i_bar = 0; i_bar < this.rtofHits.size(); i_bar++) {
RTOFHit this_rtof_hit = this.rtofHits.get(i_bar);
double this_energy = this_rtof_hit.getEnergy();
@@ -124,15 +123,15 @@ public final void computeClusterProperties() {
max_energy = this_energy;
}
}
-
+
this.time = max_energy_hit.getTime();
this.x = max_energy_hit.getX();
this.y = max_energy_hit.getY();
this.z = max_energy_hit.getZ();
this.typeMaxHit = max_energy_hit.getType();
- this.sectorMaxHit = max_energy_hit.getSector();
+ this.sectorMaxHit = max_energy_hit.getSector();
}
-
+
/**
* Computes the energy deposited in the bars.
@@ -148,7 +147,7 @@ public double getEdepBar() {
}
return energy;
}
-
+
/**
* Compute the cluster phi angle in radians.
*
@@ -158,7 +157,7 @@ public double getEdepBar() {
public double getPhi() {
return Math.atan2(this.y, this.x);
}
-
+
/**
* Retrieve the hit with maximal energy in the cluster. It must have been
@@ -187,7 +186,7 @@ public final RTOFRawHit getMaxHit() {
}
}
}
-
+
/**
* Computes the sum of TOT in the cluster.
*
@@ -202,7 +201,7 @@ public int getTot() {
}
return tot;
}
-
+
/**
* Returns the TDC of the maximal hit in the cluster.
*
@@ -212,7 +211,7 @@ public int getTot() {
public int getTdc() {
return this.getMaxHit().getTdc();
}
-
+
/**
* Constructor that initializes the list of bar hits
* and computes the cluster properties.
@@ -224,7 +223,7 @@ public RTOFCluster(ArrayList rtof_hits) {
this.rtofHits = rtof_hits;
this.computeClusterProperties();
}
-
+
/**
* Constructor that initializes the list of bar hits
* and computes the cluster properties.
@@ -237,12 +236,5 @@ public RTOFCluster(ArrayList rtof_hits, DataEvent event) {
this.rtofHits = rtof_hits;
this.computeClusterProperties();
}
-
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
-
+
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
index 581559d6d9..87330bc1ce 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFHit.java
@@ -8,110 +8,108 @@
* by the two hits upstream and downstream composing a full rtof hit. y position,
* time and energy are defined from the up/down hits.
*
- * @author npilleux, Nilanga Wickramaarachchi
+ * @author npilleux, Nilanga Wickramaarachchi
*/
public class RTOFHit extends RTOFRawHit {
-
+
//A rtof hit is the combination of a downstream and upstream hits
private RTOFRawHit hitUp, hitDown;
-
+
public RTOFRawHit getHitUp() {
return hitUp;
}
-
+
public void setHitUp(RTOFRawHit hit_up) {
this.hitUp = hit_up;
}
-
+
public RTOFRawHit getHitDown() {
return hitDown;
}
-
+
public void setHitDown(RTOFRawHit hit_down) {
this.hitDown = hit_down;
}
-
+
/**
* Computes rtof hit y local coordinate from up/downstream hit times.
- *
+ *
*/
public final void computeLocalY() {
this.setLocalY(Parameters.VEFF/2. * (hitUp.getTime() - hitDown.getTime()));
}
-
+
/**
- * Computes rtof hit y coordinate in the global coordinate system.
+ * Computes rtof hit y coordinate in the global coordinate system.
*
*/
public final void computeGlobalY() {
- double localY = this.getLocalY();
-
- int nRows = RTOFConstants.NROWS;
- double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
- double dy_long = RTOFConstants.LONG_BAR_LENGTH;
- double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
-
+ double localY = this.getLocalY();
+ int nRows = RTOFConstants.NROWS;
+ double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
+ double dy_long = RTOFConstants.LONG_BAR_LENGTH;
+ double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
+
double y_pos; // y coordinate of the center of bar wrt to the global coordinate system
- if(hitUp.getRow()-1 < (nRows - 1)/2)
- {
- y_pos = y_start + ((hitUp.getRow()-1) * dy_long);
- }
- else if (hitUp.getRow()-1 == (nRows-1) / 2) // middle row
- {
- y_pos = 0;
- }
- else
- {
- y_pos = y_start + (hitUp.getRow()-2) * dy_long + dy_short;
- }
-
- this.setY(y_pos + localY);
+ if(hitUp.getRow()-1 < (nRows - 1)/2)
+ {
+ y_pos = y_start + ((hitUp.getRow()-1) * dy_long);
+ }
+ else if (hitUp.getRow()-1 == (nRows-1) / 2) // middle row
+ {
+ y_pos = 0;
+ }
+ else
+ {
+ y_pos = y_start + (hitUp.getRow()-2) * dy_long + dy_short;
+ }
+
+ this.setY(y_pos + localY);
}
-
/**
* Computes rtof hit time from up/downstream hit times.
* The time is set as the time of the most energetic hit.
* It is corrected for propagation time.
- *
+ *
*/
public final void computeTime() {
//We pick the most energetic signal as the timing signal
double time_at_sipm, distance_to_sipm;
if(this.hitDown.getEnergy() > this.hitUp.getEnergy()) {
time_at_sipm = this.hitDown.getTime();
- if(this.hitDown.getRow() == 3) distance_to_sipm = RTOFConstants.SHORT_BAR_LENGTH/2. - this.getLocalY();
- else distance_to_sipm = RTOFConstants.LONG_BAR_LENGTH/2. - this.getLocalY();
+ if(this.hitDown.getRow() == 3) distance_to_sipm = RTOFConstants.SHORT_BAR_LENGTH/2. - this.getLocalY();
+ else distance_to_sipm = RTOFConstants.LONG_BAR_LENGTH/2. - this.getLocalY();
}
else {
time_at_sipm = this.hitUp.getTime();
- if(this.hitUp.getRow() == 3) distance_to_sipm = RTOFConstants.SHORT_BAR_LENGTH/2. + this.getLocalY();
+ if(this.hitUp.getRow() == 3) distance_to_sipm = RTOFConstants.SHORT_BAR_LENGTH/2. + this.getLocalY();
else distance_to_sipm = RTOFConstants.LONG_BAR_LENGTH/2. + this.getLocalY();
}
this.setTime(time_at_sipm - distance_to_sipm/Parameters.VEFF);
}
-
+
/**
* Computes rtof hit energy from up/downstream hits.
* The energy of the up/downstream hits is corrected for attenuation now that y is known.
* The energy of the rtof hit is the sum of the energy of the up/downstream hits.
- *
+ *
*/
public final void computeEnergy() {
this.computeLocalY();
double distance_hit_to_sipm_up, distance_hit_to_sipm_down;
-
- if (hitUp.getRow() == 3) distance_hit_to_sipm_up = RTOFConstants.SHORT_BAR_LENGTH / 2. + this.getLocalY();
- else distance_hit_to_sipm_up = RTOFConstants.LONG_BAR_LENGTH / 2. + this.getLocalY();
-
- if (hitDown.getRow() == 3) distance_hit_to_sipm_down = RTOFConstants.SHORT_BAR_LENGTH / 2. - this.getLocalY();
- else distance_hit_to_sipm_down = RTOFConstants.LONG_BAR_LENGTH / 2. - this.getLocalY();
-
+
+ if (hitUp.getRow() == 3) distance_hit_to_sipm_up = RTOFConstants.SHORT_BAR_LENGTH / 2. + this.getLocalY();
+ else distance_hit_to_sipm_up = RTOFConstants.LONG_BAR_LENGTH / 2. + this.getLocalY();
+
+ if (hitDown.getRow() == 3) distance_hit_to_sipm_down = RTOFConstants.SHORT_BAR_LENGTH / 2. - this.getLocalY();
+ else distance_hit_to_sipm_down = RTOFConstants.LONG_BAR_LENGTH / 2. - this.getLocalY();
+
double Edep_up = hitUp.getEnergy() * Math.exp(distance_hit_to_sipm_up / Parameters.ATT_L);
double Edep_down = hitDown.getEnergy() * Math.exp(distance_hit_to_sipm_down / Parameters.ATT_L);
this.setEnergy(Edep_up + Edep_down);
}
-
+
public RTOFHit(RTOFRawHit hit_down, RTOFRawHit hit_up) {
boolean hits_match = hit_down.matchBar(hit_up);
if (!hits_match) {
@@ -121,28 +119,22 @@ public RTOFHit(RTOFRawHit hit_down, RTOFRawHit hit_up) {
this.setOrder(2);//Fake order for bar hits
this.hitUp = hit_up;
this.hitDown = hit_down;
- this.setSector(hit_up.getSector());
+ this.setSector(hit_up.getSector());
this.setRow(hit_up.getRow());
this.setColumn(hit_up.getColumn());
this.setX(hit_up.getX());
this.setZ(hit_up.getZ());
this.computeLocalY();
- this.computeGlobalY();
+ this.computeGlobalY();
this.computeTime();
this.computeEnergy();
this.setTdc((hit_down.getTdc() + hit_up.getTdc())/2);
this.setTot((hit_down.getTot() + hit_up.getTot()));
}
-
+
public RTOFHit() {
super();
this.setType("bar");
this.setOrder(2);//Fake order for rtof hits
}
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
index 3998dc5674..3feabdc5ac 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RTOFRawHit.java
@@ -8,10 +8,10 @@
* order, TDC, ToT. Type is bar up/bar down/ bar. Stores whether
* the hit is part of a cluster. Calculates time, energy based on TDC/ToT.
*
- * @author npilleux, Nilanga Wickramaarachchi
+ * @author npilleux, Nilanga Wickramaarachchi
*/
public class RTOFRawHit {
-
+
private int sector, row, column, order;
private int tdc, tot;
private double time, energy, x, y, z, local_y;
@@ -19,135 +19,166 @@ public class RTOFRawHit {
private boolean isInACluster;
private int associatedClusterIndex;
int idTDC;
-
+
+ /**
+ * Constructor for a hit in the recoil tof. Initializes the hit's sector, row,
+ * column, order, TDC, ToT. Sets the hit's initial state regarding
+ * clustering. Set up the hit's type, time, energy, and spatial coordinates.
+ *
+ * @param sector The sector of the detector where the hit occurred.
+ * @param row The row of the detector where the hit was detected.
+ * @param column The column within the row that registered the hit.
+ * @param order Order of the hit.
+ * @param tdc TDC value.
+ * @param tot ToT value.
+ *
+ */
+ public RTOFRawHit(int sector, int row, int column, int order, int tdc, int tot) {
+ this.sector = sector;
+ this.row = row;
+ this.column = column;
+ this.order = order;
+ this.tdc = tdc;
+ this.tot = tot;
+ this.isInACluster = false;
+
+ this.makeType();
+ this.convertTdcToTime();
+ this.convertTotToEnergy();
+ this.calculateXYZ();
+ }
+
+ public RTOFRawHit() {
+ }
+
public int getSector() {
return sector;
}
-
+
public void setSector(int sector) {
this.sector = sector;
}
-
+
public int getRow() {
return row;
}
-
+
public void setRow(int row) {
this.row = row;
}
-
+
public int getOrder() {
return order;
}
-
+
public void setOrder(int order) {
this.order = order;
}
-
+
public int getColumn() {
return column;
}
-
+
public void setColumn(int column) {
this.column = column;
}
-
+
public int getTdc() {
return tdc;
}
-
+
public void setTdc(int tdc) {
this.tdc = tdc;
}
-
+
public int getTot() {
return tot;
}
-
+
public void setTot(int tot) {
this.tot = tot;
}
-
+
public double getTime() {
return time;
}
-
+
public void setTime(double time) {
this.time = time;
}
-
+
public double getEnergy() {
return energy;
}
-
+
public void setEnergy(double energy) {
this.energy = energy;
}
-
+
public double getX() {
return x;
}
-
+
public void setX(double x) {
this.x = x;
}
-
+
public double getY() {
return y;
}
-
+
public void setY(double y) {
this.y = y;
}
-
+
public double getLocalY() {
return local_y;
}
public void setLocalY(double local_y) {
- this.local_y = local_y;
+ this.local_y = local_y;
}
-
+
public double getZ() {
return z;
}
-
+
public void setZ(double z) {
this.z = z;
}
-
+
public String getType() {
return type;
}
-
+
public void setType(String type) {
this.type = type;
}
-
+
public boolean getIsInACluster() {
return isInACluster;
}
-
+
public void setIsInACluster(boolean is_in_a_cluster) {
this.isInACluster = is_in_a_cluster;
}
-
+
public int getAssociatedClusterIndex() {
return associatedClusterIndex;
}
-
+
public void setAssociatedClusterIndex(int index) {
this.associatedClusterIndex = index;
}
-
+
public int getIdTDC() {
return idTDC;
}
-
+
public void setIdTDC(int index) {
this.idTDC = index;
}
-
+
/**
* Assigns a type to the hit.
@@ -161,11 +192,11 @@ public final String makeType() {
itype = "bar down";
} else if (this.order == 1) {
itype = "bar up";
- }
+ }
this.type = itype;
return itype;
}
-
+
/**
* Converts TDC to time (ns). Sets the hit time parameter to a raw time for
* up/down bar hits.
@@ -180,7 +211,7 @@ public final int convertTdcToTime() {
return 1;
} else {
switch (this.type) {
- case "bar up" -> {
+ case "bar up" -> {
tdc2time = Parameters.TDC2TIME;
veff = Parameters.VEFF;
//The distance will be computed at barhit level when y information is available
@@ -206,7 +237,7 @@ public final int convertTdcToTime() {
this.time = tdc2time * this.tdc - distance_to_sipm / veff;
return 0;
}
-
+
/**
* Converts ToT to energy (MeV). Sets the hit energy parameter to a raw
* energy for up/down bar hits.
@@ -221,15 +252,15 @@ public final int convertTotToEnergy() {
return 1;
} else {
switch (this.type) {
- case "bar up" -> {
+ case "bar up" -> {
tot2energy = Parameters.TOT2ENERGY;
- //only half the information in the bar,
+ //only half the information in the bar,
//the attenuation will be computed when the full hit is formed
this.energy = tot2energy * this.tot;
}
case "bar down" -> {
tot2energy = Parameters.TOT2ENERGY;
- //only half the information in the bar,
+ //only half the information in the bar,
//the attenuation will be computed when the full hit is formed
this.energy = tot2energy * this.tot;
}
@@ -245,7 +276,7 @@ public final int convertTotToEnergy() {
}
return 0;
}
-
+
/**
* Calculates spatial coordinates (cm) for the hit based on row and column number of the bar within a sector.
* The row and column variables are obtained from the bank information.
@@ -254,75 +285,75 @@ public final int convertTotToEnergy() {
* is undefined or unsupported.
*/
public final int calculateXYZ() {
-
- // Constants for positioning
- int nRows = RTOFConstants.NROWS;
- double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
- double x_spacing = RTOFConstants.BAR_WIDTH;
- double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
- double dy_long = RTOFConstants.LONG_BAR_LENGTH;
- double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
-
- //Position calculation
- double z_pos = 0;
- double x_pos = x_start + ((this.column-1) * x_spacing);
-
+
+ // Constants for positioning
+ int nRows = RTOFConstants.NROWS;
+ double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
+ double x_spacing = RTOFConstants.BAR_WIDTH;
+ double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
+ double dy_long = RTOFConstants.LONG_BAR_LENGTH;
+ double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
+
+ //Position calculation
+ double z_pos = 0;
+ double x_pos = x_start + ((this.column-1) * x_spacing);
+
double y_pos;
- if(this.row-1 < (nRows - 1) / 2)
- {
- y_pos = y_start + ((this.row-1) * dy_long);
- }
- else if (this.row-1 == (nRows - 1) / 2) // middle row
- {
- y_pos = 0;
- }
- else
- {
- y_pos = y_start + (this.row -2) * dy_long + dy_short;
- }
-
- double[] localCoords = {x_pos, y_pos, z_pos};
-
- // Calculate center coordinates for the sector
- double sector_x = (-1+(this.sector-1)*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
- double sector_y = 0;
- double sector_z = RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
-
- // Global coordinates of the sector
+ if(this.row-1 < (nRows - 1) / 2)
+ {
+ y_pos = y_start + ((this.row-1) * dy_long);
+ }
+ else if (this.row-1 == (nRows - 1) / 2) // middle row
+ {
+ y_pos = 0;
+ }
+ else
+ {
+ y_pos = y_start + (this.row -2) * dy_long + dy_short;
+ }
+
+ double[] localCoords = {x_pos, y_pos, z_pos};
+
+ // Calculate center coordinates for the sector
+ double sector_x = (-1+(this.sector-1)*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
+ double sector_y = 0;
+ double sector_z = RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
+
+ // Global coordinates of the sector
double[] globalCoordsSector = {sector_x, sector_y, sector_z};
-
- // Rotation angle in radians
+
+ // Rotation angle in radians
double thetaY = 0;
-
- if(this.sector==1) thetaY = Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
- if(this.sector==2) thetaY = Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE);
-
+
+ if(this.sector==1) thetaY = Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
+ if(this.sector==2) thetaY = Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE);
+
// Rotation matrix around the Y-axis
double[][] Ry = {
{Math.cos(thetaY), 0, Math.sin(thetaY)},
{0, 1, 0},
{-Math.sin(thetaY), 0, Math.cos(thetaY)}
};
-
+
// Rotate local coordinates
double[] rotatedCoords = new double[3];
for (int i = 0; i < 3; i++) {
rotatedCoords[i] = Ry[i][0] * localCoords[0] + Ry[i][1] * localCoords[1] + Ry[i][2] * localCoords[2];
}
-
+
// Calculate global coordinates for the hit
double[] globalCoordsBar = new double[3];
for (int i = 0; i < 3; i++) {
globalCoordsBar[i] = globalCoordsSector[i] + rotatedCoords[i];
}
-
-
- this.x = globalCoordsBar[0];
+
+
+ this.x = globalCoordsBar[0];
this.y = globalCoordsBar[1];
this.z = globalCoordsBar[2];
return 0;
}
-
+
/**
* Compares two RTOFRawHit objects to check if they match in the bar.
*
@@ -355,7 +386,7 @@ public boolean matchBar(RTOFRawHit hit2match) {
return this.getOrder() != hit2match.getOrder();
}
}
-
+
/**
* Computes the azimuthal angle (phi) of the hit in rad.
*
@@ -364,41 +395,4 @@ public boolean matchBar(RTOFRawHit hit2match) {
public double getPhi() {
return Math.atan2(this.y, this.x);
}
-
- /**
- * Constructor for a hit in the recoil tof. Initializes the hit's sector, row,
- * column, order, TDC, ToT. Sets the hit's initial state regarding
- * clustering. Set up the hit's type, time, energy, and spatial coordinates.
- *
- * @param sector The sector of the detector where the hit occurred.
- * @param row The row of the detector where the hit was detected.
- * @param column The column within the row that registered the hit.
- * @param order Order of the hit.
- * @param tdc TDC value.
- * @param tot ToT value.
- *
- */
- public RTOFRawHit(int sector, int row, int column, int order, int tdc, int tot) {
- this.sector = sector;
- this.row = row;
- this.column = column;
- this.order = order;
- this.tdc = tdc;
- this.tot = tot;
- this.isInACluster = false;
-
- this.makeType();
- this.convertTdcToTime();
- this.convertTotToEnergy();
- this.calculateXYZ();
- }
-
- public RTOFRawHit() {
- }
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
index aa036bcc4f..1383871435 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/tof/RecoBankWriter.java
@@ -11,7 +11,7 @@
* @author pilleux, Nilanga Wickramaarachchi
*/
public class RecoBankWriter {
-
+
/**
* Writes the bank of recoil tof hits.
*
@@ -23,17 +23,17 @@ public class RecoBankWriter {
*
*/
public static DataBank fillRTOFRawHitBank(DataEvent event, ArrayList rtofHits) {
-
+
ArrayList hitList = new ArrayList<>();
hitList.addAll(rtofHits);
-
+
DataBank bank = event.createBank("RTOF::hits", hitList.size());
-
+
if (bank == null) {
System.err.println("COULD NOT CREATE A RTOF::hits BANK!!!!!!");
return null;
}
-
+
for (int i = 0; i < hitList.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
bank.setShort("clusterid", i, (short) hitList.get(i).getAssociatedClusterIndex());
@@ -48,7 +48,7 @@ public static DataBank fillRTOFRawHitBank(DataEvent event, ArrayList rt
}
return bank;
}
-
+
/**
* Writes the bank of rtof clusters.
*
@@ -61,18 +61,18 @@ public static DataBank fillRTOFRawHitBank(DataEvent event, ArrayList rt
*
*/
public static DataBank fillRTOFClusterBank(DataEvent event, ArrayList clusterList) {
-
+
DataBank bank = event.createBank("RTOF::clusters", clusterList.size());
-
+
if (bank == null) {
System.err.println("COULD NOT CREATE A RTOF::clusters BANK!!!!!!");
return null;
}
-
+
for (int i = 0; i < clusterList.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
bank.setShort("size", i, (short) clusterList.get(i).getRTOFHits().size());
- bank.setByte("sector", i, (byte) clusterList.get(i).getSectorMaxHit());
+ bank.setByte("sector", i, (byte) clusterList.get(i).getSectorMaxHit());
bank.setFloat("time", i, (float) clusterList.get(i).getTime());
bank.setFloat("x", i, (float) (clusterList.get(i).getX()));
bank.setFloat("y", i, (float) (clusterList.get(i).getY()));
@@ -81,8 +81,7 @@ public static DataBank fillRTOFClusterBank(DataEvent event, ArrayList rtofHits, ArrayList clusterList) {
-
+
DataBank hitbank = this.fillRTOFRawHitBank(event, rtofHits);
if (hitbank != null) {
event.appendBank(hitbank);
} else {
return 1;
}
-
+
DataBank clusterbank = fillRTOFClusterBank(event, clusterList);
if (clusterbank != null) {
event.appendBank(clusterbank);
} else {
return 1;
}
-
+
return 0;
}
-
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- }
-
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCluster.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCluster.java
index f258307b88..8dfed856c5 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCluster.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCluster.java
@@ -9,21 +9,21 @@
/**
* recoil in-layer cluster
- *
+ *
* @author bondi, devita, niccolai
*/
public class RtrkCluster extends ArrayList {
-
+
private DetectorDescriptor desc = new DetectorDescriptor(DetectorType.RTRK);
- private int id;
+ private int id;
private Line3D clusterLine = new Line3D();
public int indexMaxStrip = -1;
private byte clusterStatus = 1;
public RtrkCluster(RtrkStrip strip){
- this.desc.setSectorLayerComponent(strip.getDescriptor().getSector(),
- strip.getDescriptor().getLayer(), 0);
+ this.desc.setSectorLayerComponent(strip.getDescriptor().getSector(),
+ strip.getDescriptor().getLayer(), 0);
this.add(strip);
this.clusterLine.copy(strip.getLine());
this.indexMaxStrip = 0;
@@ -49,7 +49,7 @@ public int getChamber() {
return this.get(0).getChamber();
}
- public Line3D getLine() {return this.clusterLine;}
+ public Line3D getLine() {return this.clusterLine;}
public double getEnergy(){
double energy = 0.0;
@@ -72,11 +72,11 @@ public double getSeedTime(){
if(this.indexMaxStrip >= 0 && this.indexMaxStrip < this.size()){
return this.get(indexMaxStrip).getTime();
}
- return 0.0;
+ return 0.0;
}
-
+
public RtrkStrip getSeedStrip() {
- return this.get(this.indexMaxStrip);
+ return this.get(this.indexMaxStrip);
}
public int getMaxStrip(){
@@ -107,7 +107,7 @@ public int getADC(){
public void setStatus(int val) {this.clusterStatus+=val;}
- public byte getStatus() {return clusterStatus;}
+ public byte getStatus() {return clusterStatus;}
public void setClusterId(int id){
this.id = id;
@@ -115,7 +115,7 @@ public void setClusterId(int id){
strip.setClusterId(id);
}
}
-
+
public void redoClusterLine(){
Point3D pointOrigin = new Point3D(0.0,0.0,0.0);
@@ -138,30 +138,29 @@ public void redoClusterLine(){
pointEnd.setX(pointEnd.x()+line.end().x()*le);
pointEnd.setY(pointEnd.y()+line.end().y()*le);
pointEnd.setZ(pointEnd.z()+line.end().z()*le);
-
+
logSumm += le;
summE += energy;
}
-
+
this.clusterLine.set(
- pointOrigin.x()/logSumm,
- pointOrigin.y()/logSumm,
- pointOrigin.z()/logSumm,
- pointEnd.x()/logSumm,
- pointEnd.y()/logSumm,
- pointEnd.z()/logSumm
+ pointOrigin.x()/logSumm,
+ pointOrigin.y()/logSumm,
+ pointOrigin.z()/logSumm,
+ pointEnd.x()/logSumm,
+ pointEnd.y()/logSumm,
+ pointEnd.z()/logSumm
);
}
-
public static List createClusters(List stripList){
-
+
List clusterList = new ArrayList<>();
if(!stripList.isEmpty()){
- for(int loop = 0; loop < stripList.size(); loop++){ //Loop over all strips
- boolean stripAdded = false;
+ for(int loop = 0; loop < stripList.size(); loop++){ //Loop over all strips
+ boolean stripAdded = false;
for(RtrkCluster cluster : clusterList) {
if(cluster.addStrip(stripList.get(loop))){ //Add adjacent strip to newly seeded peak
stripAdded = true;
@@ -178,7 +177,7 @@ public static List createClusters(List stripList){
clusterList.get(loop).redoClusterLine();
}
return clusterList;
- }
+ }
public static List getClusters(List clusters, int sector, int layer) {
List selectedClusters = new ArrayList<>();
@@ -192,8 +191,8 @@ public static List getClusters(List clusters, int sect
@Override
public String toString(){
StringBuilder str = new StringBuilder();
- str.append(String.format("----> cluster ( %3d %3d ) ENERGY = %12.5f\n",
- this.desc.getSector(),this.desc.getLayer(), this.getEnergy()));
+ str.append(String.format("----> cluster ( %3d %3d ) ENERGY = %12.5f\n",
+ this.desc.getSector(),this.desc.getLayer(), this.getEnergy()));
str.append(this.clusterLine.toString());
str.append("\n");
for(RtrkStrip strip : this){
@@ -204,9 +203,5 @@ public String toString(){
return str.toString();
}
-
-
-
-
}
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkConstants.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkConstants.java
index ddf55032d6..6eae19bbde 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkConstants.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkConstants.java
@@ -6,7 +6,6 @@
*/
public class RtrkConstants {
-
// geometry
public final static int NSECTOR = 2;
public final static int NLAYER = 6;
@@ -17,12 +16,12 @@ public class RtrkConstants {
public final static int[] STRIPMAX = { 351, 582, 834}; // higher strip number
public final static double PITCH = 0.1; // mm
public final static double[] STEREO = { 0.0, 90.0 };
-
+
// strips
public final static double THRESHOLD = 0;
public final static double ADCTOENERGY = 25/1E4; // in eV, values from gemc ADC = (uRwellC.gain*1e6*tInfos.eTot/uRwellC.w_i); with gain = 10^4 and w_i = 25 eV
public final static double TDCTOTIME = 1;
-
+
// cluster
public final static double COINCTIME = 100;
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCross.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCross.java
index db98bc54c8..6dd65c1f78 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCross.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkCross.java
@@ -11,7 +11,7 @@
* @author devita, niccolai
*/
public class RtrkCross {
-
+
private int id;
private int sector;
@@ -26,12 +26,9 @@ public class RtrkCross {
private double time;
private int status;
-
-
-
public RtrkCross(RtrkCluster c1, RtrkCluster c2) {
- Vector3D dir = c1.getLine().direction().cross(c2.getLine().direction());
+ Vector3D dir = c1.getLine().direction().cross(c2.getLine().direction());
Plane3D plane = new Plane3D(c1.getLine().origin(), c1.getLine().direction().cross(dir));
Point3D point = new Point3D();
int nint = plane.intersectionSegment(c2.getLine(), point);
@@ -45,11 +42,11 @@ public RtrkCross(RtrkCluster c1, RtrkCluster c2) {
this.cluster2 = c2.getId();
}
}
-
+
public void setId(int id) {
this.id = id;
}
-
+
public int getId() {
return id;
}
@@ -69,19 +66,19 @@ public int getChamber() {
public int getCluster1() {
return cluster1;
}
-
+
public int getCluster2() {
return cluster2;
}
-
+
public Point3D point() {
return cross;
- }
-
+ }
+
public double getEnergy() {
return energy;
}
-
+
public double getTime() {
return time;
}
@@ -89,7 +86,7 @@ public double getTime() {
public int getStatus() {
return status;
}
-
+
public static List createCrosses(List clusters) {
List crosses = new ArrayList<>();
diff --git a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkEngine.java b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkEngine.java
index b1f3386f22..8e4c2b4559 100644
--- a/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkEngine.java
+++ b/reconstruction/recoil/src/main/java/org/jlab/service/recoil/trk/RtrkEngine.java
@@ -22,38 +22,35 @@
/**
*
* recoil reconstruction engine
- *
+ *
* @author bondi, devita, niccolai
*/
public class RtrkEngine extends ReconstructionEngine {
-
+
public static Logger LOGGER = Logger.getLogger(RtrkEngine.class.getName());
-
+
public static RtrkStripFactory factory = new RtrkStripFactory();
-
+
public RtrkEngine() {
super("Rtrk","niccolai","1.0");
}
-
+
@Override
public boolean init() {
-
+
// init ConstantsManager to read constants from CCDB
String variationName = Optional.ofNullable(this.getEngineConfigString("variation")).orElse("default");
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, variationName);
factory.init(cp, RtrkConstants.NREGION);
- // register output banks for drop option
+ // register output banks for drop option
this.registerOutputBank("RTRK::hits");
this.registerOutputBank("RTRK::clusters");
this.registerOutputBank("RTRK::crosses");
-
+
LOGGER.log(Level.INFO, "--> recoil is ready...");
return true;
}
-
-
-
-
+
@Override
public boolean processDataEventUser(DataEvent event) {
@@ -65,13 +62,12 @@ public boolean processDataEventUser(DataEvent event) {
return true;
}
-
- private void writeHipoBanks(DataEvent de,
- List strips,
- List clusters,
- List crosses){
-
+ private void writeHipoBanks(DataEvent de,
+ List strips,
+ List clusters,
+ List crosses){
+
DataBank bankS = de.createBank("RTRK::hits", strips.size());
for(int h = 0; h < strips.size(); h++){
bankS.setShort("id", h, (short) strips.get(h).getId());
@@ -79,12 +75,12 @@ private void writeHipoBanks(DataEvent de,
bankS.setByte("layer", h, (byte) strips.get(h).getDescriptor().getLayer());
bankS.setShort("strip", h, (short) strips.get(h).getDescriptor().getComponent());
bankS.setFloat("energy", h, (float) strips.get(h).getEnergy());
- bankS.setFloat("time", h, (float) strips.get(h).getTime());
+ bankS.setFloat("time", h, (float) strips.get(h).getTime());
bankS.setShort("status", h, (short) strips.get(h).getStatus());
bankS.setShort("clusterId", h, (short) strips.get(h).getClusterId());
}
- DataBank bankC = de.createBank("RTRK::clusters", clusters.size());
+ DataBank bankC = de.createBank("RTRK::clusters", clusters.size());
for(int c = 0; c < clusters.size(); c++){
bankC.setShort("id", c, (short) clusters.get(c).getId());
bankC.setByte("sector", c, (byte) clusters.get(c).get(0).getDescriptor().getSector());
@@ -99,10 +95,10 @@ private void writeHipoBanks(DataEvent de,
bankC.setFloat("ye", c, (float) clusters.get(c).getLine().end().y());
bankC.setFloat("ze", c, (float) clusters.get(c).getLine().end().z());
bankC.setShort("size", c, (short) clusters.get(c).size());
- bankC.setShort("status", c, (short) clusters.get(c).getStatus());
- }
+ bankC.setShort("status", c, (short) clusters.get(c).getStatus());
+ }
- DataBank bankX = de.createBank("RTRK::crosses", crosses.size());
+ DataBank bankX = de.createBank("RTRK::crosses", crosses.size());
for(int c = 0; c < crosses.size(); c++){
bankX.setShort("id", c, (short) crosses.get(c).getId());
bankX.setByte("sector", c, (byte) crosses.get(c).getSector());
@@ -112,13 +108,12 @@ private void writeHipoBanks(DataEvent de,
bankX.setFloat("x", c, (float) crosses.get(c).point().x());
bankX.setFloat("y", c, (float) crosses.get(c).point().y());
bankX.setFloat("z", c, (float) crosses.get(c).point().z());
- bankX.setShort("cluster1", c, (short) crosses.get(c).getCluster1());
- bankX.setShort("cluster2", c, (short) crosses.get(c).getCluster2());
- bankX.setShort("status", c, (short) crosses.get(c).getStatus());
- }
+ bankX.setShort("cluster1", c, (short) crosses.get(c).getCluster1());
+ bankX.setShort("cluster2", c, (short) crosses.get(c).getCluster2());
+ bankX.setShort("status", c, (short) crosses.get(c).getStatus());
+ }
de.appendBanks(bankS,bankC,bankX);
}
-
public static void fitGauss(H1F histo) {
double mean = histo.getMean();
@@ -135,7 +130,7 @@ public static void fitGauss(H1F histo) {
f1.setParameter(0, amp);
f1.setParameter(1, mean);
f1.setParameter(2, sigma);
-
+
if(amp>5) {
f1.setParLimits(0, amp*0.2, amp*1.2);
f1.setParLimits(1, mean*0.5, mean*1.5);
@@ -149,36 +144,36 @@ public static void fitGauss(H1F histo) {
f1.setRange(mean-2.0*sigma,mean+2.0*sigma);
DataFitter.fit(f1, histo, "Q");
}
- }
+ }
public static void main (String arg[]) {
-
+
RtrkEngine engine = new RtrkEngine();
engine.init();
-
+
String input = "/Users/devita/urwell3d.hipo";
-
+
DataGroup dg = new DataGroup(3, 2);
String[] axes = {"x", "y"};
for(int il=0; il getStrips(DataEvent event, RtrkStripFactory factor
int comp = bank.getShort("component", i);
int adc = bank.getInt("ADC", i);
double time = bank.getFloat("time", i);
-
- RtrkStrip strip = new RtrkStrip(sector, layer, comp);
-// strip.setTriggerPhase(triggerPhase);
- strip.setId(bank.trueIndex(i)+1);
- strip.setADC(adc);
- strip.setTDC((int) time);
- strip.setEnergy(strip.ADC*RtrkConstants.ADCTOENERGY);
- strip.setTime(strip.TDC*RtrkConstants.TDCTOTIME);
- strip.setLine(factory.getStrip(sector, layer, comp));
- strip.setChamber(factory.getChamberIndex(comp)+1);
- strip.setStatus(0);
+ RtrkStrip strip = new RtrkStrip(sector, layer, comp);
- if(strip.getEnergy()>RtrkConstants.THRESHOLD) strips.add(strip);
+// strip.setTriggerPhase(triggerPhase);
+strip.setId(bank.trueIndex(i)+1);
+strip.setADC(adc);
+strip.setTDC((int) time);
+strip.setEnergy(strip.ADC*RtrkConstants.ADCTOENERGY);
+strip.setTime(strip.TDC*RtrkConstants.TDCTOTIME);
+strip.setLine(factory.getStrip(sector, layer, comp));
+strip.setChamber(factory.getChamberIndex(comp)+1);
+strip.setStatus(0);
+
+if(strip.getEnergy()>RtrkConstants.THRESHOLD) strips.add(strip);
}
- }
+ }
return strips;
}
@Override
public String toString(){
StringBuilder str = new StringBuilder();
- str.append(String.format("----> strip (%3d %3d %3d) ADC/TDC %5d %5d ENERGY = %8.5f TIME = %8.5f ",
- this.desc.getSector(),this.desc.getLayer(),this.desc.getComponent(),
- this.ADC,this.TDC,this.getEnergy(),this.getTime()));
+ str.append(String.format("----> strip (%3d %3d %3d) ADC/TDC %5d %5d ENERGY = %8.5f TIME = %8.5f ",
+ this.desc.getSector(),this.desc.getLayer(),this.desc.getComponent(),
+ this.ADC,this.TDC,this.getEnergy(),this.getTime()));
return str.toString();
}
}