00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // GEANT 4 class source file 00031 // 00032 // G4BREPSolidTorus.cc 00033 // 00034 // ---------------------------------------------------------------------- 00035 00036 #include "G4BREPSolidTorus.hh" 00037 #include "G4ToroidalSurface.hh" 00038 00039 G4BREPSolidTorus::G4BREPSolidTorus(const G4String& name, 00040 const G4ThreeVector& origin, 00041 const G4ThreeVector& axis, 00042 const G4ThreeVector& direction, 00043 G4double MinRadius, 00044 G4double MaxRadius) 00045 : G4BREPSolid(name) 00046 { 00047 // Save constructor parameters 00048 constructorParams.origin = origin; 00049 constructorParams.axis = axis; 00050 constructorParams.direction = direction; 00051 constructorParams.MinRadius = MinRadius; 00052 constructorParams.MaxRadius = MaxRadius; 00053 00054 active = 1; 00055 InitializeTorus(); 00056 } 00057 00058 G4BREPSolidTorus::G4BREPSolidTorus( __void__& a ) 00059 : G4BREPSolid(a) 00060 { 00061 } 00062 00063 G4BREPSolidTorus::~G4BREPSolidTorus() 00064 { 00065 } 00066 00067 G4BREPSolidTorus::G4BREPSolidTorus(const G4BREPSolidTorus& rhs) 00068 : G4BREPSolid(rhs) 00069 { 00070 constructorParams.origin = rhs.constructorParams.origin; 00071 constructorParams.axis = rhs.constructorParams.axis; 00072 constructorParams.direction = rhs.constructorParams.direction; 00073 constructorParams.MinRadius = rhs.constructorParams.MinRadius; 00074 constructorParams.MaxRadius = rhs.constructorParams.MaxRadius; 00075 00076 InitializeTorus(); 00077 } 00078 00079 G4BREPSolidTorus& 00080 G4BREPSolidTorus::operator = (const G4BREPSolidTorus& rhs) 00081 { 00082 // Check assignment to self 00083 // 00084 if (this == &rhs) { return *this; } 00085 00086 // Copy base class data 00087 // 00088 G4BREPSolid::operator=(rhs); 00089 00090 // Copy data 00091 // 00092 constructorParams.origin = rhs.constructorParams.origin; 00093 constructorParams.axis = rhs.constructorParams.axis; 00094 constructorParams.direction = rhs.constructorParams.direction; 00095 constructorParams.MinRadius = rhs.constructorParams.MinRadius; 00096 constructorParams.MaxRadius = rhs.constructorParams.MaxRadius; 00097 00098 InitializeTorus(); 00099 00100 return *this; 00101 } 00102 00103 void G4BREPSolidTorus::InitializeTorus() 00104 { 00105 SurfaceVec = new G4Surface*[1]; 00106 SurfaceVec[0] = new G4ToroidalSurface( constructorParams.origin, 00107 constructorParams.axis, 00108 constructorParams.direction, 00109 constructorParams.MinRadius, 00110 constructorParams.MaxRadius ); 00111 nb_of_surfaces = 1; 00112 00113 Initialize(); 00114 } 00115 00116 G4VSolid* G4BREPSolidTorus::Clone() const 00117 { 00118 return new G4BREPSolidTorus(*this); 00119 } 00120 00121 std::ostream& G4BREPSolidTorus::StreamInfo(std::ostream& os) const 00122 { 00123 // Streams solid contents to output stream. 00124 00125 G4BREPSolid::StreamInfo( os ) 00126 << "\n origin: " << constructorParams.origin 00127 << "\n axis: " << constructorParams.axis 00128 << "\n direction: " << constructorParams.direction 00129 << "\n MinRadius: " << constructorParams.MinRadius 00130 << "\n MaxRadius: " << constructorParams.MaxRadius 00131 << "\n-----------------------------------------------------------\n"; 00132 00133 return os; 00134 } 00135