[831] | 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 | // |
---|
[850] | 27 | // $Id: G4LogicalSkinSurface.cc,v 1.16 2008/08/19 15:31:52 gcosmo Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // -------------------------------------------------------------------- |
---|
| 31 | // G4LogicalSkinSurface Implementation |
---|
| 32 | // -------------------------------------------------------------------- |
---|
| 33 | // |
---|
| 34 | // A Logical Surface class for the surface surrounding a single |
---|
| 35 | // logical volume. |
---|
| 36 | // |
---|
| 37 | // Created: 1997-06-26 |
---|
| 38 | // Author: John Apostolakis (John.Apostolakis@cern.ch) |
---|
| 39 | // |
---|
| 40 | // ---------------------------------------------------------------------- |
---|
| 41 | |
---|
| 42 | #include "G4LogicalSkinSurface.hh" |
---|
| 43 | #include "G4LogicalVolume.hh" |
---|
| 44 | |
---|
| 45 | G4LogicalSkinSurfaceTable G4LogicalSkinSurface::theSkinSurfaceTable; |
---|
| 46 | |
---|
| 47 | // |
---|
| 48 | // Constructors & destructor |
---|
| 49 | // |
---|
| 50 | |
---|
| 51 | G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name, |
---|
| 52 | G4LogicalVolume* logicalVolume, |
---|
| 53 | G4SurfaceProperty* surfaceProperty) |
---|
| 54 | : G4LogicalSurface(name, surfaceProperty), |
---|
| 55 | LogVolume(logicalVolume) |
---|
| 56 | { |
---|
| 57 | // Store in the table of Surfaces |
---|
| 58 | // |
---|
| 59 | theSkinSurfaceTable.push_back(this); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | G4LogicalSkinSurface::G4LogicalSkinSurface(const G4LogicalSkinSurface& right) |
---|
| 63 | : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty()) |
---|
| 64 | { |
---|
| 65 | SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); |
---|
| 66 | LogVolume = right.LogVolume; |
---|
| 67 | theSkinSurfaceTable = right.theSkinSurfaceTable; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | G4LogicalSkinSurface::~G4LogicalSkinSurface() |
---|
| 71 | { |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | // |
---|
| 75 | // Operators |
---|
| 76 | // |
---|
| 77 | |
---|
| 78 | const G4LogicalSkinSurface& |
---|
| 79 | G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface& right) |
---|
| 80 | { |
---|
| 81 | if (&right == this) return *this; |
---|
| 82 | if (&right) |
---|
| 83 | { |
---|
| 84 | SetSurfaceProperty(right.GetSurfaceProperty()); |
---|
| 85 | SetName(right.GetName()); |
---|
| 86 | SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); |
---|
| 87 | LogVolume = right.LogVolume; |
---|
| 88 | theSkinSurfaceTable = right.theSkinSurfaceTable; |
---|
| 89 | } |
---|
| 90 | return *this; |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | G4int |
---|
| 94 | G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface& right) const |
---|
| 95 | { |
---|
| 96 | return (this == (G4LogicalSkinSurface *) &right); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | G4int |
---|
| 100 | G4LogicalSkinSurface::operator!=(const G4LogicalSkinSurface& right) const |
---|
| 101 | { |
---|
| 102 | return (this != (G4LogicalSkinSurface *) &right); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | // |
---|
| 106 | // Methods |
---|
| 107 | // |
---|
| 108 | |
---|
| 109 | const G4LogicalSkinSurfaceTable* G4LogicalSkinSurface::GetSurfaceTable() |
---|
| 110 | { |
---|
| 111 | return &theSkinSurfaceTable; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces() |
---|
| 115 | { |
---|
| 116 | return theSkinSurfaceTable.size(); |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | G4LogicalSkinSurface* |
---|
| 120 | G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol) |
---|
| 121 | { |
---|
| 122 | for (size_t i=0; i<theSkinSurfaceTable.size(); i++) |
---|
| 123 | { |
---|
| 124 | if(theSkinSurfaceTable[i]->GetLogicalVolume() == vol) |
---|
| 125 | return theSkinSurfaceTable[i]; |
---|
| 126 | } |
---|
| 127 | return NULL; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | // Dump info for known surfaces |
---|
| 131 | // |
---|
| 132 | void G4LogicalSkinSurface::DumpInfo() |
---|
| 133 | { |
---|
| 134 | G4cout << "***** Skin Surface Table : Nb of Surfaces = " |
---|
| 135 | << GetNumberOfSkinSurfaces() << " *****" << G4endl; |
---|
| 136 | |
---|
| 137 | for (size_t i=0; i<theSkinSurfaceTable.size(); i++) |
---|
| 138 | { |
---|
| 139 | G4LogicalSkinSurface* pSkinSurface = theSkinSurfaceTable[i]; |
---|
| 140 | G4cout << pSkinSurface->GetName() << " : " << G4endl |
---|
| 141 | << " Skin of logical volume " |
---|
| 142 | << pSkinSurface->GetLogicalVolume()->GetName() |
---|
| 143 | << G4endl; |
---|
| 144 | } |
---|
| 145 | G4cout << G4endl; |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | void G4LogicalSkinSurface::CleanSurfaceTable() |
---|
| 149 | { |
---|
| 150 | G4LogicalSkinSurfaceTable::iterator pos; |
---|
| 151 | for(pos=theSkinSurfaceTable.begin(); pos!=theSkinSurfaceTable.end(); pos++) |
---|
| 152 | { |
---|
| 153 | if (*pos) delete *pos; |
---|
| 154 | } |
---|
| 155 | theSkinSurfaceTable.clear(); |
---|
| 156 | } |
---|