Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4tgbRotationMatrix Class Reference

#include <G4tgbRotationMatrix.hh>

Public Member Functions

 G4tgbRotationMatrix ()
 
 ~G4tgbRotationMatrix ()
 
 G4tgbRotationMatrix (G4tgrRotationMatrix *tgr)
 
G4RotationMatrixBuildG4RotMatrix ()
 
G4RotationMatrixBuildG4RotMatrixFrom3 (std::vector< G4double > &values)
 
G4RotationMatrixBuildG4RotMatrixFrom6 (std::vector< G4double > &values)
 
G4RotationMatrixBuildG4RotMatrixFrom9 (std::vector< G4double > &values)
 
G4String GetName ()
 

Detailed Description

Definition at line 52 of file G4tgbRotationMatrix.hh.

Constructor & Destructor Documentation

G4tgbRotationMatrix::G4tgbRotationMatrix ( )

Definition at line 43 of file G4tgbRotationMatrix.cc.

44  : theTgrRM(0)
45 {
46 }
G4tgbRotationMatrix::~G4tgbRotationMatrix ( )

Definition at line 50 of file G4tgbRotationMatrix.cc.

51 {
52 }
G4tgbRotationMatrix::G4tgbRotationMatrix ( G4tgrRotationMatrix tgr)

Definition at line 56 of file G4tgbRotationMatrix.cc.

57  : theTgrRM(tgr)
58 {
59 }

Member Function Documentation

G4RotationMatrix * G4tgbRotationMatrix::BuildG4RotMatrix ( )

Definition at line 63 of file G4tgbRotationMatrix.cc.

64 {
65  std::vector<G4double> values = theTgrRM->GetValues();
66 
67  if( values.size() == 3 ) {
68  return BuildG4RotMatrixFrom3( values );
69  } else if( values.size() == 6 ) {
70  return BuildG4RotMatrixFrom6( values );
71  } else if( values.size() == 9 ) {
72  return BuildG4RotMatrixFrom9( values );
73  }
74  else
75  {
76  G4String ErrMessage = "Number of values is: "
77  + G4UIcommand::ConvertToString(G4int(values.size()))
78  + G4String(". It should be 3, 6, or 9 !");
79  G4Exception("G4tgbRotationMatrix::BuildG4RotMatrix()",
80  "InvalidData", FatalException, ErrMessage);
81  }
82  return 0;
83 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
int G4int
Definition: G4Types.hh:78
std::vector< G4double > & GetValues()
G4RotationMatrix * BuildG4RotMatrixFrom3(std::vector< G4double > &values)
G4RotationMatrix * BuildG4RotMatrixFrom9(std::vector< G4double > &values)
G4RotationMatrix * BuildG4RotMatrixFrom6(std::vector< G4double > &values)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

G4RotationMatrix * G4tgbRotationMatrix::BuildG4RotMatrixFrom3 ( std::vector< G4double > &  values)

Definition at line 88 of file G4tgbRotationMatrix.cc.

89 {
90  G4RotationMatrix* rotMat = new G4RotationMatrix();
91 
92  rotMat->rotateX( values[0] );
93  rotMat->rotateY( values[1] );
94  rotMat->rotateZ( values[2] );
95 
96 #ifdef G4VERBOSE
98  {
99  G4cout << " Constructing new G4RotationMatrix from 3 numbers "
100  << GetName() << " : " << *rotMat << G4endl;
101  }
102 #endif
103 
104  return rotMat;
105 }
HepRotation & rotateX(double delta)
Definition: Rotation.cc:66
CLHEP::HepRotation G4RotationMatrix
HepRotation & rotateY(double delta)
Definition: Rotation.cc:79
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4RotationMatrix * G4tgbRotationMatrix::BuildG4RotMatrixFrom6 ( std::vector< G4double > &  values)

Definition at line 110 of file G4tgbRotationMatrix.cc.

111 {
112  G4double thetaX = values[0];
113  G4double phiX = values[1];
114  G4double thetaY = values[2];
115  G4double phiY = values[3];
116  G4double thetaZ = values[4];
117  G4double phiZ = values[5];
118 
119  // build the 3 axis from the values
120  G4ThreeVector colx(std::sin(thetaX)*std::cos(phiX),
121  std::sin(thetaX)*std::sin(phiX),std::cos(thetaX));
122  G4ThreeVector coly(std::sin(thetaY)*std::cos(phiY),
123  std::sin(thetaY)*std::sin(phiY),std::cos(thetaY));
124  G4ThreeVector colz(std::sin(thetaZ)*std::cos(phiZ),
125  std::sin(thetaZ)*std::sin(phiZ),std::cos(thetaZ));
126 
127  // Now create a G4RotationMatrix (HepRotation), which can be left handed.
128  // This is not foreseen in CLHEP, but can be achieved using the
129  // constructor which does not check its input arguments!
130 
131  G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(), // matrix representation
132  colx.y(),coly.y(),colz.y(), // (inverted)
133  colx.z(),coly.z(),colz.z());
134 
135  G4RotationMatrix* rotMat = new G4RotationMatrix(rottemp);
136 
137 #ifdef G4VERBOSE
139  {
140  G4cout << " Constructing new G4RotationMatrix from 6 numbers "
141  << GetName() << " : " << *rotMat << G4endl;
142  }
143 #endif
144 
145  return rotMat;
146 }
CLHEP::HepRotation G4RotationMatrix
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4RotationMatrix * G4tgbRotationMatrix::BuildG4RotMatrixFrom9 ( std::vector< G4double > &  values)

Definition at line 150 of file G4tgbRotationMatrix.cc.

151 {
152  // build the 3 axis from the values
153  G4ThreeVector colx(values[0],values[1],values[2]);
154  G4ThreeVector coly(values[3],values[4],values[5]);
155  G4ThreeVector colz(values[6],values[7],values[8]);
156 
157  // Now create a G4RotationMatrix (HepRotation), which can be left handed.
158  // This is not foreseen in CLHEP, but can be achieved using the
159  // constructor which does not check its input arguments!
160 
161  G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(), // matrix representation
162  colx.y(),coly.y(),colz.y(), // (inverted)
163  colx.z(),coly.z(),colz.z());
164 
165  G4RotationMatrix* rotMat = new G4RotationMatrix(rottemp);
166 
167 #ifdef G4VERBOSE
169  {
170  G4cout << " Constructing new G4RotationMatrix from 9 numbers "
171  << GetName() << " : " << *rotMat << G4endl;
172  }
173 #endif
174 
175  return rotMat;
176 }
CLHEP::HepRotation G4RotationMatrix
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4tgbRotationMatrix::GetName ( void  )
inline

Definition at line 69 of file G4tgbRotationMatrix.hh.

69 { return theTgrRM->GetName(); }
const G4String & GetName()

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: