Geant4-11
G4LogicalVolume.icc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// class G4LogicalVolume inline implementation
27//
28// 15.01.13 - G.Cosmo, A.Dotti: Modified for thread-safety for MT
29// 10.20.97 - P. MoraDeFreitas : Added SetFastSimulation method
30// 05.11.98 - M. Verderi: Add Get/Set methods for fBiasWeight
31// 09.11.98 - J.Apostolakis: Changed MagneticField to FieldManager
32// 12.02.99 - S.Giani: Added set/get methods for voxelization quality
33// 18.04.01 - G.Cosmo: Migrated to STL vector
34// 17.05.02 - G.Cosmo: Added IsToOptimise() method
35// --------------------------------------------------------------------
36
37// ********************************************************************
38// GetName
39// ********************************************************************
40//
41inline
42const G4String& G4LogicalVolume::GetName() const
43{
44 return fName;
45}
46
47// ********************************************************************
48// GetInstanceID
49// ********************************************************************
50//
51inline
52G4int G4LogicalVolume::GetInstanceID() const
53{
54 return instanceID;
55}
56
57// ********************************************************************
58// GetMasterFieldManager
59// ********************************************************************
60//
61inline
62G4FieldManager* G4LogicalVolume::GetMasterFieldManager() const
63{
64 return fFieldManager;
65}
66
67// ********************************************************************
68// GetNoDaughters
69// ********************************************************************
70//
71inline
72size_t G4LogicalVolume::GetNoDaughters() const
73{
74 return fDaughters.size();
75}
76
77// ********************************************************************
78// GetDaughter
79// ********************************************************************
80//
81inline
82G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const
83{
84 return fDaughters[i];
85}
86
87// ********************************************************************
88// GetFastSimulationManager
89// ********************************************************************
90//
91inline
92G4FastSimulationManager* G4LogicalVolume::GetFastSimulationManager () const
93{
94 G4FastSimulationManager* fFSM = nullptr;
95 if(fRegion != nullptr) fFSM = fRegion->GetFastSimulationManager();
96 return fFSM;
97}
98
99// ********************************************************************
100// IsDaughter
101// ********************************************************************
102//
103inline
104G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
105{
106 for (auto i=fDaughters.cbegin(); i!=fDaughters.cend(); ++i)
107 {
108 if (**i==*p) return true;
109 }
110 return false;
111}
112
113// ********************************************************************
114// CharacteriseDaughters
115// ********************************************************************
116//
117inline
118EVolume G4LogicalVolume::CharacteriseDaughters() const
119{
120 return fDaughtersVolumeType;
121}
122
123// ********************************************************************
124// DeduceDaughtersType
125// ********************************************************************
126//
127inline
128EVolume G4LogicalVolume::DeduceDaughtersType() const
129{
130 EVolume type= kNormal;
131 G4VPhysicalVolume* pVol;
132
133 if ( GetNoDaughters() >= 1 )
134 {
135 pVol = GetDaughter(0);
136 type = pVol->VolumeType();
137 }
138 return type;
139}
140
141// ********************************************************************
142// GetMasterSolid
143// ********************************************************************
144//
145inline
146G4VSolid* G4LogicalVolume::GetMasterSolid() const
147{
148 return fSolid;
149}
150
151// ********************************************************************
152// GetMasterSensitiveDetector
153// ********************************************************************
154//
155inline
156G4VSensitiveDetector* G4LogicalVolume::GetMasterSensitiveDetector() const
157{
158 return fSensitiveDetector;
159}
160
161// ********************************************************************
162// GetUserLimits
163// ********************************************************************
164//
165inline
166G4UserLimits* G4LogicalVolume::GetUserLimits() const
167{
168 if(fUserLimits != nullptr) return fUserLimits;
169 if(fRegion != nullptr) return fRegion->GetUserLimits();
170 return nullptr;
171}
172
173// ********************************************************************
174// SetUserLimits
175// ********************************************************************
176//
177inline
178void G4LogicalVolume::SetUserLimits(G4UserLimits* pULimits)
179{
180 fUserLimits = pULimits;
181}
182
183// ********************************************************************
184// GetVoxelHeader
185// ********************************************************************
186//
187inline
188G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const
189{
190 return fVoxel;
191}
192
193// ********************************************************************
194// SetVoxelHeader
195// ********************************************************************
196//
197inline
198void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader* pVoxel)
199{
200 fVoxel = pVoxel;
201}
202
203// ********************************************************************
204// GetSmartless
205// ********************************************************************
206//
207inline
208G4double G4LogicalVolume::GetSmartless() const
209{
210 return fSmartless;
211}
212
213// ********************************************************************
214// SetSmartless
215// ********************************************************************
216//
217inline
218void G4LogicalVolume::SetSmartless(G4double smt)
219{
220 fSmartless = smt;
221}
222
223// ********************************************************************
224// IsToOptimise
225// ********************************************************************
226//
227inline
228G4bool G4LogicalVolume::IsToOptimise() const
229{
230 return fOptimise;
231}
232
233// ********************************************************************
234// SetOptimisation
235// ********************************************************************
236//
237inline
238void G4LogicalVolume::SetOptimisation(G4bool optim)
239{
240 fOptimise = optim;
241}
242
243// ********************************************************************
244// IsRootRegion
245// ********************************************************************
246//
247inline
248G4bool G4LogicalVolume::IsRootRegion() const
249{
250 return fRootRegion;
251}
252
253// ********************************************************************
254// SetRegionRootFlag
255// ********************************************************************
256//
257inline
258void G4LogicalVolume::SetRegionRootFlag(G4bool rreg)
259{
260 fRootRegion = rreg;
261}
262
263// ********************************************************************
264// IsRegion
265// ********************************************************************
266//
267inline
268G4bool G4LogicalVolume::IsRegion() const
269{
270 G4bool reg = false;
271 if (fRegion != nullptr) reg = true;
272 return reg;
273}
274
275// ********************************************************************
276// SetRegion
277// ********************************************************************
278//
279inline
280void G4LogicalVolume::SetRegion(G4Region* reg)
281{
282 fRegion = reg;
283}
284
285// ********************************************************************
286// GetRegion
287// ********************************************************************
288//
289inline
290G4Region* G4LogicalVolume::GetRegion() const
291{
292 return fRegion;
293}
294
295// ********************************************************************
296// PropagateRegion
297// ********************************************************************
298//
299inline
300void G4LogicalVolume::PropagateRegion()
301{
302 fRegion->ScanVolumeTree(this, true);
303}
304
305// ********************************************************************
306// Lock
307// ********************************************************************
308//
309inline
310void G4LogicalVolume::Lock()
311{
312 fLock = true;
313}
314
315// ********************************************************************
316// Operator ==
317// ********************************************************************
318//
319inline
320G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
321{
322 return (this==&lv) ? true : false;
323}
324
325// ********************************************************************
326// GetVisAttributes
327// ********************************************************************
328//
329inline
330const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const
331{
332 return fVisAttributes;
333}
334
335// ********************************************************************
336// SetVisAttributes
337// ********************************************************************
338//
339inline
340void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA)
341{
342 fVisAttributes = pVA;
343}
344
345// ********************************************************************
346// SetBiasWeight
347// ********************************************************************
348//
349inline
350void G4LogicalVolume::SetBiasWeight(G4double weight)
351{
352 fBiasWeight = weight;
353}
354
355// ********************************************************************
356// GetBiasWeight
357// ********************************************************************
358//
359inline
360G4double G4LogicalVolume::GetBiasWeight() const
361{
362 return fBiasWeight;
363}