Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4tgrRotationMatrix.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// class G4tgrRotationMatrix
31
32// History:
33// - Created. P.Arce, CIEMAT (November 2007)
34// -------------------------------------------------------------------------
35
37
38#include "G4SystemOfUnits.hh"
40#include "G4tgrUtils.hh"
41#include "G4tgrMessenger.hh"
42
43// -------------------------------------------------------------------------
45 : theName("Rotation-Matrix"), theInputType(rm9)
46{
47}
48
49
50// -------------------------------------------------------------------------
52{
53}
54
55
56// -------------------------------------------------------------------------
57G4tgrRotationMatrix::G4tgrRotationMatrix( const std::vector<G4String>& wl )
58 : theInputType(rm9)
59{
60 theName = G4tgrUtils::GetString( wl[1] );
61
62 switch( wl.size() )
63 {
64 case 5:
65 theInputType = rm3;
66 break;
67 case 8:
68 theInputType = rm6;
69 break;
70 case 11:
71 theInputType = rm9;
72 break;
73 default:
74 G4Exception("G4tgrRotationMatrix::G4tgrRotationMatrix()",
75 "InvalidMatrix", FatalException,
76 "Input line must have 5, 8 or 11 words.");
77 break;
78 }
79
80 //-------- Fill matrix values
81 size_t siz = wl.size() - 2;
82 for( size_t ii = 0; ii < siz; ii++)
83 {
84 if( siz == 9 )
85 {
86 theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] ) );
87 }
88 else
89 {
90 theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] , deg ) );
91 }
92 }
93#ifdef G4VERBOSE
95 {
96 G4cout << " G4tgrRotationMatrix::G4tgrRotationMatrix() - Created: "
97 << theName << G4endl;
98 for( size_t ii = 0; ii < siz; ii++)
99 {
100 G4cout << " " << theValues[ii];
101 }
102 G4cout << G4endl;
103 }
104#endif
105}
106
107
108// -------------------------------------------------------------------------
109std::ostream& operator<<(std::ostream& os, const G4tgrRotationMatrix& obj)
110{
111 os << "G4tgrRotationMatrix= " << obj.theName
112 << " InputTyep = " << obj.theInputType << " VALUES= ";
113
114 for( size_t ii = 0; ii < obj.theValues.size(); ii++ )
115 {
116 os << obj.theValues[ii] << " ";
117 }
118
119 os << G4endl;
120
121 return os;
122}
@ FatalException
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
std::ostream & operator<<(std::ostream &os, const G4tgrRotationMatrix &obj)
static G4int GetVerboseLevel()
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:178
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:203
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41