83{
88 G4double ourStep=currentProposedStepLength, motherSafety, ourSafety;
89 G4int localNoDaughters, sampleNo;
90
91 G4bool initialNode, noStep;
93 G4int curNoVolumes, contentNo;
95
98 motherSolid = motherLogical->
GetSolid();
99
100
101
102
103
105 ourSafety = motherSafety;
106
107#ifdef G4VERBOSE
109 {
111 }
112#endif
113
114
115
116
117
118
119
120 if ( exiting && validExitNormal )
121 {
122 if ( localDirection.dot(exitNormal)>=kMinExitingNormalCosine )
123 {
124
125
126 blockedExitedVol = *pBlockedPhysical;
127 ourSafety = 0;
128 }
129 }
130 exiting = false;
131 entering = false;
132
134
137
138 initialNode = true;
139 noStep = true;
140
141 while (noStep)
142 {
145 for (contentNo=curNoVolumes-1; contentNo>=0; contentNo--)
146 {
147 sampleNo = curVoxelNode->
GetVolume(contentNo);
149 {
151 samplePhysical = motherLogical->
GetDaughter(sampleNo);
152 if ( samplePhysical!=blockedExitedVol )
153 {
156 sampleTf.Invert();
158 sampleTf.TransformPoint(localPoint);
163#ifdef G4VERBOSE
165 {
167 }
168#endif
169 if ( sampleSafety<ourSafety )
170 {
171 ourSafety = sampleSafety;
172 }
173 if ( sampleSafety<=ourStep )
174 {
175 sampleDirection = sampleTf.TransformAxis(localDirection);
177 sampleSolid->
DistanceToIn(samplePoint, sampleDirection);
178#ifdef G4VERBOSE
180 {
182 sampleSafety, sampleStep);
183 }
184#endif
185 if ( sampleStep<=ourStep )
186 {
187 ourStep = sampleStep;
188 entering = true;
189 exiting = false;
190 *pBlockedPhysical = samplePhysical;
191 blockedReplicaNo = -1;
192#ifdef G4VERBOSE
193
194
195
196
198 {
200 sampleDirection, localDirection, sampleSafety, sampleStep);
201 }
202#endif
203 }
204 }
205 }
206 }
207 }
208 if (initialNode)
209 {
210 initialNode = false;
212 if ( voxelSafety<ourSafety )
213 {
214 ourSafety = voxelSafety;
215 }
216 if ( currentProposedStepLength<ourSafety )
217 {
218
219
220 noStep = false;
221 entering = false;
222 exiting = false;
223 *pBlockedPhysical = 0;
224 ourStep = kInfinity;
225 }
226 else
227 {
228
229
230
231 if ( motherSafety<=ourStep )
232 {
235 localDirection,
236 true, &validExitNormal, &exitNormal);
237#ifdef G4VERBOSE
239 {
241 motherStep, motherSafety);
242 }
243#endif
244 if ( motherStep<=ourStep )
245 {
246 ourStep = motherStep;
247 exiting = true;
248 entering = false;
249 if ( validExitNormal )
250 {
252 if (rot)
253 {
255 }
256 }
257 }
258 else
259 {
260 validExitNormal = false;
261 }
262 }
263 }
264 newSafety = ourSafety;
265 }
266 if (noStep)
267 {
269 }
270 }
271
272 return ourStep;
273}
HepRotation inverse() const
void BlockVolume(const G4int v)
void Enlarge(const G4int nv)
G4bool IsBlocked(const G4int v) const
G4int GetNoDaughters() const
void PreComputeStepLog(const G4VPhysicalVolume *motherPhysical, G4double motherSafety, const G4ThreeVector &localPoint) const
void PostComputeStepLog(const G4VSolid *motherSolid, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, G4double motherStep, G4double motherSafety) const
void PrintDaughterLog(const G4VSolid *sampleSolid, const G4ThreeVector &samplePoint, G4double sampleSafety, G4double sampleStep) const
void AlongComputeStepLog(const G4VSolid *sampleSolid, const G4ThreeVector &samplePoint, const G4ThreeVector &sampleDirection, const G4ThreeVector &localDirection, G4double sampleSafety, G4double sampleStep) const
G4bool LocateNextVoxel(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentStep)