Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4tgrSolidBoolean.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 // $Id: G4tgrSolidBoolean.cc 66363 2012-12-18 09:12:54Z gcosmo $
28 //
29 //
30 // class G4tgrSolidBoolean
31 
32 // History:
33 // - Created. P.Arce, CIEMAT (November 2007)
34 // -------------------------------------------------------------------------
35 
36 #include "G4tgrSolidBoolean.hh"
37 #include "G4tgrUtils.hh"
38 #include "G4tgrVolume.hh"
39 #include "G4tgrVolumeMgr.hh"
40 #include "G4tgrMessenger.hh"
41 #include "G4tgrFileReader.hh"
42 
43 // -------------------------------------------------------------------------
44 G4tgrSolidBoolean::G4tgrSolidBoolean( const std::vector<G4String>& wl )
45 {
46  // :SOLID/:VOLU VOLU UNION/SUBS/INTERS VOLU1 VOLU2 ROTM POSX POSY POSZ
47 
48  if( wl.size() != 9 )
49  {
50  G4tgrUtils::DumpVS(wl, "G4tgrSolidBoolean::G4tgrSolidBoolean()");
51  G4Exception("G4tgrSolidBoolean::G4tgrSolidBoolean()", "InvalidInput",
52  FatalException, "Line read with less or more than 9 words.");
53  }
54 
55  //---------- Set name
56  theName = G4tgrUtils::GetString( wl[1] );
57 
59  const G4tgrSolid* sol1 = volmgr->FindSolid( G4tgrUtils::GetString( wl[3] ));
60  if( !sol1 )
61  {
62  sol1 = volmgr->FindVolume( G4tgrUtils::GetString( wl[3] ), 1)->GetSolid();
63  }
64  const G4tgrSolid* sol2 = volmgr->FindSolid( G4tgrUtils::GetString( wl[4] ));
65  if( !sol2 )
66  {
67  sol2 = volmgr->FindVolume( G4tgrUtils::GetString( wl[4] ), 1)->GetSolid();
68  }
69  theSolids.push_back( sol1 );
70  theSolids.push_back( sol2 );
71 
72  //---------- Set relative placement and rotation matrix
75  G4tgrUtils::GetDouble(wl[7]),
76  G4tgrUtils::GetDouble(wl[8]) );
77  //---------- Set solid type
78  G4String wl2 = wl[2];
79  for( size_t ii = 0; ii < wl2.length(); ii++ )
80  {
81  wl2[ii] = toupper( wl2[ii] );
82  }
83  theType = "Boolean_" + wl2;
84 
85 #ifdef G4VERBOSE
87  {
88  G4cout << " Created " << *this << G4endl;
89  }
90 #endif
91 
93 }
94 
95 
96 // -------------------------------------------------------------------------
98 {
99 }
100 
101 
102 // -------------------------------------------------------------------------
104 {
105  return theRelativeRotMatName;
106 }
107 
108 
109 // -------------------------------------------------------------------------
111 {
112  return theRelativePlace;
113 }
114 
115 
116 // -------------------------------------------------------------------------
117 std::ostream& operator<<(std::ostream& os, const G4tgrSolidBoolean& sol)
118 {
119  os << "G4tgrSolidBoolean= " << sol.theName << " of type " << sol.theType
120  << " PARAMS: ";
121  if( sol.theSolidParams.size() != 0 )
122  {
123  std::vector<G4double> solpar = *(sol.theSolidParams[0]);
124  for( size_t ii = 0; ii < solpar.size(); ii++)
125  {
126  os << solpar[ii] << " " ;
127  }
128  }
129  os << G4endl;
130 
131  return os;
132 }
G4ThreeVector GetRelativePlace() const
CLHEP::Hep3Vector G4ThreeVector
static G4int GetVerboseLevel()
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
#define G4endl
Definition: G4ios.hh:61
G4tgrSolid * GetSolid() const
Definition: G4tgrVolume.hh:92
std::vector< std::vector< G4double > * > theSolidParams
G4tgrSolidBoolean(const std::vector< G4String > &wl)
const G4String & GetRelativeRotMatName() const
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
G4ThreeVector theRelativePlace
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
Definition: G4tgrUtils.cc:158
G4String theType
Definition: G4tgrSolid.hh:75
void RegisterMe(G4tgrSolid *vol)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
std::vector< const G4tgrSolid * > theSolids
G4String theRelativeRotMatName
G4GLOB_DLL std::ostream G4cout
G4String theName
Definition: G4tgrSolid.hh:73
static G4tgrVolumeMgr * GetInstance()
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)