Author: [log in to unmask]
Date: Tue Dec 16 22:15:20 2014
New Revision: 3461
Log:
Start to merge the java and lcdd survey volumes. Work in progress.
Modified:
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaGhostSurveyVolume.java Tue Dec 16 22:15:20 2014
@@ -11,17 +11,16 @@
/**
* Initialize with base and mother. This is typically for a reference geometry object
* that is used for referencing coordinate systems but that doesn't have a volume itself.
- * @param base - object used to get geometry definitions
+ * @param surveyVolume - object used to get geometry definitions
* @param mother - mother object
*/
- public JavaGhostSurveyVolume(SurveyVolume base, JavaSurveyVolume mother) {
- super();
- if(isDebug()) System.out.printf("%s: constructing JAVA ghost object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName());
- setName(base.getName());
+ public JavaGhostSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother) {
+ super(surveyVolume);
+ if(isDebug()) System.out.printf("%s: constructing JAVA ghost object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
setMother(mother);
mother.addDaughter(this);
- setPositionAndRotation(base);
- if(isDebug()) System.out.printf("%s: DONE constructing JAVA object %s\n", this.getClass().getSimpleName(),base.getName());
+ setPositionAndRotation(surveyVolume);
+ if(isDebug()) System.out.printf("%s: DONE constructing JAVA object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
}
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/JavaSurveyVolume.java Tue Dec 16 22:15:20 2014
@@ -25,9 +25,7 @@
* Interface to the JAVA converter geometry for the geometry definition.
* @author Per Hansson Adrian <[log in to unmask]>
*/
-public class JavaSurveyVolume {
- private boolean debug = true;
- private String name;
+public class JavaSurveyVolume extends SurveyVolumeImpl {
private Box box= null;
private ILogicalVolume volume = null;
private ITranslation3D pos = null;
@@ -40,44 +38,45 @@
/**
* Default constructor
*/
- public JavaSurveyVolume() {
+ public JavaSurveyVolume(SurveyVolume surveyVolume) {
+ super(surveyVolume);
}
/**
* Construct a JAVA geometry object from its geometry definition and an already built logical volume.
* This is typically used by the tracking volume.
- * @param geomObject - input geometry definition
+ * @param surveyVolume - input geometry definition
* @param vol - logical volume
*/
- public JavaSurveyVolume(SurveyVolume geomObject, ILogicalVolume vol) {
- if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (given logical volume %s)\n", this.getClass().getSimpleName(),geomObject.getName(),vol.getName());
+ public JavaSurveyVolume(SurveyVolume surveyVolume, ILogicalVolume vol) {
+ super(surveyVolume);
+ if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (given logical volume %s)\n", this.getClass().getSimpleName(),surveyVolume.getName(),vol.getName());
// this must be tracking volume. May change in the future and is probably weird to make this requirement here.
- if(!geomObject.getName().contains("tracking")) throw new RuntimeException("this constructor is only used with the tracking volume!?");
- setName(geomObject.getName());
+ if(!surveyVolume.getName().contains("tracking")) throw new RuntimeException("this constructor is only used with the tracking volume!?");
setVolume(vol);
// since it's tracking volume, set the pos and rotation trivially
- Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(geomObject.getCoord().v(), geomObject.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+ Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
setPos(new Translation3D(0,0,0));
setRot(new RotationGeant(lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
- if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),geomObject.getName());
+ if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
}
/**
* Construct a JAVA geometry object from its geometry definition.
- * @param geomObject - input geometry definition
+ * @param surveyVolume - input geometry definition
* @param mother - reference to mother JAVA definition
* @param volumeId - component id number
*/
- public JavaSurveyVolume(SurveyVolume geomObject, JavaSurveyVolume mother, int volumeId) {
- if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (volumeID %d, mother %s)\n", this.getClass().getSimpleName(),geomObject.getName(),volumeId,mother==null?"null":mother.getName());
- setName(geomObject.getName());
+ public JavaSurveyVolume(SurveyVolume surveyVolume, JavaSurveyVolume mother, int volumeId) {
+ super(surveyVolume);
+ if(isDebug()) System.out.printf("%s: JavaBaseGeometry %s (volumeID %d, mother %s)\n", this.getClass().getSimpleName(),surveyVolume.getName(),volumeId,mother==null?"null":mother.getName());
setComponentId(volumeId);
setMother(mother);
mother.addDaughter(this);
- buildBox(geomObject);
- buildVolume(geomObject);
- setPositionAndRotation(geomObject);
- if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),geomObject.getName());
+ buildBox(surveyVolume);
+ buildVolume(surveyVolume);
+ setPositionAndRotation(surveyVolume);
+ if(isDebug()) System.out.printf("%s: DONE JavaBaseGeometry %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
}
protected boolean hasCoordinateSystemInfo() {
@@ -88,21 +87,21 @@
public void buildPhysVolume() {
if(isDebug()) System.out.printf("%s: build phys volume for %s with mother %s and physical mother %s\n", this.getClass().getSimpleName(),getName(),getMother().getName(),getPhysMother().getName());
JavaSurveyVolume physMother = getPhysMother();
- setPhysVolume(new PhysicalVolume(new Transform3D(getPos(), getRot()), name, volume, physMother.getVolume(),getComponentId()));
- }
- protected void buildBox(SurveyVolume base) {
+ setPhysVolume(new PhysicalVolume(new Transform3D(getPos(), getRot()), getName(), volume, physMother.getVolume(),getComponentId()));
+ }
+ public void buildBox(SurveyVolume base) {
Hep3Vector b = base.getBoxDim();
b = VecOp.mult(0.5, b);
if(isDebug()) System.out.printf("%s: build box for %s with dimensions %s \n", this.getClass().getSimpleName(),getName(), b);
setBox(new Box(getName() + "Box", b.x(), b.y(), b.z()));
}
- protected void buildVolume(SurveyVolume base) {
+ public void buildVolume(SurveyVolume base) {
if(isDebug()) System.out.printf("%s: build volume for %s with material %s\n", this.getClass().getSimpleName(),getName(),base.getMaterial());
IMaterial material = MaterialStore.getInstance().get(base.getMaterial());
setVolume(new LogicalVolume(getName() + "_volume", box, material));
}
- protected void setPositionAndRotation(SurveyVolume base) {
+ public void setPositionAndRotation(SurveyVolume base) {
if(isDebug()) System.out.printf("%s: set position and rotation for volume %s\n", this.getClass().getSimpleName(),getName());
// no mother, this must be the world/tracking volume!?
@@ -239,12 +238,6 @@
protected void setBox(Box b) {
box = b;
}
- public String getName() {
- return name;
- }
- protected void setName(String name) {
- this.name = name;
- }
protected ITranslation3D getPos() {
return pos;
}
@@ -268,9 +261,6 @@
}
protected void setPhysVolume(PhysicalVolume physVolume) {
this.physVolume = physVolume;
- }
- public boolean isDebug() {
- return debug;
}
public List<JavaSurveyVolume> getDaughters() {
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDGhostSurveyVolume.java Tue Dec 16 22:15:20 2014
@@ -19,9 +19,8 @@
* @param mother - mother LCDD object
*/
public LCDDGhostSurveyVolume(SurveyVolume base, LCDDSurveyVolume mother) {
- super();
+ super(base);
if(isDebug()) System.out.printf("%s: constructing LCDD ghost object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName());
- setName(base.getName());
setMother(mother);
mother.addDaughter(this);
if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/LCDDSurveyVolume.java Tue Dec 16 22:15:20 2014
@@ -9,7 +9,6 @@
import java.util.Map;
import org.jdom.JDOMException;
-import org.lcsim.detector.PhysicalVolume;
import org.lcsim.detector.Transform3D;
import org.lcsim.geometry.compact.converter.lcdd.util.Box;
import org.lcsim.geometry.compact.converter.lcdd.util.LCDD;
@@ -37,44 +36,45 @@
public List<LCDDSurveyVolume> daughters = new ArrayList<LCDDSurveyVolume>();
/**
* Default constructor
- */
- public LCDDSurveyVolume() {
+ * @param surveyVolume - core geometry definitions
+ */
+ public LCDDSurveyVolume(SurveyVolume surveyVolume) {
+ super(surveyVolume);
}
/**
* Initialize this object with a known volume and no mother. Typically the world volume would use this.
- * @param base - object used to get geometry definitions
+ * @param surveyVolume - core geometry definitions
* @param vol - given volume
*/
- public LCDDSurveyVolume(SurveyVolume base, Volume volume) {
- super();
- if(isDebug()) System.out.printf("%s: constructing LCDD object %s with volume name %s\n", this.getClass().getSimpleName(),base.getName(),volume.getName());
- setName(base.getName());
+ public LCDDSurveyVolume(SurveyVolume surveyVolume, Volume volume) {
+ super(surveyVolume);
+ if(isDebug()) System.out.printf("%s: constructing LCDD object %s with volume name %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),volume.getName());
setVolume(volume);
- if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
- Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(base.getCoord().v(), base.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
+ if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
+ Hep3Vector lcdd_rot_angles = TransformationUtils.getCardanAngles(surveyVolume.getCoord().v(), surveyVolume.getCoord().w(), new BasicHep3Vector(0,1,0),new BasicHep3Vector(0,0,1));
setPos(new Position(getName() + "_position", 0, 0, 0));
setRot(new Rotation(getName() + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z()));
- if(isDebug()) System.out.printf("%s: DONE %s\n", this.getClass().getSimpleName(),base.getName());
+ if(isDebug()) System.out.printf("%s: DONE %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
}
/**
* Interface to the LCDD converter geometry for the geometry definition.
- * @param base - input geometry definition
+ * @param surveyVolume - core geometry definition
* @param lcdd - lcdd file
* @param mother - reference to mother LCDD definition
*/
- public LCDDSurveyVolume(SurveyVolume base, LCDD lcdd, LCDDSurveyVolume mother) {
- if(isDebug()) System.out.printf("%s: constructing LCDD object %s with mother %s\n", this.getClass().getSimpleName(),base.getName(),mother==null?"null":mother.getName());
+ public LCDDSurveyVolume(SurveyVolume surveyVolume, LCDD lcdd, LCDDSurveyVolume mother) {
+ super(surveyVolume);
+ if(isDebug()) System.out.printf("%s: constructing LCDD object %s with mother %s\n", this.getClass().getSimpleName(),surveyVolume.getName(),mother==null?"null":mother.getName());
this.lcdd = lcdd;
- setName(base.getName());
setMother(mother);
mother.addDaughter(this);
- buildBox(base);
- buildVolume(base);
- setPositionAndRotation(base);
+ buildBox(surveyVolume);
+ buildVolume(surveyVolume);
+ setPositionAndRotation(surveyVolume);
//buildPhysVolume(mother);
- if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),base.getName());
+ if(isDebug()) System.out.printf("%s: DONE constructing LCDD object %s\n", this.getClass().getSimpleName(),surveyVolume.getName());
}
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolumeImpl.java Tue Dec 16 22:15:20 2014
@@ -3,10 +3,11 @@
public abstract class SurveyVolumeImpl extends SurveyVolumeVisualization {
private boolean debug = true;
- private String name;
+ protected SurveyVolume surveyVolume = null;
- public SurveyVolumeImpl() {
+ public SurveyVolumeImpl(SurveyVolume surveyVolume) {
super();
+ this.surveyVolume = surveyVolume;
}
public abstract void buildPhysVolume();
@@ -18,11 +19,7 @@
public abstract void setPositionAndRotation(SurveyVolume base);
public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
+ return surveyVolume.getName();
}
public boolean isDebug() {
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1
|