G4tgrVolume Class Reference

#include <G4tgrVolume.hh>

Inheritance diagram for G4tgrVolume:

G4tgrVolumeAssembly G4tgrVolumeDivision

Public Member Functions

 G4tgrVolume ()
 G4tgrVolume (const std::vector< G4String > &wl)
 G4tgrVolume (const G4tgrVolume &vol)
virtual ~G4tgrVolume ()
virtual G4tgrPlace * AddPlace (const std::vector< G4String > &wl)
G4tgrPlaceDivRep * AddPlaceReplica (const std::vector< G4String > &wl)
G4tgrPlaceParameterisation * AddPlaceParam (const std::vector< G4String > &wl)
void AddVisibility (const std::vector< G4String > &wl)
void AddRGBColour (const std::vector< G4String > &wl)
void AddCheckOverlaps (const std::vector< G4String > &wl)
const G4String & GetName () const
void SetName (const G4String &name)
const G4String & GetType () const
G4tgrSolid * GetSolid () const
const G4String & GetMaterialName () const
const std::vector< G4tgrPlace * > GetPlacements () const
G4bool GetVisibility () const
G4double * GetColour () const
G4double * GetRGBColour () const
G4bool GetCheckOverlaps () const
virtual G4tgrVolume * GetVolume (G4int ii) const

Protected Attributes

G4String theName
G4String theType
G4String theMaterialName
G4tgrSolid * theSolid
std::vector< G4tgrPlace * > thePlacements
G4bool theVisibility
G4double * theRGBColour
G4bool theCheckOverlaps

Friends

std::ostream & operator<< (std::ostream &os, const G4tgrVolume &obj)

Detailed Description

Definition at line 60 of file G4tgrVolume.hh.


Constructor & Destructor Documentation

G4tgrVolume::G4tgrVolume (  ) 

Definition at line 49 of file G4tgrVolume.cc.

00050   : theName(""), theType(""),
00051     theMaterialName(""), theSolid(0), theVisibility(false),
00052     theRGBColour(0), theCheckOverlaps(false)
00053 {
00054 }

G4tgrVolume::G4tgrVolume ( const std::vector< G4String > &  wl  ) 

Definition at line 65 of file G4tgrVolume.cc.

References G4tgrVolumeMgr::CreateSolid(), G4tgrVolumeMgr::FindSolid(), G4cout, G4endl, G4tgrVolumeMgr::GetInstance(), G4tgrUtils::GetString(), G4tgrMessenger::GetVerboseLevel(), theCheckOverlaps, theMaterialName, theName, theRGBColour, theSolid, theType, and theVisibility.

00066 {
00067   theType = "VOLSimple";
00068 
00069   //---------- set name 
00070   theName = G4tgrUtils::GetString( wl[1] ); 
00071 
00072   theVisibility = 1;
00073   theRGBColour = new G4double[4];
00074   for(size_t ii=0; ii<4; ii++)  { theRGBColour[ii] = -1.; }
00075   theCheckOverlaps = 0;
00076 
00077   if( wl.size() != 4 )
00078   {
00079     //:VOLU tag to build a volume creating solid and material
00080     //---------- set material name
00081     theMaterialName = G4tgrUtils::GetString( wl[wl.size()-1] );
00082     
00083     //---------- create only vector<double> of theSolidParams
00084     theSolid = G4tgrVolumeMgr::GetInstance()->CreateSolid( wl, 1 );
00085 
00086 #ifdef G4VERBOSE
00087     if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00088       {
00089         G4cout << "Created from new solid: " 
00090                << *this << G4endl;
00091       }
00092 #endif
00093   }
00094   else
00095     {
00096       //:VOLU tag to build a volume assigning material to solid
00097       //---------- set material name
00098       theMaterialName = G4tgrUtils::GetString( wl[3] );
00099       theSolid = G4tgrVolumeMgr::GetInstance()->FindSolid( wl[2], true );
00100       
00101 #ifdef G4VERBOSE
00102       if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00103         {
00104           G4cout << "Created from existing solid: " 
00105                  << *this << G4endl;
00106         }
00107 #endif
00108     }
00109 }

G4tgrVolume::G4tgrVolume ( const G4tgrVolume &  vol  ) 

Definition at line 113 of file G4tgrVolume.cc.

References GetCheckOverlaps(), GetMaterialName(), GetName(), GetPlacements(), GetRGBColour(), GetSolid(), GetType(), GetVisibility(), theCheckOverlaps, theMaterialName, theName, thePlacements, theRGBColour, theSolid, theType, and theVisibility.

00114 {
00115   theName = vol.GetName();   
00116   theType = vol.GetType();
00117   theMaterialName = vol.GetMaterialName();   
00118   theSolid = vol.GetSolid();
00119   thePlacements  = vol.GetPlacements();
00120   theVisibility   = vol.GetVisibility();
00121   theRGBColour   = vol.GetRGBColour();
00122   theCheckOverlaps = vol.GetCheckOverlaps();
00123 }

G4tgrVolume::~G4tgrVolume (  )  [virtual]

Definition at line 58 of file G4tgrVolume.cc.

References theRGBColour.

00059 {
00060   delete [] theRGBColour;
00061 }


Member Function Documentation

void G4tgrVolume::AddCheckOverlaps ( const std::vector< G4String > &  wl  ) 

Definition at line 271 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), theCheckOverlaps, and WLSIZE_GE.

00272 {
00273   //---------- Check for exact number of words read 
00274   G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_GE, " G4tgrVolume::AddCheckOverlaps");
00275   
00277   theCheckOverlaps = G4tgrUtils::GetBool( wl[2] );
00278 
00279 }

G4tgrPlace * G4tgrVolume::AddPlace ( const std::vector< G4String > &  wl  )  [virtual]

Reimplemented in G4tgrVolumeAssembly.

Definition at line 138 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), FatalErrorInArgument, G4cout, G4endl, G4Exception(), G4tgrPlace::GetCopyNo(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrPlace::GetType(), G4tgrMessenger::GetVerboseLevel(), G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), theName, thePlacements, and WLSIZE_EQ.

Referenced by G4tgrLineProcessor::ProcessLine().

00139 {
00140   //---------- Check for exact number of words read 
00141   G4tgrUtils::CheckWLsize( wl, 8, WLSIZE_EQ, " G4tgrVolume::AddPlace");
00142   //---------- set G4tgrPlace 
00143   G4tgrPlaceSimple* pl = new G4tgrPlaceSimple( wl );
00144   //---------- check that there is no previous placement in
00145   //           the same parent with the same copyNo 
00146   std::vector<G4tgrPlace*>::iterator ite;
00147   for( ite = thePlacements.begin(); ite != thePlacements.end(); ite++)
00148   {
00149     if( ((*ite)->GetCopyNo() == pl->GetCopyNo())
00150      && ((*ite)->GetParentName() == pl->GetParentName()) )
00151     {
00152       G4String ErrMessage = "Repeated placement. Volume "
00153                           + theName + " in " + pl->GetParentName();
00154       G4Exception("G4tgrVolume::AddPlace()", "InvalidArgument",
00155                   FatalErrorInArgument, ErrMessage);
00156     }
00157   } 
00158 
00159   pl->SetVolume( this );
00160   thePlacements.push_back( pl ); 
00161 
00162 #ifdef G4VERBOSE
00163   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00164   {
00165     G4cout << " G4tgrVolume:  New placement: " << thePlacements.size()
00166            << " added for Volume " << theName
00167            << " inside " << pl->GetParentName()
00168            << " type " << pl->GetType() << G4endl;
00169   }
00170 #endif
00171   //---------- register parent - child 
00172   G4tgrVolumeMgr::GetInstance()->RegisterParentChild( pl->GetParentName(), pl );
00173 
00174   return pl;
00175 }

