Skip to content

Commit

Permalink
corrected bug in G4Trap dz not accounting for the 25 deg tilt, adjust…
Browse files Browse the repository at this point in the history
…ed region volume thickness accordingly
  • Loading branch information
raffaelladevita committed Nov 5, 2024
1 parent dd96261 commit 8707d16
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public final class DCGeant4Factory extends Geant4Factory {
private int nsgwires;

private final double y_enlargement = 3.65;
private final double z_enlargement = -2.96;
private final double z_enlargement = -2.46;
private final double microgap = 0.01;

private final Wire[][][][] wires;
Expand Down Expand Up @@ -889,20 +889,30 @@ public Geant4Basic createRegion(int isector, int iregion) {
return regionVolume;
}

///////////////////////////////////////////////////

/**
* Create GEANT4 superlayer volume:
* - from first to last guard wire in layer=0 to define y
* - from first to last guard wire plane in z
* @param isuper
* @return
*/
public Geant4Basic createSuperlayer(int isuper) {
int nsglayers = dbref.nsenselayers(isuper) + dbref.nguardlayers(isuper);
Wire lw0 = new Wire(1, isuper, 1, 0);
Wire lw1 = new Wire(1, isuper, nsglayers-2, nsgwires - 1);
Wire lw0 = new Wire(1, isuper, 0, 0);
Wire lw1 = new Wire(1, isuper, 0, nsgwires - 1);
Wire lw2 = new Wire(1, isuper, 2, 0);

Vector3d midline = lw1.mid().minus(lw0.mid());
double lay_dy = Math.sqrt(Math.pow(midline.magnitude(), 2.0) - Math.pow(midline.dot(lw0.dir()), 2.0)) / 2.0;
Vector3d yline = lw1.mid().minus(lw0.mid());
double lay_dy = Math.sqrt(Math.pow(yline.magnitude(), 2.0) - Math.pow(yline.dot(lw0.dir()), 2.0)) / 2.0;
double lay_dx0 = lw0.length() / 2.0;
double lay_dx1 = lw1.length() / 2.0;
double lay_dz = (dbref.cellthickness(isuper)*dbref.nsenselayers(isuper)+1) * dbref.wpdist(isuper) / 2.0;
double lay_dz = (dbref.cellthickness(isuper)*dbref.nsenselayers(isuper)+1) * dbref.wpdist(isuper)/Math.cos(dbref.thtilt(isuper/2))/ 2.0;
double lay_skew = lw0.center().minus(lw1.center()).angle(lw1.dir()) - Math.toRadians(90.0);

Vector3d lcent = lw0.center().plus(lw1.center()).dividedBy(2.0);
Vector3d zline = lw2.mid().minus(lw0.mid()).normalized();
Vector3d lcent = lw0.center().plus(lw1.center()).dividedBy(2.0).plus(zline.times(lay_dz));

G4Trap superlayerVolume = new G4Trap("sl" + (isuper + 1),
lay_dz, -dbref.thtilt(isuper / 2), Math.toRadians(90.0),
lay_dy, lay_dx0, lay_dx1, lay_skew,
Expand Down

0 comments on commit 8707d16

Please sign in to comment.