Geant4 11.1.1
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 79 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 39 of file G3VolTableEntry.cc.

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

◆ ~G3VolTableEntry()

G3VolTableEntry::~G3VolTableEntry ( )
virtual

Definition at line 53 of file G3VolTableEntry.cc.

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

Member Function Documentation

◆ AddClone()

void G3VolTableEntry::AddClone ( G3VolTableEntry aDaughter)

Definition at line 90 of file G3VolTableEntry.cc.

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

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

◆ AddDaughter()

void G3VolTableEntry::AddDaughter ( G3VolTableEntry aDaughter)

Definition at line 76 of file G3VolTableEntry.cc.

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

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

◆ AddG3Pos()

void G3VolTableEntry::AddG3Pos ( G3Pos aG3Pos)

Definition at line 64 of file G3VolTableEntry.cc.

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

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

◆ AddMother()

void G3VolTableEntry::AddMother ( G3VolTableEntry aDaughter)

Definition at line 83 of file G3VolTableEntry.cc.

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

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

◆ AddOverlap()

void G3VolTableEntry::AddOverlap ( G3VolTableEntry aOverlap)

Definition at line 97 of file G3VolTableEntry.cc.

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

Referenced by G4gsbool().

◆ ClearDivision()

void G3VolTableEntry::ClearDivision ( )

Definition at line 222 of file G3VolTableEntry.cc.

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

Referenced by G3toG4BuildPVTree().

◆ ClearG3PosCopy()

void G3VolTableEntry::ClearG3PosCopy ( G4int  copy)

Definition at line 212 of file G3VolTableEntry.cc.

212 {
213 if (fG3Pos.size()>0 && copy>=0 && copy<G4int(fG3Pos.size())) {
214 std::vector<G3Pos*>::iterator it=fG3Pos.begin();
215 for(G4int j=0;j<copy;j++) it++;
216 if(it!=fG3Pos.end()) {
217 fG3Pos.erase(it);
218 }
219 }
220}
void copy(G4double dst[], const G4double src[], std::size_t size=G4FieldTrack::ncompSVEC)
Definition: G4FieldUtils.cc:98

Referenced by G3toG4BuildPVTree().

◆ FindClone()

G3VolTableEntry * G3VolTableEntry::FindClone ( const G4String vname)

Definition at line 155 of file G3VolTableEntry.cc.

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

Referenced by AddClone().

◆ FindDaughter()

G3VolTableEntry * G3VolTableEntry::FindDaughter ( const G4String vname)

Definition at line 138 of file G3VolTableEntry.cc.

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

Referenced by AddDaughter().

◆ FindMother()

G3VolTableEntry * G3VolTableEntry::FindMother ( const G4String vname)

Definition at line 146 of file G3VolTableEntry.cc.

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

Referenced by AddMother(), and G3toG4BuildPVTree().

◆ GetClone()

G3VolTableEntry * G3VolTableEntry::GetClone ( G4int  i)

Definition at line 331 of file G3VolTableEntry.cc.

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

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

◆ GetDaughter()

G3VolTableEntry * G3VolTableEntry::GetDaughter ( G4int  i)

Definition at line 306 of file G3VolTableEntry.cc.

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

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

◆ GetDivision()

G3Division * G3VolTableEntry::GetDivision ( )
inline

Definition at line 164 of file G3VolTableEntry.hh.

165{ return fDivision; }

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

◆ GetG3PosCopy()

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

Definition at line 258 of file G3VolTableEntry.cc.

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

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

◆ GetLV()

G4LogicalVolume * G3VolTableEntry::GetLV ( )

Definition at line 281 of file G3VolTableEntry.cc.

281 {
282 return fLV;
283}

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

◆ GetMasterClone()

G3VolTableEntry * G3VolTableEntry::GetMasterClone ( )

Definition at line 339 of file G3VolTableEntry.cc.

339 {
340 G3VolTableEntry* master;
341 G4String name = fVname;
342 if (G4StrUtil::contains(name, gSeparator)) {
343 name = name.substr(0, name.find(gSeparator));
344 master = G3Vol.GetVTE(name);
345 }
346 else
347 master = this;
348
349 return master;
350}
G3G4DLL_API char gSeparator
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition: G3VolTable.cc:53
const char * name(G4int ptype)
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.

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

◆ GetMother() [1/2]

G3VolTableEntry * G3VolTableEntry::GetMother ( )

Definition at line 323 of file G3VolTableEntry.cc.

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

Referenced by FindMother().

◆ GetMother() [2/2]

G3VolTableEntry * G3VolTableEntry::GetMother ( G4int  i)

Definition at line 314 of file G3VolTableEntry.cc.

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

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

◆ GetName()

◆ GetNmed()

G4int G3VolTableEntry::GetNmed ( )

Definition at line 238 of file G3VolTableEntry.cc.

238 {
239 return fNmed;
240}

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

◆ GetNoClones()

G4int G3VolTableEntry::GetNoClones ( )

Definition at line 296 of file G3VolTableEntry.cc.

296 {
297 return (G4int)fClones.size();
298}

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

◆ GetNoDaughters()

G4int G3VolTableEntry::GetNoDaughters ( )

◆ GetNoMothers()

G4int G3VolTableEntry::GetNoMothers ( )

Definition at line 291 of file G3VolTableEntry.cc.

291 {
292 return (G4int)fMothers.size();
293}

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

◆ GetNoOverlaps()

G4int G3VolTableEntry::GetNoOverlaps ( )

Definition at line 301 of file G3VolTableEntry.cc.

301 {
302 return (G4int)fOverlaps.size();
303}

Referenced by G3toG4MANY().

◆ GetNpar()

G4int G3VolTableEntry::GetNpar ( )

Definition at line 243 of file G3VolTableEntry.cc.

243 {
244 return fNpar;
245}

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

◆ GetOverlaps()

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

Definition at line 353 of file G3VolTableEntry.cc.

353 {
354 return &fOverlaps;
355}

Referenced by G3toG4MANY().

◆ GetRpar()

G4double * G3VolTableEntry::GetRpar ( )

Definition at line 248 of file G3VolTableEntry.cc.

248 {
249 return fRpar;
250}

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

◆ GetShape()

G4String G3VolTableEntry::GetShape ( )

◆ GetSolid()

G4VSolid * G3VolTableEntry::GetSolid ( )

Definition at line 276 of file G3VolTableEntry.cc.

276 {
277 return fSolid;
278}

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

◆ HasMANY()

G4bool G3VolTableEntry::HasMANY ( )

Definition at line 271 of file G3VolTableEntry.cc.

271 {
272 return fHasMANY;
273}

Referenced by G3toG4MANY().

◆ HasNegPars()

G4bool G3VolTableEntry::HasNegPars ( )

Definition at line 266 of file G3VolTableEntry.cc.

266 {
267 return fHasNegPars;
268}

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

◆ NPCopies()

G4int G3VolTableEntry::NPCopies ( )

Definition at line 253 of file G3VolTableEntry.cc.

253 {
254 return (G4int)fG3Pos.size();
255}

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

◆ operator==()

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

Definition at line 59 of file G3VolTableEntry.cc.

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

◆ PrintSolidInfo()

void G3VolTableEntry::PrintSolidInfo ( )

Definition at line 163 of file G3VolTableEntry.cc.

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

◆ ReplaceDaughter()

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

Definition at line 102 of file G3VolTableEntry.cc.

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

Referenced by G3Division::UpdateVTE().

◆ ReplaceMother()

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

Definition at line 120 of file G3VolTableEntry.cc.

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

Referenced by G3Division::UpdateVTE().

◆ SetDivision()

void G3VolTableEntry::SetDivision ( G3Division division)
inline

Definition at line 161 of file G3VolTableEntry.hh.

162{ fDivision = division; }

Referenced by G4CloneDaughters(), and G4CreateCloneVTEWithDivision().

◆ SetHasMANY()

void G3VolTableEntry::SetHasMANY ( G4bool  hasMANY)

Definition at line 208 of file G3VolTableEntry.cc.

208 {
209 fHasMANY = hasMANY;
210}

Referenced by AddG3Pos().

◆ SetHasNegPars()

void G3VolTableEntry::SetHasNegPars ( G4bool  hasNegPars)

Definition at line 204 of file G3VolTableEntry.cc.

204 {
205 fHasNegPars = hasNegPars;
206}

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

◆ SetLV()

void G3VolTableEntry::SetLV ( G4LogicalVolume lv)

Definition at line 182 of file G3VolTableEntry.cc.

182 {
183 fLV = lv;
184}

Referenced by G3toG4BuildLVTree().

◆ SetName()

void G3VolTableEntry::SetName ( G4String  name)

Definition at line 177 of file G3VolTableEntry.cc.

177 {
178 fVname = name;
179}

Referenced by G4CreateCloneVTE().

◆ SetNmed()

void G3VolTableEntry::SetNmed ( G4int  nmed)

Definition at line 191 of file G3VolTableEntry.cc.

191 {
192 fNmed = nmed;
193}

Referenced by G3Division::UpdateVTE().

◆ SetNRpar()

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

Definition at line 195 of file G3VolTableEntry.cc.

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

Referenced by G4ProcessDaughters().

◆ SetSolid()

void G3VolTableEntry::SetSolid ( G4VSolid solid)

Definition at line 187 of file G3VolTableEntry.cc.

187 {
188 fSolid = solid;
189}

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


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