Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G3VolTableEntry Class Reference

#include <G3VolTableEntry.hh>

Public Member Functions

 G3VolTableEntry (G4String &vname, G4String &shape, G4double *rpar, G4int npar, G4int nmed, G4VSolid *solid, G4bool hasNegPars)
 
virtual ~G3VolTableEntry ()
 
G4bool operator== (const G3VolTableEntry &vte) const
 
void AddG3Pos (G3Pos *aG3Pos)
 
void AddDaughter (G3VolTableEntry *aDaughter)
 
void AddMother (G3VolTableEntry *aDaughter)
 
void AddClone (G3VolTableEntry *aDaughter)
 
void AddOverlap (G3VolTableEntry *aOverlap)
 
void ReplaceDaughter (G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
 
void ReplaceMother (G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
 
G3VolTableEntryFindDaughter (const G4String &vname)
 
G3VolTableEntryFindMother (const G4String &vname)
 
G3VolTableEntryFindClone (const G4String &vname)
 
void PrintSolidInfo ()
 
void SetName (G4String name)
 
void SetLV (G4LogicalVolume *lv)
 
void SetSolid (G4VSolid *solid)
 
void SetNmed (G4int nmed)
 
void SetNRpar (G4int npar, G4double *Rpar)
 
void SetDivision (G3Division *division)
 
void SetHasNegPars (G4bool hasNegPars)
 
void SetHasMANY (G4bool hasMANY)
 
void ClearG3PosCopy (G4int copy)
 
void ClearDivision ()
 
G4String GetName ()
 
G4String GetShape ()
 
G4int GetNmed ()
 
G4int GetNpar ()
 
G4doubleGetRpar ()
 
G4int NPCopies ()
 
G3PosGetG3PosCopy (G4int copy=0)
 
G3DivisionGetDivision ()
 
G4bool HasNegPars ()
 
G4bool HasMANY ()
 
G4VSolidGetSolid ()
 
G4LogicalVolumeGetLV ()
 
G4int GetNoDaughters ()
 
G4int GetNoMothers ()
 
G4int GetNoClones ()
 
G4int GetNoOverlaps ()
 
G3VolTableEntryGetDaughter (G4int i)
 
G3VolTableEntryGetMother (G4int i)
 
G3VolTableEntryGetMother ()
 
G3VolTableEntryGetClone (G4int i)
 
G3VolTableEntryGetMasterClone ()
 
std::vector< G3VolTableEntry * > * GetOverlaps ()
 

Detailed Description

Definition at line 80 of file G3VolTableEntry.hh.

Constructor & Destructor Documentation

◆ G3VolTableEntry()

G3VolTableEntry::G3VolTableEntry ( G4String vname,
G4String shape,
G4double rpar,
G4int  npar,
G4int  nmed,
G4VSolid solid,
G4bool  hasNegPars 
)

Definition at line 40 of file G3VolTableEntry.cc.

43 : fVname(vname), fShape(shape), fRpar(0), fNpar(npar), fNmed(nmed),
44 fSolid(solid), fLV(0), fHasNegPars(hasNegPars), fHasMANY(false),
45 fDivision(0)
46{
47 if (npar>0 && rpar!=0) {
48 fRpar = new G4double[npar];
49 for (G4int i=0; i<npar; i++) fRpar[i] = rpar[i];
50 }
51 fClones.push_back(this);
52}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66

◆ ~G3VolTableEntry()

G3VolTableEntry::~G3VolTableEntry ( )
virtual

Definition at line 54 of file G3VolTableEntry.cc.

54 {
55 if (fRpar!=0) delete [] fRpar;
56 delete fDivision;
57}

Member Function Documentation

◆ AddClone()

void G3VolTableEntry::AddClone ( G3VolTableEntry aDaughter)

Definition at line 91 of file G3VolTableEntry.cc.

91 {
92 if (FindClone(itsClone->GetName()) == 0) {
93 fClones.push_back(itsClone);
94 }
95}
G3VolTableEntry * FindClone(const G4String &vname)

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), and G4CreateCloneVTEWithDivision().

◆ AddDaughter()

void G3VolTableEntry::AddDaughter ( G3VolTableEntry aDaughter)

Definition at line 77 of file G3VolTableEntry.cc.

77 {
78 if (FindDaughter(aDaughter->GetName()) == 0) {
79 fDaughters.push_back(aDaughter);
80 }
81}
G3VolTableEntry * FindDaughter(const G4String &vname)

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and G3Division::UpdateVTE().

◆ AddG3Pos()

void G3VolTableEntry::AddG3Pos ( G3Pos aG3Pos)

Definition at line 65 of file G3VolTableEntry.cc.

65 {
66
67 // insert this position to the vector
69 fG3Pos.push_back(aG3Pos);
70
71 // pass MANY info
72 G4String vonly = aG3Pos->GetOnly();
73 if (vonly == "MANY") SetHasMANY(true);
74}
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54
G4String & GetOnly()
Definition: G3Pos.cc:78
void SetHasMANY(G4bool hasMANY)
void CountG3Pos()
Definition: G3VolTable.cc:92

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), and G4gspos().

◆ AddMother()

void G3VolTableEntry::AddMother ( G3VolTableEntry aDaughter)

Definition at line 84 of file G3VolTableEntry.cc.

84 {
85 if (FindMother(itsMother->GetName()) == 0) {
86 fMothers.push_back(itsMother);
87 }
88}
G3VolTableEntry * FindMother(const G4String &vname)

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and G3Division::UpdateVTE().

◆ AddOverlap()

void G3VolTableEntry::AddOverlap ( G3VolTableEntry aOverlap)

Definition at line 98 of file G3VolTableEntry.cc.

98 {
99 fOverlaps.push_back(overlap);
100}

Referenced by G4gsbool().

◆ ClearDivision()

void G3VolTableEntry::ClearDivision ( )

Definition at line 223 of file G3VolTableEntry.cc.

223 {
224 delete fDivision;
225 fDivision = 0;
226}

Referenced by G3toG4BuildPVTree().

◆ ClearG3PosCopy()

void G3VolTableEntry::ClearG3PosCopy ( G4int  copy)

Definition at line 213 of file G3VolTableEntry.cc.

213 {
214 if (fG3Pos.size()>0 && copy>=0 && copy<G4int(fG3Pos.size())) {
215 std::vector<G3Pos*>::iterator it=fG3Pos.begin();
216 for(G4int j=0;j<copy;j++) it++;
217 if(it!=fG3Pos.end()) {
218 fG3Pos.erase(it);
219 }
220 }
221}

Referenced by G3toG4BuildPVTree().

◆ FindClone()

G3VolTableEntry * G3VolTableEntry::FindClone ( const G4String vname)

Definition at line 156 of file G3VolTableEntry.cc.

156 {
157 for (G4int i=0; i<GetNoClones(); i++){
158 G3VolTableEntry* cvte = GetClone(i);
159 if (cvte->GetName() == Cname) return cvte;
160 }
161 return 0;
162}
G3VolTableEntry * GetClone(G4int i)

Referenced by AddClone().

◆ FindDaughter()

G3VolTableEntry * G3VolTableEntry::FindDaughter ( const G4String vname)

Definition at line 139 of file G3VolTableEntry.cc.

139 {
140 for (G4int idau=0; idau<GetNoDaughters(); idau++){
141 if (GetDaughter(idau)->GetName() == Dname) return GetDaughter(idau);
142 }
143 return 0;
144}
G3VolTableEntry * GetDaughter(G4int i)

Referenced by AddDaughter().

◆ FindMother()

G3VolTableEntry * G3VolTableEntry::FindMother ( const G4String vname)

Definition at line 147 of file G3VolTableEntry.cc.

147 {
148 for (G4int i=0; i<GetNoMothers(); i++){
149 G3VolTableEntry* mvte = GetMother(i);
150 if (mvte->GetName() == Mname) return mvte;
151 }
152 return 0;
153}
G3VolTableEntry * GetMother()

Referenced by AddMother(), and G3toG4BuildPVTree().

◆ GetClone()

G3VolTableEntry * G3VolTableEntry::GetClone ( G4int  i)

Definition at line 332 of file G3VolTableEntry.cc.

332 {
333 if (i<G4int(fClones.size()) && i>=0)
334 return fClones[i];
335 else
336 return 0;
337}

Referenced by FindClone(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and MakeBooleanSolids().

◆ GetDaughter()

G3VolTableEntry * G3VolTableEntry::GetDaughter ( G4int  i)

Definition at line 307 of file G3VolTableEntry.cc.

307 {
308 if (i<G4int(fDaughters.size()) && i>=0)
309 return fDaughters[i];
310 else
311 return 0;
312}

Referenced by FindDaughter(), G3toG4BuildLVTree(), G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), G4ProcessDaughters(), and SubstractSolids().

◆ GetDivision()

G3Division * G3VolTableEntry::GetDivision ( )
inline

Definition at line 165 of file G3VolTableEntry.hh.

166{ return fDivision; }

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), G4CloneDaughters(), and G4ProcessDaughters().

◆ GetG3PosCopy()

G3Pos * G3VolTableEntry::GetG3PosCopy ( G4int  copy = 0)

Definition at line 259 of file G3VolTableEntry.cc.

259 {
260 if (fG3Pos.size()>0 && copy>=0)
261 return fG3Pos[copy];
262 else
263 return 0;
264}

Referenced by G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), and SubstractSolids().

◆ GetLV()

G4LogicalVolume * G3VolTableEntry::GetLV ( )

Definition at line 282 of file G3VolTableEntry.cc.

282 {
283 return fLV;
284}

Referenced by G3Division::CreatePVReplica(), G3toG4BuildLVTree(), G3toG4BuildPVTree(), and G4BuildGeom().

◆ GetMasterClone()

G3VolTableEntry * G3VolTableEntry::GetMasterClone ( )

Definition at line 340 of file G3VolTableEntry.cc.

340 {
341 G3VolTableEntry* master;
342 G4String name = fVname;
343 if (name.contains(gSeparator)) {
344 name = name(0, name.first(gSeparator));
345 master = G3Vol.GetVTE(name);
346 }
347 else
348 master = this;
349
350 return master;
351}
G3G4DLL_API char gSeparator
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition: G3VolTable.cc:54
G4bool contains(const std::string &) const
G4int first(char) const

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), G4CloneDaughters(), and MakeBooleanSolids().

◆ GetMother() [1/2]

G3VolTableEntry * G3VolTableEntry::GetMother ( )

Definition at line 324 of file G3VolTableEntry.cc.

324 {
325 if (fMothers.size()>0)
326 return fMothers[0];
327 else
328 return 0;
329}

Referenced by FindMother().

◆ GetMother() [2/2]

G3VolTableEntry * G3VolTableEntry::GetMother ( G4int  i)

Definition at line 315 of file G3VolTableEntry.cc.

315 {
316 if (i<G4int(fMothers.size()) && i>=0)
317 return fMothers[i];
318 else
319 return 0;
320}

Referenced by G3toG4BuildPVTree(), and G3VolTable::SetFirstVTE().

◆ GetName()

◆ GetNmed()

G4int G3VolTableEntry::GetNmed ( )

Definition at line 239 of file G3VolTableEntry.cc.

239 {
240 return fNmed;
241}

Referenced by G3toG4BuildLVTree(), G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), and G3Division::UpdateVTE().

◆ GetNoClones()

G4int G3VolTableEntry::GetNoClones ( )

Definition at line 297 of file G3VolTableEntry.cc.

297 {
298 return fClones.size();
299}

Referenced by FindClone(), G3toG4BuildLVTree(), G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and MakeBooleanSolids().

◆ GetNoDaughters()

G4int G3VolTableEntry::GetNoDaughters ( )

◆ GetNoMothers()

G4int G3VolTableEntry::GetNoMothers ( )

Definition at line 292 of file G3VolTableEntry.cc.

292 {
293 return fMothers.size();
294}

Referenced by FindMother(), G3toG4BuildPVTree(), and ReplaceMother().

◆ GetNoOverlaps()

G4int G3VolTableEntry::GetNoOverlaps ( )

Definition at line 302 of file G3VolTableEntry.cc.

302 {
303 return fOverlaps.size();
304}

Referenced by G3toG4MANY().

◆ GetNpar()

G4int G3VolTableEntry::GetNpar ( )

Definition at line 244 of file G3VolTableEntry.cc.

244 {
245 return fNpar;
246}

Referenced by G3NegVolPars(), G4CloneDaughters(), G4CreateCloneVTE(), G4gspos(), and G4ProcessDaughters().

◆ GetOverlaps()

std::vector< G3VolTableEntry * > * G3VolTableEntry::GetOverlaps ( )

Definition at line 354 of file G3VolTableEntry.cc.

354 {
355 return &fOverlaps;
356}

Referenced by G3toG4MANY().

◆ GetRpar()

G4double * G3VolTableEntry::GetRpar ( )

Definition at line 249 of file G3VolTableEntry.cc.

249 {
250 return fRpar;
251}

Referenced by G3NegVolPars(), G4CloneDaughters(), G4CreateCloneVTE(), G4gspos(), and G4ProcessDaughters().

◆ GetShape()

G4String G3VolTableEntry::GetShape ( )

◆ GetSolid()

G4VSolid * G3VolTableEntry::GetSolid ( )

Definition at line 277 of file G3VolTableEntry.cc.

277 {
278 return fSolid;
279}

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), and SubstractSolids().

◆ HasMANY()

G4bool G3VolTableEntry::HasMANY ( )

Definition at line 272 of file G3VolTableEntry.cc.

272 {
273 return fHasMANY;
274}

Referenced by G3toG4MANY().

◆ HasNegPars()

G4bool G3VolTableEntry::HasNegPars ( )

Definition at line 267 of file G3VolTableEntry.cc.

267 {
268 return fHasNegPars;
269}

Referenced by G4CloneDaughters(), G4gspos(), G4ProcessDaughters(), and G3Division::UpdateVTE().

◆ NPCopies()

G4int G3VolTableEntry::NPCopies ( )

Definition at line 254 of file G3VolTableEntry.cc.

254 {
255 return fG3Pos.size();
256}

Referenced by G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), MakeBooleanSolids(), G3VolTable::SetFirstVTE(), and SubstractSolids().

◆ operator==()

G4bool G3VolTableEntry::operator== ( const G3VolTableEntry vte) const
inline

Definition at line 60 of file G3VolTableEntry.cc.

60 {
61 return (this==&lv) ? true : false;
62}

◆ PrintSolidInfo()

void G3VolTableEntry::PrintSolidInfo ( )

Definition at line 164 of file G3VolTableEntry.cc.

164 {
165// only parameters related to solid definition
166// are printed
167 G4cout << "VTE: " << fVname << " " << this << G4endl;
168 G4cout << "Solid: " << fSolid << G4endl;
169 G4cout << "Parameters (npar = " << fNpar << ") fRpar: ";
170 for (G4int i=0; i<fNpar; i++) G4cout << fRpar[i] << " ";
171 G4cout << G4endl;
172 G4cout << "HasNegPars: " << fHasNegPars << G4endl;
173 G4cout << "HasMANY: " << fHasMANY << G4endl;
174 G4cout << "================================= " << G4endl;
175}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

◆ ReplaceDaughter()

void G3VolTableEntry::ReplaceDaughter ( G3VolTableEntry vteOld,
G3VolTableEntry vteNew 
)

Definition at line 103 of file G3VolTableEntry.cc.

105{
106 G4int index = -1;
107 for (G4int i=0; i<GetNoDaughters(); i++){
108 if (fDaughters[i]->GetName() == vteOld->GetName()) index = i;
109 }
110 if (index<0) {
111 G4String err_message = "Old daughter " + vteOld->GetName()
112 + " does not exist.";
113 G4Exception("G3VolTableEntry::ReplaceDaughter()", "G3toG40007",
114 FatalException, err_message);
115 return;
116 }
117 fDaughters[index] = vteNew;
118}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G3Division::UpdateVTE().

◆ ReplaceMother()

void G3VolTableEntry::ReplaceMother ( G3VolTableEntry vteOld,
G3VolTableEntry vteNew 
)

Definition at line 121 of file G3VolTableEntry.cc.

123{
124 G4int index = -1;
125 for (G4int i=0; i<GetNoMothers(); i++){
126 if (fMothers[i]->GetName() == vteOld->GetName()) index = i;
127 }
128 if (index<0) {
129 G4String err_message = "Old mother " + vteOld->GetName()
130 + " does not exist.";
131 G4Exception("G3VolTableEntry::ReplaceMother()", "G3toG40008",
132 FatalException, err_message);
133 return;
134 }
135 fMothers[index] = vteNew;
136}

Referenced by G3Division::UpdateVTE().

◆ SetDivision()

void G3VolTableEntry::SetDivision ( G3Division division)
inline

Definition at line 162 of file G3VolTableEntry.hh.

163{ fDivision = division; }

Referenced by G4CloneDaughters(), and G4CreateCloneVTEWithDivision().

◆ SetHasMANY()

void G3VolTableEntry::SetHasMANY ( G4bool  hasMANY)

Definition at line 209 of file G3VolTableEntry.cc.

209 {
210 fHasMANY = hasMANY;
211}

Referenced by AddG3Pos().

◆ SetHasNegPars()

void G3VolTableEntry::SetHasNegPars ( G4bool  hasNegPars)

Definition at line 205 of file G3VolTableEntry.cc.

205 {
206 fHasNegPars = hasNegPars;
207}

Referenced by G3Division::G3Division(), G4CreateCloneVTE(), and G4ProcessDaughters().

◆ SetLV()

void G3VolTableEntry::SetLV ( G4LogicalVolume lv)

Definition at line 183 of file G3VolTableEntry.cc.

183 {
184 fLV = lv;
185}

Referenced by G3toG4BuildLVTree().

◆ SetName()

void G3VolTableEntry::SetName ( G4String  name)

Definition at line 178 of file G3VolTableEntry.cc.

178 {
179 fVname = name;
180}

Referenced by G4CreateCloneVTE().

◆ SetNmed()

void G3VolTableEntry::SetNmed ( G4int  nmed)

Definition at line 192 of file G3VolTableEntry.cc.

192 {
193 fNmed = nmed;
194}

Referenced by G3Division::UpdateVTE().

◆ SetNRpar()

void G3VolTableEntry::SetNRpar ( G4int  npar,
G4double Rpar 
)

Definition at line 196 of file G3VolTableEntry.cc.

196 {
197 if (npar != fNpar) {
198 fNpar = npar;
199 delete [] fRpar;
200 fRpar = new G4double[fNpar];
201 }
202 for (G4int i=0; i<fNpar; i++) fRpar[i] = rpar[i];
203}

Referenced by G4ProcessDaughters().

◆ SetSolid()

void G3VolTableEntry::SetSolid ( G4VSolid solid)

Definition at line 188 of file G3VolTableEntry.cc.

188 {
189 fSolid = solid;
190}

Referenced by G4CreateCloneVTE(), G4ProcessDaughters(), and SubstractSolids().


The documentation for this class was generated from the following files: