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.

00044   : theTgrRM(0)
00045 {
00046 }

G4tgbRotationMatrix::~G4tgbRotationMatrix (  ) 

Definition at line 50 of file G4tgbRotationMatrix.cc.

00051 {
00052 }

G4tgbRotationMatrix::G4tgbRotationMatrix ( G4tgrRotationMatrix tgr  ) 

Definition at line 56 of file G4tgbRotationMatrix.cc.

00057   : theTgrRM(tgr)
00058 {
00059 }


Member Function Documentation

G4RotationMatrix * G4tgbRotationMatrix::BuildG4RotMatrix (  ) 

Definition at line 63 of file G4tgbRotationMatrix.cc.

References BuildG4RotMatrixFrom3(), BuildG4RotMatrixFrom6(), BuildG4RotMatrixFrom9(), G4UIcommand::ConvertToString(), FatalException, G4Exception(), and G4tgrRotationMatrix::GetValues().

Referenced by G4tgbRotationMatrixMgr::FindOrBuildG4RotMatrix().

00064 {
00065   std::vector<G4double> values = theTgrRM->GetValues();
00066 
00067   if( values.size() == 3 ) {
00068     return BuildG4RotMatrixFrom3( values );
00069   } else if( values.size() == 6 ) {
00070     return BuildG4RotMatrixFrom6( values );
00071   } else if( values.size() == 9 ) {
00072     return BuildG4RotMatrixFrom9( values );
00073   }
00074   else
00075   {
00076     G4String ErrMessage = "Number of values is: "
00077                         + G4UIcommand::ConvertToString(G4int(values.size()))
00078                         + G4String(". It should be 3, 6, or 9 !");
00079     G4Exception("G4tgbRotationMatrix::BuildG4RotMatrix()",
00080                 "InvalidData", FatalException, ErrMessage);
00081   }
00082   return 0;
00083 }

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

Definition at line 88 of file G4tgbRotationMatrix.cc.

References G4cout, G4endl, GetName(), and G4tgrMessenger::GetVerboseLevel().

Referenced by BuildG4RotMatrix().

00089 {
00090   G4RotationMatrix* rotMat = new G4RotationMatrix();
00091 
00092   rotMat->rotateX( values[0] );
00093   rotMat->rotateY( values[1] );
00094   rotMat->rotateZ( values[2] );
00095 
00096 #ifdef G4VERBOSE
00097   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00098   {
00099     G4cout << " Constructing new G4RotationMatrix from 3 numbers "
00100            <<  GetName() << " : " << *rotMat << G4endl;
00101   }
00102 #endif
00103 
00104   return rotMat;
00105 }

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

Definition at line 110 of file G4tgbRotationMatrix.cc.

References G4cout, G4endl, GetName(), and G4tgrMessenger::GetVerboseLevel().

Referenced by BuildG4RotMatrix().

00111 {
00112   G4double thetaX = values[0];
00113   G4double phiX = values[1];
00114   G4double thetaY = values[2];
00115   G4double phiY = values[3];
00116   G4double thetaZ = values[4];
00117   G4double phiZ = values[5];
00118 
00119   // build the 3 axis from the values
00120   G4ThreeVector colx(std::sin(thetaX)*std::cos(phiX),
00121                      std::sin(thetaX)*std::sin(phiX),std::cos(thetaX));
00122   G4ThreeVector coly(std::sin(thetaY)*std::cos(phiY),
00123                      std::sin(thetaY)*std::sin(phiY),std::cos(thetaY));
00124   G4ThreeVector colz(std::sin(thetaZ)*std::cos(phiZ),
00125                      std::sin(thetaZ)*std::sin(phiZ),std::cos(thetaZ));
00126 
00127   // Now create a G4RotationMatrix (HepRotation), which can be left handed. 
00128   // This is not foreseen in CLHEP, but can be achieved using the
00129   // constructor which does not check its input arguments!   
00130 
00131   G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(), // matrix representation
00132                    colx.y(),coly.y(),colz.y(), // (inverted)
00133                    colx.z(),coly.z(),colz.z());
00134   
00135   G4RotationMatrix* rotMat = new G4RotationMatrix(rottemp);
00136 
00137 #ifdef G4VERBOSE
00138   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00139   {
00140     G4cout << " Constructing new G4RotationMatrix from 6 numbers "
00141            <<  GetName() << " : " << *rotMat << G4endl;
00142   }
00143 #endif
00144 
00145   return rotMat;
00146 }

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

Definition at line 150 of file G4tgbRotationMatrix.cc.

References G4cout, G4endl, GetName(), and G4tgrMessenger::GetVerboseLevel().

Referenced by BuildG4RotMatrix().

00151 {
00152   // build the 3 axis from the values
00153   G4ThreeVector colx(values[0],values[1],values[2]);
00154   G4ThreeVector coly(values[3],values[4],values[5]);
00155   G4ThreeVector colz(values[6],values[7],values[8]);
00156 
00157   // Now create a G4RotationMatrix (HepRotation), which can be left handed. 
00158   // This is not foreseen in CLHEP, but can be achieved using the
00159   // constructor which does not check its input arguments!
00160 
00161   G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(),  // matrix representation
00162                    colx.y(),coly.y(),colz.y(),  // (inverted)
00163                    colx.z(),coly.z(),colz.z());
00164   
00165   G4RotationMatrix* rotMat = new G4RotationMatrix(rottemp);
00166 
00167 #ifdef G4VERBOSE
00168   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00169   {
00170     G4cout << " Constructing new G4RotationMatrix from 9 numbers "
00171            <<  GetName() << " : " << *rotMat << G4endl;
00172   }
00173 #endif
00174 
00175   return rotMat;
00176 }

G4String G4tgbRotationMatrix::GetName (  )  [inline]

Definition at line 69 of file G4tgbRotationMatrix.hh.

References G4tgrRotationMatrix::GetName().

Referenced by BuildG4RotMatrixFrom3(), BuildG4RotMatrixFrom6(), and BuildG4RotMatrixFrom9().

00069 { return theTgrRM->GetName(); }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:29 2013 for Geant4 by  doxygen 1.4.7