Skip to content
Open
Show file tree
Hide file tree
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 @@ -4,7 +4,7 @@
import java.util.ArrayList;
import org.jlab.detector.volume.Geant4Basic;
import org.jlab.detector.units.SystemOfUnits.Length;
import org.jlab.detector.volume.G4Pgon;
import org.jlab.detector.volume.G4Pcone;
import org.jlab.detector.volume.G4Trd;
import org.jlab.detector.volume.G4World;
import org.jlab.geom.base.ConstantProvider;
Expand All @@ -24,7 +24,7 @@ public MUCALGeant4Factory(ConstantProvider provider) {
double[] mucal_iradius = {301.0*Length.mm, 72.8*Length.mm, 81.5*Length.mm, 98.7*Length.mm};
double[] mucal_oradius = {301.1*Length.mm, 360.6*Length.mm, 401.0*Length.mm, 98.8*Length.mm};
double[] mucal_zpos_root = {520.0*Length.mm, 625.0*Length.mm, 696.0*Length.mm, 836.0*Length.mm};
G4Pgon mucalVolume = new G4Pgon("mucalVolume", phiStart, phiTotal, nplanes, nplanes, mucal_zpos_root, mucal_iradius, mucal_oradius);
G4Pcone mucalVolume = new G4Pcone("mucalVolume", phiStart, phiTotal, nplanes, mucal_zpos_root, mucal_iradius, mucal_oradius);
mucalVolume.setMother(motherVolume);
for (int sector = 1; sector <= 2; sector++) {
List<G4Trd> layerVolume = createPanel(provider, sector, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jlab.detector.volume;

import org.jlab.geometry.prim.Pcone;
import org.jlab.detector.units.Measurement;
import org.jlab.detector.units.SystemOfUnits.Angle;
import org.jlab.detector.units.SystemOfUnits.Length;

/**
* @author pdavies/devita
*/
// FIXME: currently support only polyheadra defintion to gemc geometry
public class G4Pcone extends Geant4Basic {

public G4Pcone(String name, double phiStart, double phiTotal, int numZPlanes,
double[] zPlane, double[] rInner, double[] rOuter ) {

super( new Pcone(phiStart, phiTotal, numZPlanes, zPlane, rInner, rOuter));
setName( name );
setType("Polycone");

Measurement[] dimensions = new Measurement[4+3*numZPlanes];
dimensions[0] = Angle.value(phiStart);
dimensions[1] = Angle.value(phiTotal);
dimensions[3] = new Measurement(numZPlanes,"counts");
for(int i=0; i<numZPlanes; i++) dimensions[4+0*numZPlanes+i] = Length.value(rInner[i]);
for(int i=0; i<numZPlanes; i++) dimensions[4+1*numZPlanes+i] = Length.value(rOuter[i]);
for(int i=0; i<numZPlanes; i++) dimensions[4+2*numZPlanes+i] = Length.value(zPlane[i]);
setDimensions(dimensions);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.jlab.geometry.prim;

import java.util.ArrayList;
import java.util.List;
import eu.mihosoft.vrl.v3d.Polygon;
import eu.mihosoft.vrl.v3d.Primitive;
import eu.mihosoft.vrl.v3d.PropertyStorage;

/**
* @author pdavies/devita
*/

// FIXME: currently support only polyheadra defintion to gemc geometry
public class Pcone implements Primitive {

private final PropertyStorage properties = new PropertyStorage();
private int numZPlanes;
private double phiStart, phiTotal;
double[] zPlane;
double[] rInner;
double[] rOuter;

public Pcone(double phiStart,
double phiTotal,
int numZPlanes,
double[] zPlane,
double[] rInner,
double[] rOuter)
{
if( numZPlanes < 0 || phiStart < 0 || phiTotal <= 0 ) {
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
}
if( zPlane.length<2 || rInner.length<2 || rOuter.length<2) {
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
}
if( zPlane.length!=rInner.length || zPlane.length!=rOuter.length) {
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
}

this.phiStart = phiStart;
this.phiTotal = phiTotal;
this.zPlane = zPlane;
this.rInner = rInner;
this.rOuter = rOuter;
}

@Override
public List<Polygon> toPolygons()
{
List<Polygon> polygons = new ArrayList<>();
// just returns something to not cause a NullPointerException
return polygons;
}

@Override
public PropertyStorage getProperties()
{
return null;
}

}
Loading