-
Notifications
You must be signed in to change notification settings - Fork 33
Geometry Factory for Muon Calorimeter #1302
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
Open
ethancline
wants to merge
24
commits into
development
Choose a base branch
from
mucal-geomfactory
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
06d8a7e
imported muCLAS12/ddvcs reconstruction from ddvcs branch creating new…
raffaelladevita 135d3b2
Merge branch 'development' into ddvcsMerge
raffaelladevita 6f22ad8
fix version number in mu pom, and adding missing MUHD reconstruction …
raffaelladevita 85dfbd5
fix dependency in mu pom
raffaelladevita 9ce0517
fix dependency in mu pom
raffaelladevita b28aaf2
addressing spotbugs findings
raffaelladevita 88f080c
Merge branch 'ddvcsMerge' of github.com:JeffersonLab/coatjava into de…
ethancline c9beaa5
Merge branch 'development' into ddvcsMerge
raffaelladevita 41a1ffe
updatedmu pom and MUVT fixes
raffaelladevita 18a30be
added MUVT trajectory points
raffaelladevita b046673
bug fixes
raffaelladevita ffab8f4
Merge branch 'ddvcsMerge' of github.com:JeffersonLab/coatjava into de…
ethancline e66b8e4
mucal factory for ddvcs experiment
ethancline 4ace20a
make sure to make all crystals
ethancline 6f7ca7b
Merge github.com:JeffersonLab/coatjava into cal
ethancline 4d2d71e
remove unused methods, clean-up doubly defined variables.
ethancline 665c3c7
Merge github.com:JeffersonLab/coatjava into development
ethancline 6f24b2a
revert
ethancline 0542cb9
remove DCengine file from pull request
ethancline 23cf3fb
rename to crystals
ethancline 37d017a
remove unused imports, run auto-formatter
baltzell bf926d2
Merge pull request #1317 from JeffersonLab/mucal-geomfactory-cleanup
ethancline 50a3337
Merge branch 'development' into mucal-geomfactory
baltzell 16c34db
Merge branch 'development' into mucal-geomfactory
baltzell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MUCALGeant4Factory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| package org.jlab.detector.geant4.v2; | ||
|
|
||
| import java.util.List; | ||
| import java.util.ArrayList; | ||
| import org.jlab.detector.volume.Geant4Basic; | ||
| import org.jlab.detector.volume.G4Trd; | ||
| import org.jlab.detector.volume.G4World; | ||
| import org.jlab.geom.base.ConstantProvider; | ||
| import static org.jlab.detector.units.SystemOfUnits.Length; | ||
|
|
||
| /** | ||
| * | ||
| * @author Ethan Cline | ||
| */ | ||
| public final class MUCALGeant4Factory extends Geant4Factory { | ||
|
|
||
| public MUCALGeant4Factory(ConstantProvider provider) { | ||
| motherVolume = new G4World("ddvcs_ecal"); | ||
| for (int sector = 1; sector <= 2; sector++) { | ||
| List<G4Trd> layerVolume = createPanel(provider, sector, 1); | ||
| for (G4Trd crystal : layerVolume) { | ||
| crystal.setMother(motherVolume); | ||
| } | ||
| // layerVolume.setMother(motherVolume); | ||
| } | ||
| properties.put("email", "ewcline@mit.edu"); | ||
| properties.put("author", "cline"); | ||
| properties.put("date", "3/23/26"); | ||
| } | ||
|
|
||
| private List<G4Trd> createPanel(ConstantProvider cp, int sector, int layer) { | ||
| return this.createLayer(cp, layer); | ||
| } | ||
|
|
||
| private List<G4Trd> createLayer(ConstantProvider cp, int layer) { | ||
|
|
||
| double Dat25deg = 596.*Length.mm; // distance of the upstream face from the target at 25 deg | ||
| double ThetaU = Math.toRadians(25); // deg | ||
| double ThetaMin = Math.toRadians(7); // deg | ||
|
baltzell marked this conversation as resolved.
|
||
| double ThetaMax = Math.toRadians(30); // deg | ||
| double CwidthU = 13*Length.mm; | ||
| double CwidthD = 17*Length.mm; | ||
| double Clength = 190*Length.mm; | ||
| double CrminU = (Dat25deg+Clength/2.) * ( Math.tan(ThetaU) - Math.tan(ThetaU - ThetaMin) )*Math.cos(ThetaU); | ||
| double CrmaxU = (Dat25deg+Clength/2.) * ( Math.tan(ThetaU) + Math.tan(ThetaMax - ThetaU) )*Math.cos(ThetaU); | ||
| double microgap = 0.5*Length.mm; | ||
| double Cwidth = (CwidthU+CwidthD)/2. + microgap; | ||
| int nCrystal = 2*((int)(CrmaxU / Cwidth)+100);// add 100 to get full coverage | ||
|
|
||
| double centerX, centerY, x12, x22, y12, y22, rad1, rad2, rad3, rad4, rxy; | ||
| double centerZ, thetaX, thetaY, radius, posX, posY, posZ, dx1, dx2, dz; | ||
| String vname; | ||
| List<G4Trd> crystalVolumes = new ArrayList<>(); | ||
|
|
||
| for(int iX = 0; iX < nCrystal; iX++) | ||
| { | ||
| for(int iY = 0; iY < nCrystal; iY++) | ||
| { | ||
| centerX = - nCrystal/2.*Cwidth + (double)iX*Cwidth + 0.5*Cwidth; | ||
| centerY = - nCrystal/2.*Cwidth + (double)iY*Cwidth + 0.5*Cwidth; | ||
|
|
||
| x12 = (centerX - 0.5*Cwidth)*(centerX - 0.5*Cwidth); | ||
| x22 = (centerX + 0.5*Cwidth)*(centerX + 0.5*Cwidth); | ||
| y12 = (centerY - 0.5*Cwidth)*(centerY - 0.5*Cwidth); | ||
| y22 = (centerY + 0.5*Cwidth)*(centerY + 0.5*Cwidth); | ||
|
|
||
| rad1 = Math.sqrt(x12 + y12); | ||
| rad2 = Math.sqrt(x22 + y22); | ||
| rad3 = Math.sqrt(x12 + y22); | ||
| rad4 = Math.sqrt(x22 + y12); | ||
| if(rad1 > CrminU + microgap && rad1 < CrmaxU - microgap && | ||
| rad2 > CrminU + microgap && rad2 < CrmaxU - microgap && | ||
| rad3 > CrminU + microgap && rad3 < CrmaxU - microgap && | ||
| rad4 > CrminU + microgap && rad4 < CrmaxU - microgap | ||
| ) | ||
| { | ||
| rxy = Math.sqrt(centerX*centerX + centerY*centerY); | ||
| centerZ = (Dat25deg+Clength/2.)/Math.cos(ThetaU) - rxy*Math.sin(ThetaU); | ||
| thetaX = -Math.atan(centerX/centerZ); | ||
| thetaY = Math.atan(centerY/centerZ); | ||
| radius = Math.sqrt(rxy*rxy + centerZ*centerZ); | ||
| posX = centerX; | ||
| posY = centerY; | ||
| posZ = centerZ; | ||
| vname = String.format("sci_S%d_L%d_C%d", iX + 1, iY + 1, nCrystal); | ||
| dx1 = CwidthU/2.0; | ||
| dx2 = CwidthD/2.0; | ||
| dz = Clength/2.0; | ||
| G4Trd crvolume = new G4Trd("mucal_" + iX + "_" + iY, dx1, dx2, dx1, dx2, dz); | ||
| crvolume.makeSensitive(); | ||
| crvolume.rotate("zyx",0, thetaX, thetaY); | ||
| crvolume.translate(posX, posY, posZ); | ||
| crystalVolumes.add(crvolume); | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| return crystalVolumes; | ||
| } | ||
|
|
||
| public G4Trd getComponent(int sector, int layer, int crystal) { | ||
| int ivolume = (sector - 1) * 3 + layer - 1; | ||
|
|
||
| if (sector >= 1 && sector <= 6 | ||
| && layer >= 1 && layer <= 3) { | ||
|
|
||
| List<Geant4Basic> panel = motherVolume.getChildren().get(ivolume).getChildren(); | ||
| int ncrystals = panel.size(); | ||
|
|
||
| if (crystal >= 1 && crystal <= ncrystals) { | ||
| return (G4Trd) panel.get(crystal - 1); | ||
| } | ||
| } | ||
|
|
||
| System.err.println("ERROR!!!"); | ||
| System.err.println("Component: sector: " + sector + ", layer: " + layer + ", crystal: " + crystal + " doesn't exist"); | ||
| throw new IndexOutOfBoundsException(); | ||
| } | ||
|
|
||
| public G4World getMother() { | ||
| return motherVolume; | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| ConstantProvider cp = null;//GeometryFactory.getConstants(DetectorType.MUCAL); | ||
| MUCALGeant4Factory factory = new MUCALGeant4Factory(cp); | ||
|
|
||
| factory.getAllVolumes().forEach(volume -> { | ||
| System.out.println(volume.gemcString()); | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.