Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4gsrotm.cc File Reference
#include "G3toG4.hh"
#include "G3RotTable.hh"
#include "G3toG4RotationMatrix.hh"
#include "G4PhysicalConstants.hh"
#include "G4ThreeVector.hh"
Include dependency graph for G4gsrotm.cc:

Go to the source code of this file.

Functions

void PG4gsrotm (G4String *tokens)
 
void G4gsrotm (G4int irot, G4double theta1, G4double phi1, G4double theta2, G4double phi2, G4double theta3, G4double phi3)
 

Function Documentation

void G4gsrotm ( G4int  irot,
G4double  theta1,
G4double  phi1,
G4double  theta2,
G4double  phi2,
G4double  theta3,
G4double  phi3 
)

Definition at line 54 of file G4gsrotm.cc.

56 {
57  G4double degrad = pi/180;
58 
59  G4double th1r = theta1*degrad;
60  G4double th2r = theta2*degrad;
61  G4double th3r = theta3*degrad;
62 
63  G4double phi1r = phi1*degrad;
64  G4double phi2r = phi2*degrad;
65  G4double phi3r = phi3*degrad;
66 
67  // Construct unit vectors
68 
69  G4ThreeVector x(std::sin(th1r)*std::cos(phi1r), std::sin(th1r)*std::sin(phi1r), std::cos(th1r));
70  G4ThreeVector y(std::sin(th2r)*std::cos(phi2r), std::sin(th2r)*std::sin(phi2r), std::cos(th2r));
71  G4ThreeVector z(std::sin(th3r)*std::cos(phi3r), std::sin(th3r)*std::sin(phi3r), std::cos(th3r));
72 
73  // check for orthonormality and left-handedness
74 
75  G4double check = (x.cross(y))*z;
76  G4double tol = 1.0e-3;
77 
78  if (1-std::abs(check)>tol) {
79  G4cerr << "Coordinate axes forming rotation matrix "
80  << irot << " are not orthonormal.(" << 1-std::abs(check) << ")"
81  << G4endl;
82  G4cerr << " theta1=" << theta1;
83  G4cerr << " phi1=" << phi1;
84  G4cerr << " theta2=" << theta2;
85  G4cerr << " phi2=" << phi2;
86  G4cerr << " theta3=" << theta3;
87  G4cerr << " phi3=" << phi3;
88  G4cerr << G4endl;
89  G4Exception("G4gsrotm()", "G3toG40023", FatalException,
90  "Non orthogonal axes!");
91  return;
92  }
93  //else if (1+check<=tol) {
94  // G4cerr << "G4gsrotm warning: coordinate axes forming rotation "
95  // << "matrix " << irot << " are left-handed" << G4endl;
96  //}
97 
99 
100  rotp->SetRotationMatrixByRow(x, y, z);
101 
102  // add it to the List
103 
104  G3Rot.Put(irot, rotp);
105 }
G3G4DLL_API G3RotTable G3Rot
Definition: clparse.cc:57
unsigned long check
Definition: inflate.h:88
tuple x
Definition: test.py:50
void SetRotationMatrixByRow(const G4ThreeVector &Row1, const G4ThreeVector &Row2, const G4ThreeVector &Row3)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tuple z
Definition: test.py:28
#define G4endl
Definition: G4ios.hh:61
static constexpr double pi
Definition: G4SIunits.hh:75
double G4double
Definition: G4Types.hh:76
void Put(G4int id, G4RotationMatrix *matrix)
Definition: G3RotTable.cc:53
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void PG4gsrotm ( G4String tokens)

Definition at line 35 of file G4gsrotm.cc.

36 {
37  // fill the parameter containers
38  G3fillParams(tokens,PTgsrotm);
39 
40  // interpret the parameters
41  G4int irot = Ipar[0];
42 
43  // the angles in Geant are in degrees
44  G4double theta1 = Rpar[0];
45  G4double phi1 = Rpar[1];
46  G4double theta2 = Rpar[2];
47  G4double phi2 = Rpar[3];
48  G4double theta3 = Rpar[4];
49  G4double phi3 = Rpar[5];
50 
51  G4gsrotm(irot, theta1,phi1, theta2,phi2, theta3,phi3);
52 }
G3G4DLL_API G4double Rpar[1000]
Definition: clparse.cc:67
void G4gsrotm(G4int irot, G4double theta1, G4double phi1, G4double theta2, G4double phi2, G4double theta3, G4double phi3)
Definition: G4gsrotm.cc:54
void G3fillParams(G4String *tokens, const char *ptypes)
Definition: clparse.cc:219
int G4int
Definition: G4Types.hh:78
G3G4DLL_API G4int Ipar[1000]
Definition: clparse.cc:66
#define PTgsrotm
Definition: G3toG4.hh:56
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function: