Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Member Functions | Protected Member Functions
G4ITStepProcessor Class Reference

#include <G4ITStepProcessor.hh>

Public Member Functions

 G4ITStepProcessor ()
 
virtual ~G4ITStepProcessor ()
 
void SetPreviousStepTime (G4double)
 
G4TrackGetTrack ()
 
G4StepGetStep ()
 
const G4StepGetStep () const
 
void SetStep (G4Step *val)
 
G4TrackVectorGetSecondaries ()
 
void SetTrackingManager (G4ITTrackingManager *trackMan)
 
G4ITTrackingManagerGetTrackingManager ()
 
virtual void Initialize ()
 
void ForceReInitialization ()
 
void DefinePhysicalStepLength (G4Track *)
 
void Stepping (G4Track *, const double &)
 
void CalculateStep (G4Track *, const double &)
 
void CalculateStep (G4Track *)
 
void DoIt (G4Track *, double)
 
void FindTransportationStep ()
 
void UpdateTrack (G4Track *)
 
double GetInteractionTime ()
 
const G4TrackGetTrack () const
 
void CleanProcessor ()
 

Protected Member Functions

void SetupGeneralProcessInfo (G4ParticleDefinition *, G4ProcessManager *)
 
void ClearProcessInfo ()
 
void SetTrack (G4Track *)
 
void GetProcessInfo ()
 
void SetupMembers ()
 
void ResetSecondaries ()
 
void InitDefineStep ()
 
void SetInitialStep ()
 
void GetAtRestIL ()
 
void DoDefinePhysicalStepLength ()
 
void DoStepping ()
 
void CalculateStep ()
 
void DoCalculateStep ()
 
void CloneProcesses ()
 
void ActiveOnlyITProcess ()
 
void ActiveOnlyITProcess (G4ProcessManager *)
 
void DealWithSecondaries (G4int &)
 
void InvokeAtRestDoItProcs ()
 
void InvokeAlongStepDoItProcs ()
 
void InvokePostStepDoItProcs ()
 
void InvokePSDIP (size_t)
 
void InvokeTransportationProc ()
 
void SetNavigator (G4ITNavigator *value)
 
G4double CalculateSafety ()
 
void ApplyProductionCut (G4Track *)
 
 G4ITStepProcessor (const G4ITStepProcessor &other)
 
G4ITStepProcessoroperator= (const G4ITStepProcessor &other)
 

Detailed Description

Its role is the same as G4StepManager :

Definition at line 83 of file G4ITStepProcessor.hh.

Constructor & Destructor Documentation

G4ITStepProcessor::G4ITStepProcessor ( )

Definition at line 63 of file G4ITStepProcessor.cc.

References DBL_MAX.

64 {
65  verboseLevel = 0 ;
66  // fpUserSteppingAction = 0 ;
67  fStoreTrajectory = 0;
68  fpTrackingManager = 0;
69  fpNavigator = 0;
70  kCarTolerance = -1.;
71  fInitialized = false;
72  fPreviousTimeStep = DBL_MAX;
75 }
#define DBL_MAX
Definition: templates.hh:83
G4ITStepProcessor::~G4ITStepProcessor ( )
virtual

Definition at line 189 of file G4ITStepProcessor.cc.

References ClearProcessInfo(), G4ITTransportationManager::DeleteInstance(), and G4Step::DeleteSecondaryVector().

190 {
191  if(fpStep)
192  {
193  fpStep->DeleteSecondaryVector();
194  delete fpStep;
195  }
196 
197  if(fpSecondary) delete fpSecondary;
200 
201  // if(fpUserSteppingAction) delete fpUserSteppingAction;
202 }
void DeleteSecondaryVector()
G4ITStepProcessor::G4ITStepProcessor ( const G4ITStepProcessor other)
protected

Definition at line 205 of file G4ITStepProcessor.cc.

References CleanProcessor(), DBL_MAX, and ResetSecondaries().

206 {
207  verboseLevel = rhs.verboseLevel ;
208  fStoreTrajectory = rhs.fStoreTrajectory ;
209 
210  // fpUserSteppingAction = 0 ;
211  fpTrackingManager = 0;
212  fpNavigator = 0;
213  fInitialized = false;
214 
215  kCarTolerance = rhs.kCarTolerance;
216  fInitialized = false;
217  fPreviousTimeStep = DBL_MAX;
218 
219  CleanProcessor();
221 }
#define DBL_MAX
Definition: templates.hh:83

Member Function Documentation

void G4ITStepProcessor::ActiveOnlyITProcess ( )
protected

Definition at line 232 of file G4ITStepProcessor.cc.

References FatalException, G4cerr, G4cout, G4endl, G4Exception(), G4ParticleTable::GetIterator(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGEncoding(), G4ParticleDefinition::GetProcessManager(), G4ParticleTableIterator< K, V >::reset(), theParticleIterator, and G4ParticleTableIterator< K, V >::value().

233 {
234  // Method not used for the time being
235 #ifdef debug
236  G4cout<<"G4ITStepProcessor::CloneProcesses: is called"<<G4endl;
237 #endif
238 
241 
242  theParticleIterator->reset();
243  // TODO : Ne faire la boucle que sur les IT **** !!!
244  while( (*theParticleIterator)() )
245  {
246  G4ParticleDefinition* particle = theParticleIterator->value();
247  G4ProcessManager* pm= particle->GetProcessManager();
248 
249  if(!pm)
250  {
251  G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
252  << " ProcessManager is NULL for particle = "
253  << particle->GetParticleName() << ", PDG_code = "
254  << particle->GetPDGEncoding() << G4endl;
255  G4Exception("G4ITStepProcessor::GetProcessNumber()", "ITStepProcessor0001",
256  FatalException, "Process Manager is not found.");
257  return;
258  }
259 
261  }
262 }
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
G4PTblDicIterator * GetIterator() const
#define theParticleIterator
G4GLOB_DLL std::ostream G4cerr
void G4ITStepProcessor::ActiveOnlyITProcess ( G4ProcessManager processManager)
protected

Definition at line 265 of file G4ITStepProcessor.cc.

References G4ProcessManager::GetProcessList(), G4ProcessManager::SetProcessActivation(), and G4ProcessVector::size().

266 {
267  // Method not used for the time being
268  G4ProcessVector* processVector = processManager->GetProcessList();
269 
270  G4VITProcess* itProcess = 0 ;
271  for(int i = 0 ; i < processVector->size() ; i++)
272  {
273  G4VProcess* base_process = (*processVector)[i];
274  itProcess = dynamic_cast<G4VITProcess*>(base_process);
275 
276  if(!itProcess)
277  {
278  processManager->SetProcessActivation(base_process, false);
279  }
280  }
281 }
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4int size() const
G4ProcessVector * GetProcessList() const
void G4ITStepProcessor::ApplyProductionCut ( G4Track aSecondary)
protected

Definition at line 569 of file G4ITStepProcessor2.cc.

References G4Step::AddTotalEnergyDeposit(), CalculateSafety(), DBL_MIN, G4DynamicParticle::GetCharge(), G4ProductionCutsTable::GetCoupleIndex(), G4Track::GetDefinition(), G4Track::GetDynamicParticle(), G4ProductionCutsTable::GetEnergyCutsVector(), G4ProductionCuts::GetIndex(), G4Track::GetKineticEnergy(), G4StepPoint::GetMaterialCutsCouple(), G4ProductionCutsTable::GetProductionCutsTable(), G4LossTableManager::GetRange(), G4LossTableManager::Instance(), G4Track::IsGoodForTracking(), and G4Track::SetKineticEnergy().

Referenced by DealWithSecondaries().

570 {
571  G4bool tBelowCutEnergyAndSafety = false;
572  G4int tPtclIdx
573  = G4ProductionCuts::GetIndex(aSecondary->GetDefinition());
574  if (tPtclIdx<0)
575  {
576  return;
577  }
578  G4ProductionCutsTable* tCutsTbl
580  G4int tCoupleIdx
581  = tCutsTbl->GetCoupleIndex(fpPreStepPoint->GetMaterialCutsCouple());
582  G4double tProdThreshold
583  = (*(tCutsTbl->GetEnergyCutsVector(tPtclIdx)))[tCoupleIdx];
584  if( aSecondary->GetKineticEnergy()<tProdThreshold )
585  {
586  tBelowCutEnergyAndSafety = true;
587  if(std::abs(aSecondary->GetDynamicParticle()->GetCharge()) > DBL_MIN)
588  {
589  G4double currentRange
591  aSecondary->GetKineticEnergy(),
592  fpPreStepPoint->GetMaterialCutsCouple());
593  tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
594  }
595  }
596 
597  if( tBelowCutEnergyAndSafety )
598  {
599  if( !(aSecondary->IsGoodForTracking()) )
600  {
601  // Add kinetic energy to the total energy deposit
602  fpStep->AddTotalEnergyDeposit(
603  aSecondary->GetKineticEnergy() );
604  aSecondary->SetKineticEnergy(0.0);
605  }
606  }
607 }
G4ParticleDefinition * GetDefinition() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
static G4LossTableManager * Instance()
static G4int GetIndex(const G4String &name)
const G4DynamicParticle * GetDynamicParticle() const
int G4int
Definition: G4Types.hh:78
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double GetKineticEnergy() const
bool G4bool
Definition: G4Types.hh:79
G4int GetCoupleIndex(const G4MaterialCutsCouple *aCouple) const
G4double GetCharge() const
static G4ProductionCutsTable * GetProductionCutsTable()
void AddTotalEnergyDeposit(G4double value)
#define DBL_MIN
Definition: templates.hh:75
G4bool IsGoodForTracking() const
void SetKineticEnergy(const G4double aValue)
double G4double
Definition: G4Types.hh:76
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double G4ITStepProcessor::CalculateSafety ( )
inlineprotected

Definition at line 314 of file G4ITStepProcessor.hh.

References G4StepPoint::GetPosition(), and G4INCL::Math::max().

Referenced by ApplyProductionCut(), and InvokePSDIP().

315 {
316  return std::max( fpState->endpointSafety -
317  (fpState->endpointSafOrigin - fpPostStepPoint->GetPosition()).mag(),
318  kCarTolerance );
319 }
const G4ThreeVector & GetPosition() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void G4ITStepProcessor::CalculateStep ( G4Track ,
const double &   
)
void G4ITStepProcessor::CalculateStep ( G4Track )
void G4ITStepProcessor::CalculateStep ( )
protected
void G4ITStepProcessor::CleanProcessor ( )
inline

Definition at line 326 of file G4ITStepProcessor.hh.

References DBL_MAX, INT_MAX, NotCandidateForSelection, and NotForced.

Referenced by G4ITStepProcessor(), Initialize(), and Stepping().

327 {
328  fTimeStep = DBL_MAX ;
329  fPhysIntLength = DBL_MAX;
330 
331  fpState = 0;
332  fpTrack = 0;
333  fpTrackingInfo = 0 ;
334  fpITrack = 0;
335  fpStep = 0;
336  fpPreStepPoint = 0;
337  fpPostStepPoint = 0;
338 
339  fpParticleChange = 0;
340 
341  fpCurrentVolume = 0;
342 // fpSensitive = 0;
343 
344  fpSecondary = 0 ;
345 
346  fpTransportation = 0;
347 
348  fpCurrentProcess= 0;
349  fpProcessInfo = 0;
350 
351  fAtRestDoItProcTriggered = INT_MAX;
352  fPostStepDoItProcTriggered = INT_MAX;
353  fPostStepAtTimeDoItProcTriggered = INT_MAX;
354  fGPILSelection = NotCandidateForSelection ;
355  fCondition = NotForced;
356 }
#define INT_MAX
Definition: templates.hh:111
#define DBL_MAX
Definition: templates.hh:83
void G4ITStepProcessor::ClearProcessInfo ( )
protected

Definition at line 146 of file G4ITStepProcessor.cc.

Referenced by ForceReInitialization(), and ~G4ITStepProcessor().

147 {
148  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> ::iterator it;
149 
150  for(it = fProcessGeneralInfoMap.begin();it != fProcessGeneralInfoMap.end();it++)
151  {
152  if(it->second)
153  {
154  delete it->second;
155  it->second = 0;
156  }
157  }
158 
159  fProcessGeneralInfoMap.clear();
160 }
void G4ITStepProcessor::CloneProcesses ( )
protected
void G4ITStepProcessor::DealWithSecondaries ( G4int counter)
protected

Definition at line 49 of file G4ITStepProcessor2.cc.

References ApplyProductionCut(), DBL_MIN, G4ProcessVector::entries(), fStopButAlive, G4ParticleDefinition::GetApplyCutsFlag(), G4ProcessManager::GetAtRestProcessVector(), G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4VParticleChange::GetNumberOfSecondaries(), G4ParticleDefinition::GetProcessManager(), G4VParticleChange::GetSecondary(), G4Track::GetTrackID(), G4Track::SetCreatorProcess(), G4Track::SetParentID(), and G4Track::SetTrackStatus().

Referenced by InvokeAlongStepDoItProcs(), InvokeAtRestDoItProcs(), and InvokePSDIP().

50 {
51  // Now Store the secondaries from ParticleChange to SecondaryList
52  G4Track* tempSecondaryTrack;
53 
54  for(G4int DSecLoop=0 ;
55  DSecLoop<fpParticleChange->GetNumberOfSecondaries() ;
56  DSecLoop++)
57  {
58  tempSecondaryTrack = fpParticleChange->GetSecondary(DSecLoop);
59 
60  if(tempSecondaryTrack->GetDefinition()->GetApplyCutsFlag())
61  {
62  ApplyProductionCut(tempSecondaryTrack);
63  }
64 
65  // Set parentID
66  tempSecondaryTrack->SetParentID( fpTrack->GetTrackID() );
67 
68  // Set the process pointer which created this track
69  tempSecondaryTrack->SetCreatorProcess( fpCurrentProcess );
70 
71  // If this 2ndry particle has 'zero' kinetic energy, make sure
72  // it invokes a rest process at the beginning of the tracking
73  if(tempSecondaryTrack->GetKineticEnergy() <= DBL_MIN)
74  {
75  G4ProcessManager* pm = tempSecondaryTrack->GetDefinition()->GetProcessManager();
76  if (pm->GetAtRestProcessVector()->entries()>0){
77  tempSecondaryTrack->SetTrackStatus( fStopButAlive );
78  fpSecondary->push_back( tempSecondaryTrack );
79  fN2ndariesAtRestDoIt++;
80  } else {
81  delete tempSecondaryTrack;
82  }
83  }
84  else
85  {
86  fpSecondary->push_back( tempSecondaryTrack );
87  counter++;
88  }
89  } //end of loop on secondary
90 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4int GetNumberOfSecondaries() const
G4Track * GetSecondary(G4int anIndex) const
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
void SetCreatorProcess(const G4VProcess *aValue)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double GetKineticEnergy() const
G4int entries() const
void ApplyProductionCut(G4Track *)
G4int GetTrackID() const
void SetParentID(const G4int aValue)
#define DBL_MIN
Definition: templates.hh:75
G4bool GetApplyCutsFlag() const
void G4ITStepProcessor::DefinePhysicalStepLength ( G4Track track)

Definition at line 514 of file G4ITStepProcessor.cc.

References DoDefinePhysicalStepLength(), and SetTrack().

515 {
516  SetTrack(track);
518 }
void SetTrack(G4Track *)
void G4ITStepProcessor::DoCalculateStep ( )
protected
void G4ITStepProcessor::DoDefinePhysicalStepLength ( )
protected

Definition at line 704 of file G4ITStepProcessor.cc.

References CandidateForSelection, G4ITTransportation::ComputeStep(), Conditionally, DBL_MAX, ExclusivelyForced, fAlongStepDoItProc, FatalErrorInArgument, FatalException, fExclusivelyForcedProc, fGeomBoundary, Forced, fPostStepDoItProc, fStopAndKill, fStopButAlive, fWorldBoundary, G4Exception(), GetAtRestIL(), G4VITProcess::GetInteractionTimeLeft(), G4ITNavigator::GetNavigatorState(), G4Track::GetNextVolume(), G4Step::GetPostStepPoint(), G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), G4IT::GetTrackingInfo(), InActivated, InitDefineStep(), NotForced, G4VITProcess::ProposesTimeStep(), G4ITNavigator::SetNavigatorState(), G4TrackingInformation::SetNavigatorState(), G4StepPoint::SetProcessDefinedStep(), G4VITProcess::SetProcessState(), and StronglyForced.

Referenced by DefinePhysicalStepLength().

705 {
706 
707  InitDefineStep();
708 
709  G4TrackStatus trackStatus = fpTrack -> GetTrackStatus() ;
710 
711  if(trackStatus == fStopAndKill)
712  {
713  return ;
714  }
715 
716  if(trackStatus == fStopButAlive)
717  {
718  fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
719  fpNavigator->SetNavigatorState(0);
720  return GetAtRestIL() ;
721  }
722 
723 
724  // Find minimum Step length and corresponding time
725  // demanded by active disc./cont. processes
726 
727  // ReSet the counter etc.
728  fpState->fPhysicalStep = DBL_MAX; // Initialize by a huge number
729  fPhysIntLength = DBL_MAX; // Initialize by a huge number
730 
731  double proposedTimeStep = DBL_MAX;
732  G4VProcess* processWithPostStepGivenByTimeStep(0);
733 
734  // GPIL for PostStep
735  fPostStepDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
736  fPostStepAtTimeDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
737 
738  // G4cout << "fpProcessInfo->MAXofPostStepLoops : " << fpProcessInfo->MAXofPostStepLoops
739  // << " mol : " << fpITrack -> GetName() << " id : " << fpTrack->GetTrackID()
740  // << G4endl;
741 
742  for(size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
743  {
744  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpPostStepGetPhysIntVector)[np];
745  if (fpCurrentProcess== 0)
746  {
747  (fpState->fSelectedPostStepDoItVector)[np] = InActivated;
748  continue;
749  } // NULL means the process is inactivated by a user on fly.
750 
751  fCondition=NotForced;
752  fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
753 
754  // G4cout << "Is going to call : " << fpCurrentProcess -> GetProcessName() << G4endl;
755  fPhysIntLength = fpCurrentProcess->
756  PostStepGPIL( *fpTrack,
757  fpState->fPreviousStepSize,
758  &fCondition );
759  fpCurrentProcess->SetProcessState(0);
760 
761  switch (fCondition)
762  {
763  case ExclusivelyForced: // Will need special treatment
764  (fpState->fSelectedPostStepDoItVector)[np] = ExclusivelyForced;
765  fpState->fStepStatus = fExclusivelyForcedProc;
766  fpStep->GetPostStepPoint()
767  ->SetProcessDefinedStep(fpCurrentProcess);
768  break;
769 
770  case Conditionally:
771  // (fpState->fSelectedPostStepDoItVector)[np] = Conditionally;
772  G4Exception("G4ITStepProcessor::DefinePhysicalStepLength()", "ITStepProcessor0008",
773  FatalException, "This feature is no more supported");
774  break;
775 
776  case Forced:
777  (fpState->fSelectedPostStepDoItVector)[np] = Forced;
778  break;
779 
780  case StronglyForced:
781  (fpState->fSelectedPostStepDoItVector)[np] = StronglyForced;
782  break;
783 
784  default:
785  (fpState->fSelectedPostStepDoItVector)[np] = InActivated;
786  break;
787  }
788 
789  if (fCondition==ExclusivelyForced)
790  {
791  for(size_t nrest=np+1; nrest < fpProcessInfo->MAXofPostStepLoops; nrest++)
792  {
793  (fpState->fSelectedPostStepDoItVector)[nrest] = InActivated;
794  }
795  return; // Please note the 'return' at here !!!
796  }
797  else
798  {
799  if(fPhysIntLength < fpState->fPhysicalStep )
800  {
801  // To avoid checking whether the process is actually
802  // proposing a time step, the returned time steps are
803  // negative (just for tagging)
804  if(fpCurrentProcess->ProposesTimeStep())
805  {
806  fPhysIntLength *= -1;
807  if(fPhysIntLength < proposedTimeStep)
808  {
809  proposedTimeStep = fPhysIntLength;
810  fPostStepAtTimeDoItProcTriggered = np;
811  processWithPostStepGivenByTimeStep = fpCurrentProcess;
812  }
813  }
814  else
815  {
816  fpState->fPhysicalStep = fPhysIntLength;
817  fpState->fStepStatus = fPostStepDoItProc;
818  fPostStepDoItProcTriggered = G4int(np);
819  fpStep->GetPostStepPoint()
820  ->SetProcessDefinedStep(fpCurrentProcess);
821  }
822  }
823  }
824  }
825 
826  // GPIL for AlongStep
827  fpState->proposedSafety = DBL_MAX;
828  G4double safetyProposedToAndByProcess = fpState->proposedSafety;
829 
830  for(size_t kp=0; kp < fpProcessInfo->MAXofAlongStepLoops; kp++)
831  {
832  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAlongStepGetPhysIntVector)[kp];
833  if (fpCurrentProcess== 0) continue;
834  // NULL means the process is inactivated by a user on fly.
835 
836  fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
837  fPhysIntLength = fpCurrentProcess-> AlongStepGPIL( *fpTrack,
838  fpState->fPreviousStepSize,
839  fpState->fPhysicalStep,
840  safetyProposedToAndByProcess,
841  &fGPILSelection );
842 
843  if(fPhysIntLength < fpState->fPhysicalStep)
844  {
845  fpState->fPhysicalStep = fPhysIntLength;
846  // Should save PS and TS in IT
847 
848  // Check if the process wants to be the GPIL winner. For example,
849  // multi-scattering proposes Step limit, but won't be the winner.
850  if(fGPILSelection==CandidateForSelection)
851  {
852  fpState->fStepStatus = fAlongStepDoItProc;
853  fpStep->GetPostStepPoint()
854  ->SetProcessDefinedStep(fpCurrentProcess);
855  }
856 
857  // Transportation is assumed to be the last process in the vector
858  if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
859  {
860  fpTransportation = dynamic_cast<G4ITTransportation*>(fpCurrentProcess);
861 
862  if(! fpTransportation)
863  {
864  G4ExceptionDescription exceptionDescription ;
865  exceptionDescription << "No transportation process found " ;
866  G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength","ITStepProcessor0009",
867  FatalErrorInArgument,exceptionDescription);
868  }
869 
870  fTimeStep = fpTransportation->GetInteractionTimeLeft();
871 
872 
873  if (fpTrack->GetNextVolume() != 0)
874  fpState->fStepStatus = fGeomBoundary;
875  else
876  fpState->fStepStatus = fWorldBoundary;
877  }
878  }
879  else
880  {
881  if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
882  {
883  fpTransportation = dynamic_cast<G4ITTransportation*>(fpCurrentProcess);
884 
885  if(! fpTransportation)
886  {
887  G4ExceptionDescription exceptionDescription ;
888  exceptionDescription << "No transportation process found " ;
889  G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength","ITStepProcessor0010",
890  FatalErrorInArgument,exceptionDescription);
891  }
892 
893  fTimeStep = fpTransportation->GetInteractionTimeLeft();
894  }
895  }
896 
897  if(proposedTimeStep < fTimeStep)
898  {
899  if(fPostStepAtTimeDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
900  {
901  if ((fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] ==
902  InActivated)
903  {
904  (fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] = NotForced;
905  // (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = InActivated;
906 
907  fpState->fStepStatus = fPostStepDoItProc;
908  fpStep->GetPostStepPoint()->SetProcessDefinedStep(processWithPostStepGivenByTimeStep);
909 
910  fTimeStep = proposedTimeStep;
911 
912  fpTransportation->ComputeStep(*fpTrack,*fpStep,fTimeStep,fpState->fPhysicalStep);
913  }
914  }
915  }
916  else
917  {
918  if (fPostStepDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
919  {
920  if ((fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
921  InActivated)
922  {
923  (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
924  NotForced;
925  }
926  }
927  }
928 
929  fpCurrentProcess->SetProcessState(0);
930 
931  // Make sure to check the safety, even if Step is not limited
932  // by this process. J. Apostolakis, June 20, 1998
933  //
934  if (safetyProposedToAndByProcess < fpState->proposedSafety)
935  // proposedSafety keeps the smallest value:
936  fpState->proposedSafety = safetyProposedToAndByProcess;
937  else
938  // safetyProposedToAndByProcess always proposes a valid safety:
939  safetyProposedToAndByProcess = fpState->proposedSafety;
940 
941  }
942 
943  fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
944  fpNavigator->SetNavigatorState(0);
945 }
void SetProcessDefinedStep(const G4VProcess *aValue)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
G4VPhysicalVolume * GetNextVolume() const
G4ITNavigatorState_Lock * GetNavigatorState()
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
G4double GetInteractionTimeLeft()
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
G4ProcessState_Lock * GetProcessState(size_t index)
G4StepPoint * GetPostStepPoint() const
void SetNavigatorState(G4ITNavigatorState_Lock *)
void SetNavigatorState(G4ITNavigatorState_Lock *)
double G4double
Definition: G4Types.hh:76
G4bool ProposesTimeStep() const
#define DBL_MAX
Definition: templates.hh:83
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
G4TrackStatus
void G4ITStepProcessor::DoIt ( G4Track ,
double   
)
void G4ITStepProcessor::DoStepping ( )
protected

Definition at line 107 of file G4ITStepProcessor2.cc.

References G4Track::AddTrackLength(), G4ITTrackingManager::AppendStep(), FatalErrorInArgument, fAtRestDoItProc, FindTransportationStep(), fPostStepDoItProc, fStopAndKill, fStopButAlive, fUndefined, G4endl, G4Exception(), G4Track::GetDefinition(), GetIT(), G4Track::GetMomentumDirection(), G4ITNavigator::GetNavigatorState(), G4TrackingInformation::GetNavigatorState(), G4ParticleDefinition::GetParticleName(), G4StepPoint::GetPosition(), G4Track::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetStepLength(), G4Track::GetTouchableHandle(), G4Track::GetTrackID(), G4IT::GetTrackingInfo(), G4Track::GetTrackStatus(), G4Track::IncrementCurrentStepNumber(), InvokeAlongStepDoItProcs(), InvokeAtRestDoItProcs(), InvokePostStepDoItProcs(), InvokeTransportationProc(), G4TrackingInformation::IsLeadingStep(), G4INCL::Math::max(), G4ITNavigator::ResetHierarchyAndLocate(), G4ITNavigator::SetNavigatorState(), G4TrackingInformation::SetNavigatorState(), G4StepPoint::SetProcessDefinedStep(), G4StepPoint::SetSafety(), G4Step::SetStepLength(), G4Track::SetStepLength(), G4StepPoint::SetStepStatus(), G4Track::SetTrackStatus(), and SetupMembers().

Referenced by Stepping().

108 {
109  SetupMembers() ;
110 
111  if(!fpProcessInfo)
112  {
113  G4ExceptionDescription exceptionDescription ;
114  exceptionDescription << "No process info found for particle :"
115  << fpTrack->GetDefinition()->GetParticleName();
116  G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0012",
117  FatalErrorInArgument,exceptionDescription);
118  return ;
119  }
120  else if(fpTrack->GetTrackStatus() == fStopAndKill )
121  {
122  fpState->fStepStatus = fUndefined;
123  return ;
124  }
125 
126  if(fpProcessInfo->MAXofPostStepLoops == 0
127  && fpProcessInfo->MAXofAlongStepLoops == 0
128  && fpProcessInfo->MAXofAtRestLoops == 0)
129  {
130  fpTrack -> SetTrackStatus(fStopAndKill) ;
131  fpState->fStepStatus = fUndefined;
132  return ;
133  }
134  //---------------------------------
135  // AtRestStep, AlongStep and PostStep Processes
136  //---------------------------------
137  else
138  {
139  fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
140  fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
141  fpTrack->GetMomentumDirection(),
142  *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
143  fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
144  // We reset the navigator state before checking for AtRest
145  // in case a AtRest processe would use a navigator info
146 
147  if( fpTrack->GetTrackStatus() == fStopButAlive )
148  {
149  if( fpProcessInfo->MAXofAtRestLoops>0 &&
150  fpProcessInfo->fpAtRestDoItVector != 0) // second condition to make coverity happy
151  {
152  //-----------------
153  // AtRestStepDoIt
154  //-----------------
156  fpState->fStepStatus = fAtRestDoItProc;
157  fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
158 
159  }
160  // Make sure the track is killed
161  fpTrack->SetTrackStatus( fStopAndKill );
162  }
163  else // if(fTimeStep > 0.) // Bye, because PostStepIL can return 0 => time =0
164  {
165  if(fpITrack == 0)
166  {
167  G4ExceptionDescription exceptionDescription ;
168  exceptionDescription
169  << " !!! TrackID : "<< fpTrack->GetTrackID() << G4endl
170  << " !!! Track status : "<< fpTrack->GetTrackStatus() << G4endl
171  << " !!! Particle Name : "<< fpTrack -> GetDefinition() -> GetParticleName() << G4endl
172  << "No G4ITStepProcessor::fpITrack found" << G4endl;
173 
174  G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0013",
175  FatalErrorInArgument,exceptionDescription);
176  return ; // to make coverity happy
177  }
178 
179  if(fpITrack->GetTrackingInfo()->IsLeadingStep() == false)
180  {
181  // In case the track has NOT the minimum step length
182  // Given the final step time, the transportation
183  // will compute the final position of the particle
184 
185  fpState->fStepStatus = fPostStepDoItProc;
186  fpStep->GetPostStepPoint()
187  ->SetProcessDefinedStep(fpTransportation);
189  }
190 
191 
192  // Store the Step length (geometrical length) to G4Step and G4Track
193  fpTrack->SetStepLength( fpState->fPhysicalStep );
194  fpStep->SetStepLength( fpState->fPhysicalStep );
195 
196  G4double GeomStepLength = fpState->fPhysicalStep;
197 
198  // Store StepStatus to PostStepPoint
199  fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
200 
201  // Invoke AlongStepDoIt
203 
204  // Update track by taking into account all changes by AlongStepDoIt
205  // fpStep->UpdateTrack(); // done in InvokeAlongStepDoItProcs
206 
207  // Update safety after invocation of all AlongStepDoIts
208  fpState->endpointSafOrigin= fpPostStepPoint->GetPosition();
209 
210  fpState->endpointSafety= std::max( fpState->proposedSafety - GeomStepLength, kCarTolerance);
211 
212  fpStep->GetPostStepPoint()->SetSafety( fpState->endpointSafety );
213 
214  if(GetIT(fpTrack)->GetTrackingInfo()->IsLeadingStep())
215  {
216  // Invoke PostStepDoIt including G4ITTransportation::PSDI
218  }
219  else
220  {
221  // Only invoke transportation
223  }
224  }
225 
226  fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
227  fpNavigator->SetNavigatorState(0);
228  }
229  //-------
230  // Finale
231  //-------
232 
233  // Update 'TrackLength' and remeber the Step length of the current Step
234  fpTrack->AddTrackLength(fpStep->GetStepLength());
235  fpTrack->IncrementCurrentStepNumber();
236 
237  // Send G4Step information to Hit/Dig if the volume is sensitive
238 /***
239  fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
240  StepControlFlag = fpStep->GetControlFlag();
241 
242  if( fpCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation)
243  {
244  fpSensitive = fpStep->GetPreStepPoint()->
245  GetSensitiveDetector();
246  if( fpSensitive != 0 )
247  {
248  fpSensitive->Hit(fpStep);
249  }
250  }
251 
252  User intervention process.
253  if( fpUserSteppingAction != 0 )
254  {
255  fpUserSteppingAction->UserSteppingAction(fpStep);
256  }
257  G4UserSteppingAction* regionalAction
258  = fpStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetRegion()
259  ->GetRegionalSteppingAction();
260  if( regionalAction ) regionalAction->UserSteppingAction(fpStep);
261 ***/
262  fpTrackingManager->AppendStep(fpTrack,fpStep);
263  // Stepping process finish. Return the value of the StepStatus.
264 
265  // return fpState->fStepStatus;
266 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
void SetStepLength(G4double value)
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
void SetProcessDefinedStep(const G4VProcess *aValue)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetStepLength() const
const G4ThreeVector & GetPosition() const
G4TrackStatus GetTrackStatus() const
void SetStepStatus(const G4StepStatus aValue)
const G4String & GetParticleName() const
G4ITNavigatorState_Lock * GetNavigatorState()
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
const G4ThreeVector & GetPosition() const
void SetStepLength(G4double value)
G4ITNavigatorState_Lock * GetNavigatorState() const
G4int GetTrackID() const
const G4TouchableHandle & GetTouchableHandle() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
const G4ThreeVector & GetMomentumDirection() const
void IncrementCurrentStepNumber()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4StepPoint * GetPostStepPoint() const
void SetNavigatorState(G4ITNavigatorState_Lock *)
void SetNavigatorState(G4ITNavigatorState_Lock *)
#define G4endl
Definition: G4ios.hh:61
void AddTrackLength(const G4double aValue)
double G4double
Definition: G4Types.hh:76
void SetSafety(const G4double aValue)
virtual void AppendStep(G4Track *track, G4Step *step)
void G4ITStepProcessor::FindTransportationStep ( )

Definition at line 463 of file G4ITStepProcessor2.cc.

References G4ITTransportation::ComputeStep(), DBL_MAX, FatalErrorInArgument, fStopAndKill, G4Exception(), G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), G4IT::GetTrack(), and G4VITProcess::SetProcessState().