G4tgrPlaceParameterisation * G4tgrVolume::AddPlaceParam ( const std::vector< G4String > &  wl  ) 

Definition at line 218 of file G4tgrVolume.cc.

References G4cout, G4endl, G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), theName, and thePlacements.

Referenced by G4tgrLineProcessor::ProcessLine().

00219 {
00220   //---------- set G4tgrPlaceParameterisation
00221   G4tgrPlaceParameterisation* pl = new G4tgrPlaceParameterisation( wl );
00222 
00223   pl->SetVolume( this );
00224   thePlacements.push_back( pl ); 
00225 
00226 #ifdef G4VERBOSE
00227   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00228   {
00229     G4cout << " G4tgrVolume:  New placement Param: " << thePlacements.size()
00230            << " added for Volume " << theName
00231            << " inside " << pl->GetParentName() << G4endl;
00232   }
00233 #endif
00234   //---------- register parent - child 
00235   G4tgrVolumeMgr::GetInstance()->RegisterParentChild( pl->GetParentName(), pl );
00236 
00237   return pl;
00238 }

G4tgrPlaceDivRep * G4tgrVolume::AddPlaceReplica ( const std::vector< G4String > &  wl  ) 

Definition at line 180 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4cout, G4endl, G4Exception(), G4tgrUtils::GetDouble(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), JustWarning, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetType(), G4tgrPlace::SetVolume(), theName, thePlacements, WLSIZE_GE, and WLSIZE_LE.

Referenced by G4tgrLineProcessor::ProcessLine().

00181 {
00182   //---------- Check for exact number of words read 
00183   G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE, " G4tgrVolume::AddPlaceReplica");
00184   G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_LE, " G4tgrVolume::AddPlaceReplica");
00185 
00186   if( (wl.size() == 7) && (G4tgrUtils::GetDouble(wl[6]) != 0.)
00187                        && (wl[3] != "PHI") )
00188   {
00189     G4Exception("G4tgrVolume::AddPlaceReplica",
00190                 "Offset set for replica not along PHI, it will not be used",
00191                 JustWarning,
00192                 G4String("Volume "+wl[1]+" in volume "+wl[2]).c_str());
00193   }
00194   
00195   //---------- set G4tgrPlace 
00196   G4tgrPlaceDivRep* pl = new G4tgrPlaceDivRep( wl );
00197   pl->SetType("PlaceReplica");
00198   pl->SetVolume( this );
00199   thePlacements.push_back( pl ); 
00200 
00201 #ifdef G4VERBOSE
00202   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00203   {
00204     G4cout << " G4tgrVolume:  New placement replica: " << thePlacements.size()
00205            << " added for Volume " << theName
00206            << " inside " << pl->GetParentName() << G4endl;
00207   }
00208 #endif
00209   //---------- register parent - child 
00210   G4tgrVolumeMgr::GetInstance()->RegisterParentChild( pl->GetParentName(), pl );
00211 
00212   return pl;
00213 }

void G4tgrVolume::AddRGBColour ( const std::vector< G4String > &  wl  ) 

Definition at line 253 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetDouble(), theRGBColour, and WLSIZE_GE.

00254 {
00255   //---------- Check for exact number of words read 
00256   G4tgrUtils::CheckWLsize( wl, 5, WLSIZE_GE, " G4tgrVolume::AddRGBColour");
00257   
00258   //---------- Set RGB colour
00259   theRGBColour[0] = G4tgrUtils::GetDouble( wl[2] );
00260   theRGBColour[1] = G4tgrUtils::GetDouble( wl[3] );
00261   theRGBColour[2] = G4tgrUtils::GetDouble( wl[4] );
00263   if( wl.size() == 6 )
00264   {
00265     theRGBColour[3] = G4tgrUtils::GetDouble( wl[5] );
00266   }
00267 }

