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: G4tgrRotationMatrix.cc,v 1.5 2008/12/18 13:00:06 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // class G4tgrRotationMatrix |
---|
32 | |
---|
33 | // History: |
---|
34 | // - Created. P.Arce, CIEMAT (November 2007) |
---|
35 | // ------------------------------------------------------------------------- |
---|
36 | |
---|
37 | #include "G4tgrRotationMatrix.hh" |
---|
38 | #include "G4tgrRotationMatrixFactory.hh" |
---|
39 | #include "G4tgrUtils.hh" |
---|
40 | #include "G4tgrMessenger.hh" |
---|
41 | |
---|
42 | // ------------------------------------------------------------------------- |
---|
43 | G4tgrRotationMatrix::G4tgrRotationMatrix() |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | // ------------------------------------------------------------------------- |
---|
49 | G4tgrRotationMatrix::~G4tgrRotationMatrix() |
---|
50 | { |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | // ------------------------------------------------------------------------- |
---|
55 | G4tgrRotationMatrix::G4tgrRotationMatrix( const std::vector<G4String>& wl ) |
---|
56 | { |
---|
57 | theName = G4tgrUtils::GetString( wl[1] ); |
---|
58 | |
---|
59 | switch( wl.size() ) |
---|
60 | { |
---|
61 | case 5: |
---|
62 | theInputType = rm3; |
---|
63 | break; |
---|
64 | case 8: |
---|
65 | theInputType = rm6; |
---|
66 | break; |
---|
67 | case 11: |
---|
68 | theInputType = rm9; |
---|
69 | break; |
---|
70 | default: |
---|
71 | G4Exception("G4tgrRotationMatrix::G4tgrRotationMatrix()", |
---|
72 | "InvalidMatrix", FatalException, |
---|
73 | "Input line must have 5, 8 or 11 words."); |
---|
74 | break; |
---|
75 | } |
---|
76 | |
---|
77 | //-------- Fill matrix values |
---|
78 | size_t siz = wl.size() - 2; |
---|
79 | for( size_t ii = 0; ii < siz; ii++) |
---|
80 | { |
---|
81 | if( siz == 9 ) |
---|
82 | { |
---|
83 | theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] ) ); |
---|
84 | } |
---|
85 | else |
---|
86 | { |
---|
87 | theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] , deg ) ); |
---|
88 | } |
---|
89 | } |
---|
90 | #ifdef G4VERBOSE |
---|
91 | if( G4tgrMessenger::GetVerboseLevel() >= 2 ) |
---|
92 | { |
---|
93 | G4cout << " G4tgrRotationMatrix::G4tgrRotationMatrix() - Created: " |
---|
94 | << theName << G4endl; |
---|
95 | for( size_t ii = 0; ii < siz; ii++) |
---|
96 | { |
---|
97 | G4cout << " " << theValues[ii]; |
---|
98 | } |
---|
99 | G4cout << G4endl; |
---|
100 | } |
---|
101 | #endif |
---|
102 | } |
---|
103 | |
---|
104 | |
---|
105 | // ------------------------------------------------------------------------- |
---|
106 | std::ostream& operator<<(std::ostream& os, const G4tgrRotationMatrix& obj) |
---|
107 | { |
---|
108 | os << "G4tgrRotationMatrix= " << obj.theName |
---|
109 | << " InputTyep = " << obj.theInputType << " VALUES= "; |
---|
110 | |
---|
111 | for( size_t ii = 0; ii < obj.theValues.size(); ii++ ) |
---|
112 | { |
---|
113 | os << obj.theValues[ii] << " "; |
---|
114 | } |
---|
115 | |
---|
116 | os << G4endl; |
---|
117 | |
---|
118 | return os; |
---|
119 | } |
---|