208{
209
210
211
212
213
214
215
216 if ( fIamFirstGPIL )
217 {
218
219
220
221
222 fSharedData->fPreviousBiasingOperator = fSharedData->fCurrentBiasingOperator;
223 fSharedData->fIsNewOperator = false;
224 fSharedData->fLeavingPreviousOperator = false;
225
226
227
228 G4bool firstStepInParallelVolume =
false;
229 if ( fSharedData->fParallelGeometriesLimiterProcess )
230 {
233 size_t iParallel = 0;
234 for (
auto wasLimiting : fSharedData->fParallelGeometriesLimiterProcess->
GetWasLimiting() )
235 {
236 if ( firstStep || wasLimiting )
237 {
238 firstStepInParallelVolume = true;
239
241 ->GetLogicalVolume() );
242 if ( newParallelOperator )
243 {
244 if ( tmpParallelOperator )
245 {
247 ed << " Several biasing operators are defined at the same place in parallel geometries ! Found:\n";
248 ed << " - `" << newParallelOperator->GetName() << "' and \n";
249 ed << " - `" << tmpParallelOperator->GetName() << "'.\n";
250 ed <<
" Keeping `" << newParallelOperator->GetName() <<
"'. Behavior not guaranteed ! Please consider having only one operator at a place. " <<
G4endl;
251 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
252 "BIAS.GEN.30",
254 ed);
255 }
256 }
257 else newParallelOperator = tmpParallelOperator;
258 }
259 iParallel++;
260 }
261 fSharedData->fParallelGeometryOperator = newParallelOperator;
262 }
263
264
265
267
268
269 if ( firstStepInVolume )
270 {
272 fSharedData->fMassGeometryOperator = newOperator;
273 if ( ( newOperator != nullptr ) && ( fSharedData->fParallelGeometryOperator != nullptr ) )
274 {
276 ed << " Biasing operators are defined at the same place in mass and parallel geometries ! Found:\n";
277 ed <<
" - `" << fSharedData->fParallelGeometryOperator->
GetName() <<
"' in parallel geometry and \n";
278 ed <<
" - `" << newOperator->
GetName() <<
"' in mass geometry.\n";
279 ed <<
" Keeping `" << fSharedData->fParallelGeometryOperator->
GetName() <<
"'. Behavior not guaranteed ! Please consider having only one operator at a place. " <<
G4endl;
280 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
281 "BIAS.GEN.31",
283 ed);
284 }
285 }
286
287
288 if ( firstStepInVolume || firstStepInParallelVolume )
289 {
291 if ( newOperator == nullptr ) newOperator = fSharedData->fMassGeometryOperator;
292
293 fSharedData->fCurrentBiasingOperator = newOperator ;
294
295 if ( newOperator != fSharedData->fPreviousBiasingOperator )
296 {
297 fSharedData->fLeavingPreviousOperator = ( fSharedData->fPreviousBiasingOperator != nullptr ) ;
298 fSharedData->fIsNewOperator = ( newOperator != nullptr );
299 }
300 }
301
302
303
304
305
306
307
308
309
310 if ( fSharedData->fCurrentBiasingOperator != nullptr )
311 {
312 for ( size_t i = 0 ; i < (fSharedData->fPhysicsBiasingProcessInterfaces).size(); i++ )
313 (fSharedData->fPhysicsBiasingProcessInterfaces)[i]->InvokeWrappedProcessPostStepGPIL( track, previousStepSize,
condition );
314 }
315 }
316
317
318
319
320
321
322 if ( ( fSharedData->fPreviousBiasingOperator != 0 ) ||
323 ( fSharedData->fCurrentBiasingOperator != 0 ) )
324 {
325 fPreviousOccurenceBiasingOperation = fOccurenceBiasingOperation;
326 fPreviousFinalStateBiasingOperation = fFinalStateBiasingOperation;
327 fPreviousNonPhysicsBiasingOperation = fNonPhysicsBiasingOperation;
328 fPreviousBiasingInteractionLaw = fBiasingInteractionLaw;
329
330 fOccurenceBiasingOperation = 0;
331 fFinalStateBiasingOperation = 0;
332 fNonPhysicsBiasingOperation = 0;
333 fBiasingInteractionLaw = 0;
334
335
336 fBiasingPostStepGPIL =
DBL_MAX;
337
338
340 fWrappedProcessAlongStepGPIL =
DBL_MAX;
341 fBiasingAlongStepGPIL =
DBL_MAX;
344
345 fPreviousStepSize = previousStepSize;
346 }
347
348
349
350
351 G4double usedPreviousStepSize = previousStepSize;
352
353
354
355
356 if ( fSharedData->fLeavingPreviousOperator )
357 {
358 (fSharedData->fPreviousBiasingOperator)->ExitingBiasing( &track, this );
359
360 if ( fSharedData->fCurrentBiasingOperator == 0 )
361 {
362 ResetForUnbiasedTracking();
363 if ( fIsPhysicsBasedBiasing )
364 {
365
366 if ( fResetWrappedProcessInteractionLength )
367 {
368 fResetWrappedProcessInteractionLength = false;
370
371 usedPreviousStepSize = 0.0;
372 }
373 }
374 }
375 }
376
377
378
379
380
381 if ( fSharedData->fCurrentBiasingOperator == 0 )
382 {
383
385 else
386 {
389 }
390 }
391
392
393
394
395
396
397
398
399 if ( !fIsPhysicsBasedBiasing )
400 {
401 fNonPhysicsBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedNonPhysicsBiasingOperation( &track, this );
402 if ( fNonPhysicsBiasingOperation == 0 )
403 {
406 }
408 }
409
410
411
412
413
414 fOccurenceBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedOccurenceBiasingOperation( &track, this );
415
416
417
418 if ( fOccurenceBiasingOperation == 0 )
419 {
420 *
condition = fWrappedProcessForceCondition;
421 return fWrappedProcessPostStepGPIL;
422 }
423
424
425
426 fResetWrappedProcessInteractionLength = true;
427
429
430
431
432
433
434 fBiasingForceCondition = fWrappedProcessForceCondition;
436
438
439
441 return fBiasingPostStepGPIL;
442
443}
void SetPhysicalCrossSection(G4double crossSection)
const std::vector< const G4VPhysicalVolume * > & GetCurrentVolumes() const
const std::vector< G4bool > & GetWasLimiting() const
G4StepStatus GetStepStatus() const
G4StepPoint * GetPreStepPoint() const
G4VPhysicalVolume * GetVolume() const
G4int GetCurrentStepNumber() const
const G4Step * GetStep() const
G4double GetSampledInteractionLength() const
virtual G4double DistanceToApplyOperation(const G4Track *, G4double, G4ForceCondition *)=0
virtual const G4VBiasingInteractionLaw * ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface *, G4ForceCondition &)=0
const G4String GetName() const
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
G4LogicalVolume * GetLogicalVolume() const
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
virtual void ResetNumberOfInteractionLengthLeft()