LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  May 2016

HPS-SVN May 2016

Subject:

r4369 - in /java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal: CrystalTaitBryanAngleCalculator.java GVector.java Geant4Position.java StatFunUtils.java Transformations.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 23 May 2016 22:29:39 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (539 lines)

Author: [log in to unmask]
Date: Mon May 23 15:29:37 2016
New Revision: 4369

Log: (empty)

Modified:
    java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/CrystalTaitBryanAngleCalculator.java
    java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/GVector.java
    java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Geant4Position.java
    java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/StatFunUtils.java
    java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Transformations.java

Modified: java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/CrystalTaitBryanAngleCalculator.java
 =============================================================================
--- java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/CrystalTaitBryanAngleCalculator.java	(original)
+++ java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/CrystalTaitBryanAngleCalculator.java	Mon May 23 15:29:37 2016
@@ -26,9 +26,11 @@
     private double cosPhi = 0;
     private double sinPhi = 0;
     
-    //contractor: the argument is the final state unitary vector,
-    //if not unit, it will be redefined as unitary
-    //initial state is defined as (0,0,1) vector, which is parallel to Z(beam direction)
+    /* constructor:
+    * @param vecFin final state unit vector, 
+    * if not unit, it will be redefined as unitary,
+    * initial state is defined as (0,0,1) vector, which is parallel to Z(beam direction)
+    */
     public CrystalTaitBryanAngleCalculator(GVector vecFin) {
         fin = vecFin;
         if (vecFin.isUnitary() == false) {
@@ -38,14 +40,21 @@
         this.theta = this.calculateTheta();
     }
 
-    //calculates phi angle
+    /*
+     * calculates phi angle
+     * @return phi angle, rotation around X [rad]
+     */
     private double calculatePhi() {
         sinPhi = -fin.y();
         cosPhi = Math.sqrt(1 - this.sinPhi * this.sinPhi);
         return Math.asin(this.sinPhi);
     }
     
-    //calculates theta angle after phi is calculated
+    /*
+     * calculates theta angle after phi is calculated
+     * @return theta angle, rotation around Y [rad]
+     *  
+     */
     private double calculateTheta() {
         if (this.cosPhi == 0) {
             this.sinTheta = Double.NaN;
@@ -55,22 +64,31 @@
         return Math.asin(this.sinTheta);
     }
     
-    //returns value of theta in rad
+    /*
+     * @return value of theta [rad],  rotation around Y
+     */
     public double getTheta() {
         return this.theta;
     }
 
-    //returns value of phi anlge in rad
+    /*
+     * @return value of phi [rad],  rotation around X
+     * /
+     */
     public double getPhi() {
         return this.phi;
     }
     
-    //returns value of psi angle in rad
+    /*
+     * @return value of psi [rad],  rotation around Z
+     */
     public double getPsi() {
         return this.psi;
     }
     
-    //returns Tait-Bryan angles as a String in the format of (phi, theta, psi)
+    /*
+     * @return string of Tait-Bryan angles-(phi, theta, psi) [rad]
+     */
     public String toString(){
         return ("("+this.phi+","+this.theta+","+this.psi+")");
     }

Modified: java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/GVector.java
 =============================================================================
--- java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/GVector.java	(original)
+++ java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/GVector.java	Mon May 23 15:29:37 2016
@@ -3,7 +3,7 @@
 import hep.physics.vec.BasicHep3Vector;
 
 /**
- * Defines a vector in (XYZ) coordinate system as a geometrical object.
+ * Define a vector in (XYZ) coordinate system as a geometrical object.
  * This class is similar to HepVector 
  * 
  * @author Annie Simonyan
@@ -13,11 +13,16 @@
     private double x = 0, y = 0, z = 0;
     private double[] vec;
 
-    //default constructor
+    /**
+     * default constructor
+     */
     public GVector() {
     }
 
-    //constructor: argument - double[3]={x,y,z} array for vector coordinates
+    /**
+     * constructor
+     * @param double[3]={x,y,z} array for vector coordinates
+     */
     public GVector(double[] array) {
         vec = array;
         this.x = array[0];
@@ -25,12 +30,21 @@
         this.z = array[2];
     }
 
-    //converts this Vvector to BasicHep3Vector
+    /**
+     * convert this GVector to BasicHep3Vector
+     * @return BasicHep3Vector object
+     */
     public BasicHep3Vector getHepVector(){
         return new BasicHep3Vector(this.x, this.y, this.z);
     }
     
-    //constructor: arguments - double(x,y,z) coordinates of vector
+    /**
+     * constructor: 
+     * @param x - x coordinates of vector
+     * @param y - y coordinates of vector
+     * @param z - z coordinates of vector
+     * 
+     */
     public GVector(double x, double y, double z) {
         this.x = x;
         this.y = y;
@@ -53,78 +67,120 @@
         return z;
     }
 
-    //set vector x coordinate
+    /**
+     * set vector x coordinate
+     * @param x vector x coordinate
+     */ 
     public void SetX(double x) {
         this.x = x;
     }
 
-    //set vector y coordinate
+    
+    /**
+     * set vector y coordinate
+     * @param y vector y coordinate
+     */ 
     public void SetY(double y) {
         this.y = y;
     }
 
     
-    //set vector z coordinate
+    /**
+     * set vector z coordinate
+     *@param z vector z coordinate
+     */ 
     public void SetZ(double z) {
         this.z = z;
     }
 
-    //set vector (x,y,z) coordinates
+    
+    /**
+     * set vector (x,y,z) coordinate
+     * @param x vector x coordinate
+     * @param y vector y coordinate
+     * @param z vector z coordinate
+     */ 
     public void SetXYZ(double x, double y, double z) {
         this.x = x;
         this.y = y;
         this.z = z;
     }
 
-    //check if the vector is unit vector
+    /**
+     * check if the vector is unit vector
+     * @return true if the vector is unit vector
+     */ 
     public boolean isUnitary() {
         return (Double.compare(StatFunUtils.round(this.Module(), 12), 1.0) == 0);
     }
 
-    //returns the module of the vector
+    /**
+     * @return the module of the vector
+     */     
     public double Module() {
         return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
     }
 
-    //vector multiplication by cooficent k
+    /**
+     * multiplication by coefficient k
+     * @param k - multiplication coefficient
+     * @return new GVector=this*k
+     */ 
     public GVector Multiply(double k) {
 
         return (new GVector(k * this.x, k * this.y, k * this.z));
     }
 
-    //returns new vector = sum of this vector and argument vec2
+    
+    /**
+     * sum of this vector and argument vec2
+     * @param vec2 GVector to add
+     * @return new GVector = this+vec2
+     */ 
     public GVector Add(GVector vec2) {
 
         return (new GVector(this.x + vec2.x, this.y + vec2.y, this.z + vec2.z));
 
     }
 
-    //returns new vector opposite to this vector
+    /**
+     *
+     * @return new vector opposite to this vector
+     */ 
     public GVector getOpposite() {
         return (new GVector(-this.x, -this.y, -this.z));
     }
 
-    //returns new vector = this vector - argument vector
+    /**
+     * substract GVectors
+     * @param vec2 GVector to substract  
+     * @return new vector = this - vec2
+     *
+     */
     public GVector Substract(GVector vec2) {
 
         return (new GVector(this.x - vec2.x, this.y - vec2.y, this.z - vec2.z));
 
     }
 
-    //returns new vector defined as translation of this vector by argument vector
+    /**
+     * @param trvec translation vector
+     * @return new GVector defined as translation of this vector by argument vector
+     * newVector = this+trvec
+     */ 
     public GVector TranslateBy(GVector trvec) {
-        // return this.Substract(trvec);
+        
         return this.Add(trvec);
     }
 
-    /*
-     * Returns new vector = this vector rotated by (alpha, betta, gamma) rotation
+    /**
+     * Rotate this vector by (alpha, betta, gamma) rotation angles
      * (Rz-alpha,Ry-beta,Rx-gamma)
-     * 
-     * Vector rotation defined as:
-     * alpha-rotation around Z axis
-     * beta-rotation around Y axis
-     * gamma-rotation around X axis
+     *   
+     * @param alpha rotation around Z axis
+     * @param beta rotation around Y axis
+     * @param gamma rotation around X axis
+     * @return new GVector=this vector rotated by (alpha, betta, gamma)
      */
     public GVector RotateBy(double alpha, double betta, double gamma) {
 
@@ -150,17 +206,26 @@
         return (new GVector(xx, yy, zz));
     }
 
-    // returns scaliar multiplication of vectors
-    public double ScaliarM(GVector vec2) {
+    /**
+     * scalar multiplication of this vector by vec2
+     * @param vec2 GVector
+     * @return double = (this vector * vec2 vector)
+     * 
+     */ 
+    public double ScalarM(GVector vec2) {
         return this.x * vec2.x + this.y * vec2.y + this.z * vec2.z;
     }
 
-    //returns angle between vectors in rad
+    /**
+     * Calculate angle between vectors
+     * @param vec2 GVector to calc. angle with this
+     * @return angle between this and vec2 vectors [rad] 
+     */ 
     public double Angle(GVector vec2) {
         // System.out.print("Scaliar= "+this.ScaliarM(vec2) +" modN1 = "+this.Module()+"  modN2 = "+vec2.Module()+"\n");
         // System.out.print(this.ScaliarM(vec2)/(this.Module()*vec2.Module())+ "\n");
         // System.out.println(Math.acos(this.ScaliarM(vec2)/(this.Module()*vec2.Module())));
-        double cosAlpha = this.ScaliarM(vec2) / (this.Module() * vec2.Module());
+        double cosAlpha = this.ScalarM(vec2) / (this.Module() * vec2.Module());
 
         if (Double.compare(StatFunUtils.round(cosAlpha, 12), 1.0) == 0) {
             cosAlpha = 1.0;
@@ -171,28 +236,43 @@
         return Math.acos(cosAlpha);
     }
 
-    //returns coordinates of this vector as an array of doubles
+    /**
+     * 
+     * @return coordinates of this vector as an array 
+     */
     public double[] getVector() {
         return this.vec;
     }
 
-    //returns new vector, which is unit vector of this vector
+    /**
+     * Calculate unit vector of this vector
+     * @return new GVector, which is unit vector of this vector
+     * 
+     */ 
     public GVector getUnitVector() {
         return new GVector(this.x / this.Module(), this.y / this.Module(), this.z / this.Module());
     }
 
     
-    //returns the center coordinates of this vector as a Vvector object
+    /**
+     * 
+     * @return new GVector = coordinates of center of this vector as a GVector object
+     * 
+     */ 
     public GVector getCenter() {
         return (this.Multiply(0.5));
     }
 
-    //Print the coordinates of the Vector as (x,y,z)
+    /**
+     * Print the coordinates of the GVector as (x,y,z)
+     */
     public void Print() {
         System.out.println("(" + this.x + ", " + this.y + ", " + this.z + ")");
     }
     
-    //returns coordinates of the vector as a String "(x,y,z)"
+    /**
+     * @return String of coordinates of this vector
+     */ 
     public String toString(){
         return ("(" + this.x + ", " + this.y + ", " + this.z + ")");
     }

Modified: java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Geant4Position.java
 =============================================================================
--- java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Geant4Position.java	(original)
+++ java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Geant4Position.java	Mon May 23 15:29:37 2016
@@ -2,30 +2,34 @@
 
 
 /**
- * Calculates G4 position for a crystal, by it's front and back face coordinates calculates the position for the center
+ * Calculate G4 position for a crystal, by it's front and back face coordinates calculates the position for the center
  * of the crystal calculates the rotation of the crystal in convention of Tait-Bryan angles, {phi, theta, psi} 
  * 
- * or look here: http://sedris.org/wg8home/Documents/WG80485.pdf
- * 
- * Brief:
  * phi-rotation around X
  * theta-rotation around Y
  * psi-rotation around Z
  * 
  * @author Annie Simonyan
  */
-// FIXME: There is not anything specific to Geant4 about this class, so it should be renamed.
+
 public final class Geant4Position {
     
-    private GVector centerPoint; // center coordinate
-    private GVector crysvec; // crystal vector formed by front face center point and back face center point
-    private double[] taitbriangles; // { phi,theta,psi=0}; Tait-Bryan angles to define crystal orientation in the space
-    private double[] centerArr; //crystal center coordinates as a double[3] array
-
-    //contsructor arguments
-    //1 Vector - (x,y,z) of crystal front face center point as Vector
-    //2 Vector - (x,y,z) of crystal back face center point as Vector
-    public Geant4Position(GVector point1, GVector point2) {       
+    /* center coordinates */
+    private GVector centerPoint; 
+    /* crystal vector formed by front face center point and back face center point*/
+    private GVector crysvec;
+    /* { phi,theta,psi=0}; Tait-Bryan angles to define crystal orientation in the space */
+    private double[] taitbriangles;
+    
+    /* crystal center coordinates as a double[3] array */      
+    private double[] centerArr; 
+      
+    /**
+     * constructor
+     * @param point1  (x,y,z) of crystal front face center point as GVector
+     * @param point2 (x,y,z) of crystal back face center point as GVector
+     */
+        public Geant4Position(GVector point1, GVector point2) {       
         centerPoint = point2.Add(point1).Multiply(0.5);
         centerArr = new double[3];
         centerArr[0] = centerPoint.x();
@@ -36,23 +40,38 @@
         this.calculateTaitBryanAngles();
     }
 
-    //returns the center coordinates as a Vector
-    public GVector getCenter() {
+   
+    /**
+     *
+     * @return center coordinates as a GVector
+     */
+        public GVector getCenter() {
         return this.centerPoint;
     }
 
-    //returns center coordinates as an array of doubles
-    public double[] getCenterArr() {
+    
+
+    /**
+     *
+     * @return center coordinates as an array double[x_center, y_center, z_center]
+     */
+        public double[] getCenterArr() {
         return centerArr;
     }
 
-    //returns Tait-Bryan angles as an array of doubles [phi, theta, psi]
-    public double[] getTaitBryanAngles() {
+
+    /**
+     *
+     * @return Tait-Bryan angles as an array doubles [phi, theta, psi]
+     */
+        public double[] getTaitBryanAngles() {
         return this.taitbriangles;
     }
 
-    //calculates Tait-Bryan angles for the object orientation  defined by initial and final state vectors
-    //throws arithmetical exception if the phi angle is calculated wrong or 0
+    /*
+     * calculates Tait-Bryan angles for the object orientation  defined by initial and final state vectors
+     * throws arithmetical exception if the phi angle is calculated wrong or 0
+     */ 
     private void calculateTaitBryanAngles() throws ArithmeticException{
         CrystalTaitBryanAngleCalculator crysTBang = new CrystalTaitBryanAngleCalculator(crysvec);
         if (crysTBang.getPhi() == Double.NaN) {
@@ -63,13 +82,21 @@
         this.taitbriangles[2] = -crysTBang.getPsi();
     }
 
-    //Print crystal center coordinates(X,Y,Z) and Tait-Bryan angles
-    public void Print() {
+
+    /**
+     * Print crystal center coordinates(X,Y,Z) and Tait-Bryan angles
+     */
+        public void Print() {
         this.centerPoint.Print();
     }
     
-    //return Geant4Position object attributes as a String 
-    public String toString(){
+    
+
+    /**
+     *
+     * @return String of Geant4Position object attributes
+     */
+        public String toString(){
         return ("\"Crys Center coordinates:\\t\""+this.centerPoint.toString()+"Tait Brian angles phi = " + Math.toDegrees(this.taitbriangles[0]) + "\t theta = "
                 + Math.toDegrees(this.taitbriangles[1]) + "\t psi = " + Math.toDegrees(this.taitbriangles[2]) + "\n");
     }

Modified: java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/StatFunUtils.java
 =============================================================================
--- java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/StatFunUtils.java	(original)
+++ java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/StatFunUtils.java	Mon May 23 15:29:37 2016
@@ -9,6 +9,9 @@
 
     /**
      * Function for double to round up the arg. value to 'places' digits after the semicolon 
+     * @param value double number to round
+     * @param places round up to places
+     * @return rounded value 
      */
     public static double round(double value, int places) {
         if (places < 0 || places > 16) {

Modified: java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Transformations.java
 =============================================================================
--- java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Transformations.java	(original)
+++ java/branches/HPSJAVA-409/detector-model/src/main/java/org/hps/detector/ecal/Transformations.java	Mon May 23 15:29:37 2016
@@ -17,6 +17,7 @@
 
     /* vector of translation */
     private GVector transVec; 
+    /* array with rotation angles */
     private double[] rotation;
 
     /* geometrically defined center mass of top module */
@@ -35,6 +36,13 @@
         this.rotation = rot;
     }
     
+    /**
+     * perform rotation and translation operation for a single crystal
+     * 
+     * @param position crystal position 
+     * @param channel crystal channel
+     * @return crystal position in G4 conventions
+     */
     public Geant4Position transformToGeant4(EcalCrystalPosition position, EcalChannel channel) {
         
         // Define untransformed front and back positions.

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use