void G4tgrVolume::AddVisibility ( const std::vector< G4String > &  wl  ) 

Definition at line 242 of file G4tgrVolume.cc.

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), theVisibility, and WLSIZE_EQ.

00243 {
00244   //---------- Check for exact number of words read 
00245   G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_EQ, " G4tgrVolume::AddVisibility");
00246 
00247   //---------- Set visibility
00248   theVisibility = G4tgrUtils::GetBool( wl[2] );
00249 }

G4bool G4tgrVolume::GetCheckOverlaps (  )  const [inline]

Definition at line 100 of file G4tgrVolume.hh.

References theCheckOverlaps.

Referenced by G4tgbVolume::ConstructG4PhysVol(), and G4tgrVolume().

00100 {return theCheckOverlaps;}

G4double* G4tgrVolume::GetColour (  )  const [inline]

Definition at line 97 of file G4tgrVolume.hh.

References theRGBColour.

Referenced by G4tgbVolume::GetColour().

00097 {return theRGBColour;}

const G4String& G4tgrVolume::GetMaterialName (  )  const [inline]

Definition at line 93 of file G4tgrVolume.hh.

References theMaterialName.

Referenced by G4tgbVolume::ConstructG4LogVol(), G4tgbVolume::ConstructG4PhysVol(), and G4tgrVolume().

00093 {return theMaterialName;}

const G4String& G4tgrVolume::GetName (  )  const [inline]

Definition at line 89 of file G4tgrVolume.hh.

References theName.

Referenced by G4tgbDetectorConstruction::Construct(), G4tgbDetectorBuilder::ConstructDetector(), G4tgbVolume::ConstructG4Volumes(), G4tgrVolumeMgr::DumpSummary(), G4tgrVolumeMgr::DumpVolumeLeaf(), G4tgrVolume(), G4tgbVolume::GetName(), G4tgrVolumeMgr::GetTopVolume(), G4tgrVolumeMgr::RegisterMe(), and G4tgrVolumeMgr::UnRegisterMe().

00089 {return theName;}

const std::vector<G4tgrPlace*> G4tgrVolume::GetPlacements (  )  const [inline]

Definition at line 95 of file G4tgrVolume.hh.

References thePlacements.

Referenced by G4tgrVolume().

00095 {return thePlacements;}

G4double* G4tgrVolume::GetRGBColour (  )  const [inline]

Definition at line 98 of file G4tgrVolume.hh.

References theRGBColour.

Referenced by G4tgrVolume().

00098 {return theRGBColour;}

G4tgrSolid* G4tgrVolume::GetSolid (  )  const [inline]

Definition at line 92 of file G4tgrVolume.hh.

References theSolid.

Referenced by G4tgbVolume::ConstructG4Volumes(), G4tgrSolidBoolean::G4tgrSolidBoolean(), and G4tgrVolume().

00092 {return theSolid;}

const G4String& G4tgrVolume::GetType ( void   )  const [inline]

Definition at line 91 of file G4tgrVolume.hh.

References theType.

Referenced by G4tgbVolume::ConstructG4PhysVol(), G4tgbVolume::ConstructG4Volumes(), G4tgrLineProcessor::FindVolume(), G4tgrVolume(), and G4tgrVolumeMgr::GetTopVolume().

00091 {return theType;}

G4bool G4tgrVolume::GetVisibility (  )  const [inline]

Definition at line 96 of file G4tgrVolume.hh.

References theVisibility.

Referenced by G4tgrVolume(), and G4tgbVolume::GetVisibility().

00096 {return theVisibility;}

G4tgrVolume * G4tgrVolume::GetVolume ( G4int  ii  )  const [virtual]

Definition at line 127 of file G4tgrVolume.cc.

References G4UIcommand::ConvertToString(), FatalException, and G4Exception().

00128 {
00129   G4String ErrMessage = "Should only be called for composite solids... "
00130                       + G4UIcommand::ConvertToString(ii);
00131   G4Exception("G4tgrVolume::GetVolume()", "InvalidCall",
00132               FatalException, ErrMessage);
00133   return 0;
00134 }

void G4tgrVolume::SetName ( const G4String &  name  )  [inline]

Definition at line 90 of file G4tgrVolume.hh.

References theName.

00090 {theName = name;}


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const G4tgrVolume &  obj 
) [friend]

Definition at line 283 of file G4tgrVolume.cc.

00284 {
00285   os << "G4tgrVolume= " << obj.theName << " Type= " << obj.theType
00286      << " Material= " << obj.theMaterialName
00287      << " Visibility " << obj.theVisibility 
00288      << " Colour " << (obj.theRGBColour)[0] << " "
00289                    << (obj.theRGBColour)[1] << " "
00290                    << (obj.theRGBColour)[2] << " "
00291                    << (obj.theRGBColour)[3] << " "
00292      << " CheckOverlaps " << obj.theCheckOverlaps
00293      << " N placements " << obj.thePlacements.size() << G4endl;
00294       
00295   return os;
00296 }


Field Documentation

G4bool G4tgrVolume::theCheckOverlaps [protected]

Definition at line 121 of file G4tgrVolume.hh.

Referenced by AddCheckOverlaps(), G4tgrVolume(), GetCheckOverlaps(), and operator<<().

G4String G4tgrVolume::theMaterialName [protected]

Definition at line 112 of file G4tgrVolume.hh.

Referenced by G4tgrVolume(), G4tgrVolumeDivision::G4tgrVolumeDivision(), GetMaterialName(), and operator<<().

G4String G4tgrVolume::theName [protected]

Definition at line 108 of file G4tgrVolume.hh.

Referenced by G4tgrVolumeAssembly::AddPlace(), AddPlace(), AddPlaceParam(), AddPlaceReplica(), G4tgrVolume(), G4tgrVolumeAssembly::G4tgrVolumeAssembly(), G4tgrVolumeDivision::G4tgrVolumeDivision(), GetName(), operator<<(), and SetName().

std::vector<G4tgrPlace*> G4tgrVolume::thePlacements [protected]

Definition at line 116 of file G4tgrVolume.hh.

Referenced by G4tgrVolumeAssembly::AddPlace(), AddPlace(), AddPlaceParam(), AddPlaceReplica(), G4tgrVolume(), GetPlacements(), and operator<<().

G4double* G4tgrVolume::theRGBColour [protected]

Definition at line 120 of file G4tgrVolume.hh.

Referenced by AddRGBColour(), G4tgrVolume(), G4tgrVolumeAssembly::G4tgrVolumeAssembly(), G4tgrVolumeDivision::G4tgrVolumeDivision(), GetColour(), GetRGBColour(), operator<<(), and ~G4tgrVolume().

G4tgrSolid* G4tgrVolume::theSolid [protected]

Definition at line 114 of file G4tgrVolume.hh.

Referenced by G4tgrVolume(), G4tgrVolumeAssembly::G4tgrVolumeAssembly(), G4tgrVolumeDivision::G4tgrVolumeDivision(), and GetSolid().

G4String G4tgrVolume::theType [protected]

Definition at line 110 of file G4tgrVolume.hh.

Referenced by G4tgrVolume(), G4tgrVolumeAssembly::G4tgrVolumeAssembly(), G4tgrVolumeDivision::G4tgrVolumeDivision(), GetType(), and operator<<().

G4bool G4tgrVolume::theVisibility [protected]

Definition at line 119 of file G4tgrVolume.hh.

Referenced by AddVisibility(), G4tgrVolume(), G4tgrVolumeAssembly::G4tgrVolumeAssembly(), G4tgrVolumeDivision::G4tgrVolumeDivision(), GetVisibility(), and operator<<().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:31 2013 for Geant4 by  doxygen 1.4.7