Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // >> 24 // $Id: G4LogicalSkinSurface.cc,v 1.7 2001/07/11 10:00:32 gunter Exp $ >> 25 // GEANT4 tag $Name: geant4-04-00 $ >> 26 // >> 27 //////////////////////////////////////////////////////////////////////// 26 // G4LogicalSkinSurface Implementation 28 // G4LogicalSkinSurface Implementation >> 29 //////////////////////////////////////////////////////////////////////// 27 // 30 // 28 // A Logical Surface class for the surface sur << 31 // File: G4LogicalSkinSurface.cc 29 // logical volume. << 32 // Description: A Logical Surface class for the surface >> 33 // surrounding a single logical volume. >> 34 // Version: 1.0 >> 35 // Created: 1997-06-26 >> 36 // Author: John Apostolakis >> 37 // mail: John.Apostolakis@cern.ch >> 38 // Modified: 1997-06-26 John Apostolakis 30 // 39 // 31 // Author: John Apostolakis, CERN - 26-06-1997 << 40 // CVS Id tag: 32 // ------------------------------------------- << 41 //////////////////////////////////////////////////////////////////////// 33 42 34 #include "G4LogicalSkinSurface.hh" 43 #include "G4LogicalSkinSurface.hh" 35 #include "G4LogicalVolume.hh" << 44 #include "G4ios.hh" >> 45 // #include "G4OpticalSurface.hh" 36 46 37 G4LogicalSkinSurfaceTable *G4LogicalSkinSurfac << 47 G4LogicalSkinSurfaceTable G4LogicalSkinSurface::theSurfaceTable; 38 48 39 // ------------------------------------------- << 49 ///////////////////////// 40 // Constructor << 50 // Class Implementation 41 // << 51 ///////////////////////// 42 G4LogicalSkinSurface::G4LogicalSkinSurface(con << 52 43 G4L << 53 ///////////////// 44 G4S << 54 // Constructors 45 : G4LogicalSurface(name, surfaceProperty), << 55 ///////////////// >> 56 >> 57 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name, >> 58 G4LogicalVolume* logicalVolume, >> 59 G4OpticalSurface* opticalSurface) >> 60 : G4LogicalSurface(name, opticalSurface), 46 LogVolume(logicalVolume) 61 LogVolume(logicalVolume) 47 { 62 { 48 if (theSkinSurfaceTable == nullptr) << 49 { << 50 theSkinSurfaceTable = new G4LogicalSkinSur << 51 } << 52 // Store in the table of Surfaces 63 // Store in the table of Surfaces 53 // << 64 theSurfaceTable.push_back(this); 54 theSkinSurfaceTable->insert(std::make_pair(l << 55 } 65 } 56 66 57 // ------------------------------------------- << 67 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4LogicalSkinSurface &right) 58 // Default destructor << 68 : G4LogicalSurface(right.GetName(), right.GetOpticalSurface()) 59 // << 69 { 60 G4LogicalSkinSurface::~G4LogicalSkinSurface() << 70 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); >> 71 LogVolume = right.LogVolume; >> 72 theSurfaceTable = right.theSurfaceTable; >> 73 } >> 74 >> 75 G4LogicalSkinSurface::~G4LogicalSkinSurface(){} 61 76 62 // ------------------------------------------- << 77 ////////////// 63 G4bool << 78 // Operators 64 G4LogicalSkinSurface::operator==(const G4Logic << 79 ////////////// >> 80 >> 81 const G4LogicalSkinSurface& >> 82 G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface &right) 65 { 83 { 66 return (this == (G4LogicalSkinSurface *) &ri << 84 if (&right == this) return *this; >> 85 if (&right) >> 86 { >> 87 SetOpticalSurface(right.GetOpticalSurface()); >> 88 SetName(right.GetName()); >> 89 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); >> 90 LogVolume = right.LogVolume; >> 91 theSurfaceTable = right.theSurfaceTable; >> 92 } >> 93 return *this; 67 } 94 } 68 95 69 // ------------------------------------------- << 96 G4int 70 G4bool << 97 G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface &right) const 71 G4LogicalSkinSurface::operator!=(const G4Logic << 72 { 98 { 73 return (this != (G4LogicalSkinSurface *) &ri << 99 return (this == (G4LogicalSkinSurface *) &right); 74 } 100 } 75 101 76 // ------------------------------------------- << 102 G4int 77 const G4LogicalSkinSurfaceTable* G4LogicalSkin << 103 G4LogicalSkinSurface::operator!=(const G4LogicalSkinSurface &right) const 78 { 104 { 79 if (theSkinSurfaceTable == nullptr) << 105 return (this != (G4LogicalSkinSurface *) &right); 80 { << 81 theSkinSurfaceTable = new G4LogicalSkinSur << 82 } << 83 return theSkinSurfaceTable; << 84 } 106 } >> 107 //////////// >> 108 // Methods >> 109 //////////// 85 110 86 // ------------------------------------------- << 87 size_t G4LogicalSkinSurface::GetNumberOfSkinSu 111 size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces() 88 { 112 { 89 if (theSkinSurfaceTable != nullptr) << 113 return theSurfaceTable.size(); 90 { << 91 return theSkinSurfaceTable->size(); << 92 } << 93 return 0; << 94 } 114 } 95 115 96 // ------------------------------------------- << 97 G4LogicalSkinSurface* 116 G4LogicalSkinSurface* 98 G4LogicalSkinSurface::GetSurface(const G4Logic 117 G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol) 99 { 118 { 100 if (theSkinSurfaceTable != nullptr) << 119 for (size_t i=0; i<theSurfaceTable.size(); i++) { 101 { << 120 if(theSurfaceTable[i]->GetLogicalVolume() == vol) 102 auto pos = theSkinSurfaceTable->find(vol); << 121 return theSurfaceTable[i]; 103 if(pos != theSkinSurfaceTable->cend()) ret << 122 } 104 } << 123 return NULL; 105 return nullptr; << 106 } 124 } 107 125 108 // ------------------------------------------- << 109 // Dump info for known surfaces << 110 // << 111 void G4LogicalSkinSurface::DumpInfo() 126 void G4LogicalSkinSurface::DumpInfo() 112 { 127 { 113 G4cout << "***** Skin Surface Table : Nb of << 114 << GetNumberOfSkinSurfaces() << " *** << 115 128 116 if (theSkinSurfaceTable != nullptr) << 129 // Dump info for known surfaces 117 { << 130 118 for(const auto & pos : *theSkinSurfaceTabl << 131 G4cout << "***** Surface Table : Nb of Surfaces = " 119 { << 132 << GetNumberOfSkinSurfaces() << " *****" << G4endl; 120 G4LogicalSkinSurface* pSurf = pos.second << 133 121 G4cout << pSurf->GetName() << " : " << G << 134 for (size_t i=0; i<theSurfaceTable.size(); i++) { 122 << " Skin of logical volume " << 135 G4LogicalSkinSurface *pSkinSurface= theSurfaceTable[i]; 123 << pSurf->GetLogicalVolume()->Get << 136 G4cout << theSurfaceTable[i]->GetName() << " : " << G4endl << 124 << G4endl; << 137 " Skin of logical volume " << pSkinSurface->GetLogicalVolume()->GetName () 125 } << 138 // << G4endl << 126 } << 139 // " Optical Surface Ptr = " << (long)(pSkinSurface->GetOpticalSurface() ) 127 G4cout << G4endl; << 140 << G4endl; 128 } << 141 >> 142 #ifdef PRINT_INFO >> 143 // DOES NOT COMPILE without including "G4OpticalSurface.hh" >> 144 >> 145 // G4cout << pSkinSurface->GetOpticalSurface() << G4endl ; >> 146 G4pticalSurface opticalSurface= pSkinSurface->GetOpticalSurface(); >> 147 G4cout << >> 148 " Surface type = " << opticalSurface->GetType() << G4endl << >> 149 " Surface finish = " << opticalSurface->GetFinish() << G4endl << >> 150 " Surface model = " << opticalSurface->GetModel() << G4endl; >> 151 >> 152 /* >> 153 operator << ( G4OpticalSurface opticalSurface ) should exist >> 154 and do something like: >> 155 " Surface type = " << opticalSurface->GetType() << G4endl << >> 156 " Surface finish = " << opticalSurface->GetFinish() << G4endl << >> 157 " Surface model = " << opticalSurface->GetModel() << G4endl; >> 158 */ >> 159 #endif 129 160 130 // ------------------------------------------- << 131 void G4LogicalSkinSurface::CleanSurfaceTable() << 132 { << 133 if (theSkinSurfaceTable != nullptr) << 134 { << 135 for(const auto & pos : *theSkinSurfaceTabl << 136 { << 137 delete pos.second; << 138 } 161 } 139 theSkinSurfaceTable->clear(); << 162 G4cout << G4endl; 140 } << 141 return; << 142 } 163 } 143 164