source: trunk/source/persistency/ascii/src/G4tgrSolidBoolean.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 4.7 KB
Line 
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,v 1.5 2010/10/13 07:56:56 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31// class G4tgrSolidBoolean
32
33// History:
34// - Created.                                 P.Arce, CIEMAT (November 2007)
35// -------------------------------------------------------------------------
36
37#include "G4tgrSolidBoolean.hh"
38#include "G4tgrUtils.hh"
39#include "G4tgrVolume.hh"
40#include "G4tgrVolumeMgr.hh"
41#include "G4tgrMessenger.hh"
42#include "G4tgrFileReader.hh"
43
44// -------------------------------------------------------------------------
45G4tgrSolidBoolean::G4tgrSolidBoolean( const std::vector<G4String>& wl ) 
46{ 
47  // :SOLID/:VOLU VOLU UNION/SUBS/INTERS VOLU1 VOLU2 ROTM POSX POSY POSZ
48
49  if( wl.size() != 9 )
50  {
51    G4tgrUtils::DumpVS(wl, "G4tgrSolidBoolean::G4tgrSolidBoolean()");
52    G4Exception("G4tgrSolidBoolean::G4tgrSolidBoolean()", "InvalidInput",
53                FatalException, "Line read with less or more than 9 words.");
54  }
55
56  //---------- Set name
57  theName = G4tgrUtils::GetString( wl[1] ); 
58
59  G4tgrVolumeMgr* volmgr = G4tgrVolumeMgr::GetInstance();
60  const G4tgrSolid* sol1 = volmgr->FindSolid( G4tgrUtils::GetString( wl[3] ));
61  if( !sol1 )
62  {
63    sol1 = volmgr->FindVolume( G4tgrUtils::GetString( wl[3] ), 1)->GetSolid();
64  }
65  const G4tgrSolid* sol2 = volmgr->FindSolid( G4tgrUtils::GetString( wl[4] ));
66  if( !sol2 )
67  {
68    sol2 = volmgr->FindVolume( G4tgrUtils::GetString( wl[4] ), 1)->GetSolid();
69  }
70  theSolids.push_back( sol1 );
71  theSolids.push_back( sol2 );
72
73  //---------- Set relative placement and rotation matrix
74  theRelativeRotMatName = G4tgrUtils::GetString( wl[5] );
75  theRelativePlace = G4ThreeVector( G4tgrUtils::GetDouble(wl[6]),
76                                    G4tgrUtils::GetDouble(wl[7]),
77                                    G4tgrUtils::GetDouble(wl[8]) );
78  //---------- Set solid type
79  G4String wl2 = wl[2];
80  for( size_t ii = 0; ii < wl2.length(); ii++ )
81  {
82    wl2[ii] = toupper( wl2[ii] );
83  }
84  theType = "Boolean_" + wl2;
85
86#ifdef G4VERBOSE
87  if( G4tgrMessenger::GetVerboseLevel() >= 1 )
88  {
89     G4cout << " Created " << *this << G4endl;
90  }
91#endif
92
93  G4tgrVolumeMgr::GetInstance()->RegisterMe( this );
94}
95
96
97// -------------------------------------------------------------------------
98G4tgrSolidBoolean::~G4tgrSolidBoolean()
99{
100}
101
102
103// -------------------------------------------------------------------------
104const G4String& G4tgrSolidBoolean::GetRelativeRotMatName() const
105{
106  return theRelativeRotMatName;
107}
108
109
110// -------------------------------------------------------------------------
111G4ThreeVector G4tgrSolidBoolean::GetRelativePlace() const
112{
113  return theRelativePlace;
114}
115
116
117// -------------------------------------------------------------------------
118std::ostream& operator<<(std::ostream& os, const G4tgrSolidBoolean& sol)
119{
120  os << "G4tgrSolidBoolean= " << sol.theName << " of type " << sol.theType
121     << " PARAMS: ";
122  if( sol.theSolidParams.size() != 0 )
123  {
124    std::vector<G4double> solpar = *(sol.theSolidParams[0]); 
125    for( size_t ii = 0; ii < solpar.size(); ii++)
126    {
127      os << solpar[ii] << " " ;
128    }
129  }
130  os << G4endl;
131
132  return os;
133}
Note: See TracBrowser for help on using the repository browser.