44 fCurrentTrack ( nullptr ),
45 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
46 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
47 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
48 fResetWrappedProcessInteractionLength(
true ),
49 fWrappedProcess ( nullptr ),
50 fIsPhysicsBasedBiasing (
false ),
51 fWrappedProcessIsAtRest (
false ),
52 fWrappedProcessIsAlong (
false ),
53 fWrappedProcessIsPost (
false ),
54 fWrappedProcessPostStepGPIL ( -1.0 ),
55 fBiasingPostStepGPIL ( -1.0 ),
56 fWrappedProcessInteractionLength ( -1.0 ),
57 fWrappedProcessForceCondition (
NotForced ),
59 fWrappedProcessAlongStepGPIL ( -1.0 ),
60 fBiasingAlongStepGPIL ( -1.0 ),
63 fBiasingInteractionLaw ( nullptr ),
64 fPreviousBiasingInteractionLaw ( nullptr ),
65 fPhysicalInteractionLaw ( nullptr ),
66 fOccurenceBiasingParticleChange ( nullptr ),
67 fDummyParticleChange ( nullptr ),
68 fIamFirstGPIL (
false ),
69 fProcessManager ( nullptr ),
70 fSharedData ( nullptr )
83 :
G4VProcess( useThisName !=
"" ? useThisName :
"biasWrapper("+wrappedProcess->GetProcessName()+
")",
84 wrappedProcess->GetProcessType()),
85 fCurrentTrack ( nullptr ),
86 fPreviousStepSize (-1.0), fCurrentMinimumStep( -1.0 ), fProposedSafety ( -1.0),
87 fOccurenceBiasingOperation( nullptr ), fFinalStateBiasingOperation( nullptr ), fNonPhysicsBiasingOperation( nullptr ),
88 fPreviousOccurenceBiasingOperation( nullptr ), fPreviousFinalStateBiasingOperation( nullptr ), fPreviousNonPhysicsBiasingOperation( nullptr ),
89 fResetWrappedProcessInteractionLength (
false ),
90 fWrappedProcess ( wrappedProcess ),
91 fIsPhysicsBasedBiasing (
true ),
92 fWrappedProcessIsAtRest ( wrappedIsAtRest ),
93 fWrappedProcessIsAlong ( wrappedIsAlongStep ),
94 fWrappedProcessIsPost ( wrappedIsPostStep ),
95 fWrappedProcessPostStepGPIL ( -1.0 ),
96 fBiasingPostStepGPIL ( -1.0 ),
97 fWrappedProcessInteractionLength ( -1.0 ),
98 fWrappedProcessForceCondition (
NotForced ),
100 fWrappedProcessAlongStepGPIL ( -1.0 ),
101 fBiasingAlongStepGPIL ( -1.0 ),
104 fBiasingInteractionLaw ( nullptr ),
105 fPreviousBiasingInteractionLaw ( nullptr ),
106 fPhysicalInteractionLaw ( nullptr ),
107 fOccurenceBiasingParticleChange ( nullptr ),
108 fIamFirstGPIL (
false ),
109 fProcessManager ( nullptr ),
110 fSharedData ( nullptr )
144 return (*itr).second;
228 G4bool firstStepInParallelVolume =
false;
233 size_t iParallel = 0;
236 if ( firstStep || wasLimiting )
238 firstStepInParallelVolume =
true;
241 ->GetLogicalVolume() );
242 if ( newParallelOperator )
244 if ( tmpParallelOperator )
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(...)",
257 else newParallelOperator = tmpParallelOperator;
269 if ( firstStepInVolume )
276 ed <<
" Biasing operators are defined at the same place in mass and parallel geometries ! Found:\n";
278 ed <<
" - `" << newOperator->
GetName() <<
"' in mass geometry.\n";
280 G4Exception(
" G4BiasingProcessInterface::PostStepGetPhysicalInteractionLength(...)",
288 if ( firstStepInVolume || firstStepInParallelVolume )
351 G4double usedPreviousStepSize = previousStepSize;
371 usedPreviousStepSize = 0.0;
462 return particleChange;
485 G4bool forceBiasedFinalState =
false;
501 return finalStateParticleChange;
505 if ( forceBiasedFinalState )
508 return finalStateParticleChange;
513 G4double weightForInteraction = 1.0;
523 ed <<
"Internal inconsistency in cross-section handling. Please report !" <<
G4endl;
524 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
534 if ( weightForInteraction <= 0. )
537 ed <<
" Negative interaction weight : w_I = "
538 << weightForInteraction <<
544 G4Exception(
" G4BiasingProcessInterface::PostStepDoIt(...)",
674 G4double weightForNonInteraction (1.0);
677 weightForNonInteraction =
683 if ( weightForNonInteraction <= 0. )
686 ed <<
" Negative non interaction weight : w_NI = " << weightForNonInteraction <<
691 G4Exception(
" G4BiasingProcessInterface::AlongStepDoIt(...)",
814 fSharedData-> fBiasingProcessInterfaces.push_back(
this );
815 fSharedData-> fPublicBiasingProcessInterfaces.push_back(
this );
818 fSharedData-> fPhysicsBiasingProcessInterfaces.push_back(
this );
819 fSharedData-> fPublicPhysicsBiasingProcessInterfaces.push_back(
this );
823 fSharedData-> fNonPhysicsBiasingProcessInterfaces.push_back(
this );
824 fSharedData-> fPublicNonPhysicsBiasingProcessInterfaces.push_back(
this );
890 G4int iPhys = ( physOnly ) ? 1 : 0;
897 G4int iPhys = ( physOnly ) ? 1 : 0;
904 G4int iPhys = ( physOnly ) ? 1 : 0;
911 G4int iPhys = ( physOnly ) ? 1 : 0;
921 for (std::size_t i = 0; i < pv->
size(); ++i )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
922 if ( thisIdx < 0 )
return false;
931 if ( thisIdx > thatIdx )
948 for (std::size_t i = 0; i < pv->
size(); ++i )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
949 if ( thisIdx < 0 )
return false;
958 if ( thisIdx < thatIdx )
975 for (std::size_t i = 0; i < pv->
size(); ++i )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
976 if ( thisIdx < 0 )
return false;
985 if ( thisIdx > thatIdx )
1002 for (std::size_t i = 0; i < pv->
size(); ++i )
if ( (*pv)(i) ==
this ) { thisIdx = i;
break; }
1003 if ( thisIdx < 0 )
return false;
1012 if ( thisIdx < thatIdx )
1026 for (
G4int iPhys = 0; iPhys < 2; iPhys++ )
1028 G4bool physOnly = ( iPhys == 1 );
1053 G4double usedPreviousStepSize = previousStepSize;
1065 usedPreviousStepSize = 0.0;
1087 for (std::size_t i = 0; i < pv->
size(); ++i )
1089 for ( std::size_t j = 0; j < tmpProcess.size(); ++j )
1091 if ( (*pv)(i) == tmpProcess[j] )
1093 (
fSharedData -> fBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1094 (
fSharedData -> fPublicBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1097 (
fSharedData -> fPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1098 (
fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1102 (
fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1103 (
fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );