Skip to content

Commit 4524aaf

Browse files
N-PlxN-Plx
authored andcommitted
fix atof geometry service (#593)
* fix: translation after the objects are built * fix:remove z translation after geometry fix * fix: use logger instead of print out --------- Co-authored-by: N-Plx <clas12-3@ifarm2401.jlab.org>
1 parent 3bd0f8e commit 4524aaf

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

  • common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/ATOF
  • reconstruction/alert/src/main/java/org/jlab/rec/atof/hit

common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/ATOF/AlertTOFFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public AlertTOFLayer createLayer(ConstantProvider cp, int sectorId, int superlay
135135
for (int padId = 0; padId < current_ncomponents; padId++) {
136136

137137
//Component index increases with increasing z
138-
double len_b = padId * pad_z + padId * gap_pad_z - atof_length/2; // back paddle plan, centered at z = 0
139-
double len_f = len_b + pad_z - atof_length/2; // front paddle plan, centered at z = 0
138+
double len_b = padId * pad_z + padId * gap_pad_z;// back paddle plan
139+
double len_f = len_b + pad_z;// front paddle plan
140140

141141
Point3D p0 = new Point3D(-dR / 2, -widthBl / 2, len_f);
142142
Point3D p1 = new Point3D(dR / 2, -widthTl / 2, len_f);
@@ -162,8 +162,8 @@ public AlertTOFLayer createLayer(ConstantProvider cp, int sectorId, int superlay
162162

163163
xoffset = (Rl + dR / 2) * Math.cos(Math.toRadians(current_angle_deg));
164164
yoffset = (Rl + dR / 2) * Math.sin(Math.toRadians(current_angle_deg));
165-
166-
Paddle.translateXYZ(xoffset, yoffset, 0);
165+
166+
Paddle.translateXYZ(xoffset, yoffset, - atof_length/2); //centering at z=0
167167

168168
// Add the paddles to the list
169169
layer.addComponent(Paddle);

reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import org.jlab.geom.base.*;
44
import org.jlab.geom.prim.Point3D;
55
import org.jlab.rec.atof.constants.Parameters;
6+
import java.util.logging.Level;
7+
import java.util.logging.Logger;
68

79
/**
810
*
@@ -15,6 +17,8 @@
1517
*/
1618
public class ATOFHit {
1719

20+
static final Logger LOGGER = Logger.getLogger(ATOFHit.class.getName());
21+
1822
private int sector, layer, component, order;
1923
private int tdc, tot;
2024
private double time, energy, x, y, z;
@@ -182,7 +186,7 @@ public final String makeType() {
182186
public final int convertTdcToTime() {
183187
double tdc2time, veff, distance_to_sipm;
184188
if (null == this.type) {
185-
System.out.print("Null hit type, cannot convert tdc to time.");
189+
LOGGER.finest("Null hit type, cannot convert tdc to time.");
186190
return 1;
187191
} else {
188192
switch (this.type) {
@@ -205,11 +209,11 @@ public final int convertTdcToTime() {
205209
distance_to_sipm = 0;
206210
}
207211
case "bar" -> {
208-
System.out.print("Bar hit type, cannot convert tdc to time.");
212+
LOGGER.finest("Bar hit type, cannot convert tdc to time.");
209213
return 1;
210214
}
211215
default -> {
212-
System.out.print("Undefined hit type, cannot convert tdc to time.");
216+
LOGGER.finest("Undefined hit type, cannot convert tdc to time.");
213217
return 1;
214218
}
215219
}
@@ -230,7 +234,7 @@ public final int convertTdcToTime() {
230234
public final int convertTotToEnergy() {
231235
double tot2energy;
232236
if (null == this.type) {
233-
System.out.print("Null hit type, cannot convert tot to energy.");
237+
LOGGER.finest("Null hit type, cannot convert tot to energy.");
234238
return 1;
235239
} else {
236240
switch (this.type) {
@@ -254,11 +258,11 @@ public final int convertTotToEnergy() {
254258
this.energy = tot2energy * this.tot;
255259
}
256260
case "bar" -> {
257-
System.out.print("Bar hit type, cannot convert tot to energy.");
261+
LOGGER.finest("Bar hit type, cannot convert tot to energy.");
258262
return 1;
259263
}
260264
default -> {
261-
System.out.print("Undefined hit type, cannot convert tot to energy.");
265+
LOGGER.finest("Undefined hit type, cannot convert tot to energy.");
262266
return 1;
263267
}
264268
}
@@ -294,12 +298,11 @@ public final int convertSLCToXYZ(Detector atof) {
294298
Component comp = atof.getSector(this.sector).getSuperlayer(sl).getLayer(this.layer).getComponent(this.component);
295299
Point3D midpoint = comp.getMidpoint();
296300
//Midpoints defined in the system were z=0 is the upstream end of the atof
297-
//Translation to the system were z=0 is the center of the atof
298301
//Units are mm
299302
this.x = midpoint.x();
300303
this.y = midpoint.y();
301-
this.z = midpoint.z() - Parameters.LENGTH_ATOF / 2.;
302-
return 0;
304+
this.z = midpoint.z();
305+
return 0;
303306
}
304307

305308
/**

0 commit comments

Comments
 (0)