Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4BiasingProcessInterface.cc
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 //
27 #include "G4VBiasingOperator.hh"
28 #include "G4VBiasingOperation.hh"
33 #include "G4ProcessManager.hh"
34 #include "G4BiasingAppliedCase.hh"
36 
37 G4Cache<G4bool> G4BiasingProcessInterface::fResetInteractionLaws;// = true;
38 G4Cache<G4bool> G4BiasingProcessInterface::fCommonStart;// = true;
39 G4Cache<G4bool> G4BiasingProcessInterface::fCommonEnd;// = true;
40 G4Cache<G4bool> G4BiasingProcessInterface::fDoCommonConfigure;
41 
43  : G4VProcess ( name ),
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 ),
58  fBiasingForceCondition ( NotForced ),
59  fWrappedProcessAlongStepGPIL ( -1.0 ),
60  fBiasingAlongStepGPIL ( -1.0 ),
61  fWrappedProcessGPILSelection ( NotCandidateForSelection ),
62  fBiasingGPILSelection ( NotCandidateForSelection ),
63  fBiasingInteractionLaw ( nullptr ),
64  fPreviousBiasingInteractionLaw ( nullptr ),
65  fPhysicalInteractionLaw ( nullptr ),
66  fOccurenceBiasingParticleChange ( nullptr ),
67  fDummyParticleChange ( nullptr ),
68  fIamFirstGPIL ( false ),
69  fProcessManager ( nullptr ),
70  fSharedData ( nullptr )
71 {
72  for (G4int i = 0 ; i < 8 ; i++) fFirstLastFlags[i] = false;
73  fResetInteractionLaws.Put( true );
74  fCommonStart.Put(true);
75  fCommonEnd.Put(true);
76  fDoCommonConfigure.Put(true);
77 }
78 
79 
81  G4bool wrappedIsAtRest, G4bool wrappedIsAlongStep, G4bool wrappedIsPostStep,
82  G4String useThisName)
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 ),
99  fBiasingForceCondition ( NotForced ),
100  fWrappedProcessAlongStepGPIL ( -1.0 ),
101  fBiasingAlongStepGPIL ( -1.0 ),
102  fWrappedProcessGPILSelection ( NotCandidateForSelection ),
103  fBiasingGPILSelection ( NotCandidateForSelection ),
104  fBiasingInteractionLaw ( nullptr ),
105  fPreviousBiasingInteractionLaw ( nullptr ),
106  fPhysicalInteractionLaw ( nullptr ),
107  fOccurenceBiasingParticleChange ( nullptr ),
108  fIamFirstGPIL ( false ),
109  fProcessManager ( nullptr ),
110  fSharedData ( nullptr )
111 {
112  for (G4int i = 0 ; i < 8 ; i++) fFirstLastFlags[i] = false;
113  fResetInteractionLaws.Put( true );
114  fCommonStart.Put(true);
115  fCommonEnd.Put(true);
116  fDoCommonConfigure.Put(true);
117 
118  SetProcessSubType(fWrappedProcess->GetProcessSubType());
119 
120  // -- create physical interaction law:
121  fPhysicalInteractionLaw = new G4InteractionLawPhysical("PhysicalInteractionLawFor("+GetProcessName()+")");
122  // -- instantiate particle change wrapper for occurence biaising:
123  fOccurenceBiasingParticleChange = new G4ParticleChangeForOccurenceBiasing("biasingPCfor"+GetProcessName());
124  // -- instantiate a "do nothing" particle change:
125  fDummyParticleChange = new G4ParticleChangeForNothing();
126 }
127 
128 
129 
131 {
132  if ( fPhysicalInteractionLaw != 0 ) delete fPhysicalInteractionLaw;
133  if ( fOccurenceBiasingParticleChange ) delete fOccurenceBiasingParticleChange;
134  if ( fDummyParticleChange ) delete fDummyParticleChange;
135 }
136 
137 
139 {
140  G4MapCache< const G4ProcessManager*,
141  G4BiasingProcessSharedData* >::const_iterator itr = G4BiasingProcessSharedData::fSharedDataMap.Find( mgr );
142  if ( itr != G4BiasingProcessSharedData::fSharedDataMap.End( ) )
143  {
144  return (*itr).second;
145  }
146  else return 0;
147 }
148 
149 
151 {
152  fCurrentTrack = track;
153  if ( fIsPhysicsBasedBiasing ) fWrappedProcess->StartTracking(fCurrentTrack);
154  fOccurenceBiasingOperation = 0;
155  fPreviousOccurenceBiasingOperation = 0;
156  fFinalStateBiasingOperation = 0;
157  fPreviousFinalStateBiasingOperation = 0;
158  fNonPhysicsBiasingOperation = 0;
159  fPreviousNonPhysicsBiasingOperation = 0;
160  fBiasingInteractionLaw = 0;
161  fPreviousBiasingInteractionLaw = 0;
162 
163  fPreviousStepSize = -1.0;
164 
165  fResetWrappedProcessInteractionLength = false;
166 
167  if ( fCommonStart.Get() )
168  {
169  fCommonStart.Put( false );// = false;
170  fCommonEnd.Put(true);// = true;
171 
172  fSharedData-> fCurrentBiasingOperator = 0;
173  fSharedData->fPreviousBiasingOperator = 0;
174 
175  // -- §§ Add a "fSharedData->nStarting" here and outside bracket "fSharedData->nStarting++" and " if (fSharedData->nStarting) == fSharedData->(vector interface length)"
176  // -- §§ call to the loop "StartTracking" of operators"
177 
178  for ( size_t optr = 0 ; optr < ( G4VBiasingOperator::GetBiasingOperators() ).size() ; optr ++)
179  ( G4VBiasingOperator::GetBiasingOperators() )[optr]->StartTracking( fCurrentTrack );
180  }
181 }
182 
183 
185 {
186  if ( fIsPhysicsBasedBiasing ) fWrappedProcess->EndTracking();
187  if ( fSharedData->fCurrentBiasingOperator) (fSharedData->fCurrentBiasingOperator)->ExitingBiasing( fCurrentTrack, this );
188  fBiasingInteractionLaw = 0;
189 
190  // -- Inform operators of end of tracking:
191  if ( fCommonEnd.Get() )
192  {
193  fCommonEnd.Put( false );// = false;
194  fCommonStart.Put( true );// = true;
195 
196  for ( size_t optr = 0 ; optr < ( G4VBiasingOperator::GetBiasingOperators() ).size() ; optr ++)
198 
199  // -- §§ for above loop, do as in StartTracking.
200  }
201 }
202 
203 
204 
206  G4double previousStepSize,
208 {
209 
210  // ---------------------------------------------------------------------------------------------------
211  // -- The "biasing process master" takes care of updating the biasing operator, and for all biasing
212  // -- processes it invokes the PostStepGPIL of physical wrapped processes (anticipate stepping manager
213  // -- call ! ) to make all cross-sections updated with current step, and hence available before the
214  // -- first call to the biasing operator.
215  // ---------------------------------------------------------------------------------------------------
216  if ( fIamFirstGPIL )
217  {
218  // -- Update previous biasing operator, and assume the operator stays the same by
219  // -- default and that it is not left at the beginning of this step. These
220  // -- assumptions might be wrong if there is a volume change (in paralllel or
221  // -- mass geometries) in what case the flags will be updated.
222  fSharedData->fPreviousBiasingOperator = fSharedData->fCurrentBiasingOperator;
223  fSharedData->fIsNewOperator = false;
224  fSharedData->fLeavingPreviousOperator = false;
225  // -- If new volume, either in mass or parallel geometries, get possible new biasing operator:
226  // -------------------------------------------------------------------------------------------
227  // -- Get biasing operator in parallel geometries:
228  G4bool firstStepInParallelVolume = false;
229  if ( fSharedData->fParallelGeometriesLimiterProcess )
230  {
231  G4VBiasingOperator* newParallelOperator( nullptr );
232  G4bool firstStep = ( track.GetCurrentStepNumber() == 1 );
233  size_t iParallel = 0;
234  for ( auto wasLimiting : fSharedData->fParallelGeometriesLimiterProcess->GetWasLimiting() )
235  {
236  if ( firstStep || wasLimiting )
237  {
238  firstStepInParallelVolume = true;
239 
240  auto tmpParallelOperator = G4VBiasingOperator::GetBiasingOperator( (fSharedData->fParallelGeometriesLimiterProcess->GetCurrentVolumes()[iParallel])
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",
253  JustWarning,
254  ed);
255  }
256  }
257  else newParallelOperator = tmpParallelOperator;
258  }
259  iParallel++;
260  }
261  fSharedData->fParallelGeometryOperator = newParallelOperator;
262  } // -- end of " if ( fSharedData->fParallelGeometriesLimiterProcess )"
263 
264  // -- Get biasing operator in mass geometry:
265  // -- [§§ Note : bug with this first step ? Does not work if previous step was concurrently limited with geometry. Might make use of safety at last point ?]
266  G4bool firstStepInVolume = ( (track.GetStep()->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) || (track.GetCurrentStepNumber() == 1) );
267  // fSharedData->fIsNewOperator = false;
268  // fSharedData->fLeavingPreviousOperator = false;
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",
282  JustWarning,
283  ed);
284  }
285  }
286 
287  // -- conclude the operator selection, giving priority to parallel geometry (as told in exception message BIAS.GEN.30):
288  if ( firstStepInVolume || firstStepInParallelVolume )
289  {
290  G4VBiasingOperator* newOperator = fSharedData->fParallelGeometryOperator;
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  // -- calls to wrapped process PostStepGPIL's:
304  // -------------------------------------------
305  // -- Each physics wrapper process has its
306  // -- fWrappedProcessPostStepGPIL ,
307  // -- fWrappedProcessForceCondition ,
308  // -- fWrappedProcessInteractionLength
309  // -- updated.
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  } // -- end of "if ( fIamFirstGPIL )"
316 
317 
318 
319  // -- Remember previous operator and proposed operations, if any, and reset:
320  // -------------------------------------------------------------------------
321  // -- remember only in case some biasing might be called
322  if ( ( fSharedData->fPreviousBiasingOperator != 0 ) ||
323  ( fSharedData->fCurrentBiasingOperator != 0 ) )
324  {
325  fPreviousOccurenceBiasingOperation = fOccurenceBiasingOperation;
326  fPreviousFinalStateBiasingOperation = fFinalStateBiasingOperation;
327  fPreviousNonPhysicsBiasingOperation = fNonPhysicsBiasingOperation;
328  fPreviousBiasingInteractionLaw = fBiasingInteractionLaw;
329  // -- reset:
330  fOccurenceBiasingOperation = 0;
331  fFinalStateBiasingOperation = 0;
332  fNonPhysicsBiasingOperation = 0;
333  fBiasingInteractionLaw = 0;
334  // -- Physics PostStep and AlongStep GPIL
335  // fWrappedProcessPostStepGPIL : updated by InvokeWrappedProcessPostStepGPIL(...) above
336  fBiasingPostStepGPIL = DBL_MAX;
337  // fWrappedProcessInteractionLength : updated by InvokeWrappedProcessPostStepGPIL(...) above; inverse of analog cross-section.
338  // fWrappedProcessForceCondition : updated by InvokeWrappedProcessPostStepGPIL(...) above
339  fBiasingForceCondition = NotForced;
340  fWrappedProcessAlongStepGPIL = DBL_MAX;
341  fBiasingAlongStepGPIL = DBL_MAX;
342  fWrappedProcessGPILSelection = NotCandidateForSelection;
343  fBiasingGPILSelection = NotCandidateForSelection;
344  // -- for helper:
345  fPreviousStepSize = previousStepSize;
346  }
347 
348 
349  // -- previous step size value; it is switched to zero if resetting a wrapped process:
350  // -- (same trick used than in InvokedWrappedProcessPostStepGPIL )
351  G4double usedPreviousStepSize = previousStepSize;
352 
353  // ----------------------------------------------
354  // -- If leaving a biasing operator, let it know:
355  // ----------------------------------------------
356  if ( fSharedData->fLeavingPreviousOperator )
357  {
358  (fSharedData->fPreviousBiasingOperator)->ExitingBiasing( &track, this );
359  // -- if no further biasing operator, reset process behavior to standard tracking:
360  if ( fSharedData->fCurrentBiasingOperator == 0 )
361  {
362  ResetForUnbiasedTracking();
363  if ( fIsPhysicsBasedBiasing )
364  {
365  // -- if the physics process has been under occurence biasing, reset it:
366  if ( fResetWrappedProcessInteractionLength )
367  {
368  fResetWrappedProcessInteractionLength = false;
369  fWrappedProcess->ResetNumberOfInteractionLengthLeft();
370  // -- We set "previous step size" as 0.0, to let the process believe this is first step:
371  usedPreviousStepSize = 0.0;
372  }
373  }
374  }
375  }
376 
377 
378  // --------------------------------------------------------------
379  // -- no operator : analog tracking if physics-based, or nothing:
380  // --------------------------------------------------------------
381  if ( fSharedData->fCurrentBiasingOperator == 0 )
382  {
383  // -- take note of the "usedPreviousStepSize" value:
384  if ( fIsPhysicsBasedBiasing ) return fWrappedProcess->PostStepGetPhysicalInteractionLength(track, usedPreviousStepSize, condition);
385  else
386  {
387  *condition = NotForced;
388  return DBL_MAX;
389  }
390  }
391 
392 
393 
394  // --------------------------------------------------
395  // -- A biasing operator exists. Proceed with
396  // -- treating non-physics and physics biasing cases:
397  //---------------------------------------------------
398 
399  // -- non-physics-based biasing case:
400  // ----------------------------------
401  if ( !fIsPhysicsBasedBiasing )
402  {
403  fNonPhysicsBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedNonPhysicsBiasingOperation( &track, this );
404  if ( fNonPhysicsBiasingOperation == 0 )
405  {
406  *condition = NotForced;
407  return DBL_MAX;
408  }
409  return fNonPhysicsBiasingOperation->DistanceToApplyOperation(&track, previousStepSize, condition);
410  }
411 
412 
413  // -- Physics based biasing case:
414  // ------------------------------
415  // -- Ask for possible GPIL biasing operation:
416  fOccurenceBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedOccurenceBiasingOperation( &track, this );
417 
418 
419  // -- no operation for occurence biasing, analog GPIL returns the wrapped process GPIL and condition values
420  if ( fOccurenceBiasingOperation == 0 )
421  {
422  *condition = fWrappedProcessForceCondition;
423  return fWrappedProcessPostStepGPIL;
424  }
425 
426  // -- A valid GPIL biasing operation has been proposed:
427  // -- 0) remember wrapped process will need to be reset on biasing exit, if particle survives:
428  fResetWrappedProcessInteractionLength = true;
429  // -- 1) update process interaction length for reference analog interaction law ( fWrappedProcessInteractionLength updated/collected above):
430  fPhysicalInteractionLaw->SetPhysicalCrossSection( 1.0 / fWrappedProcessInteractionLength );
431  // -- 2) Collect biasing interaction law:
432  // -- The interaction law pointer is collected as a const pointer to the interaction law object.
433  // -- This interaction law will be kept under control of the biasing operation, which is the only
434  // -- entity that will change the state of the biasing interaction law.
435  // -- The force condition for biasing is asked at the same time, passing the analog one as default:
436  fBiasingForceCondition = fWrappedProcessForceCondition;
437  fBiasingInteractionLaw = fOccurenceBiasingOperation->ProvideOccurenceBiasingInteractionLaw( this, fBiasingForceCondition );
438  // -- 3) Ask operation to sample the biasing interaction law:
439  fBiasingPostStepGPIL = fBiasingInteractionLaw->GetSampledInteractionLength();
440 
441  // -- finish
442  *condition = fBiasingForceCondition;
443  return fBiasingPostStepGPIL;
444 
445 }
446 
447 
448 
450  const G4Step& step)
451 {
452 
453  // ---------------------------------------
454  // -- case outside of volume with biasing:
455  // ---------------------------------------
456  if ( fSharedData->fCurrentBiasingOperator == 0 ) return fWrappedProcess->PostStepDoIt(track, step);
457 
458  // ----------------------------
459  // -- non-physics biasing case:
460  // ----------------------------
461  if ( !fIsPhysicsBasedBiasing )
462  {
463  G4VParticleChange* particleChange = fNonPhysicsBiasingOperation->GenerateBiasingFinalState( &track, &step );
464  (fSharedData->fCurrentBiasingOperator)->ReportOperationApplied( this, BAC_NonPhysics, fNonPhysicsBiasingOperation, particleChange );
465  return particleChange;
466  }
467 
468  // -- physics biasing case:
469  // ------------------------
470  // -- It proceeds with the following logic:
471  // -- 1) Obtain the final state
472  // -- This final state may be analog or biased.
473  // -- The biased final state is obtained through a biasing operator
474  // -- returned by the operator.
475  // -- 2) The biased final state may be asked to be "force as it is"
476  // -- in what case the particle change is returned as is to the
477  // -- stepping.
478  // -- In all other cases (analog final state or biased final but
479  // -- not forced) the final state weight may be modified by the
480  // -- occurence biasing, if such an occurence biasing is at play.
481 
482  // -- Get final state, biased or analog:
483  G4VParticleChange* finalStateParticleChange;
485  fFinalStateBiasingOperation = (fSharedData->fCurrentBiasingOperator)->GetProposedFinalStateBiasingOperation( &track, this );
486  // -- Flag below is to force the biased generated particle change to be retruned "as is" to the stepping, disregarding there
487  // -- was or not a occurence biasing that would apply. Weight relevance under full responsibility of the biasing operation.
488  G4bool forceBiasedFinalState = false;
489  if ( fFinalStateBiasingOperation != 0 )
490  {
491  finalStateParticleChange = fFinalStateBiasingOperation->ApplyFinalStateBiasing( this, &track, &step, forceBiasedFinalState );
492  BAC = BAC_FinalState;
493  }
494  else
495  {
496  finalStateParticleChange = fWrappedProcess->PostStepDoIt(track, step);
497  BAC = BAC_None ;
498  }
499 
500  // -- if no occurence biasing operation, we're done:
501  if ( fOccurenceBiasingOperation == 0 )
502  {
503  (fSharedData->fCurrentBiasingOperator)->ReportOperationApplied( this, BAC, fFinalStateBiasingOperation, finalStateParticleChange );
504  return finalStateParticleChange;
505  }
506 
507  // -- if biased final state has been asked to be forced, we're done:
508  if ( forceBiasedFinalState )
509  {
510  (fSharedData->fCurrentBiasingOperator)->ReportOperationApplied( this, BAC, fFinalStateBiasingOperation, finalStateParticleChange );
511  return finalStateParticleChange;
512  }
513 
514 
515  // -- If occurence biasing, applies the occurence biasing weight correction on top of final state (biased or not):
516  G4double weightForInteraction = 1.0;
517  if ( !fBiasingInteractionLaw->IsSingular() ) weightForInteraction =
518  fPhysicalInteractionLaw->ComputeEffectiveCrossSectionAt(step.GetStepLength()) /
519  fBiasingInteractionLaw ->ComputeEffectiveCrossSectionAt(step.GetStepLength());
520  else
521  {
522  // -- at this point effective XS can only be infinite, if not, there is a logic problem
523  if ( !fBiasingInteractionLaw->IsEffectiveCrossSectionInfinite() )
524  {
526  ed << "Internal inconsistency in cross-section handling. Please report !" << G4endl;
527  G4Exception(" G4BiasingProcessInterface::PostStepDoIt(...)",
528  "BIAS.GEN.02",
529  JustWarning,
530  ed);
531  // -- if XS is infinite, weight is zero (and will stay zero), but we'll do differently.
532  // -- Should foresee in addition something to remember that in case of singular
533  // -- distribution, weight can only be partly calculated
534  }
535  }
536 
537  if ( weightForInteraction <= 0. )
538  {
540  ed << " Negative interaction weight : w_I = "
541  << weightForInteraction <<
542  " XS_I(phys) = " << fBiasingInteractionLaw ->ComputeEffectiveCrossSectionAt(step.GetStepLength()) <<
543  " XS_I(bias) = " << fPhysicalInteractionLaw->ComputeEffectiveCrossSectionAt(step.GetStepLength()) <<
544  " step length = " << step.GetStepLength() <<
545  " Interaction law = `" << fBiasingInteractionLaw << "'" <<
546  G4endl;
547  G4Exception(" G4BiasingProcessInterface::PostStepDoIt(...)",
548  "BIAS.GEN.03",
549  JustWarning,
550  ed);
551 
552  }
553 
554  (fSharedData->fCurrentBiasingOperator)->ReportOperationApplied( this, BAC,
555  fOccurenceBiasingOperation, weightForInteraction,
556  fFinalStateBiasingOperation, finalStateParticleChange );
557 
558 
559  fOccurenceBiasingParticleChange->SetOccurenceWeightForInteraction( weightForInteraction );
560  fOccurenceBiasingParticleChange->SetSecondaryWeightByProcess( true );
561  fOccurenceBiasingParticleChange->SetWrappedParticleChange( finalStateParticleChange );
562  fOccurenceBiasingParticleChange->ProposeTrackStatus( finalStateParticleChange->GetTrackStatus() );
563  fOccurenceBiasingParticleChange->StealSecondaries(); // -- this also makes weightForInteraction applied to secondaries stolen
564 
565  // -- finish:
566  return fOccurenceBiasingParticleChange;
567 
568 }
569 
570 
571 // -- AlongStep methods:
573  G4double previousStepSize,
574  G4double currentMinimumStep,
575  G4double& proposedSafety,
576  G4GPILSelection* selection)
577 {
578 
579  // -- for helper methods:
580  fCurrentMinimumStep = currentMinimumStep;
581  fProposedSafety = proposedSafety;
582 
583 
584  // -- initialization default case:
585  fWrappedProcessAlongStepGPIL = DBL_MAX;
586  *selection = NotCandidateForSelection;
587  // ---------------------------------------
588  // -- case outside of volume with biasing:
589  // ---------------------------------------
590  if ( fSharedData->fCurrentBiasingOperator == 0 )
591  {
592  if ( fWrappedProcessIsAlong ) fWrappedProcessAlongStepGPIL =
593  fWrappedProcess->AlongStepGetPhysicalInteractionLength(track,
594  previousStepSize,
595  currentMinimumStep,
596  proposedSafety,
597  selection);
598  return fWrappedProcessAlongStepGPIL;
599  }
600 
601  // --------------------------------------------------------------------
602  // -- non-physics based biasing: no along operation expected (for now):
603  // --------------------------------------------------------------------
604  if ( !fIsPhysicsBasedBiasing ) return fWrappedProcessAlongStepGPIL;
605 
606  // ----------------------
607  // -- physics-based case:
608  // ----------------------
609  if ( fOccurenceBiasingOperation == 0 )
610  {
611  if ( fWrappedProcessIsAlong ) fWrappedProcessAlongStepGPIL =
612  fWrappedProcess->AlongStepGetPhysicalInteractionLength(track,
613  previousStepSize,
614  currentMinimumStep,
615  proposedSafety,
616  selection);
617  return fWrappedProcessAlongStepGPIL;
618  }
619 
620 
621  // ----------------------------------------------------------
622  // -- From here we have an valid occurence biasing operation:
623  // ----------------------------------------------------------
624  // -- Give operation opportunity to shorten step proposed by physics process:
625  fBiasingAlongStepGPIL = fOccurenceBiasingOperation->ProposeAlongStepLimit( this );
626  G4double minimumStep = fBiasingAlongStepGPIL < currentMinimumStep ? fBiasingAlongStepGPIL : currentMinimumStep ;
627  // -- wrapped process is called with minimum step ( <= currentMinimumStep passed ) : an along process can not
628  // -- have its operation stretched over what it expects:
629  if ( fWrappedProcessIsAlong )
630  {
631  fWrappedProcessAlongStepGPIL = fWrappedProcess->AlongStepGetPhysicalInteractionLength(track,
632  previousStepSize,
633  minimumStep,
634  proposedSafety,
635  selection);
636  fWrappedProcessGPILSelection = *selection;
637  fBiasingGPILSelection = fOccurenceBiasingOperation->ProposeGPILSelection( fWrappedProcessGPILSelection );
638  }
639  else
640  {
641  fBiasingGPILSelection = fOccurenceBiasingOperation->ProposeGPILSelection( NotCandidateForSelection );
642  fWrappedProcessAlongStepGPIL = fBiasingAlongStepGPIL;
643  }
644 
645  *selection = fBiasingGPILSelection;
646 
647  return fWrappedProcessAlongStepGPIL;
648 
649 }
650 
652  const G4Step& step)
653 {
654 
655  // ---------------------------------------
656  // -- case outside of volume with biasing:
657  // ---------------------------------------
658  if ( fSharedData->fCurrentBiasingOperator == 0 )
659  {
660  if ( fWrappedProcessIsAlong ) return fWrappedProcess->AlongStepDoIt(track, step);
661  else
662  {
663  fDummyParticleChange->Initialize( track );
664  return fDummyParticleChange;
665  }
666  }
667 
668  // -----------------------------------
669  // -- case inside volume with biasing:
670  // -----------------------------------
671  if ( fWrappedProcessIsAlong ) fOccurenceBiasingParticleChange->SetWrappedParticleChange( fWrappedProcess->AlongStepDoIt(track, step) );
672  else
673  {
674  fOccurenceBiasingParticleChange->SetWrappedParticleChange ( 0 );
675  fOccurenceBiasingParticleChange->ProposeTrackStatus( track.GetTrackStatus() );
676  }
677  G4double weightForNonInteraction (1.0);
678  if ( fBiasingInteractionLaw != 0 )
679  {
680  weightForNonInteraction =
681  fPhysicalInteractionLaw->ComputeNonInteractionProbabilityAt(step.GetStepLength()) /
682  fBiasingInteractionLaw ->ComputeNonInteractionProbabilityAt(step.GetStepLength());
683 
684  fOccurenceBiasingOperation->AlongMoveBy( this, &step, weightForNonInteraction );
685 
686  if ( weightForNonInteraction <= 0. )
687  {
689  ed << " Negative non interaction weight : w_NI = " << weightForNonInteraction <<
690  " p_NI(phys) = " << fPhysicalInteractionLaw->ComputeNonInteractionProbabilityAt(step.GetStepLength()) <<
691  " p_NI(bias) = " << fBiasingInteractionLaw ->ComputeNonInteractionProbabilityAt(step.GetStepLength()) <<
692  " step length = " << step.GetStepLength() <<
693  " biasing interaction law = `" << fBiasingInteractionLaw->GetName() << "'" << G4endl;
694  G4Exception(" G4BiasingProcessInterface::AlongStepDoIt(...)",
695  "BIAS.GEN.04",
696  JustWarning,
697  ed);
698  }
699 
700  }
701 
702  fOccurenceBiasingParticleChange->SetOccurenceWeightForNonInteraction( weightForNonInteraction );
703 
704  return fOccurenceBiasingParticleChange;
705 
706 }
707 
708 // -- AtRest methods
711 {
712  return fWrappedProcess->AtRestGetPhysicalInteractionLength(track, condition);
713 }
715  const G4Step& step)
716 {
717  return fWrappedProcess->AtRestDoIt(track, step);
718 }
719 
720 
722 {
723  if ( fWrappedProcess != 0 ) return fWrappedProcess->IsApplicable(pd);
724  else return true;
725 }
726 
727 
729 {
730  // -- Master for this process:
732  // -- Master for wrapped process:
733  if ( fWrappedProcess != 0 )
734  {
735  const G4BiasingProcessInterface* thisWrapperMaster = (const G4BiasingProcessInterface *)GetMasterProcess();
736  // -- paranoia check: (?)
737  G4VProcess* wrappedMaster = 0;
738  wrappedMaster = thisWrapperMaster->GetWrappedProcess();
739  fWrappedProcess->SetMasterProcess( wrappedMaster );
740  }
741 }
742 
743 
745 {
746  // -- Sequential mode : called second (after PreparePhysicsTable(..))
747  // -- MT mode : called second (after PreparePhysicsTable(..)) by master thread.
748  // -- Corresponding process instance not used then by tracking.
749  // -- PreparePhysicsTable(...) has been called first for all processes,
750  // -- so the first/last flags and G4BiasingProcessInterface vector of processes have
751  // -- been properly setup, fIamFirstGPIL is valid.
752  if ( fWrappedProcess != 0 )
753  {
754  fWrappedProcess->BuildPhysicsTable(pd);
755  }
756 
757  if ( fIamFirstGPIL )
758  {
759  // -- Re-order vector of processes to match that of the GPIL
760  // -- (made for fIamFirstGPIL, but important is to have it made once):
761  ReorderBiasingVectorAsGPIL();
762  // -- Let operators to configure themselves for the master thread or for sequential mode.
763  // -- Intended here is in particular the registration to physics model catalog.
764  // -- The fDoCommonConfigure is to ensure that this Configure is made by only one process (othewise each first process makes the call):
765  if ( fDoCommonConfigure.Get() )
766  {
767  for ( size_t optr = 0 ; optr < ( G4VBiasingOperator::GetBiasingOperators() ).size() ; optr ++)
768  ( G4VBiasingOperator::GetBiasingOperators() )[optr]->Configure( );
769  fDoCommonConfigure.Put(false);
770  }
771 
772  }
773 }
774 
775 
777 {
778  // -- Sequential mode : called first (before BuildPhysicsTable(..))
779  // -- MT mode : called first (before BuildPhysicsTable(..)) by master thread.
780  // -- Corresponding process instance not used then by tracking.
781  // -- Let process finding its first/last position in the process manager:
782  SetUpFirstLastFlags();
783  if ( fWrappedProcess != 0 )
784  {
785  fWrappedProcess->PreparePhysicsTable(pd);
786  }
787 }
788 
789 
791 {
792  if ( fWrappedProcess != 0 ) return fWrappedProcess->StorePhysicsTable(pd, s, f);
793  else return false;
794 }
795 
796 
798 {
799  if ( fWrappedProcess != 0 ) return fWrappedProcess->RetrievePhysicsTable(pd, s, f);
800  else return false;
801 }
802 
803 
805 {
806  if ( fWrappedProcess != 0 ) fWrappedProcess->SetProcessManager(mgr);
808 
809  // -- initialize fSharedData pointer:
810  if ( G4BiasingProcessSharedData::fSharedDataMap.Find(mgr) == G4BiasingProcessSharedData::fSharedDataMap.End() )
811  {
812  fSharedData = new G4BiasingProcessSharedData( mgr );
813  G4BiasingProcessSharedData::fSharedDataMap[mgr] = fSharedData;
814  }
815  else fSharedData = G4BiasingProcessSharedData::fSharedDataMap[mgr] ;
816  // -- augment list of co-operating processes:
817  fSharedData-> fBiasingProcessInterfaces.push_back( this );
818  fSharedData-> fPublicBiasingProcessInterfaces.push_back( this );
819  if ( fIsPhysicsBasedBiasing )
820  {
821  fSharedData-> fPhysicsBiasingProcessInterfaces.push_back( this );
822  fSharedData-> fPublicPhysicsBiasingProcessInterfaces.push_back( this );
823  }
824  else
825  {
826  fSharedData-> fNonPhysicsBiasingProcessInterfaces.push_back( this );
827  fSharedData-> fPublicNonPhysicsBiasingProcessInterfaces.push_back( this );
828  }
829  // -- remember process manager:
830  fProcessManager = mgr;
831 }
832 
833 
835 {
836  if ( fWrappedProcess != 0 ) return fWrappedProcess->GetProcessManager();
837  else return G4VProcess::GetProcessManager();
838 }
839 
840 
842 {
843  // -- Sequential mode : not called
844  // -- MT mode : called after PrepareWorkerPhysicsTable(..)
845  // -- PrepareWorkerPhysicsTable(...) has been called first for all processes,
846  // -- so the first/last flags and G4BiasingProcessInterface vector of processes have
847  // -- been properly setup, fIamFirstGPIL is valid.
848  if ( fWrappedProcess != 0 )
849  {
850  fWrappedProcess->BuildWorkerPhysicsTable(pd);
851  }
852 
853  if ( fIamFirstGPIL )
854  {
855  // -- Re-order vector of processes to match that of the GPIL
856  // -- (made for fIamFirstGPIL, but important is to have it made once):
857  ReorderBiasingVectorAsGPIL();
858  // -- Let operators to configure themselves for the worker thread, if needed.
859  // -- Registration to physics model catalog **IS NOT** to be made here, but in Configure().
860  // -- The fDoCommonConfigure is to ensure that this Configure is made by only one process (othewise each first process makes the call):
861  if ( fDoCommonConfigure.Get() )
862  {
863  for ( size_t optr = 0 ; optr < ( G4VBiasingOperator::GetBiasingOperators() ).size() ; optr ++)
864  ( G4VBiasingOperator::GetBiasingOperators() )[optr]->ConfigureForWorker( );
865  fDoCommonConfigure.Put(false);
866  }
867  }
868 }
869 
870 
872 {
873  // -- Sequential mode : not called
874  // -- MT mode : called first, before BuildWorkerPhysicsTable(..)
875  // -- Let process finding its first/last position in the process manager:
876  SetUpFirstLastFlags();
877 
878  if ( fWrappedProcess != 0 )
879  {
880  fWrappedProcess->PrepareWorkerPhysicsTable(pd);
881  }
882 }
883 
884 
886 {
887  if ( fWrappedProcess != 0 ) fWrappedProcess->ResetNumberOfInteractionLengthLeft();
888 }
889 
890 
892 {
893  G4int iPhys = ( physOnly ) ? 1 : 0;
894  return fFirstLastFlags[IdxFirstLast( 1, 1, iPhys)];
895 }
896 
897 
899 {
900  G4int iPhys = ( physOnly ) ? 1 : 0;
901  return fFirstLastFlags[IdxFirstLast( 0, 1, iPhys)];
902 }
903 
904 
906 {
907  G4int iPhys = ( physOnly ) ? 1 : 0;
908  return fFirstLastFlags[IdxFirstLast( 1, 0, iPhys)];
909 }
910 
911 
913 {
914  G4int iPhys = ( physOnly ) ? 1 : 0;
915  return fFirstLastFlags[IdxFirstLast( 0, 0, iPhys)];
916 }
917 
918 
920 {
921  G4bool isFirst = true;
922  const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
923  G4int thisIdx(-1);
924  for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
925  for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
926  {
927  if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
928  {
929  G4int thatIdx(-1);
930  for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
931  if ( thisIdx > thatIdx )
932  {
933  isFirst = false;
934  break;
935  }
936  }
937  }
938  return isFirst;
939 }
940 
941 
943 {
944  G4bool isLast = true;
945  const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
946  G4int thisIdx(-1);
947  for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
948  for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
949  {
950  if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
951  {
952  G4int thatIdx(-1);
953  for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
954  if ( thisIdx < thatIdx )
955  {
956  isLast = false;
957  break;
958  }
959  }
960  }
961  return isLast;
962 }
963 
964 
966 {
967  G4bool isFirst = true;
968  const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeDoIt);
969  G4int thisIdx(-1);
970  for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
971  for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
972  {
973  if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
974  {
975  G4int thatIdx(-1);
976  for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
977  if ( thisIdx > thatIdx )
978  {
979  isFirst = false;
980  break;
981  }
982  }
983  }
984  return isFirst;
985 }
986 
987 
989 {
990  G4bool isLast = true;
991  const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeDoIt);
992  G4int thisIdx(-1);
993  for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
994  for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
995  {
996  if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
997  {
998  G4int thatIdx(-1);
999  for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
1000  if ( thisIdx < thatIdx )
1001  {
1002  isLast = false;
1003  break;
1004  }
1005  }
1006  }
1007  return isLast;
1008 }
1009 
1010 
1011 void G4BiasingProcessInterface::SetUpFirstLastFlags()
1012 {
1013  for ( G4int iPhys = 0; iPhys < 2; iPhys++ )
1014  {
1015  G4bool physOnly = ( iPhys == 1 );
1016  fFirstLastFlags[IdxFirstLast( 1, 1, iPhys)] = IsFirstPostStepGPILInterface(physOnly);
1017  fFirstLastFlags[IdxFirstLast( 0, 1, iPhys)] = IsLastPostStepGPILInterface(physOnly);
1018  fFirstLastFlags[IdxFirstLast( 1, 0, iPhys)] = IsFirstPostStepDoItInterface(physOnly);
1019  fFirstLastFlags[IdxFirstLast( 0, 0, iPhys)] = IsLastPostStepDoItInterface(physOnly);
1020  }
1021 
1022  // -- for itself, for optimization:
1023  fIamFirstGPIL = GetIsFirstPostStepGPILInterface( false );
1024 }
1025 
1026 
1027 void G4BiasingProcessInterface::ResetForUnbiasedTracking()
1028 {
1029  fOccurenceBiasingOperation = 0;
1030  fFinalStateBiasingOperation = 0;
1031  fNonPhysicsBiasingOperation = 0;
1032  fBiasingInteractionLaw = 0;
1033 }
1034 
1035 
1036 void G4BiasingProcessInterface::InvokeWrappedProcessPostStepGPIL( const G4Track& track,
1037  G4double previousStepSize,
1039 {
1040  G4double usedPreviousStepSize = previousStepSize;
1041  // -- if the physics process has been under occurence biasing in the previous step
1042  // -- we reset it, as we don't know if it will be biased again or not in this
1043  // -- step. The pity is that PostStepGPIL and interaction length (cross-section)
1044  // -- calculations are done both in the PostStepGPIL of the process, while here we
1045  // -- are just interested in the calculation of the cross-section. This is a pity
1046  // -- as this forces to re-generated a random number for nothing.
1047  if ( fResetWrappedProcessInteractionLength )
1048  {
1049  fResetWrappedProcessInteractionLength = false;
1050  fWrappedProcess->ResetNumberOfInteractionLengthLeft();
1051  // -- We set "previous step size" as 0.0, to let the process believe this is first step:
1052  usedPreviousStepSize = 0.0;
1053  }
1054  // -- GPIL response:
1055  fWrappedProcessPostStepGPIL = fWrappedProcess->PostStepGetPhysicalInteractionLength(track, usedPreviousStepSize, condition);
1056  fWrappedProcessForceCondition = *condition;
1057  // -- and (inverse) cross-section:
1058  fWrappedProcessInteractionLength = fWrappedProcess->GetCurrentInteractionLength();
1059 }
1060 
1061 
1062 void G4BiasingProcessInterface::ReorderBiasingVectorAsGPIL()
1063 {
1064  // -- re-order vector of processes to match that of the GPIL:
1065  std::vector < G4BiasingProcessInterface* > tmpProcess ( fSharedData->fBiasingProcessInterfaces );
1066  ( fSharedData -> fBiasingProcessInterfaces ) . clear();
1067  ( fSharedData -> fPhysicsBiasingProcessInterfaces ) . clear();
1068  ( fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . clear();
1069  ( fSharedData -> fPublicBiasingProcessInterfaces ) . clear();
1070  ( fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . clear();
1071  ( fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . clear();
1072 
1073  const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
1074  for (G4int i = 0; i < pv->size(); i++ )
1075  {
1076  for ( size_t j = 0; j < tmpProcess.size(); j++ )
1077  {
1078  if ( (*pv)(i) == tmpProcess[j] )
1079  {
1080  ( fSharedData -> fBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1081  ( fSharedData -> fPublicBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1082  if ( tmpProcess[j] -> fIsPhysicsBasedBiasing )
1083  {
1084  ( fSharedData -> fPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1085  ( fSharedData -> fPublicPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1086  }
1087  else
1088  {
1089  ( fSharedData -> fNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1090  ( fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . push_back( tmpProcess[j] );
1091  }
1092  break;
1093  }
1094  }
1095  }
1096 }
virtual void SetMasterProcess(G4VProcess *masterP)
Definition: G4VProcess.cc:212
virtual void Initialize(const G4Track &track)
G4double condition(const G4ErrorSymMatrix &m)
const G4VProcess * GetMasterProcess() const
Definition: G4VProcess.hh:538
const XML_Char * name
Definition: expat.h:151
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &pd)
G4bool IsLastPostStepGPILInterface(G4bool physOnly=true) const
virtual void PreparePhysicsTable(const G4ParticleDefinition &pd)
virtual G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &)
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition)=0
virtual void SetProcessManager(const G4ProcessManager *)
Definition: G4VProcess.hh:508
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetStepLength() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &pd)
virtual G4VParticleChange * ApplyFinalStateBiasing(const G4BiasingProcessInterface *, const G4Track *, const G4Step *, G4bool &)=0
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &pd)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step)
G4StepStatus GetStepStatus() const
const std::vector< const G4VPhysicalVolume * > & GetCurrentVolumes() const
value_type & Get() const
Definition: G4Cache.hh:282
G4TrackStatus GetTrackStatus() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
virtual void SetProcessManager(const G4ProcessManager *)
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const =0
virtual void ResetNumberOfInteractionLengthLeft()
Definition: G4VProcess.cc:95
const G4Step * GetStep() const
int G4int
Definition: G4Types.hh:78
G4BiasingAppliedCase
virtual G4double ProposeAlongStepLimit(const G4BiasingProcessInterface *)
G4VProcess * GetWrappedProcess() const
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition &part)
Definition: G4VProcess.cc:202
G4bool GetIsFirstPostStepGPILInterface(G4bool physOnly=true) const
G4StepPoint * GetPreStepPoint() const
virtual void StartTracking(G4Track *)
Definition: G4VProcess.cc:101
const XML_Char * s
Definition: expat.h:262
void SetSecondaryWeightByProcess(G4bool)
G4int GetCurrentStepNumber() const
G4bool GetIsLastPostStepDoItInterface(G4bool physOnly=true) const
G4bool GetIsLastPostStepGPILInterface(G4bool physOnly=true) const
virtual void PreparePhysicsTable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:217
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const
bool G4bool
Definition: G4Types.hh:79
G4bool GetIsFirstPostStepDoItInterface(G4bool physOnly=true) const
G4double GetCurrentInteractionLength() const
Definition: G4VProcess.hh:462
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
void SetPhysicalCrossSection(G4double crossSection)
Definition: G4Step.hh:76
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
Definition: G4VProcess.hh:236
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
const std::vector< G4bool > & GetWasLimiting() const
virtual G4VParticleChange * GenerateBiasingFinalState(const G4Track *, const G4Step *)=0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4bool IsApplicable(const G4ParticleDefinition &pd)
virtual const G4ProcessManager * GetProcessManager()
static G4VBiasingOperator * GetBiasingOperator(const G4LogicalVolume *)
virtual G4bool IsSingular() const
G4int size() const
virtual const G4ProcessManager * GetProcessManager()
Definition: G4VProcess.hh:514
iterator Find(const key_type &k)
Definition: G4Cache.hh:417
G4LogicalVolume * GetLogicalVolume() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:210
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4bool IsFirstPostStepGPILInterface(G4bool physOnly=true) const
virtual void SetMasterProcess(G4VProcess *masterP)
G4BiasingProcessInterface(G4String name="biasWrapper(0)")
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *pd, const G4String &s, G4bool f)
virtual G4GPILSelection ProposeGPILSelection(const G4GPILSelection wrappedProcessSelection)
G4VPhysicalVolume * GetVolume() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
G4double GetSampledInteractionLength() const
#define G4endl
Definition: G4ios.hh:61
static const std::vector< G4VBiasingOperator * > & GetBiasingOperators()
const G4String & GetName() const
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &, G4bool)
Definition: G4VProcess.hh:231
virtual G4bool IsEffectiveCrossSectionInfinite() const
G4TrackStatus GetTrackStatus() const
G4bool IsFirstPostStepDoItInterface(G4bool physOnly=true) const
virtual const G4VBiasingInteractionLaw * ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface *, G4ForceCondition &)=0
virtual void AlongMoveBy(const G4BiasingProcessInterface *, const G4Step *, G4double)
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition &)
Definition: G4VProcess.cc:207
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
virtual void EndTracking()
Definition: G4VProcess.cc:113
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4ForceCondition
G4bool IsLastPostStepDoItInterface(G4bool physOnly=true) const
#define DBL_MAX
Definition: templates.hh:83
void Put(const value_type &val) const
Definition: G4Cache.hh:286
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
virtual G4double DistanceToApplyOperation(const G4Track *, G4double, G4ForceCondition *)=0
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:205
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
G4GPILSelection
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
const G4String GetName() const
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
const G4BiasingProcessSharedData * GetSharedData() const