Skip to content
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 Dec 17, 2025
135d3b2
Merge branch 'development' into ddvcsMerge
raffaelladevita Dec 18, 2025
6f22ad8
fix version number in mu pom, and adding missing MUHD reconstruction …
raffaelladevita Dec 18, 2025
85dfbd5
fix dependency in mu pom
raffaelladevita Dec 18, 2025
9ce0517
fix dependency in mu pom
raffaelladevita Dec 18, 2025
b28aaf2
addressing spotbugs findings
raffaelladevita Dec 18, 2025
88f080c
Merge branch 'ddvcsMerge' of github.com:JeffersonLab/coatjava into de…
ethancline Jan 21, 2026
c9beaa5
Merge branch 'development' into ddvcsMerge
raffaelladevita Mar 4, 2026
41a1ffe
updatedmu pom and MUVT fixes
raffaelladevita Mar 5, 2026
18a30be
added MUVT trajectory points
raffaelladevita Mar 5, 2026
b046673
bug fixes
raffaelladevita Mar 5, 2026
ffab8f4
Merge branch 'ddvcsMerge' of github.com:JeffersonLab/coatjava into de…
ethancline Mar 6, 2026
e66b8e4
mucal factory for ddvcs experiment
ethancline Jun 2, 2026
4ace20a
make sure to make all crystals
ethancline Jun 2, 2026
6f7ca7b
Merge github.com:JeffersonLab/coatjava into cal
ethancline Jun 3, 2026
4d2d71e
remove unused methods, clean-up doubly defined variables.
ethancline Jun 15, 2026
665c3c7
Merge github.com:JeffersonLab/coatjava into development
ethancline Jun 15, 2026
6f24b2a
revert
ethancline Jun 15, 2026
0542cb9
remove DCengine file from pull request
ethancline Jun 15, 2026
23cf3fb
rename to crystals
ethancline Jun 15, 2026
37d017a
remove unused imports, run auto-formatter
baltzell Jun 15, 2026
bf926d2
Merge pull request #1317 from JeffersonLab/mucal-geomfactory-cleanup
ethancline Jun 16, 2026
50a3337
Merge branch 'development' into mucal-geomfactory
baltzell Jun 16, 2026
16c34db
Merge branch 'development' into mucal-geomfactory
baltzell Jun 16, 2026
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
@@ -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
Comment thread
baltzell marked this conversation as resolved.
double ThetaU = Math.toRadians(25); // deg
double ThetaMin = Math.toRadians(7); // deg
Comment thread
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());
});
}
}
Loading