ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4tgrRotationMatrix.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4tgrRotationMatrix.cc
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 //
28 //
29 // class G4tgrRotationMatrix
30 
31 // History:
32 // - Created. P.Arce, CIEMAT (November 2007)
33 // -------------------------------------------------------------------------
34 
35 #include "G4tgrRotationMatrix.hh"
36 
37 #include "G4SystemOfUnits.hh"
39 #include "G4tgrUtils.hh"
40 #include "G4tgrMessenger.hh"
41 
42 // -------------------------------------------------------------------------
44  : theName("Rotation-Matrix"), theInputType(rm9)
45 {
46 }
47 
48 
49 // -------------------------------------------------------------------------
51 {
52 }
53 
54 
55 // -------------------------------------------------------------------------
56 G4tgrRotationMatrix::G4tgrRotationMatrix( const std::vector<G4String>& wl )
57  : theInputType(rm9)
58 {
59  theName = G4tgrUtils::GetString( wl[1] );
60 
61  switch( wl.size() )
62  {
63  case 5:
64  theInputType = rm3;
65  break;
66  case 8:
67  theInputType = rm6;
68  break;
69  case 11:
70  theInputType = rm9;
71  break;
72  default:
73  G4Exception("G4tgrRotationMatrix::G4tgrRotationMatrix()",
74  "InvalidMatrix", FatalException,
75  "Input line must have 5, 8 or 11 words.");
76  break;
77  }
78 
79  //-------- Fill matrix values
80  size_t siz = wl.size() - 2;
81  for( size_t ii = 0; ii < siz; ii++)
82  {
83  if( siz == 9 )
84  {
85  theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] ) );
86  }
87  else
88  {
89  theValues.push_back( G4tgrUtils::GetDouble( wl[ii+2] , deg ) );
90  }
91  }
92 #ifdef G4VERBOSE
94  {
95  G4cout << " G4tgrRotationMatrix::G4tgrRotationMatrix() - Created: "
96  << theName << G4endl;
97  for( size_t ii = 0; ii < siz; ii++)
98  {
99  G4cout << " " << theValues[ii];
100  }
101  G4cout << G4endl;
102  }
103 #endif
104 }
105 
106 
107 // -------------------------------------------------------------------------
108 std::ostream& operator<<(std::ostream& os, const G4tgrRotationMatrix& obj)
109 {
110  os << "G4tgrRotationMatrix= " << obj.theName
111  << " InputTyep = " << obj.theInputType << " VALUES= ";
112 
113  for( size_t ii = 0; ii < obj.theValues.size(); ii++ )
114  {
115  os << obj.theValues[ii] << " ";
116  }
117 
118  os << G4endl;
119 
120  return os;
121 }