Print

Print


Author: phansson
Date: Mon Oct 27 22:29:40 2014
New Revision: 3394

Log:
Fixed coordinate transformation to apply to local coordinate system.

Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/SurveyVolume.java	Mon Oct 27 22:29:40 2014
@@ -60,7 +60,7 @@
 		setCenter();
 		setBoxDim();
 		applyGenericCoordinateSystemCorrections();
-		applyAlignmentCorrections();
+		applyLocalAlignmentCorrections();
 	}
 
 	protected void applyGenericCoordinateSystemCorrections() {
@@ -99,7 +99,7 @@
 
 	}
 	
-	private void applyAlignmentCorrections() {
+	private void applyLocalAlignmentCorrections() {
 	    // Apply alignment corrections to local coordinate system that is already built
 	    boolean debug_local = true;
 	    if(this.coord==null) throw new RuntimeException("no coordinate system was set before trying to apply alignment corrections.");
@@ -111,9 +111,15 @@
 	        // translate
 	        if(alignmentCorrections.getTranslation()!=null) {			    
 
-	            if(debug_local) System.out.printf("%s: Apply translation %s to coordinate system\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString());			    
-
-	            getCoord().translate(alignmentCorrections.getTranslation());
+	            if(debug_local) System.out.printf("%s: Apply local translation %s\n", this.getClass().getSimpleName(),alignmentCorrections.getTranslation().toString());			    
+	            
+	            // rotate into mother coordinate system
+	            Hep3Vector translation_mother = getCoord().getTransformation().rotated(alignmentCorrections.getTranslation());
+	            
+	            if(debug_local) System.out.printf("%s: after rotation apply translation %s to coordinate system\n", this.getClass().getSimpleName(),translation_mother.toString());
+	            
+	            //apply translation
+	            getCoord().translate(translation_mother);
 
 	        } else {
 	            if(debug_local) System.out.printf("%s: No translation to coordinate system\n", this.getClass().getSimpleName());

########################################################################
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