Skip to content

Commit

Permalink
added DC superlayers as geant4 volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelladevita committed Nov 5, 2024
1 parent 527d42e commit b5bbe1f
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,19 @@ public Geant4Basic createRegion(int isector, int iregion) {

for (int isup = 0; isup < 2; isup++) {
int isuper = iregion * 2 + isup;
Geant4Basic superlayerVolume = this.createSuperlayer(isuper);
superlayerVolume.setName("sl" + (isuper + 1) + "_s" + (isector + 1));

Vector3d slcenter = superlayerVolume.getLocalPosition();
Vector3d slshift = slcenter.minus(reg_position0);
slshift.rotateX(reg_thtilt);

superlayerVolume.rotate("zxy", -dbref.thster(isuper), 0.0, 0.0);

superlayerVolume.setPosition(slshift.x, slshift.y, slshift.z);
superlayerVolume.setMother(regionVolume);
superlayerVolume.setId(isector + 1, iregion + 1, isuper + 1);

int nsglayers = dbref.nsenselayers(isuper) + dbref.nguardlayers(isuper);
for (int ilayer = 1; ilayer < nsglayers - 1; ilayer++) {
Geant4Basic layerVolume = this.createLayer(isuper, ilayer);
Expand All @@ -876,6 +889,30 @@ public Geant4Basic createRegion(int isector, int iregion) {
return regionVolume;
}

///////////////////////////////////////////////////
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);

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;
double lay_dx0 = lw0.length() / 2.0;
double lay_dx1 = lw1.length() / 2.0;
double lay_dz = dbref.cellthickness(isuper) * dbref.wpdist(isuper) * (nsglayers -2) / 2.0 - microgap;
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);
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,
lay_dy, lay_dx0, lay_dx1, lay_skew);

superlayerVolume.setPosition(lcent.x, lcent.y, lcent.z);

return superlayerVolume;
}

///////////////////////////////////////////////////
public Geant4Basic createLayer(int isuper, int ilayer) {
Wire lw0 = new Wire(1, isuper, ilayer, 0);
Expand Down

0 comments on commit b5bbe1f

Please sign in to comment.