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