Geant4  10.00.p02
G4StackManager.hh
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 //
27 // $Id: G4StackManager.hh 66892 2013-01-17 10:57:59Z gunter $
28 //
29 // Last Modification : 04/Oct/11 P. Mato - making use of G4TrackStack with value semantics
31 
32 
33 #ifndef G4StackManager_h
34 #define G4StackManager_h 1
35 
36 #include "G4UserStackingAction.hh"
37 #include "G4StackedTrack.hh"
38 #include "G4TrackStack.hh"
39 #include "G4SmartTrackStack.hh"
41 #include "G4Track.hh"
42 #include "G4TrackStatus.hh"
43 #include "globals.hh"
44 #include "evmandefs.hh"
45 
47 class G4VTrajectory;
48 
49 // class description:
50 //
51 // This is the manager class of handling stacks of G4Track objects.
52 // This class must be a singleton and be constructed by G4EventManager.
53 // Almost all methods must be invoked exclusively by G4EventManager.
54 // Especially, some Clear() methods MUST NOT be invoked by the user.
55 // Event abortion is handled by G4EventManager.
56 //
57 // This G4StackingManager has three stacks, the urgent stack, the
58 // waiting stack, and the postpone to next event stack. The meanings
59 // of each stack is descrived in the Geant4 user's manual.
60 //
61 
63 {
64  public:
67 
68  private:
70  G4int operator==(const G4StackManager &right) const;
71  G4int operator!=(const G4StackManager &right) const;
72 
73  public:
74  G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory = 0);
75  G4Track * PopNextTrack(G4VTrajectory**newTrajectory);
77 
78  public: // with description
79  void ReClassify();
80  // Send all tracks stored in the Urgent stack one by one to
81  // the user's concrete ClassifyNewTrack() method. This method
82  // can be invoked from the user's G4UserStackingAction concrete
83  // class, especially fron its NewStage() method. Be aware that
84  // when the urgent stack becomes empty, all tracks in the waiting
85  // stack are send to the urgent stack and then the user's NewStage()
86  // method is invoked.
87 
89  // Set the number of additional (optional) waiting stacks.
90  // This method must be invoked at PreInit, Init or Idle states.
91  // Once the user set the number of additional waiting stacks,
92  // he/she can use the corresponding ENUM in G4ClassificationOfNewTrack.
93  // The user should invoke G4RunManager::SetNumberOfAdditionalWaitingStacks
94  // method, which invokes this method.
95 
97  // Transfter all stacked tracks from the origin stack to the destination stack.
98  // The destination stack needs not be empty.
99  // If the destination is fKill, tracks are deleted.
100  // If the origin is fKill, nothing happen.
101 
103  // Transfter one stacked track from the origin stack to the destination stack.
104  // The transfered track is the one which came last to the origin stack.
105  // The destination stack needs not be empty.
106  // If the destination is fKill, the track is deleted.
107  // If the origin is fKill, nothing happen.
108 
109  private:
112 #ifdef G4_USESMARTSTACK
114 #else
116 #endif
120  std::vector<G4TrackStack*> additionalWaitingStacks;
122 
123  public:
124  void clear();
125  void ClearUrgentStack();
126  void ClearWaitingStack(int i=0);
127  void ClearPostponeStack();
128  G4int GetNTotalTrack() const;
129  G4int GetNUrgentTrack() const;
130  G4int GetNWaitingTrack(int i=0) const;
131  G4int GetNPostponedTrack() const;
132  void SetVerboseLevel( G4int const value );
134 
135  private:
137 };
138 
139 #endif
140 
G4TrackStack * urgentStack
G4UserStackingAction * userStackingAction
std::vector< G4TrackStack * > additionalWaitingStacks
G4int GetNTotalTrack() const
G4Track * PopNextTrack(G4VTrajectory **newTrajectory)
int G4int
Definition: G4Types.hh:78
G4TrackStack * waitingStack
G4int GetNUrgentTrack() const
G4int operator!=(const G4StackManager &right) const
void SetUserStackingAction(G4UserStackingAction *value)
G4int operator==(const G4StackManager &right) const
G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory=0)
G4int PrepareNewEvent()
void SetVerboseLevel(G4int const value)
void TransferOneStackedTrack(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination)
G4TrackStack * postponeStack
void TransferStackedTracks(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination)
G4int GetNWaitingTrack(int i=0) const
void ClearPostponeStack()
const G4StackManager & operator=(const G4StackManager &right)
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
G4int GetNPostponedTrack() const
G4ClassificationOfNewTrack DefaultClassification(G4Track *aTrack)
G4int numberOfAdditionalWaitingStacks
void ClearWaitingStack(int i=0)
G4StackingMessenger * theMessenger