Referenced by DoStepping().

464 {
465  double physicalStep(0.) ;
466 
467  fpTransportation = fpProcessInfo->fpTransportation;
468  // dynamic_cast<G4ITTransportation*>((fpProcessInfo->fpAlongStepGetPhysIntVector)[MAXofAlongStepLoops-1]);
469 
470  if(!fpTrack)
471  {
472  G4ExceptionDescription exceptionDescription ;
473  exceptionDescription
474  << "No G4ITStepProcessor::fpTrack found";
475  G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0013",
476  FatalErrorInArgument,exceptionDescription);
477  return;
478 
479  }
480  if(!fpITrack)
481  {
482  G4ExceptionDescription exceptionDescription ;
483  exceptionDescription
484  << "No G4ITStepProcessor::fITrack" ;
485  G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0014",
486  FatalErrorInArgument,exceptionDescription);
487  return;
488  }
489  if(!(fpITrack->GetTrack()))
490  {
491  G4ExceptionDescription exceptionDescription ;
492  exceptionDescription
493  << "No G4ITStepProcessor::fITrack->GetTrack()" ;
494  G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0015",
495  FatalErrorInArgument,exceptionDescription);
496  return;
497  }
498 
499  if(fpTransportation)
500  {
501  fpTransportation->SetProcessState(fpTrackingInfo->GetProcessState(fpTransportation->GetProcessID()));
502  fpTransportation->ComputeStep(*fpTrack, *fpStep, fTimeStep, physicalStep) ;
503  fpTransportation->SetProcessState(0);
504  }
505 
506  if(physicalStep >= DBL_MAX)
507  {
508  fpTrack -> SetTrackStatus(fStopAndKill) ;
509  return ;
510  }
511 
512  fpState->fPhysicalStep = physicalStep ;
513 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ProcessState_Lock * GetProcessState(size_t index)
G4Track * GetTrack()
Definition: G4IT.hh:208
#define DBL_MAX
Definition: templates.hh:83
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
void G4ITStepProcessor::ForceReInitialization ( )

Definition at line 164 of file G4ITStepProcessor.cc.

References ClearProcessInfo(), and Initialize().

165 {
166  fInitialized = false;
168  Initialize();
169 }
virtual void Initialize()
void G4ITStepProcessor::GetAtRestIL ( )
protected

Definition at line 459 of file G4ITStepProcessor.cc.

References G4VProcess::AtRestGPIL(), DBL_MAX, Forced, G4cerr, G4endl, G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), InActivated, NotForced, and G4VITProcess::SetProcessState().

Referenced by DoDefinePhysicalStepLength().

460 {
461  // Select the rest process which has the shortest time before
462  // it is invoked. In rest processes, GPIL()
463  // returns the time before a process occurs.
464  G4double lifeTime (DBL_MAX), shortestLifeTime (DBL_MAX);
465 
466  fAtRestDoItProcTriggered = 0;
467  shortestLifeTime = DBL_MAX;
468 
469  unsigned int NofInactiveProc=0;
470 
471  for( size_t ri=0 ; ri < fpProcessInfo->MAXofAtRestLoops ; ri++ )
472  {
473  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAtRestGetPhysIntVector)[ri];
474  if (fpCurrentProcess== 0)
475  {
476  (fpState->fSelectedAtRestDoItVector)[ri] = InActivated;
477  NofInactiveProc++;
478  continue;
479  } // NULL means the process is inactivated by a user on fly.
480 
481  fCondition=NotForced;
482  fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
483  lifeTime = fpCurrentProcess->AtRestGPIL( *fpTrack, &fCondition );
484  fpCurrentProcess->SetProcessState(0);
485 
486  if(fCondition==Forced)
487  {
488  (fpState->fSelectedAtRestDoItVector)[ri] = Forced;
489  }
490  else
491  {
492  (fpState->fSelectedAtRestDoItVector)[ri] = InActivated;
493  if(lifeTime < shortestLifeTime )
494  {
495  shortestLifeTime = lifeTime;
496  fAtRestDoItProcTriggered = G4int(ri);
497  (fpState->fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced;
498  }
499  }
500  }
501 
502  fTimeStep = shortestLifeTime ;
503 
504  // at least one process is necessary to destroy the particle
505  // exit with warning
506  if(NofInactiveProc==fpProcessInfo->MAXofAtRestLoops)
507  {
508  G4cerr << "ERROR - G4ITStepProcessor::InvokeAtRestDoItProcs()" << G4endl
509  << " No AtRestDoIt process is active!" << G4endl;
510  }
511 }
int G4int
Definition: G4Types.hh:78
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
Definition: G4VProcess.hh:490
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4ProcessState_Lock * GetProcessState(size_t index)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
G4GLOB_DLL std::ostream G4cerr
double G4ITStepProcessor::GetInteractionTime ( )
inline

Definition at line 359 of file G4ITStepProcessor.hh.

360 {
361  return fTimeStep ;
362 }
void G4ITStepProcessor::GetProcessInfo ( )
protected

Definition at line 414 of file G4ITStepProcessor.cc.

References FatalErrorInArgument, G4Exception(), G4Track::GetDefinition(), G4ParticleDefinition::GetProcessManager(), and SetupGeneralProcessInfo().

Referenced by SetupMembers().

415 {
416  G4ParticleDefinition* particle = fpTrack->GetDefinition();
417  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
418 
419  if(it == fProcessGeneralInfoMap.end())
420  {
422  if(fpProcessInfo == 0)
423  {
424  G4ExceptionDescription exceptionDescription ("...");
425  G4Exception("G4ITStepProcessor::GetProcessNumber","ITStepProcessor0008",
426  FatalErrorInArgument,exceptionDescription);
427  return;
428  }
429  }
430  else
431  {
432  fpProcessInfo = it->second;
433  }
434 }
G4ParticleDefinition * GetDefinition() const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4ProcessManager * GetProcessManager() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)
G4TrackVector* G4ITStepProcessor::GetSecondaries ( )
inline

Definition at line 97 of file G4ITStepProcessor.hh.

97 {return fpSecondary;}
G4Step* G4ITStepProcessor::GetStep ( )
inline

Definition at line 93 of file G4ITStepProcessor.hh.

Referenced by SetTrack().

93 {return fpStep;}
const G4Step* G4ITStepProcessor::GetStep ( ) const
inline

Definition at line 94 of file G4ITStepProcessor.hh.

94 {return fpStep;}
G4Track* G4ITStepProcessor::GetTrack ( )
inline

Definition at line 92 of file G4ITStepProcessor.hh.

92 {return fpTrack;}
const G4Track * G4ITStepProcessor::GetTrack ( ) const
inline

Definition at line 309 of file G4ITStepProcessor.hh.

310 {
311  return fpTrack;
312 }
G4ITTrackingManager* G4ITStepProcessor::GetTrackingManager ( )
inline

Definition at line 99 of file G4ITStepProcessor.hh.

99 {return fpTrackingManager;}
void G4ITStepProcessor::InitDefineStep ( )
protected

Definition at line 617 of file G4ITStepProcessor.cc.

References G4Step::CopyPostToPreStepPoint(), G4ITNavigator::CreateTouchableHistory(), G4Track::GetMomentumDirection(), G4TrackingInformation::GetNavigatorState(), G4Track::GetNextTouchableHandle(), G4StepPoint::GetPhysicalVolume(), G4Track::GetPosition(), G4Step::GetPreStepPoint(), G4VPhysicalVolume::GetRegularStructureId(), G4Track::GetStepLength(), G4Track::GetTouchableHandle(), G4IT::GetTrackingInfo(), G4VTouchable::GetVolume(), G4ITNavigator::NewNavigatorState(), G4Step::NewSecondaryVector(), G4ITNavigator::ResetHierarchyAndLocate(), G4Step::ResetTotalEnergyDeposit(), SetInitialStep(), G4ITNavigator::SetNavigatorState(), G4Track::SetNextTouchableHandle(), G4Step::SetPointerToVectorOfAuxiliaryPoints(), G4Track::SetStep(), G4TrackingInformation::SetStepProcessorState(), G4Track::SetTouchableHandle(), and SetupMembers().

Referenced by DoDefinePhysicalStepLength().

618 {
619 
620  if(!fpStep)
621  {
622 
623  // Create new Step and give it to the track
624  fpStep = new G4Step();
625  fpTrack->SetStep(fpStep);
626  fpSecondary = fpStep->NewSecondaryVector();
627 
628  // Create new state and set it in the trackingInfo
629  fpState = new G4ITStepProcessorState();
631 
632  SetupMembers();
633  fpNavigator->NewNavigatorState();
634 
635  SetInitialStep();
636  }
637  else
638  {
639  SetupMembers();
640 
641  fpState->fPreviousStepSize = fpTrack->GetStepLength();
642 /***
643  // Send G4Step information to Hit/Dig if the volume is sensitive
644  fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
645  StepControlFlag = fpStep->GetControlFlag();
646  if( fpCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation)
647  {
648  fpSensitive = fpStep->GetPreStepPoint()->
649  GetSensitiveDetector();
650 
651  // if( fSensitive != 0 ) {
652  // fSensitive->Hit(fStep);
653  // }
654  }
655 ***/
656  // Store last PostStepPoint to PreStepPoint, and swap current and next
657  // volume information of G4Track. Reset total energy deposit in one Step.
658  fpStep->CopyPostToPreStepPoint();
659  fpStep->ResetTotalEnergyDeposit();
660 
661  //JA Set the volume before it is used (in DefineStepLength() for User Limit)
662  fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
663 /*
664  G4cout << G4endl;
665  G4cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << G4endl;
666  G4cout << "PreStepPoint Volume : " << fpCurrentVolume->GetName() << G4endl;
667  G4cout << "Track Touchable : " << fpTrack->GetTouchableHandle()->GetVolume()->GetName() << G4endl;
668  G4cout << "Track NextTouchable : " << fpTrack->GetNextTouchableHandle()->GetVolume()->GetName() << G4endl;
669 */
670  // Reset the step's auxiliary points vector pointer
672 
673  // Switch next touchable in track to current one
674  fpTrack->SetTouchableHandle(fpTrack->GetNextTouchableHandle());
675  fpState->fTouchableHandle = fpTrack->GetTouchableHandle();
676  fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
677  G4VPhysicalVolume* oldTopVolume= fpTrack->GetTouchableHandle()->GetVolume();
678  fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
679 
680  G4VPhysicalVolume* newTopVolume=
681  fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
682  fpTrack->GetMomentumDirection(),
683  *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
684 
685  // G4cout << "New Top Volume : " << newTopVolume->GetName() << G4endl;
686 
687  if(newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId() == 1 )
688  {
689  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
690  fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
691  fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
692  }
693 
694  fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
695  }
696 }
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
void SetStepProcessorState(G4ITStepProcessorState_Lock *)
const G4ThreeVector & GetPosition() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
Definition: G4Step.hh:237
G4StepPoint * GetPreStepPoint() const
G4TrackVector * NewSecondaryVector()
G4VPhysicalVolume * GetPhysicalVolume() const
virtual G4int GetRegularStructureId() const =0
void ResetTotalEnergyDeposit()
const G4TouchableHandle & GetNextTouchableHandle() const
G4ITNavigatorState_Lock * GetNavigatorState() const
Definition: G4Step.hh:76
const G4TouchableHandle & GetTouchableHandle() const
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
const G4ThreeVector & GetMomentumDirection() const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
void SetNavigatorState(G4ITNavigatorState_Lock *)
G4TouchableHistory * CreateTouchableHistory() const
void NewNavigatorState()
void SetStep(const G4Step *aValue)
G4double GetStepLength() const
void CopyPostToPreStepPoint()
void G4ITStepProcessor::Initialize ( )
virtual

Definition at line 173 of file G4ITStepProcessor.cc.

References CleanProcessor(), DBL_MAX, G4GeometryTolerance::GetInstance(), G4GeometryTolerance::GetSurfaceTolerance(), G4ITTransportationManager::GetTransportationManager(), and SetNavigator().

Referenced by ForceReInitialization().

174 {
175  CleanProcessor();
176  if(fInitialized) return;
177  // ActiveOnlyITProcess();
178 
180  ->GetNavigatorForTracking());
181 
182  fPhysIntLength = DBL_MAX;
183  kCarTolerance = 0.5*G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
184 
185  fInitialized = true;
186 }
void SetNavigator(G4ITNavigator *value)
G4double GetSurfaceTolerance() const
static G4ITTransportationManager * GetTransportationManager()
#define DBL_MAX
Definition: templates.hh:83
static G4GeometryTolerance * GetInstance()
void G4ITStepProcessor::InvokeAlongStepDoItProcs ( )
protected

Definition at line 324 of file G4ITStepProcessor2.cc.

References G4VProcess::AlongStepDoIt(), G4VParticleChange::Clear(), DBL_MIN, DealWithSecondaries(), fAlive, fExclusivelyForcedProc, fStopAndKill, fStopButAlive, G4Track::GetKineticEnergy(), G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), G4VParticleChange::GetTrackStatus(), G4Track::GetTrackStatus(), G4VITProcess::SetProcessState(), G4Track::SetTrackStatus(), G4VParticleChange::UpdateStepForAlongStep(), and G4Step::UpdateTrack().

Referenced by DoStepping().

325 {
326 
327  // If the current Step is defined by a 'ExclusivelyForced'
328  // PostStepDoIt, then don't invoke any AlongStepDoIt
329  if(fpState->fStepStatus == fExclusivelyForcedProc)
330  {
331  return; // Take note 'return' at here !!!
332  }
333 
334  // Invoke the all active continuous processes
335  for( size_t ci=0 ; ci<fpProcessInfo->MAXofAlongStepLoops ; ci++ )
336  {
337  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAlongStepDoItVector)[ci];
338  if (fpCurrentProcess== 0) continue;
339  // NULL means the process is inactivated by a user on fly.
340 
341  fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
342  fpParticleChange
343  = fpCurrentProcess->AlongStepDoIt( *fpTrack, *fpStep );
344  fpCurrentProcess->SetProcessState(0);
345  // Update the PostStepPoint of Step according to ParticleChange
346 
347  fpParticleChange->UpdateStepForAlongStep(fpStep);
348 
349  // Now Store the secondaries from ParticleChange to SecondaryList
350  DealWithSecondaries(fN2ndariesAlongStepDoIt) ;
351 
352  // Set the track status according to what the process defined
353  // if kinetic energy >0, otherwise set fStopButAlive
354  fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
355 
356  // clear ParticleChange
357  fpParticleChange->Clear();
358  }
359 
360  fpStep->UpdateTrack();
361 
362  G4TrackStatus fNewStatus = fpTrack->GetTrackStatus();
363 
364  if ( fNewStatus == fAlive && fpTrack->GetKineticEnergy() <= DBL_MIN )
365  {
366  // G4cout << "G4ITStepProcessor::InvokeAlongStepDoItProcs : Track will be killed" << G4endl;
367  if(fpProcessInfo->MAXofAtRestLoops>0) fNewStatus = fStopButAlive;
368  else fNewStatus = fStopAndKill;
369  fpTrack->SetTrackStatus( fNewStatus );
370  }
371 
372 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
virtual G4Step * UpdateStepForAlongStep(G4Step *Step)
G4TrackStatus GetTrackStatus() const
void UpdateTrack()
G4double GetKineticEnergy() const
void DealWithSecondaries(G4int &)
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4ProcessState_Lock * GetProcessState(size_t index)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0
#define DBL_MIN
Definition: templates.hh:75
G4TrackStatus GetTrackStatus() const
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
G4TrackStatus
void G4ITStepProcessor::InvokeAtRestDoItProcs ( )
protected

Definition at line 274 of file G4ITStepProcessor2.cc.

References G4VProcess::AtRestDoIt(), G4VParticleChange::Clear(), DealWithSecondaries(), fStopAndKill, G4Step::GetPostStepPoint(), G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), InActivated, G4StepPoint::SetProcessDefinedStep(), G4VITProcess::SetProcessState(), G4Step::SetStepLength(), G4Track::SetStepLength(), G4Track::SetTrackStatus(), G4VParticleChange::UpdateStepForAtRest(), and G4Step::UpdateTrack().

Referenced by DoStepping().

275 {
276  fpStep->SetStepLength( 0. ); //the particle has stopped
277  fpTrack->SetStepLength( 0. );
278 
279  G4SelectedAtRestDoItVector& selectedAtRestDoItVector = fpState->fSelectedAtRestDoItVector;
280 
281  // invoke selected process
282  for(size_t np=0; np < fpProcessInfo->MAXofAtRestLoops; np++)
283  {
284  //
285  // Note: DoItVector has inverse order against GetPhysIntVector
286  // and SelectedAtRestDoItVector.
287  //
288  if( selectedAtRestDoItVector[fpProcessInfo->MAXofAtRestLoops-np-1] != InActivated)
289  {
290  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAtRestDoItVector)[np];
291 
292  fpCurrentProcess->SetProcessState(
293  fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
294  fpParticleChange
295  = fpCurrentProcess->AtRestDoIt( *fpTrack, *fpStep);
296  fpCurrentProcess->SetProcessState(0);
297 
298  // Set the current process as a process which defined this Step length
299  fpStep->GetPostStepPoint()
300  ->SetProcessDefinedStep(fpCurrentProcess);
301 
302  // Update Step
303  fpParticleChange->UpdateStepForAtRest(fpStep);
304 
305  // Now Store the secondaries from ParticleChange to SecondaryList
306  DealWithSecondaries(fN2ndariesAtRestDoIt) ;
307 
308  // clear ParticleChange
309  fpParticleChange->Clear();
310 
311  } //if(fSelectedAtRestDoItVector[np] != InActivated){
312  } //for(size_t np=0; np < MAXofAtRestLoops; np++){
313  fpStep->UpdateTrack();
314 
315  fpTrack->SetTrackStatus( fStopAndKill );
316 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStepLength(G4double value)
void SetProcessDefinedStep(const G4VProcess *aValue)
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
void UpdateTrack()
void SetStepLength(G4double value)
void DealWithSecondaries(G4int &)
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4ProcessState_Lock * GetProcessState(size_t index)
G4StepPoint * GetPostStepPoint() const
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
virtual G4Step * UpdateStepForAtRest(G4Step *Step)
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
void G4ITStepProcessor::InvokePostStepDoItProcs ( )
protected

Definition at line 382 of file G4ITStepProcessor2.cc.

References ExclusivelyForced, fExclusivelyForcedProc, Forced, fPostStepDoItProc, fStopAndKill, G4Track::GetTrackStatus(), InActivated, InvokePSDIP(), NotForced, and StronglyForced.

Referenced by DoStepping().

383 {
384 
385  G4SelectedPostStepDoItVector& selectedPostStepDoItVector = fpState->fSelectedPostStepDoItVector;
386  G4StepStatus& stepStatus = fpState->fStepStatus;
387 
388  // Invoke the specified discrete processes
389  for(size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
390  {
391  //
392  // Note: DoItVector has inverse order against GetPhysIntVector
393  // and SelectedPostStepDoItVector.
394  //
395  G4int Cond = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np-1];
396  if(Cond != InActivated)
397  {
398  if( ((Cond == NotForced) && (stepStatus == fPostStepDoItProc)) ||
399  ((Cond == Forced) && (stepStatus != fExclusivelyForcedProc)) ||
400  // ((Cond == Conditionally) && (stepStatus == fAlongStepDoItProc)) ||
401  ((Cond == ExclusivelyForced) && (stepStatus == fExclusivelyForcedProc)) ||
402  ((Cond == StronglyForced) )
403  )
404  {
405 
406  InvokePSDIP(np);
407  }
408  } //if(*fSelectedPostStepDoItVector(np)........
409 
410  // Exit from PostStepLoop if the track has been killed,
411  // but extra treatment for processes with Strongly Forced flag
412  if(fpTrack->GetTrackStatus() == fStopAndKill)
413  {
414  for(size_t np1=np+1; np1 < fpProcessInfo->MAXofPostStepLoops; np1++)
415  {
416  G4int Cond2 = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np1-1];
417  if (Cond2 == StronglyForced)
418  {
419  InvokePSDIP(np1);
420  }
421  }
422  break;
423  }
424  } //for(size_t np=0; np < MAXofPostStepLoops; np++){
425 }
G4TrackStatus GetTrackStatus() const
int G4int
Definition: G4Types.hh:78
G4StepStatus
Definition: G4StepStatus.hh:49
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
void G4ITStepProcessor::InvokePSDIP ( size_t  np)
protected

Definition at line 429 of file G4ITStepProcessor2.cc.

References CalculateSafety(), G4VParticleChange::Clear(), DealWithSecondaries(), G4Step::GetPostStepPoint(), G4VITProcess::GetProcessID(), G4TrackingInformation::GetProcessState(), G4VParticleChange::GetTrackStatus(), G4VProcess::PostStepDoIt(), G4VITProcess::SetProcessState(), G4StepPoint::SetSafety(), G4Track::SetTrackStatus(), G4VParticleChange::UpdateStepForPostStep(), and G4Step::UpdateTrack().

Referenced by InvokePostStepDoItProcs(), and InvokeTransportationProc().

430 {
431  fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpPostStepDoItVector)[np];
432 
433  fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
434  fpParticleChange
435  = fpCurrentProcess->PostStepDoIt( *fpTrack, *fpStep);
436  fpCurrentProcess->SetProcessState(0);
437 
438  // Update PostStepPoint of Step according to ParticleChange
439  fpParticleChange->UpdateStepForPostStep(fpStep);
440 
441  // Update G4Track according to ParticleChange after each PostStepDoIt
442  fpStep->UpdateTrack();
443 
444  // Update safety after each invocation of PostStepDoIts
446 
447  // Now Store the secondaries from ParticleChange to SecondaryList
448  DealWithSecondaries(fN2ndariesPostStepDoIt) ;
449 
450  // Set the track status according to what the process defined
451  fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
452 
453  // clear ParticleChange
454  fpParticleChange->Clear();
455 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void UpdateTrack()
void DealWithSecondaries(G4int &)
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4ProcessState_Lock * GetProcessState(size_t index)
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
virtual G4Step * UpdateStepForPostStep(G4Step *Step)
void SetSafety(const G4double aValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
void G4ITStepProcessor::InvokeTransportationProc ( )
protected

Definition at line 517 of file G4ITStepProcessor2.cc.

References ExclusivelyForced, fExclusivelyForcedProc, Forced, fStopAndKill, G4Track::GetTrackStatus(), InActivated, InvokePSDIP(), and StronglyForced.

Referenced by DoStepping().

518 {
519  size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
520  G4SelectedPostStepDoItVector& selectedPostStepDoItVector = fpState->fSelectedPostStepDoItVector;
521  G4StepStatus& stepStatus = fpState->fStepStatus;
522 
523  // Invoke the specified discrete processes
524  for(size_t np=0; np < _MAXofPostStepLoops; np++)
525  {
526  //
527  // Note: DoItVector has inverse order against GetPhysIntVector
528  // and SelectedPostStepDoItVector.
529  //
530  G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops-np-1];
531  if(Cond != InActivated)
532  {
533  if(
534  ((Cond == Forced) && (stepStatus != fExclusivelyForcedProc)) ||
535  // ((Cond == Conditionally) && (stepStatus == fAlongStepDoItProc)) ||
536  ((Cond == ExclusivelyForced) && (stepStatus == fExclusivelyForcedProc)) ||
537  ((Cond == StronglyForced) )
538  )
539  {
540 
541  InvokePSDIP(np);
542  }
543  } //if(*fSelectedPostStepDoItVector(np)........
544 
545  // Exit from PostStepLoop if the track has been killed,
546  // but extra treatment for processes with Strongly Forced flag
547  if(fpTrack->GetTrackStatus() == fStopAndKill)
548  {
549  for(size_t np1=np+1; np1 < _MAXofPostStepLoops; np1++)
550  {
551  G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops-np1-1];
552  if (Cond2 == StronglyForced)
553  {
554  InvokePSDIP(np1);
555  }
556  }
557  break;
558  }
559  }
560 }
G4TrackStatus GetTrackStatus() const
int G4int
Definition: G4Types.hh:78
G4StepStatus
Definition: G4StepStatus.hh:49
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
G4ITStepProcessor & G4ITStepProcessor::operator= ( const G4ITStepProcessor other)
protected

Definition at line 224 of file G4ITStepProcessor.cc.

225 {
226  if (this == &rhs) return *this; // handle self assignment
227  //assignment operator
228  return *this;
229 }
void G4ITStepProcessor::ResetSecondaries ( )
protected

Definition at line 450 of file G4ITStepProcessor.cc.

Referenced by G4ITStepProcessor(), and SetupMembers().

451 {
452  // Reset the secondary particles
453  fN2ndariesAtRestDoIt = 0;
454  fN2ndariesAlongStepDoIt = 0;
455  fN2ndariesPostStepDoIt = 0;
456 }
void G4ITStepProcessor::SetInitialStep ( )
protected

Definition at line 522 of file G4ITStepProcessor.cc.

References G4ITNavigator::CreateTouchableHistory(), fAlive, FatalException, fPostponeToNextEvent, fStopAndKill, fStopButAlive, fSuspend, fUndefined, G4cerr, G4cout, G4endl, G4Exception(), G4Track::GetCurrentStepNumber(), G4Track::GetKineticEnergy(), G4VPhysicalVolume::GetLogicalVolume(), G4Track::GetMomentumDirection(), G4Track::GetParentID(), G4Track::GetPosition(), G4VPhysicalVolume::GetRegularStructureId(), G4Track::GetTouchableHandle(), G4Track::GetTrackStatus(), G4VTouchable::GetVolume(), G4Track::GetVolume(), G4Step::InitializeStep(), G4ITNavigator::LocateGlobalPointAndSetup(), G4ITNavigator::ResetHierarchyAndLocate(), G4Track::SetLogicalVolumeAtVertex(), G4Track::SetNextTouchableHandle(), G4Track::SetTouchableHandle(), G4Track::SetTrackStatus(), G4Track::SetVertexKineticEnergy(), G4Track::SetVertexMomentumDirection(), G4Track::SetVertexPosition(), and G4ITTrackingManager::StartTracking().

Referenced by InitDefineStep().

523 {
524  // DEBUG
525  // G4cout << "SetInitialStep for : " << fpITrack-> GetName() << G4endl;
526  //________________________________________________________
527  // Initialize geometry
528 
529 
530  if ( ! fpTrack->GetTouchableHandle())
531  {
532  G4ThreeVector direction= fpTrack->GetMomentumDirection();
533  fpNavigator->LocateGlobalPointAndSetup( fpTrack->GetPosition(),
534  &direction, false, false );
535  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
536 
537  fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
538  fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
539  }
540  else
541  {
542  fpState->fTouchableHandle = fpTrack->GetTouchableHandle();
543  fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
544  G4VPhysicalVolume* oldTopVolume= fpTrack->GetTouchableHandle()->GetVolume();
545  G4VPhysicalVolume* newTopVolume=
546  fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
547  fpTrack->GetMomentumDirection(),
548  *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
549  if(newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId() == 1 )
550  {
551  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
552  fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
553  fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
554  }
555  }
556 
557  fpCurrentVolume = fpState->fTouchableHandle->GetVolume();
558 
559  //________________________________________________________
560  // If the primary track has 'Suspend' or 'PostponeToNextEvent' state,
561  // set the track state to 'Alive'.
562  if( (fpTrack->GetTrackStatus()==fSuspend) ||
563  (fpTrack->GetTrackStatus()==fPostponeToNextEvent) )
564  {
565  fpTrack->SetTrackStatus(fAlive);
566  }
567 
568  // If the primary track has 'zero' kinetic energy, set the track
569  // state to 'StopButAlive'.
570  if(fpTrack->GetKineticEnergy() <= 0.0)
571  {
572  fpTrack->SetTrackStatus( fStopButAlive );
573  }
574  //________________________________________________________
575  // Set vertex information of G4Track at here
576  if ( fpTrack->GetCurrentStepNumber() == 0 )
577  {
578  fpTrack->SetVertexPosition( fpTrack->GetPosition() );
579  fpTrack->SetVertexMomentumDirection( fpTrack->GetMomentumDirection() );
580  fpTrack->SetVertexKineticEnergy( fpTrack->GetKineticEnergy() );
581  fpTrack->SetLogicalVolumeAtVertex( fpTrack->GetVolume()->GetLogicalVolume() );
582  }
583  //________________________________________________________
584  // If track is already outside the world boundary, kill it
585  if( fpCurrentVolume==0 )
586  {
587  // If the track is a primary, stop processing
588  if(fpTrack->GetParentID()==0)
589  {
590  G4cerr << "ERROR - G4ITStepProcessor::SetInitialStep()" << G4endl
591  << " Primary particle starting at - "
592  << fpTrack->GetPosition()
593  << " - is outside of the world volume." << G4endl;
594  G4Exception("G4ITStepProcessor::SetInitialStep()", "ITStepProcessor0011",
595  FatalException, "Primary vertex outside of the world!");
596  }
597 
598  fpTrack->SetTrackStatus( fStopAndKill );
599  G4cout << "WARNING - G4ITStepProcessor::SetInitialStep()" << G4endl
600  << " Initial track position is outside world! - "
601  << fpTrack->GetPosition() << G4endl;
602  }
603  else{
604  // Initial set up for attribues of 'Step'
605  fpStep->InitializeStep( fpTrack );
606  }
607 
608 
609  if( fpTrack->GetTrackStatus() == fStopAndKill ) return ;
610 
611  fpTrackingManager->StartTracking(fpTrack);
612 
613  fpState->fStepStatus = fUndefined;
614 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4int GetParentID() const
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
const G4ThreeVector & GetPosition() const
G4TrackStatus GetTrackStatus() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual void StartTracking(G4Track *)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4int GetCurrentStepNumber() const
virtual G4int GetRegularStructureId() const =0
void SetVertexKineticEnergy(const G4double aValue)
const G4TouchableHandle & GetTouchableHandle() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
void SetVertexPosition(const G4ThreeVector &aValue)
G4VPhysicalVolume * GetVolume() const
#define G4endl
Definition: G4ios.hh:61
void InitializeStep(G4Track *aValue)
G4TouchableHistory * CreateTouchableHistory() const
G4GLOB_DLL std::ostream G4cerr
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
void G4ITStepProcessor::SetNavigator ( G4ITNavigator value)
inlineprotected

Definition at line 321 of file G4ITStepProcessor.hh.

Referenced by Initialize().

322 {
323  fpNavigator = value;
324 }
const XML_Char int const XML_Char * value
void G4ITStepProcessor::SetPreviousStepTime ( G4double  previousTimeStep)
inline

Definition at line 304 of file G4ITStepProcessor.hh.

305 {
306  fPreviousTimeStep = previousTimeStep;
307 }
void G4ITStepProcessor::SetStep ( G4Step val)
inline

Definition at line 95 of file G4ITStepProcessor.hh.

95 {fpStep = val;}
void G4ITStepProcessor::SetTrack ( G4Track track)
protected

Definition at line 384 of file G4ITStepProcessor.cc.

References FatalErrorInArgument, G4cerr, G4endl, G4Exception(), GetIT(), GetStep(), G4Track::GetTrackID(), and G4IT::GetTrackingInfo().

Referenced by DefinePhysicalStepLength(), and Stepping().

385 {
386  fpTrack = track ;
387  if(fpTrack)
388  {
389  fpITrack = GetIT(fpTrack) ;
390  fpStep = const_cast<G4Step*>(fpTrack -> GetStep());
391 
392  if(fpITrack)
393  {
394  fpTrackingInfo = fpITrack->GetTrackingInfo() ;
395  }
396  else
397  {
398  fpTrackingInfo = 0;
399  G4cerr << "Track ID : " << fpTrack->GetTrackID() << G4endl;
400 
401  G4ExceptionDescription exceptionDescription ("No IT pointer was attached to the track you try to process.");
402  G4Exception("G4ITStepProcessor::SetTrack","ITStepProcessor0007",
403  FatalErrorInArgument,exceptionDescription);
404  }
405  }
406  else
407  {
408  fpITrack = 0;
409  fpStep = 0 ;
410  }
411 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
Definition: G4Step.hh:76
G4int GetTrackID() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ITStepProcessor::SetTrackingManager ( G4ITTrackingManager trackMan)
inline

Definition at line 98 of file G4ITStepProcessor.hh.

98 {fpTrackingManager = trackMan;}
void G4ITStepProcessor::SetupGeneralProcessInfo ( G4ParticleDefinition particle,
G4ProcessManager pm 
)
protected

Definition at line 283 of file G4ITStepProcessor.cc.

References G4ProcessVector::entries(), FatalErrorInArgument, FatalException, G4cerr, G4cout, G4endl, G4Exception(), G4ProcessManager::GetAlongStepProcessVector(), G4ProcessManager::GetAtRestProcessVector(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGEncoding(), G4ProcessManager::GetPostStepProcessVector(), typeDoIt, and typeGPIL.

Referenced by GetProcessInfo().

285 {
286 
287 #ifdef debug
288  G4cout<<"G4ITStepProcessor::GetProcessNumber: is called track"<<G4endl;
289 #endif
290  if(!pm)
291  {
292  G4cerr << "ERROR - G4SteppingManager::GetProcessNumber()" << G4endl
293  << " ProcessManager is NULL for particle = "
294  << particle->GetParticleName() << ", PDG_code = "
295  << particle->GetPDGEncoding() << G4endl;
296  G4Exception("G4SteppingManager::GetProcessNumber()", "ITStepProcessor0002",
297  FatalException, "Process Manager is not found.");
298  return;
299  }
300 
301  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
302  if(it != fProcessGeneralInfoMap.end())
303  {
304  G4Exception("G4SteppingManager::SetupGeneralProcessInfo()", "ITStepProcessor0003",
305  FatalException, "Process info already registered.");
306  return;
307  }
308 
309  // here used as temporary
310  fpProcessInfo = new ProcessGeneralInfo();
311 
312  // AtRestDoits
313  fpProcessInfo->MAXofAtRestLoops = pm->GetAtRestProcessVector()->entries();
314  fpProcessInfo->fpAtRestDoItVector = pm->GetAtRestProcessVector(typeDoIt);
315  fpProcessInfo->fpAtRestGetPhysIntVector = pm->GetAtRestProcessVector(typeGPIL);
316 #ifdef debug
317  G4cout << "G4ITStepProcessor::GetProcessNumber: #ofAtRest="
318  << fpProcessInfo->MAXofAtRestLoops << G4endl;
319 #endif
320 
321  // AlongStepDoits
322  fpProcessInfo->MAXofAlongStepLoops = pm->GetAlongStepProcessVector()->entries();
323  fpProcessInfo->fpAlongStepDoItVector = pm->GetAlongStepProcessVector(typeDoIt);
324  fpProcessInfo->fpAlongStepGetPhysIntVector = pm->GetAlongStepProcessVector(typeGPIL);
325 #ifdef debug
326  G4cout << "G4ITStepProcessor::GetProcessNumber:#ofAlongStp="
327  << fpProcessInfo->MAXofAlongStepLoops << G4endl;
328 #endif
329 
330  // PostStepDoits
331  fpProcessInfo->MAXofPostStepLoops = pm->GetPostStepProcessVector()->entries();
332  fpProcessInfo->fpPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
333  fpProcessInfo->fpPostStepGetPhysIntVector = pm->GetPostStepProcessVector(typeGPIL);
334 #ifdef debug
335  G4cout << "G4ITStepProcessor::GetProcessNumber: #ofPostStep="
336  << fpProcessInfo->MAXofPostStepLoops << G4endl;
337 #endif
338 
339  if (SizeOfSelectedDoItVector<fpProcessInfo->MAXofAtRestLoops ||
340  SizeOfSelectedDoItVector<fpProcessInfo->MAXofAlongStepLoops ||
341  SizeOfSelectedDoItVector<fpProcessInfo->MAXofPostStepLoops )
342  {
343  G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
344  << " SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
345  << " ; is smaller then one of MAXofAtRestLoops= "
346  << fpProcessInfo->MAXofAtRestLoops << G4endl
347  << " or MAXofAlongStepLoops= " << fpProcessInfo->MAXofAlongStepLoops
348  << " or MAXofPostStepLoops= " << fpProcessInfo->MAXofPostStepLoops << G4endl;
349  G4Exception("G4ITStepProcessor::GetProcessNumber()",
350  "ITStepProcessor0004", FatalException,
351  "The array size is smaller than the actual No of processes.");
352  }
353 
354  if(!fpProcessInfo->fpAtRestDoItVector &&
355  !fpProcessInfo->fpAlongStepDoItVector &&
356  !fpProcessInfo->fpPostStepDoItVector)
357  {
358  G4ExceptionDescription exceptionDescription ;
359  exceptionDescription << "No DoIt process found " ;
360  G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0005",
361  FatalErrorInArgument,exceptionDescription);
362  return ;
363  }
364 
365  if(fpProcessInfo->fpAlongStepGetPhysIntVector && fpProcessInfo->MAXofAlongStepLoops>0)
366  {
367  fpProcessInfo->fpTransportation = dynamic_cast<G4ITTransportation*>
368  ((*fpProcessInfo->fpAlongStepGetPhysIntVector)[fpProcessInfo->MAXofAlongStepLoops-1]);
369 
370  if(fpProcessInfo->fpTransportation == 0)
371  {
372  G4ExceptionDescription exceptionDescription ;
373  exceptionDescription << "No transportation process found " ;
374  G4Exception("G4ITStepProcessor::SetupGeneralProcessInfo","ITStepProcessor0006",
375  FatalErrorInArgument,exceptionDescription);
376  }
377  }
378  fProcessGeneralInfoMap[particle] = fpProcessInfo;
379  // fpProcessInfo = 0;
380 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4String & GetParticleName() const
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int entries() const
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4GLOB_DLL std::ostream G4cerr
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void G4ITStepProcessor::SetupMembers ( )
protected

Definition at line 437 of file G4ITStepProcessor.cc.

References G4Step::GetfSecondary(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), GetProcessInfo(), G4TrackingInformation::GetStepProcessorState(), G4IT::GetTrackingInfo(), and ResetSecondaries().

Referenced by DoStepping(), and InitDefineStep().

438 {
439  fpSecondary = fpStep->GetfSecondary();
440  fpPreStepPoint = fpStep->GetPreStepPoint();
441  fpPostStepPoint = fpStep->GetPostStepPoint();
442 
443  fpState = (G4ITStepProcessorState*) fpITrack->GetTrackingInfo()->GetStepProcessorState();
444 
445  GetProcessInfo();
447 }
G4StepPoint * GetPreStepPoint() const
G4ITStepProcessorState_Lock * GetStepProcessorState()
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
G4TrackVector * GetfSecondary()
G4StepPoint * GetPostStepPoint() const
void G4ITStepProcessor::Stepping ( G4Track track,
const double &  timeStep 
)

Definition at line 94 of file G4ITStepProcessor2.cc.

References CleanProcessor(), DoStepping(), and SetTrack().

95 {
97  if(track == 0) return ; // maybe put an exception here
98  fTimeStep = timeStep ;
99  SetTrack(track);
100  DoStepping();
101 }
void SetTrack(G4Track *)
void G4ITStepProcessor::UpdateTrack ( G4Track )

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