Geant4  10.01.p03
G4ITStepProcessor.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4ITStepProcessor.cc 87375 2014-12-02 08:17:28Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // History:
31 // -----------
32 // 10 Oct 2011 M.Karamitros created
33 //
34 // -------------------------------------------------------------------
35 
36 #include "G4ITStepProcessor.hh"
37 #include "G4UImanager.hh"
38 #include "G4ForceCondition.hh"
39 #include "G4GPILSelection.hh"
41 // #include "G4VSensitiveDetector.hh" // Include from 'hits/digi'
42 #include "G4GeometryTolerance.hh"
43 #include "G4ParticleTable.hh"
44 #include "G4ITTrackingManager.hh"
45 #include "G4TrackingInformation.hh"
46 #include "G4IT.hh"
47 #include "G4ITNavigator.hh" // Include from 'geometry'
48 
49 #include "G4VITProcess.hh"
50 #include "G4VProcess.hh"
51 #include "G4ITTransportation.hh"
52 
53 #include <iomanip> // Include from 'system'
54 #include <vector> // Include from 'system'
55 
56 using namespace std;
57 
58 static const size_t SizeOfSelectedDoItVector = 100;
59 //static const size_t& gMaxNProcesses(G4VITProcess::GetMaxProcessIndex());
60 
61 //____________________________________________________________________________________
62 
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;
73  CleanProcessor();
74  ResetSecondaries();
75 }
76 
79 // fSelectedAtRestDoItVector (gMaxNProcesses,0),
80 // fSelectedPostStepDoItVector (gMaxNProcesses,0)
81  fSelectedAtRestDoItVector(G4VITProcess::GetMaxProcessIndex(), 0),
82  fSelectedPostStepDoItVector(G4VITProcess::GetMaxProcessIndex(), 0)
83 {
84  fPhysicalStep = -1.;
85  fPreviousStepSize = -1.;
86 
87  fSafety = -1.;
88  proposedSafety = -1.;
89  endpointSafety = -1;
90 
92 
93  fTouchableHandle = 0;
94 }
95 
96 // should not be used
99 // fSelectedAtRestDoItVector (gMaxNProcesses,0),
100 // fSelectedPostStepDoItVector (gMaxNProcesses,0)
101  fSelectedAtRestDoItVector(G4VITProcess::GetMaxProcessIndex(), 0),
102  fSelectedPostStepDoItVector(G4VITProcess::GetMaxProcessIndex(), 0)
103 {
104  fPhysicalStep = -1.;
105  fPreviousStepSize = -1.;
106 
107  fSafety = -1.;
108  proposedSafety = -1.;
109  endpointSafety = -1;
110 
112 
113  fTouchableHandle = 0;
114 }
115 
116 // should not be used
118 {
119  if (this == &rhs) return *this;
120 
121  fSelectedAtRestDoItVector.clear();
122 // fSelectedAtRestDoItVector.resize(gMaxNProcesses,0);
123  fSelectedAtRestDoItVector.resize(G4VITProcess::GetMaxProcessIndex(), 0);
124  fSelectedPostStepDoItVector.clear();
125 // fSelectedPostStepDoItVector.resize(gMaxNProcesses,0);
126  fSelectedPostStepDoItVector.resize(G4VITProcess::GetMaxProcessIndex(), 0);
127 
128  fPhysicalStep = -1.;
129  fPreviousStepSize = -1.;
130 
131  fSafety = -1.;
132  proposedSafety = -1.;
133  endpointSafety = -1;
134 
135  fStepStatus = fUndefined;
136 
137  fTouchableHandle = 0;
138  return *this;
139 }
140 //____________________________________________________________________________________
141 
143 {
144  ;
145 }
146 //____________________________________________________________________________________
147 
149 {
150  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it;
151 
152  for (it = fProcessGeneralInfoMap.begin(); it != fProcessGeneralInfoMap.end();
153  it++)
154  {
155  if (it->second)
156  {
157  delete it->second;
158  it->second = 0;
159  }
160  }
161 
162  fProcessGeneralInfoMap.clear();
163 }
164 
165 //____________________________________________________________________________________
166 
168 {
169  fInitialized = false;
171  Initialize();
172 }
173 
174 //____________________________________________________________________________________
175 
177 {
178  CleanProcessor();
179  if (fInitialized) return;
180  // ActiveOnlyITProcess();
181 
182  SetNavigator(
184  ->GetNavigatorForTracking());
185 
187  kCarTolerance = 0.5
189 
190  fInitialized = true;
191 }
192 //______________________________________________________________________________
193 
195 {
196  if (fpStep)
197  {
199  delete fpStep;
200  }
201 
202  if (fpSecondary) delete fpSecondary;
204  //G4ITTransportationManager::DeleteInstance();
205 
206  // if(fpUserSteppingAction) delete fpUserSteppingAction;
207 }
208 //______________________________________________________________________________
209 // should not be used
211 {
214 
215  // fpUserSteppingAction = 0 ;
216  fpTrackingManager = 0;
217  fpNavigator = 0;
218  fInitialized = false;
219 
221  fInitialized = false;
223 
224  CleanProcessor();
226 }
227 //______________________________________________________________________________
228 
230 {
231  if (this == &rhs) return *this; // handle self assignment
232  //assignment operator
233  return *this;
234 }
235 // ******************************************************************
236 
238 {
239  // Method not used for the time being
240 #ifdef debug
241  G4cout<<"G4ITStepProcessor::CloneProcesses: is called"<<G4endl;
242 #endif
243 
246  ->GetIterator();
247 
248  theParticleIterator->reset();
249  // TODO : Ne faire la boucle que sur les IT **** !!!
250  while ((*theParticleIterator)())
251  {
252  G4ParticleDefinition* particle = theParticleIterator->value();
253  G4ProcessManager* pm = particle->GetProcessManager();
254 
255  if (!pm)
256  {
257  G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl<< " ProcessManager is NULL for particle = "
258  << particle->GetParticleName() << ", PDG_code = "
259  << particle->GetPDGEncoding() << G4endl;
260  G4Exception("G4ITStepProcessor::GetProcessNumber()", "ITStepProcessor0001",
261  FatalException, "Process Manager is not found.");
262  return;
263  }
264 
266  }
267 }
268 // ******************************************************************
269 
271 {
272  // Method not used for the time being
273  G4ProcessVector* processVector = processManager->GetProcessList();
274 
275  G4VITProcess* itProcess = 0;
276  for (int i = 0; i < processVector->size(); i++)
277  {
278  G4VProcess* base_process = (*processVector)[i];
279  itProcess = dynamic_cast<G4VITProcess*>(base_process);
280 
281  if (!itProcess)
282  {
283  processManager->SetProcessActivation(base_process, false);
284  }
285  }
286 }
287 // ******************************************************************
289  G4ProcessManager* pm)
290 {
291 
292 #ifdef debug
293  G4cout<<"G4ITStepProcessor::GetProcessNumber: is called track"<<G4endl;
294 #endif
295  if (!pm)
296  {
297  G4cerr << "ERROR - G4SteppingManager::GetProcessNumber()" << G4endl<< " ProcessManager is NULL for particle = "
298  << particle->GetParticleName() << ", PDG_code = "
299  << particle->GetPDGEncoding() << G4endl;
300  G4Exception("G4SteppingManager::GetProcessNumber()", "ITStepProcessor0002",
301  FatalException, "Process Manager is not found.");
302  return;
303  }
304 
305  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
306  if(it != fProcessGeneralInfoMap.end())
307  {
308  G4Exception("G4SteppingManager::SetupGeneralProcessInfo()", "ITStepProcessor0003",
309  FatalException, "Process info already registered.");
310  return;
311  }
312 
313  // here used as temporary
315 
316  // AtRestDoits
320 #ifdef debug
321  G4cout << "G4ITStepProcessor::GetProcessNumber: #ofAtRest="
323 #endif
324 
325  // AlongStepDoits
329 #ifdef debug
330  G4cout << "G4ITStepProcessor::GetProcessNumber:#ofAlongStp="
332 #endif
333 
334  // PostStepDoits
338 #ifdef debug
339  G4cout << "G4ITStepProcessor::GetProcessNumber: #ofPostStep="
341 #endif
342 
343  if (SizeOfSelectedDoItVector<fpProcessInfo->MAXofAtRestLoops ||
344  SizeOfSelectedDoItVector<fpProcessInfo->MAXofAlongStepLoops ||
345  SizeOfSelectedDoItVector<fpProcessInfo->MAXofPostStepLoops )
346  {
347  G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
348  << " SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
349  << " ; is smaller then one of MAXofAtRestLoops= "
350  << fpProcessInfo->MAXofAtRestLoops << G4endl
351  << " or MAXofAlongStepLoops= " << fpProcessInfo->MAXofAlongStepLoops
352  << " or MAXofPostStepLoops= " << fpProcessInfo->MAXofPostStepLoops << G4endl;
353  G4Exception("G4ITStepProcessor::GetProcessNumber()",
354  "ITStepProcessor0004", FatalException,
355  "The array size is smaller than the actual No of processes.");
356  }
357 
361  {
362  G4ExceptionDescription exceptionDescription;
363  exceptionDescription << "No DoIt process found ";
364  G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0005",
365  FatalErrorInArgument,exceptionDescription);
366  return;
367  }
368 
370  {
373 
375  {
376  G4ExceptionDescription exceptionDescription;
377  exceptionDescription << "No transportation process found ";
378  G4Exception("G4ITStepProcessor::SetupGeneralProcessInfo","ITStepProcessor0006",
379  FatalErrorInArgument,exceptionDescription);
380  }
381  }
383  // fpProcessInfo = 0;
384 }
385 
386 // ******************************************************************
387 
389 {
390  fpTrack = track;
391  if (fpTrack)
392  {
394  fpStep = const_cast<G4Step*>(fpTrack->GetStep());
395 
396  if (fpITrack)
397  {
399  }
400  else
401  {
402  fpTrackingInfo = 0;
403  G4cerr << "Track ID : " << fpTrack->GetTrackID() << G4endl;
404 
405  G4ExceptionDescription exceptionDescription(
406  "No IT pointer was attached to the track you try to process.");
407  G4Exception("G4ITStepProcessor::SetTrack", "ITStepProcessor0007",
408  FatalErrorInArgument, exceptionDescription);
409  }
410  }
411  else
412  {
413  fpITrack = 0;
414  fpStep = 0;
415  }
416 }
417 //______________________________________________________________________________
418 
420 {
422  std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it =
423  fProcessGeneralInfoMap.find(particle);
424 
425  if (it == fProcessGeneralInfoMap.end())
426  {
427  SetupGeneralProcessInfo(particle,
429  if (fpProcessInfo == 0)
430  {
431  G4ExceptionDescription exceptionDescription("...");
432  G4Exception("G4ITStepProcessor::GetProcessNumber", "ITStepProcessor0008",
433  FatalErrorInArgument, exceptionDescription);
434  return;
435  }
436  }
437  else
438  {
439  fpProcessInfo = it->second;
440  }
441 }
442 //______________________________________________________________________________
443 
445 {
449 
452 
453  GetProcessInfo();
455 }
456 //______________________________________________________________________________
457 
459 {
460  // Reset the secondary particles
464 }
465 //______________________________________________________________________________
466 
468 {
469  // Select the rest process which has the shortest time before
470  // it is invoked. In rest processes, GPIL()
471  // returns the time before a process occurs.
472  G4double lifeTime(DBL_MAX), shortestLifeTime (DBL_MAX);
473 
475  shortestLifeTime = DBL_MAX;
476 
477  unsigned int NofInactiveProc=0;
478 
479  for( size_t ri=0; ri < fpProcessInfo->MAXofAtRestLoops; ri++ )
480  {
482  if (fpCurrentProcess== 0)
483  {
485  NofInactiveProc++;
486  continue;
487  } // NULL means the process is inactivated by a user on fly.
488 
491  lifeTime = fpCurrentProcess->AtRestGPIL( *fpTrack, &fCondition );
492 // fpCurrentProcess->SetProcessState(0);
494 
495  if(fCondition==Forced)
496  {
498  }
499  else
500  {
502  if(lifeTime < shortestLifeTime )
503  {
504  shortestLifeTime = lifeTime;
507  }
508  }
509  }
510 
511  fTimeStep = shortestLifeTime;
512 
513  // at least one process is necessary to destroy the particle
514  // exit with warning
515  if(NofInactiveProc==fpProcessInfo->MAXofAtRestLoops)
516  {
517  G4cerr << "ERROR - G4ITStepProcessor::InvokeAtRestDoItProcs()" << G4endl
518  << " No AtRestDoIt process is active!" << G4endl;
519  }
520 }
521 //___________________________________________________________________________
522 
524 {
525  SetTrack(track);
527 }
528 //______________________________________________________________________________
529 
531 {
532  // DEBUG
533  // G4cout << "SetInitialStep for : " << fpITrack-> GetName() << G4endl;
534  //________________________________________________________
535  // Initialize geometry
536 
537  if (!fpTrack->GetTouchableHandle())
538  {
539  //==========================================================================
540  // Create navigator state and Locate particle in geometry
541  //==========================================================================
542 /*
543  fpNavigator->NewNavigatorStateAndLocate(fpTrack->GetPosition(),
544  fpTrack->GetMomentumDirection());
545 
546  fpITrack->GetTrackingInfo()->
547  SetNavigatorState(fpNavigator->GetNavigatorState());
548 */
549  fpNavigator->NewNavigatorState();
551  SetNavigatorState(fpNavigator->GetNavigatorState());
552 
554  fpNavigator->LocateGlobalPointAndSetup(fpTrack->GetPosition(), &direction,
555  false, false); // was false, false
556 
557 
558  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
559 
562  }
563  else
564  {
567 
568  //==========================================================================
569  // Create OR set navigator state
570  //==========================================================================
571 
573  {
574  fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->
575  GetNavigatorState());
577  fpNavigator->GetNavigatorState());
578  }
579  else
580  {
581  fpNavigator->NewNavigatorState(*((G4TouchableHistory*)fpState->
582  fTouchableHandle()));
584  fpNavigator->GetNavigatorState());
585  }
586 
587  G4VPhysicalVolume* oldTopVolume =
589 
590  //==========================================================================
591  // Locate particle in geometry
592  //==========================================================================
593 
594 // G4VPhysicalVolume* newTopVolume =
595 // fpNavigator->LocateGlobalPointAndSetup(
596 // fpTrack->GetPosition(),
597 // &fpTrack->GetMomentumDirection(),
598 // true, false);
599 
600  G4VPhysicalVolume* newTopVolume = fpNavigator->ResetHierarchyAndLocate(
603 
604  if (newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId()
605  == 1)
606  {
607  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
610  }
611  }
612 
614 
615  //________________________________________________________
616  // If the primary track has 'Suspend' or 'PostponeToNextEvent' state,
617  // set the track state to 'Alive'.
620  {
622  }
623 
624  // If the primary track has 'zero' kinetic energy, set the track
625  // state to 'StopButAlive'.
626  if (fpTrack->GetKineticEnergy() <= 0.0)
627  {
629  }
630  //________________________________________________________
631  // Set vertex information of G4Track at here
632  if (fpTrack->GetCurrentStepNumber() == 0)
633  {
638  }
639  //________________________________________________________
640  // If track is already outside the world boundary, kill it
641  if (fpCurrentVolume == 0)
642  {
643  // If the track is a primary, stop processing
644  if (fpTrack->GetParentID() == 0)
645  {
646  G4cerr << "ERROR - G4ITStepProcessor::SetInitialStep()"
647  << G4endl
648  << " Primary particle starting at - "
649  << fpTrack->GetPosition()
650  << " - is outside of the world volume." << G4endl;
651  G4Exception("G4ITStepProcessor::SetInitialStep()", "ITStepProcessor0011",
652  FatalException, "Primary vertex outside of the world!");
653  }
654 
656  G4cout << "WARNING - G4ITStepProcessor::SetInitialStep()" << G4endl
657  << " Initial track position is outside world! - "
658  << fpTrack->GetPosition() << G4endl;
659  }
660  else
661  {
662  // Initial set up for attribues of 'Step'
664  }
665 
666  if (fpTrack->GetTrackStatus() == fStopAndKill) return;
667 
669 
671 }
672 //______________________________________________________________________________
673 
675 {
676 
677  if (!fpStep)
678  {
679  // Create new Step and give it to the track
680  fpStep = new G4Step();
683 
684  // Create new state and set it in the trackingInfo
688 
689  SetupMembers();
690  SetInitialStep();
691  }
692  else
693  {
694  SetupMembers();
695 
697  /***
698  // Send G4Step information to Hit/Dig if the volume is sensitive
699  fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
700  StepControlFlag = fpStep->GetControlFlag();
701  if( fpCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation)
702  {
703  fpSensitive = fpStep->GetPreStepPoint()->
704  GetSensitiveDetector();
705 
706  // if( fSensitive != 0 ) {
707  // fSensitive->Hit(fStep);
708  // }
709  }
710  ***/
711  // Store last PostStepPoint to PreStepPoint, and swap current and next
712  // volume information of G4Track. Reset total energy deposit in one Step.
715 
716  //JA Set the volume before it is used (in DefineStepLength() for User Limit)
718  /*
719  G4cout << G4endl;
720  G4cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << G4endl;
721  G4cout << "PreStepPoint Volume : " << fpCurrentVolume->GetName() << G4endl;
722  G4cout << "Track Touchable : " << fpTrack->GetTouchableHandle()->GetVolume()->GetName() << G4endl;
723  G4cout << "Track NextTouchable : " << fpTrack->GetNextTouchableHandle()->GetVolume()->GetName() << G4endl;
724  */
725  // Reset the step's auxiliary points vector pointer
727 
728  // Switch next touchable in track to current one
732 
733 
735 /*
736  G4VPhysicalVolume* oldTopVolume =
737  fpTrack->GetTouchableHandle()->GetVolume();
738  fpNavigator->SetNavigatorState(
739  fpITrack->GetTrackingInfo()->GetNavigatorState());
740 
741  G4VPhysicalVolume* newTopVolume = fpNavigator->ResetHierarchyAndLocate(
742  fpTrack->GetPosition(), fpTrack->GetMomentumDirection(),
743  *((G4TouchableHistory*) fpTrack->GetTouchableHandle()()));
744 
745  // G4VPhysicalVolume* newTopVolume=
746 // fpNavigator->LocateGlobalPointAndSetup( fpTrack->GetPosition(),
747 // &fpTrack->GetMomentumDirection(),
748 // true, false);
749 
750  // G4cout << "New Top Volume : " << newTopVolume->GetName() << G4endl;
751 
752  if (newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId()
753  == 1)
754  {
755  fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
756  fpTrack->SetTouchableHandle(fpState->fTouchableHandle);
757  fpTrack->SetNextTouchableHandle(fpState->fTouchableHandle);
758  }
759 
760 */
762 
763  //==========================================================================
764  // Only reset navigator state + reset volume hierarchy (internal)
765  // No need to relocate
766  //==========================================================================
767 
768  fpNavigator->SetNavigatorState(
770  }
771 }
772 
773 //______________________________________________________________________________
774 
775 // ************************************************************************
776 // Compute Interaction Length
777 // ************************************************************************
779 {
780 
781  InitDefineStep();
782 
783  G4TrackStatus trackStatus = fpTrack->GetTrackStatus();
784 
785  if (trackStatus == fStopAndKill)
786  {
787  return;
788  }
789 
790  if (trackStatus == fStopButAlive)
791  {
793  fpNavigator->GetNavigatorState());
794  fpNavigator->ResetNavigatorState();
795  return GetAtRestIL();
796  }
797 
798  // Find minimum Step length and corresponding time
799  // demanded by active disc./cont. processes
800 
801  // ReSet the counter etc.
802  fpState->fPhysicalStep = DBL_MAX; // Initialize by a huge number
803  fPhysIntLength = DBL_MAX; // Initialize by a huge number
804 
805  double proposedTimeStep = DBL_MAX;
806  G4VProcess* processWithPostStepGivenByTimeStep(0);
807 
808  // GPIL for PostStep
811 
812  // G4cout << "fpProcessInfo->MAXofPostStepLoops : " << fpProcessInfo->MAXofPostStepLoops
813  // << " mol : " << fpITrack -> GetName() << " id : " << fpTrack->GetTrackID()
814  // << G4endl;
815 
816  for (size_t np = 0; np < fpProcessInfo->MAXofPostStepLoops; np++)
817  {
819  ->fpPostStepGetPhysIntVector)[np];
820  if (fpCurrentProcess == 0)
821  {
823  continue;
824  } // NULL means the process is inactivated by a user on fly.
825 
829 
830  // G4cout << "Is going to call : " << fpCurrentProcess -> GetProcessName() << G4endl;
833  &fCondition);
835  //fpCurrentProcess->SetProcessState(0);
836 
837  switch (fCondition)
838  {
839  case ExclusivelyForced: // Will need special treatment
843  break;
844 
845  case Conditionally:
846  // (fpState->fSelectedPostStepDoItVector)[np] = Conditionally;
847  G4Exception("G4ITStepProcessor::DefinePhysicalStepLength()",
848  "ITStepProcessor0008", FatalException,
849  "This feature is no more supported");
850  break;
851 
852  case Forced:
854  break;
855 
856  case StronglyForced:
858  break;
859 
860  default:
862  break;
863  }
864 
866  {
867  for (size_t nrest = np + 1; nrest < fpProcessInfo->MAXofPostStepLoops;
868  nrest++)
869  {
871  }
872  return; // Please note the 'return' at here !!!
873  }
874  else
875  {
876  if (fPhysIntLength < fpState->fPhysicalStep)
877  {
878  // To avoid checking whether the process is actually
879  // proposing a time step, the returned time steps are
880  // negative (just for tagging)
882  {
883  fPhysIntLength *= -1;
884  if (fPhysIntLength < proposedTimeStep)
885  {
886  proposedTimeStep = fPhysIntLength;
888  processWithPostStepGivenByTimeStep = fpCurrentProcess;
889  }
890  }
891  else
892  {
897  }
898  }
899  }
900  }
901 
902  // GPIL for AlongStep
904  G4double safetyProposedToAndByProcess = fpState->proposedSafety;
905 
906  for (size_t kp = 0; kp < fpProcessInfo->MAXofAlongStepLoops; kp++)
907  {
909  ->fpAlongStepGetPhysIntVector)[kp];
910  if (fpCurrentProcess == 0) continue;
911  // NULL means the process is inactivated by a user on fly.
912 
917  safetyProposedToAndByProcess, &fGPILSelection);
918 
919  if (fPhysIntLength < fpState->fPhysicalStep)
920  {
922  // Should save PS and TS in IT
923 
924  // Check if the process wants to be the GPIL winner. For example,
925  // multi-scattering proposes Step limit, but won't be the winner.
927  {
930  }
931 
932  // Transportation is assumed to be the last process in the vector
933  if (kp == fpProcessInfo->MAXofAlongStepLoops - 1)
934  {
936 
937  if (!fpTransportation)
938  {
939  G4ExceptionDescription exceptionDescription;
940  exceptionDescription << "No transportation process found ";
941  G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength",
942  "ITStepProcessor0009", FatalErrorInArgument,
943  exceptionDescription);
944  }
945 
947 
950  }
951  }
952  else
953  {
954  if (kp == fpProcessInfo->MAXofAlongStepLoops - 1)
955  {
957 
958  if (!fpTransportation)
959  {
960  G4ExceptionDescription exceptionDescription;
961  exceptionDescription << "No transportation process found ";
962  G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength",
963  "ITStepProcessor0010", FatalErrorInArgument,
964  exceptionDescription);
965  }
966 
968  }
969  }
970 
971  // Handle PostStep processes sending back time steps rather than space length
972  if (proposedTimeStep < fTimeStep)
973  {
974  if (fPostStepAtTimeDoItProcTriggered < fpProcessInfo->MAXofPostStepLoops)
975  {
977  {
979  NotForced;
980  // (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = InActivated;
981 
984  processWithPostStepGivenByTimeStep);
985 
986  fTimeStep = proposedTimeStep;
987 
990  }
991  }
992  }
993  else
994  {
995  if (fPostStepDoItProcTriggered < fpProcessInfo->MAXofPostStepLoops)
996  {
998  {
1000  NotForced;
1001  }
1002  }
1003  }
1004 
1005 // fpCurrentProcess->SetProcessState(0);
1007 
1008  // Make sure to check the safety, even if Step is not limited
1009  // by this process. J. Apostolakis, June 20, 1998
1010  //
1011  if (safetyProposedToAndByProcess < fpState->proposedSafety)
1012  // proposedSafety keeps the smallest value:
1013  fpState->proposedSafety = safetyProposedToAndByProcess;
1014  else
1015  // safetyProposedToAndByProcess always proposes a valid safety:
1016  safetyProposedToAndByProcess = fpState->proposedSafety;
1017 
1018  }
1019 
1021  fpNavigator->GetNavigatorState());
1022  fpNavigator->ResetNavigatorState();
1023 }
1024 
1025 //______________________________________________________________________________
G4TrackVector * fpSecondary
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
Its role is the same as G4StepManager :
G4int GetParentID() const
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
G4ITTrackingManager * fpTrackingManager
void SetProcessDefinedStep(const G4VProcess *aValue)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
CLHEP::Hep3Vector G4ThreeVector
static const size_t & GetMaxProcessIndex()
G4GPILSelection fGPILSelection
void DeleteSecondaryVector()
void SetStepProcessorState(G4ITStepProcessorState_Lock *)
G4SelectedAtRestDoItVector fSelectedAtRestDoItVector
void SetNavigator(G4ITNavigator *value)
const G4ThreeVector & GetPosition() const
G4double GetSurfaceTolerance() const
G4TrackStatus GetTrackStatus() const
std::map< const G4ParticleDefinition *, ProcessGeneralInfo * > fProcessGeneralInfoMap
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4VITProcess * fpCurrentProcess
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
Definition: G4Step.hh:237
const G4Step * GetStep() const
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
virtual void StartTracking(G4Track *)
const G4String & GetParticleName() const
G4ForceCondition fCondition
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4VPhysicalVolume * GetNextVolume() const
void SetTrack(G4Track *)
void DefinePhysicalStepLength(G4Track *)
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
Definition: G4VProcess.hh:490
G4StepPoint * GetPreStepPoint() const
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4ITStepProcessorState & operator=(const G4ITStepProcessorState &)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double GetKineticEnergy() const
G4int entries() const
static G4ITTransportationManager * GetTransportationManager()
G4TrackingInformation * fpTrackingInfo
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
G4int GetCurrentStepNumber() const
G4TrackVector * NewSecondaryVector()
G4VPhysicalVolume * GetPhysicalVolume() const
G4StepPoint * fpPreStepPoint
G4double AlongStepGPIL(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
Definition: G4VProcess.hh:479
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
virtual G4int GetRegularStructureId() const =0
void ResetTotalEnergyDeposit()
G4ITStepProcessorState_Lock * GetStepProcessorState()
void SetVertexKineticEnergy(const G4double aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
G4ITNavigatorState_Lock * GetNavigatorState() const
G4VPhysicalVolume * fpCurrentVolume
Definition: G4Step.hh:76
G4int GetTrackID() const
G4ITNavigator * fpNavigator
G4ITStepProcessorState * fpState
G4StepPoint * fpPostStepPoint
G4double GetInteractionTimeLeft()
const G4TouchableHandle & GetTouchableHandle() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void Initialize()
G4int size() const
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:152
G4double PostStepGPIL(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
Definition: G4VProcess.hh:498
void SetProcessState(G4shared_ptr< G4ProcessState_Lock > aProcInfo)
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
G4TrackVector * GetfSecondary()
static G4ParticleTable * GetParticleTable()
G4shared_ptr< G4ProcessState_Lock > GetProcessState(size_t index)
Every process should store the information computed at the InteractionLegth stage in the track...
G4ITTransportation * fpTransportation
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
void SetVertexPosition(const G4ThreeVector &aValue)
G4StepPoint * GetPostStepPoint() const
G4ITStepProcessor & operator=(const G4ITStepProcessor &other)
void SetNavigatorState(G4ITNavigatorState_Lock *)
G4VPhysicalVolume * GetVolume() const
ProcessGeneralInfo * fpProcessInfo
#define G4endl
Definition: G4ios.hh:61
void InitializeStep(G4Track *aValue)
double G4double
Definition: G4Types.hh:76
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4bool ProposesTimeStep() const
G4VITProcess inherits from G4VProcess.
Definition: G4VITProcess.hh:99
#define DBL_MAX
Definition: templates.hh:83
void ResetProcessState()
G4SelectedPostStepDoItVector fSelectedPostStepDoItVector
size_t GetProcessID() const
G4TrackStatus
G4PTblDicIterator * GetIterator() const
void SetStep(const G4Step *aValue)
size_t fPostStepAtTimeDoItProcTriggered
#define theParticleIterator
G4double GetStepLength() const
static G4GeometryTolerance * GetInstance()
G4ProcessVector * GetProcessList() const
static const size_t SizeOfSelectedDoItVector
G4GLOB_DLL std::ostream G4cerr
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
void CopyPostToPreStepPoint()
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const