ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4StackManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4StackManager.hh
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 //
28 // Last Modification : 04/Oct/11 P. Mato - making use of G4TrackStack with value semantics
30 
31 
32 #ifndef G4StackManager_h
33 #define G4StackManager_h 1
34 
35 #include "G4UserStackingAction.hh"
36 #include "G4StackedTrack.hh"
37 #include "G4TrackStack.hh"
38 #include "G4SmartTrackStack.hh"
40 #include "G4Track.hh"
41 #include "G4TrackStatus.hh"
42 #include "globals.hh"
43 #include "evmandefs.hh"
44 
46 class G4VTrajectory;
47 
48 // class description:
49 //
50 // This is the manager class of handling stacks of G4Track objects.
51 // This class must be a singleton and be constructed by G4EventManager.
52 // Almost all methods must be invoked exclusively by G4EventManager.
53 // Especially, some Clear() methods MUST NOT be invoked by the user.
54 // Event abortion is handled by G4EventManager.
55 //
56 // This G4StackingManager has three stacks, the urgent stack, the
57 // waiting stack, and the postpone to next event stack. The meanings
58 // of each stack is descrived in the Geant4 user's manual.
59 //
60 
62 {
63  public:
66 
67  private:
69  G4bool operator==(const G4StackManager &right) const;
70  G4bool operator!=(const G4StackManager &right) const;
71 
72  public:
73  G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory = 0);
74  G4Track * PopNextTrack(G4VTrajectory**newTrajectory);
76 
77  public: // with description
78  void ReClassify();
79  // Send all tracks stored in the Urgent stack one by one to
80  // the user's concrete ClassifyNewTrack() method. This method
81  // can be invoked from the user's G4UserStackingAction concrete
82  // class, especially fron its NewStage() method. Be aware that
83  // when the urgent stack becomes empty, all tracks in the waiting
84  // stack are send to the urgent stack and then the user's NewStage()
85  // method is invoked.
86 
88  // Set the number of additional (optional) waiting stacks.
89  // This method must be invoked at PreInit, Init or Idle states.
90  // Once the user set the number of additional waiting stacks,
91  // he/she can use the corresponding ENUM in G4ClassificationOfNewTrack.
92  // The user should invoke G4RunManager::SetNumberOfAdditionalWaitingStacks
93  // method, which invokes this method.
94 
96  // Transfter all stacked tracks from the origin stack to the destination stack.
97  // 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  // Transfter one stacked track from the origin stack to the destination stack.
103  // The transfered track is the one which came last to the origin stack.
104  // The destination stack needs not be empty.
105  // If the destination is fKill, the track is deleted.
106  // If the origin is fKill, nothing happen.
107 
108  private:
111 #ifdef G4_USESMARTSTACK
113 #else
115 #endif
119  std::vector<G4TrackStack*> additionalWaitingStacks;
121 
122  public:
123  void clear();
124  void ClearUrgentStack();
125  void ClearWaitingStack(int i=0);
126  void ClearPostponeStack();
127  G4int GetNTotalTrack() const;
128  G4int GetNUrgentTrack() const;
129  G4int GetNWaitingTrack(int i=0) const;
130  G4int GetNPostponedTrack() const;
131  void SetVerboseLevel( G4int const value );
133 
134  private:
136 };
137 
138 #endif
139