Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Revamped ATOF geometry. #227

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,34 @@
import java.util.List;

/**
* @author viktoriya
* this is the latest ATOF geometry class to be used in reco. and in GEMC simulations!
* commit on July 02, 2020
* @author viktoriya, whit
*
* Swapped the meaning of "paddle" and "layer" The "paddle" is 10 wedges to a row. The row is the "layer" (of which there are 4).
*
* ATOF geometry:
* _________________
* \ /
* \ wedge / 2cm thick
* \ /
* \_________/
* \__row__/ 3mm thick
*
* ^
* |
* |
* paticle
*
*/
public class AlertTOFFactory implements Factory<AlertTOFDetector, AlertTOFSector, AlertTOFSuperlayer, AlertTOFLayer> {

private final int nsectors = 15;
private final int nsuperl = 2;
private final int nlayers1 = 10;
private final int npaddles = 4;
private final int nsectors = 15; // 15 modules
private final int nsuperl = 2; // 2 layers
private final int npaddles = 10; // 10 wedges per paddle
private final int nlayers1 = 4; // 4 rows per layer

private final double openAng_pad_deg = 6.0;
private final double openAng_pad_deg = 6.0;
private final double openAng_pad_rad = Math.toRadians(openAng_pad_deg);
private final double openAng_sector_rad = npaddles * openAng_pad_rad;
private final double openAng_sector_rad = 4 * openAng_pad_rad;

@Override
public AlertTOFDetector createDetectorCLAS(ConstantProvider cp) {
Expand Down Expand Up @@ -62,8 +76,11 @@ public AlertTOFDetector createDetectorLocal(ConstantProvider cp) {
public AlertTOFSector createSector(ConstantProvider cp, int sectorId) {
if (!(0 <= sectorId && sectorId < nsectors)) throw new IllegalArgumentException("Error: invalid sector=" + sectorId);
AlertTOFSector sector = new AlertTOFSector(sectorId);
for (int superlayerId = 0; superlayerId < nsuperl; superlayerId++)
sector.addSuperlayer(createSuperlayer(cp, sectorId, superlayerId));
// Lets not confuse things there are 2 "super layers"
sector.addSuperlayer(createSuperlayer(cp, sectorId, 0)); // is it ok to start at zero here?
sector.addSuperlayer(createSuperlayer(cp, sectorId, 1));
//for (int superlayerId = 0; superlayerId < nsuperl; superlayerId++)
// sector.addSuperlayer(createSuperlayer(cp, sectorId, superlayerId));
return sector;
}

Expand All @@ -73,60 +90,85 @@ public AlertTOFSuperlayer createSuperlayer(ConstantProvider cp, int sectorId, in
if (!(0 <= superlayerId && superlayerId < nsuperl)) throw new IllegalArgumentException("Error: invalid superlayer=" + superlayerId);
AlertTOFSuperlayer superlayer = new AlertTOFSuperlayer(sectorId, superlayerId);

if (superlayerId == 0) {
int nlayers0 = 1;
for (int layerId = 0; layerId < nlayers0; layerId++)
superlayer.addLayer(createLayer(cp, sectorId, superlayerId, layerId));
} else {
for (int layerId = 0; layerId < nlayers1; layerId++)
superlayer.addLayer(createLayer(cp, sectorId, superlayerId, layerId));
}
return superlayer;
}
if (superlayerId == 0) { // should this start at 1?
for (int layerId = 0; layerId < nlayers1; layerId++)
superlayer.addLayer(createLayer(cp, sectorId, superlayerId, layerId));
} else {
for (int layerId = 0; layerId < nlayers1; layerId++)
superlayer.addLayer(createLayer(cp, sectorId, superlayerId, layerId));
}
return superlayer;
}

@Override
public AlertTOFLayer createLayer(ConstantProvider cp, int sectorId, int superlayerId, int layerId) {
if (!(0 <= sectorId && sectorId < nsectors)) throw new IllegalArgumentException("Error: invalid sector=" + sectorId);
if (!(0 <= superlayerId && superlayerId < nsuperl)) throw new IllegalArgumentException("Error: invalid superlayer=" + superlayerId);
if (!(0 <= layerId && layerId < nlayers1)) throw new IllegalArgumentException("Error: invalid layer=" + layerId);

double R0 = 77.0d;
double R1 = 80.0d;
double dR0 = 3.0d;
double dR1 = 20.0d;
double R0 = 77.0;
double R1 = 80.0;
double dR0 = 3.0; // row scintillator thickness
double dR1 = 20.0; // wedge scintillator thickness

//double pad_b1 = 2*((R1)*tan(openAng_pad_deg/2) - 25.4*0.004*);
//double pad_b2 = 2*((R1+dR1)*tan(openAng_pad_deg/2) - 25.4*0.004*);
// where the wrap thickness is 4 mil.

// trapezoide dimensions for a bigger paddle (external)
double pad_b1 = 8.17369; // mm
double pad_b2 = 10.27; // mm
// trapezoide dimensions for a bigger paddle (external)
double pad_b1 = 8.17369; // mm inner width of wedge
double pad_b2 = 10.27; // mm outer width of wedge

double pad_z = 279.7; // mm
if (superlayerId == 1) pad_z = 27.7; // mm
// 4 mil wrapping thickness = 25.4*0.004*2 = 0.2032 mm
double gap_pad_z = 0.2032; // mm, gap between paddles in z
double pad_z = 280.0; // mm wedge length
if (superlayerId == 1) pad_z = 28.0 - gap_pad_z; // mm inner bar length

//double small_pad_b1 = 2*((R0)*tan(openAng_pad_deg/2) - 25.4*0.004*);
//double small_pad_b2 = 2*((R0+dR0)*tan(openAng_pad_deg/2) - 25.4*0.004*);
// where the wrap thickness is 4 mil.

// trapezoide dimensions for a smaller paddle (internal)
double small_pad_b1 = 7.85924; // mm
double small_pad_b2 = 8.17369; // mm

double gap_pad_z = 0.3d; // mm, gap between paddles in z

// "layer" is a paddle
AlertTOFLayer layer = new AlertTOFLayer(sectorId, superlayerId, layerId);

List<Plane3D> planes = new ArrayList<>();

double len_b = layerId * pad_z + layerId * gap_pad_z; // back paddle plan
double len_f = len_b + pad_z; // front paddle plan
double Rl = R0;
double dR = dR0;
double widthTl = small_pad_b2;
double widthBl = small_pad_b1;
int scint_per_row = 1;

if (superlayerId == 1) {
Rl = R1;
dR = dR1;
widthTl = pad_b2;
widthBl = pad_b1;
}
// Outer wedges
Rl = R1;
dR = dR1;
widthTl = pad_b2;
widthBl = pad_b1;
scint_per_row = npaddles; //10 wedges
}

int comp_index = 0;

// 10 pads per layer in the outer wedges
for (int padId = 0; padId < scint_per_row; padId++) {

// Not sure what this is relative to but it seems to start at z=0. -whit
double len_b = padId * pad_z + padId * gap_pad_z; // back paddle plan
double len_f = len_b + pad_z; // front paddle plan

if (superlayerId == 1) {
// first 4 index values are for the 4 inner bars
comp_index = 3 + layerId*10 +padId;
} else {
comp_index = layerId+padId; // padId should be 0 here so it is just layerId.
}

for (int padId = 0; padId < npaddles; padId++) {
Point3D p0 = new Point3D(-dR / 2, -widthBl / 2, len_f);
Point3D p1 = new Point3D(dR / 2, -widthTl / 2, len_f);
Point3D p2 = new Point3D(dR / 2, widthTl / 2, len_f);
Expand All @@ -136,26 +178,35 @@ public AlertTOFLayer createLayer(ConstantProvider cp, int sectorId, int superlay
Point3D p5 = new Point3D(dR / 2, -widthTl / 2, len_b);
Point3D p6 = new Point3D(dR / 2, widthTl / 2, len_b);
Point3D p7 = new Point3D(-dR / 2, widthBl / 2, len_b);
ScintillatorPaddle Paddle = new ScintillatorPaddle(sectorId * 4 + padId, p0, p1, p2, p3, p4, p5, p6, p7);

// What is the role of the component ID here: -whit
//
// Each scintillator paddle has a unique ID.
ScintillatorPaddle Paddle = new ScintillatorPaddle(sectorId *44 + comp_index, p0, p1, p2, p3, p4, p5, p6, p7);

double openAng_sector_deg = npaddles * openAng_pad_deg;
Paddle.rotateZ(Math.toRadians(padId * openAng_pad_deg + sectorId * openAng_sector_deg));
Paddle.rotateZ(Math.toRadians(layerId * openAng_pad_deg + sectorId * openAng_sector_deg));

double xoffset;
double yoffset;

xoffset = (Rl + dR / 2) * Math.cos(padId * openAng_pad_rad + sectorId * openAng_sector_rad);
yoffset = (Rl + dR / 2) * Math.sin(padId * openAng_pad_rad + sectorId * openAng_sector_rad);
xoffset = (Rl + dR / 2) * Math.cos(layerId * openAng_pad_rad + sectorId * openAng_sector_rad);
yoffset = (Rl + dR / 2) * Math.sin(layerId * openAng_pad_rad + sectorId * openAng_sector_rad);

Paddle.translateXYZ(xoffset, yoffset, 0);

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


if (superlayerId == 0) {
// Not sure what this is for? -whit
// adding plane for each of the 60 inner bars. Maybe the outer wedge rows need a plane too?...
Plane3D plane = new Plane3D(0, Rl, 0, 0, 1, 0);
plane.rotateZ(sectorId * openAng_sector_rad - Math.toRadians(90));
plane.rotateZ((sectorId) * openAng_sector_rad + layerId*openAng_pad_rad - Math.toRadians(90));
planes.add(plane);
}

return layer;
}
Expand Down