Skip to content

Commit ca1c727

Browse files
raffaelladevitatongtongcao
authored andcommitted
shift the AHDC center to z=0, improve code clarity
1 parent ddbd3e1 commit ca1c727

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/alert/AHDC/AlertDCFactory.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye
8686
double R_layer = 32.0d;
8787
double DR_layer = 4.0d;
8888

89-
double zoff1 = 0.0d;
90-
double zoff2 = 300.0d;
89+
double zoff1 = -150.0d;
90+
double zoff2 = 150.0d;
9191
Point3D p1 = new Point3D(R_layer, 0, zoff1);
9292
Vector3D n1 = new Vector3D(0, 0, 1);
9393

@@ -131,10 +131,12 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye
131131
// Create AHDC sense wires
132132
for (int iw = 0; iw < numWires; iw++) {
133133

134-
int wireId = iw + 1 + (int) (numWires/2);
135-
if(wireId>numWires) wireId -= numWires;
134+
// start at phi=180
135+
double wirePhiIndex = (numWires/2) + iw - 0.5*(layerId-1);
136136

137-
double wirePhiIndex = (numWires/2) + iw - 0.5*(layerId-1); // start at phi=180
137+
// the wire id is such that the wire number = (wireId+1) is the first wqual or greater than numWires/2
138+
int wireId = iw + (int) (numWires/2);
139+
if(wireId>numWires-1) wireId -= numWires;
138140

139141
// The point given by (wx, wy, wz) is the origin of the current wire.
140142
double wx = R_layer * Math.cos(alphaW_layer * wirePhiIndex);
@@ -144,7 +146,7 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye
144146
// planes by construciting a long line that passes through the midpoint
145147
double wx_end = R_layer * Math.cos(alphaW_layer * wirePhiIndex + thster * (Math.pow(-1, superlayerId)));
146148
double wy_end = R_layer * Math.sin(alphaW_layer * wirePhiIndex + thster * (Math.pow(-1, superlayerId)));
147-
Line3D line = new Line3D(wx, wy, 0, wx_end, wy_end, zl);
149+
Line3D line = new Line3D(wx, wy, -zl/2, wx_end, wy_end, zl/2);
148150

149151
Point3D lPoint = new Point3D();
150152
Point3D rPoint = new Point3D();
@@ -185,19 +187,19 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye
185187
List<Point3D> firstF = new ArrayList<>();
186188
List<Point3D> secondF = new ArrayList<>();
187189
// first Face
188-
Point3D p_0 = new Point3D(px_0, py_0, 0.0d);
189-
Point3D p_1 = new Point3D(px_1, py_1, 0.0d);
190-
Point3D p_2 = new Point3D(px_2, py_2, 0.0d);
191-
Point3D p_3 = new Point3D(px_3, py_3, 0.0d);
192-
Point3D p_4 = new Point3D(px_4, py_4, 0.0d);
193-
Point3D p_5 = new Point3D(px_5, py_5, 0.0d);
190+
Point3D p_0 = new Point3D(px_0, py_0, -zl/2);
191+
Point3D p_1 = new Point3D(px_1, py_1, -zl/2);
192+
Point3D p_2 = new Point3D(px_2, py_2, -zl/2);
193+
Point3D p_3 = new Point3D(px_3, py_3, -zl/2);
194+
Point3D p_4 = new Point3D(px_4, py_4, -zl/2);
195+
Point3D p_5 = new Point3D(px_5, py_5, -zl/2);
194196
// second Face
195-
Point3D p_6 = new Point3D(px_6, py_6, zl);
196-
Point3D p_7 = new Point3D(px_7, py_7, zl);
197-
Point3D p_8 = new Point3D(px_8, py_8, zl);
198-
Point3D p_9 = new Point3D(px_9, py_9, zl);
199-
Point3D p_10 = new Point3D(px_10, py_10, zl);
200-
Point3D p_11 = new Point3D(px_11, py_11, zl);
197+
Point3D p_6 = new Point3D(px_6, py_6, zl/2);
198+
Point3D p_7 = new Point3D(px_7, py_7, zl/2);
199+
Point3D p_8 = new Point3D(px_8, py_8, zl/2);
200+
Point3D p_9 = new Point3D(px_9, py_9, zl/2);
201+
Point3D p_10 = new Point3D(px_10, py_10, zl/2);
202+
Point3D p_11 = new Point3D(px_11, py_11, zl/2);
201203
// defining a cell around a wireLine, must be counter-clockwise!
202204
firstF.add(p_0);
203205
firstF.add(p_5);
@@ -218,7 +220,7 @@ public AlertDCLayer createLayer(ConstantProvider cp, int sectorId, int superlaye
218220
// not possible to add directly PrismaticComponent class because it is an ABSTRACT
219221
// a new class should be created: public class NewClassWire extends PrismaticComponent {...}
220222
// 5 top points & 5 bottom points with convexe shape. Concave shape is not supported.
221-
AlertDCWire wire = new AlertDCWire(wireId, wireLine, firstF, secondF);
223+
AlertDCWire wire = new AlertDCWire(wireId+1, wireLine, firstF, secondF);
222224
// Add wire object to the list
223225
layer.addComponent(wire);
224226
}

0 commit comments

Comments
 (0)