G4LogicalSkinSurface.cc

Go to the documentation of this file.
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 // G4LogicalSkinSurface Implementation
00031 // --------------------------------------------------------------------
00032 //
00033 // A Logical Surface class for the surface surrounding a single
00034 // logical volume.
00035 //
00036 // Created:     1997-06-26
00037 // Author:      John Apostolakis (John.Apostolakis@cern.ch)
00038 //
00039 // ----------------------------------------------------------------------
00040 
00041 #include "G4LogicalSkinSurface.hh"
00042 #include "G4LogicalVolume.hh"
00043 
00044 G4LogicalSkinSurfaceTable G4LogicalSkinSurface::theSkinSurfaceTable;
00045 
00046 //
00047 // Constructors & destructor
00048 //
00049 
00050 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String&   name,
00051                                            G4LogicalVolume*  logicalVolume,
00052                                            G4SurfaceProperty* surfaceProperty)
00053   : G4LogicalSurface(name, surfaceProperty),
00054     LogVolume(logicalVolume)
00055 {
00056   // Store in the table of Surfaces
00057   //
00058   theSkinSurfaceTable.push_back(this);
00059 }
00060 
00061 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4LogicalSkinSurface& right)
00062   : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty())
00063 {
00064   SetTransitionRadiationSurface(right.GetTransitionRadiationSurface());
00065   LogVolume = right.LogVolume;
00066   theSkinSurfaceTable = right.theSkinSurfaceTable;
00067 }
00068 
00069 G4LogicalSkinSurface::~G4LogicalSkinSurface()
00070 {
00071 }
00072 
00073 //
00074 // Operators
00075 //
00076 
00077 const G4LogicalSkinSurface&
00078 G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface& right)
00079 {
00080   if (&right == this) return *this;
00081   if (&right)
00082   {
00083     SetSurfaceProperty(right.GetSurfaceProperty());
00084     SetName(right.GetName());
00085     SetTransitionRadiationSurface(right.GetTransitionRadiationSurface());
00086     LogVolume = right.LogVolume;
00087     theSkinSurfaceTable = right.theSkinSurfaceTable;
00088   }
00089   return *this;
00090 }
00091 
00092 G4int
00093 G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface& right) const
00094 {
00095   return (this == (G4LogicalSkinSurface *) &right);
00096 }
00097 
00098 G4int
00099 G4LogicalSkinSurface::operator!=(const G4LogicalSkinSurface& right) const
00100 {
00101   return (this != (G4LogicalSkinSurface *) &right);
00102 }
00103 
00104 //
00105 // Methods
00106 //
00107 
00108 const G4LogicalSkinSurfaceTable* G4LogicalSkinSurface::GetSurfaceTable()
00109 {
00110   return &theSkinSurfaceTable;
00111 }
00112 
00113 size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces()
00114 {
00115   return theSkinSurfaceTable.size();
00116 }
00117 
00118 G4LogicalSkinSurface*
00119 G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol)
00120 {
00121   for (size_t i=0; i<theSkinSurfaceTable.size(); i++)
00122   {
00123     if(theSkinSurfaceTable[i]->GetLogicalVolume() == vol)
00124       return theSkinSurfaceTable[i];
00125   }
00126   return NULL;
00127 }
00128 
00129 // Dump info for known surfaces
00130 //
00131 void G4LogicalSkinSurface::DumpInfo() 
00132 {
00133     G4cout << "***** Skin Surface Table : Nb of Surfaces = "
00134            << GetNumberOfSkinSurfaces() << " *****" << G4endl;
00135 
00136     for (size_t i=0; i<theSkinSurfaceTable.size(); i++)
00137     {
00138       G4LogicalSkinSurface* pSkinSurface = theSkinSurfaceTable[i];
00139       G4cout << pSkinSurface->GetName() << " : " << G4endl
00140              << " Skin of logical volume "
00141              << pSkinSurface->GetLogicalVolume()->GetName()
00142              << G4endl;
00143     }
00144     G4cout << G4endl;
00145 }
00146 
00147 void G4LogicalSkinSurface::CleanSurfaceTable()
00148 {  
00149   G4LogicalSkinSurfaceTable::iterator pos;
00150   for(pos=theSkinSurfaceTable.begin(); pos!=theSkinSurfaceTable.end(); pos++)
00151   {
00152     if (*pos) delete *pos;
00153   }
00154   theSkinSurfaceTable.clear();
00155 }

Generated on Mon May 27 17:48:49 2013 for Geant4 by  doxygen 1.4.7