Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4WeightCutOffProcess Class Reference

#include <G4WeightCutOffProcess.hh>

+ Inheritance diagram for G4WeightCutOffProcess:

Public Member Functions

 G4WeightCutOffProcess (G4double wsurvival, G4double wlimit, G4double isource, G4VIStore *istore, const G4String &aName="WeightCutOffProcess", G4bool para=false)
 
virtual ~G4WeightCutOffProcess ()
 
void SetParallelWorld (G4String parallelWorldName)
 
void SetParallelWorld (G4VPhysicalVolume *parallelWorld)
 
void StartTracking (G4Track *)
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4VParticleChangePostStepDoIt (const G4Track &, const G4Step &)
 
const G4StringGetName () const
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4int operator== (const G4VProcess &right) const
 
G4int operator!= (const G4VProcess &right) const
 
virtual G4VParticleChangePostStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &track, G4ForceCondition *condition)=0
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void PreparePhysicsTable (const G4ParticleDefinition &)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual void StartTracking (G4Track *)
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double previousStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager
 
G4VParticleChangepParticleChange
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft
 
G4double currentInteractionLength
 
G4double theInitialNumberOfInteractionLength
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType
 
G4int theProcessSubType
 
G4double thePILfactor
 
G4bool enableAtRestDoIt
 
G4bool enableAlongStepDoIt
 
G4bool enablePostStepDoIt
 
G4int verboseLevel
 

Detailed Description

Definition at line 59 of file G4WeightCutOffProcess.hh.

Constructor & Destructor Documentation

◆ G4WeightCutOffProcess()

G4WeightCutOffProcess::G4WeightCutOffProcess ( G4double  wsurvival,
G4double  wlimit,
G4double  isource,
G4VIStore istore,
const G4String aName = "WeightCutOffProcess",
G4bool  para = false 
)

Definition at line 54 of file G4WeightCutOffProcess.cc.

61 : G4VProcess(aName),
62 fParticleChange(new G4ParticleChange),
63 fWeightSurvival(wsurvival),
64 fWeightLimit(wlimit),
65 fSourceImportance(isource),
66 fIStore(istore),
67 // fGCellFinder(aGCellFinder),
68 fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0')
69{
70 if (!fParticleChange)
71 {
72 G4Exception("G4WeightCutOffProcess::G4WeightCutOffProcess()",
73 "FatalError", FatalException,
74 "Failed to allocate G4ParticleChange !");
75 }
76
77 G4VProcess::pParticleChange = fParticleChange;
78
79 fGhostStep = new G4Step();
80 fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
81 fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
82
84 fPathFinder = G4PathFinder::GetInstance();
85
86 if (verboseLevel>0)
87 {
88 G4cout << GetProcessName() << " is created " << G4endl;
89 }
90
91 paraflag = para;
92
93}
@ FatalException
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4PathFinder * GetInstance()
Definition: G4PathFinder.cc:57
Definition: G4Step.hh:78
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
static G4TransportationManager * GetTransportationManager()
G4int verboseLevel
Definition: G4VProcess.hh:368
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
const G4String & GetProcessName() const
Definition: G4VProcess.hh:379
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ ~G4WeightCutOffProcess()

G4WeightCutOffProcess::~G4WeightCutOffProcess ( )
virtual

Definition at line 95 of file G4WeightCutOffProcess.cc.

96{
97 delete fParticleChange;
98 delete fGhostStep;
99}

Member Function Documentation

◆ AlongStepDoIt()

G4VParticleChange * G4WeightCutOffProcess::AlongStepDoIt ( const G4Track track,
const G4Step  
)
virtual

Implements G4VProcess.

Definition at line 387 of file G4WeightCutOffProcess.cc.

388{
389 // Dummy ParticleChange ie: does nothing
390 // Expecting G4Transportation to move the track
392 return pParticleChange;
393
394 // return 0;
395}
virtual void Initialize(const G4Track &)

◆ AlongStepGetPhysicalInteractionLength()

G4double G4WeightCutOffProcess::AlongStepGetPhysicalInteractionLength ( const G4Track track,
G4double  previousStepSize,
G4double  currentMinimumStep,
G4double proposedSafety,
G4GPILSelection selection 
)
virtual

Implements G4VProcess.

Definition at line 297 of file G4WeightCutOffProcess.cc.

301{
302 if(paraflag) {
303 static G4FieldTrack endTrack('0');
304 static ELimited eLimited;
305
306 *selection = NotCandidateForSelection;
307 G4double returnedStep = DBL_MAX;
308
309 if (previousStepSize > 0.)
310 { fGhostSafety -= previousStepSize; }
311 // else
312 // { fGhostSafety = -1.; }
313 if (fGhostSafety < 0.) fGhostSafety = 0.0;
314
315 // ------------------------------------------
316 // Determination of the proposed STEP LENGTH:
317 // ------------------------------------------
318 if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
319 {
320 // I have no chance to limit
321 returnedStep = currentMinimumStep;
322 fOnBoundary = false;
323 proposedSafety = fGhostSafety - currentMinimumStep;
324 }
325 else // (currentMinimumStep > fGhostSafety: I may limit the Step)
326 {
327 G4FieldTrackUpdator::Update(&fFieldTrack,&track);
328 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
329 // ComputeStep
330 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
331 returnedStep
332 = fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
333 track.GetCurrentStepNumber(),fGhostSafety,eLimited,
334 endTrack,track.GetVolume());
335 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
336 if(eLimited == kDoNot)
337 {
338 // Track is not on the boundary
339 fOnBoundary = false;
340 fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
341 }
342 else
343 {
344 // Track is on the boundary
345 fOnBoundary = true;
346 proposedSafety = fGhostSafety;
347 }
348 //xbug? proposedSafety = fGhostSafety;
349 if(eLimited == kUnique || eLimited == kSharedOther) {
350 *selection = CandidateForSelection;
351 }else if (eLimited == kSharedTransport) {
352 returnedStep *= (1.0 + 1.0e-9);
353 // Expand to disable its selection in Step Manager comparison
354 }
355
356 }
357
358 // ----------------------------------------------
359 // Returns the fGhostSafety as the proposedSafety
360 // The SteppingManager will take care of keeping
361 // the smallest one.
362 // ----------------------------------------------
363 return returnedStep;
364
365 } else {
366 return DBL_MAX;
367 //not sensible! return -1.0;
368 }
369
370}
@ CandidateForSelection
@ NotCandidateForSelection
ELimited
@ kDoNot
@ kUnique
@ kSharedOther
@ kSharedTransport
double G4double
Definition: G4Types.hh:64
static void Update(G4FieldTrack *, const G4Track *)
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
G4VPhysicalVolume * GetVolume() const
G4int GetCurrentStepNumber() const
#define DBL_MAX
Definition: templates.hh:83

◆ AtRestDoIt()

G4VParticleChange * G4WeightCutOffProcess::AtRestDoIt ( const G4Track ,
const G4Step  
)
virtual

Implements G4VProcess.

Definition at line 381 of file G4WeightCutOffProcess.cc.

382{
383 return 0;
384}

◆ AtRestGetPhysicalInteractionLength()

G4double G4WeightCutOffProcess::AtRestGetPhysicalInteractionLength ( const G4Track ,
G4ForceCondition  
)
virtual

Implements G4VProcess.

Definition at line 373 of file G4WeightCutOffProcess.cc.

376{
377 return -1.0;
378}

◆ GetName()

const G4String & G4WeightCutOffProcess::GetName ( ) const

Definition at line 292 of file G4WeightCutOffProcess.cc.

293{
294 return theProcessName;
295}
G4String theProcessName
Definition: G4VProcess.hh:335

◆ PostStepDoIt()

G4VParticleChange * G4WeightCutOffProcess::PostStepDoIt ( const G4Track aTrack,
const G4Step aStep 
)
virtual

Implements G4VProcess.

Definition at line 189 of file G4WeightCutOffProcess.cc.

191{
192 fParticleChange->Initialize(aTrack);
193
194 if(paraflag) {
195 fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
196 //xbug? fOnBoundary = false;
197 CopyStep(aStep);
198
199 if(fOnBoundary)
200 {
201//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
202// Locate the point and get new touchable
203//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
204 //?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
205 //?? step.GetPostStepPoint()->GetMomentumDirection());
206 fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
207//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
208 }
209 else
210 {
211 // Do I need this ??????????????????????????????????????????????????????????
212 // fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
213 // ?????????????????????????????????????????????????????????????????????????
214
215 // fPathFinder->ReLocate(track.GetPosition());
216
217 // reuse the touchable
218 fNewGhostTouchable = fOldGhostTouchable;
219 }
220
221 fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
222 fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
223
224 }
225
226 if(paraflag) {
227 G4GeometryCell postCell(*(fGhostPostStepPoint->GetPhysicalVolume()),
228 fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
229
230
231 // G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
232 // G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
233 G4double R = fSourceImportance;
234 if (fIStore)
235 {
236 G4double i = fIStore->GetImportance(postCell);
237 if (i>0)
238 {
239 R/=i;
240 }
241 }
242 G4double w = aTrack.GetWeight();
243 if (w<R*fWeightLimit)
244 {
245 G4double ws = fWeightSurvival*R;
246 G4double p = w/(ws);
247 if (G4UniformRand()<p)
248 {
249 fParticleChange->ProposeTrackStatus(fStopAndKill);
250 }
251 else
252 {
253 fParticleChange->ProposeWeight(ws);
254 }
255 }
256 } else {
257
258 G4GeometryCell postCell(*(aStep.GetPostStepPoint()->GetPhysicalVolume()),
260
261 // G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
262 // G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
263 G4double R = fSourceImportance;
264 if (fIStore)
265 {
266 G4double i = fIStore->GetImportance(postCell);
267 if (i>0)
268 {
269 R/=i;
270 }
271 }
272 G4double w = aTrack.GetWeight();
273 if (w<R*fWeightLimit)
274 {
275 G4double ws = fWeightSurvival*R;
276 G4double p = w/(ws);
277 if (G4UniformRand()<p)
278 {
279 fParticleChange->ProposeTrackStatus(fStopAndKill);
280 }
281 else
282 {
283 fParticleChange->ProposeWeight(ws);
284 }
285 }
286 }
287
288 return fParticleChange;
289
290}
@ fStopAndKill
#define G4UniformRand()
Definition: Randomize.hh:53
virtual void Initialize(const G4Track &)
G4TouchableHandle CreateTouchableHandle(G4int navId) const
const G4VTouchable * GetTouchable() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4TouchableHandle & GetTouchableHandle() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4double GetWeight() const
virtual G4double GetImportance(const G4GeometryCell &gCell) const =0
void ProposeTrackStatus(G4TrackStatus status)
void ProposeWeight(G4double finalWeight)
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58

◆ PostStepGetPhysicalInteractionLength()

G4double G4WeightCutOffProcess::PostStepGetPhysicalInteractionLength ( const G4Track aTrack,
G4double  previousStepSize,
G4ForceCondition condition 
)
virtual

Implements G4VProcess.

Definition at line 176 of file G4WeightCutOffProcess.cc.

179{
180// *condition = Forced;
181// return kInfinity;
182
183// *condition = StronglyForced;
184 *condition = Forced;
185 return DBL_MAX;
186}
G4double condition(const G4ErrorSymMatrix &m)
@ Forced

◆ SetParallelWorld() [1/2]

void G4WeightCutOffProcess::SetParallelWorld ( G4String  parallelWorldName)

Definition at line 107 of file G4WeightCutOffProcess.cc.

109{
110//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
111// Get pointers of the parallel world and its navigator
112//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
113 fGhostWorldName = parallelWorldName;
114 fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
115 fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
116//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
117}
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
G4Navigator * GetNavigator(const G4String &worldName)

Referenced by G4WeightCutOffConfigurator::Configure().

◆ SetParallelWorld() [2/2]

void G4WeightCutOffProcess::SetParallelWorld ( G4VPhysicalVolume parallelWorld)

Definition at line 119 of file G4WeightCutOffProcess.cc.

121{
122//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
123// Get pointer of navigator
124//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
125 fGhostWorldName = parallelWorld->GetName();
126 fGhostWorld = parallelWorld;
127 fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
128//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129}
const G4String & GetName() const

◆ StartTracking()

void G4WeightCutOffProcess::StartTracking ( G4Track trk)
virtual

Reimplemented from G4VProcess.

Definition at line 136 of file G4WeightCutOffProcess.cc.

137{
138//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
139// Activate navigator and get the navigator ID
140//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
142
143 if(paraflag) {
144 if(fGhostNavigator)
145 { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
146 else
147 {
148 G4Exception("G4WeightCutOffProcess::StartTracking",
149 "ProcParaWorld000",FatalException,
150 "G4WeightCutOffProcess is used for tracking without having a parallel world assigned");
151 }
152//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
153
154// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
155//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
156// Let PathFinder initialize
157//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
158 fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
159//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
160
161//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
162// Setup initial touchables for the first step
163//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
164 fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
165 fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
166 fNewGhostTouchable = fOldGhostTouchable;
167 fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
168
169 // Initialize
170 fGhostSafety = -1.;
171 fOnBoundary = false;
172 }
173}
void PrepareNewTrack(const G4ThreeVector &position, const G4ThreeVector &direction, G4VPhysicalVolume *massStartVol=0)
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4int ActivateNavigator(G4Navigator *aNavigator)

The documentation for this class was generated from the following files: