Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4WeightWindowProcess Class Reference

#include <G4WeightWindowProcess.hh>

Inheritance diagram for G4WeightWindowProcess:
Collaboration diagram for G4WeightWindowProcess:

Public Member Functions

 G4WeightWindowProcess (const G4VWeightWindowAlgorithm &aWeightWindowAlgorithm, const G4VWeightWindowStore &aWWStore, const G4VTrackTerminator *TrackTerminator, G4PlaceOfAction placeOfAction, const G4String &aName="WeightWindowProcess", G4bool para=false)
 
virtual ~G4WeightWindowProcess ()
 
void SetParallelWorld (const 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 &)
 
virtual void KillTrack () const
 
virtual 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
 
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 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
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 
- Public Member Functions inherited from G4VTrackTerminator
 G4VTrackTerminator ()
 
virtual ~G4VTrackTerminator ()
 

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
 
- Protected Attributes inherited from G4VTrackTerminator
G4double kCarTolerance
 

Detailed Description

Definition at line 62 of file G4WeightWindowProcess.hh.

Constructor & Destructor Documentation

G4WeightWindowProcess::G4WeightWindowProcess ( const G4VWeightWindowAlgorithm aWeightWindowAlgorithm,
const G4VWeightWindowStore aWWStore,
const G4VTrackTerminator TrackTerminator,
G4PlaceOfAction  placeOfAction,
const G4String aName = "WeightWindowProcess",
G4bool  para = false 
)

Definition at line 55 of file G4WeightWindowProcess.cc.

61  : G4VProcess(aName),
62  fParticleChange(new G4ParticleChange),
63  fWeightWindowAlgorithm(aWeightWindowAlgorithm),
64  fWeightWindowStore(aWWStore),
65  fPostStepAction(0),
66  fPlaceOfAction(placeOfAction),
67  fGhostWorldName("NoParallelWorld"),fGhostWorld(0),
68  fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0'),
69  fParaflag(), fEndTrack('0'), feLimited(kDoNot)
70 {
71  if (TrackTerminator)
72  {
73  fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
74  }
75  else
76  {
77  fPostStepAction = new G4SamplingPostStepAction(*this);
78  }
79  if (!fParticleChange)
80  {
81  G4Exception("G4WeightWindowProcess::G4WeightWindowProcess()",
82  "FatalError", FatalException,
83  "Failed allocation of G4ParticleChange !");
84  }
85  G4VProcess::pParticleChange = fParticleChange;
86 
87  fGhostStep = new G4Step();
88  fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
89  fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
90 
91  fTransportationManager = G4TransportationManager::GetTransportationManager();
92  fPathFinder = G4PathFinder::GetInstance();
93 
94  if (verboseLevel>0)
95  {
96  G4cout << GetProcessName() << " is created " << G4endl;
97  }
98 
99  fParaflag = para;
100 
101 }
static G4PathFinder * GetInstance()
Definition: G4PathFinder.cc:57
G4int verboseLevel
Definition: G4VProcess.hh:368
G4VProcess(const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
Definition: G4VProcess.cc:52
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
Definition: G4Step.hh:76
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4TransportationManager * GetTransportationManager()
G4StepPoint * GetPostStepPoint() const
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4WeightWindowProcess::~G4WeightWindowProcess ( )
virtual

Definition at line 103 of file G4WeightWindowProcess.cc.

104 {
105 
106  delete fPostStepAction;
107  delete fParticleChange;
108  // delete fGhostStep;
109 
110 }

Member Function Documentation

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

Implements G4VProcess.

Definition at line 389 of file G4WeightWindowProcess.cc.

390 {
391  // Dummy ParticleChange ie: does nothing
392  // Expecting G4Transportation to move the track
393  pParticleChange->Initialize(track);
394  return pParticleChange;
395 
396  // return 0;
397 }
virtual void Initialize(const G4Track &)
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283

Here is the call graph for this function:

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

Implements G4VProcess.

Definition at line 302 of file G4WeightWindowProcess.cc.

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

Here is the call graph for this function:

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

Implements G4VProcess.

Definition at line 383 of file G4WeightWindowProcess.cc.

384 {
385  return 0;
386 }
G4double G4WeightWindowProcess::AtRestGetPhysicalInteractionLength ( const G4Track ,
G4ForceCondition  
)
virtual

Implements G4VProcess.

Definition at line 376 of file G4WeightWindowProcess.cc.

378 {
379  return -1.0;
380 }
const G4String & G4WeightWindowProcess::GetName ( ) const
virtual

Implements G4VTrackTerminator.

Definition at line 296 of file G4WeightWindowProcess.cc.

297 {
299 }
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408

Here is the call graph for this function:

void G4WeightWindowProcess::KillTrack ( ) const
virtual

Implements G4VTrackTerminator.

Definition at line 291 of file G4WeightWindowProcess.cc.

292 {
293  fParticleChange->ProposeTrackStatus(fStopAndKill);
294 }
void ProposeTrackStatus(G4TrackStatus status)

Here is the call graph for this function:

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

Implements G4VProcess.

Definition at line 201 of file G4WeightWindowProcess.cc.

203 {
204 
205  fParticleChange->Initialize(aTrack);
206 
207  if(fParaflag) {
208  fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
209  //xbug? fOnBoundary = false;
210  CopyStep(aStep);
211 
212  if(fOnBoundary)
213  {
214 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
215 // Locate the point and get new touchable
216 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
217  //?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
218  //?? step.GetPostStepPoint()->GetMomentumDirection());
219  fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
220 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
221  }
222  else
223  {
224  // Do I need this ??????????????????????????????????????????????????????????
225  // fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
226  // ?????????????????????????????????????????????????????????????????????????
227 
228  // fPathFinder->ReLocate(track.GetPosition());
229 
230  // reuse the touchable
231  fNewGhostTouchable = fOldGhostTouchable;
232  }
233 
234  fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
235  fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
236 
237  }
238 
239  if (aStep.GetStepLength() > kCarTolerance)
240  {
241 // if ( ( fPlaceOfAction == onBoundaryAndCollision)
242 // || ( (fPlaceOfAction == onBoundary) &&
243 // (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) )
244 // || ( (fPlaceOfAction == onCollision) &&
245 // (aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) ) )
246  if(fParaflag) {
247  if ( ( fPlaceOfAction == onBoundaryAndCollision)
248  || ( (fPlaceOfAction == onBoundary) &&
249  (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary) )
250  || ( (fPlaceOfAction == onCollision) &&
251  (fGhostPostStepPoint->GetStepStatus() != fGeomBoundary) ) )
252  {
253 
254 // G4StepPoint *postpoint = aStep.GetPostStepPoint();
255 
256 // G4GeometryCell postCell(*(postpoint->GetPhysicalVolume()),
257 // postpoint->GetTouchable()->GetReplicaNumber());
258 
259  G4GeometryCell postCell(*(fGhostPostStepPoint->GetPhysicalVolume()),
260  fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
261  G4Nsplit_Weight nw =
262  fWeightWindowAlgorithm.Calculate(aTrack.GetWeight(),
263  fWeightWindowStore.GetLowerWeight(postCell,
264  aTrack.GetKineticEnergy()));
265  fPostStepAction->DoIt(aTrack, fParticleChange, nw);
266  }
267  } else {
268  if ( ( fPlaceOfAction == onBoundaryAndCollision)
269  || ( (fPlaceOfAction == onBoundary) &&
271  || ( (fPlaceOfAction == onCollision) &&
272  (aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) ) )
273  {
274 
275  G4StepPoint *postpoint = aStep.GetPostStepPoint();
276 
277  G4GeometryCell postCell(*(postpoint->GetPhysicalVolume()),
278  postpoint->GetTouchable()->GetReplicaNumber());
279 
280  G4Nsplit_Weight nw =
281  fWeightWindowAlgorithm.Calculate(aTrack.GetWeight(),
282  fWeightWindowStore.GetLowerWeight(postCell,
283  aTrack.GetKineticEnergy()));
284  fPostStepAction->DoIt(aTrack, fParticleChange, nw);
285  }
286  }
287  }
288  return fParticleChange;
289 }
G4double GetStepLength() const
G4StepStatus GetStepStatus() const
G4TouchableHandle CreateTouchableHandle(G4int navId) const
const G4VTouchable * GetTouchable() const
G4double GetKineticEnergy() const
G4VPhysicalVolume * GetPhysicalVolume() const
virtual void Initialize(const G4Track &)
void DoIt(const G4Track &aTrack, G4ParticleChange *aParticleChange, const G4Nsplit_Weight &nw)
G4StepPoint * GetPostStepPoint() const
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
virtual G4Nsplit_Weight Calculate(G4double init_w, G4double lowerWeightBound) const =0
G4double GetWeight() const
virtual G4double GetLowerWeight(const G4GeometryCell &gCell, G4double partEnergy) const =0
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4TouchableHandle & GetTouchableHandle() const

Here is the call graph for this function:

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

Implements G4VProcess.

Definition at line 188 of file G4WeightWindowProcess.cc.

191 {
192 // *condition = Forced;
193 // return kInfinity;
194 
195 // *condition = StronglyForced;
196  *condition = Forced;
197  return DBL_MAX;
198 }
G4double condition(const G4ErrorSymMatrix &m)
#define DBL_MAX
Definition: templates.hh:83
void G4WeightWindowProcess::SetParallelWorld ( const G4String parallelWorldName)

Definition at line 119 of file G4WeightWindowProcess.cc.

120 {
121 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
122 // Get pointers of the parallel world and its navigator
123 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
124  fGhostWorldName = parallelWorldName;
125  fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
126  fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
127 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
128 }
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
G4Navigator * GetNavigator(const G4String &worldName)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4WeightWindowProcess::SetParallelWorld ( G4VPhysicalVolume parallelWorld)

Definition at line 131 of file G4WeightWindowProcess.cc.

132 {
133 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
134 // Get pointer of navigator
135 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
136  fGhostWorldName = parallelWorld->GetName();
137  fGhostWorld = parallelWorld;
138  fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
139 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
140 }
const G4String & GetName() const
G4Navigator * GetNavigator(const G4String &worldName)

Here is the call graph for this function:

void G4WeightWindowProcess::StartTracking ( G4Track trk)
virtual

Reimplemented from G4VProcess.

Definition at line 147 of file G4WeightWindowProcess.cc.

148 {
149 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150 // Activate navigator and get the navigator ID
151 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
152 // G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
153 
154  if(fParaflag) {
155  if(fGhostNavigator)
156  { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
157  else
158  {
159  G4Exception("G4WeightWindowProcess::StartTracking",
160  "ProcParaWorld000",FatalException,
161  "G4WeightWindowProcess is used for tracking without having a parallel world assigned");
162  }
163 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
164 
165 // G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
166 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
167 // Let PathFinder initialize
168 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169  fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
170 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
171 
172 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
173 // Setup initial touchables for the first step
174 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
175  fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
176  fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
177  fNewGhostTouchable = fOldGhostTouchable;
178  fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
179 
180  // Initialize
181  fGhostSafety = -1.;
182  fOnBoundary = false;
183  }
184 }
void PrepareNewTrack(const G4ThreeVector &position, const G4ThreeVector &direction, G4VPhysicalVolume *massStartVol=0)
const G4ThreeVector & GetPosition() const
G4TouchableHandle CreateTouchableHandle(G4int navId) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int ActivateNavigator(G4Navigator *aNavigator)
const G4ThreeVector & GetMomentumDirection() const
void SetTouchableHandle(const G4TouchableHandle &apValue)

Here is the call graph for this function:


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