Geant4  10.03
G4TrackStack.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: G4TrackStack.hh 66892 2013-01-17 10:57:59Z gunter $
28 //
29 //
30 // Last Modification : 09/Dec/96 M.Asai
31 //
32 
33 
34 #ifndef G4TrackStack_h
35 #define G4TrackStack_h 1
36 
37 #include "G4StackedTrack.hh"
38 #include "G4Types.hh"
39 #include <vector>
40 
41 class G4SmartTrackStack;
42 
43 // class description:
44 //
45 // This is a stack class used by G4StackManager. This class object
46 // stores G4StackedTrack class objects in the form of bi-directional
47 // linked list.
48 
49 class G4TrackStack : public std::vector<G4StackedTrack>
50 {
51 public:
53  G4TrackStack(size_t n) : safetyValve1(4*n/5), safetyValve2(4*n/5-100), nstick(100) { reserve(n);}
54  ~G4TrackStack();
55 
56 private:
57  const G4TrackStack & operator=(const G4TrackStack &right);
58  G4int operator==(const G4TrackStack &right) const;
59  G4int operator!=(const G4TrackStack &right) const;
60 
61 public:
62  void PushToStack(const G4StackedTrack& aStackedTrack) { push_back(aStackedTrack); }
63  G4StackedTrack PopFromStack() { G4StackedTrack st = back(); pop_back(); return st; }
64  void TransferTo(G4TrackStack* aStack);
65  void TransferTo(G4SmartTrackStack* aStack);
66 
67  void clearAndDestroy();
68 private:
72 
73 public:
74  G4int GetNTrack() const { return size(); }
75  G4int GetMaxNTrack() const { return max_size(); }
76  inline G4int GetSafetyValve1() const { return safetyValve1; }
77  inline G4int GetSafetyValve2() const { return safetyValve2; }
78  inline G4int GetNStick() const { return nstick; }
79 
80  G4double getTotalEnergy(void) const;
81  void SetSafetyValve2(int x) { safetyValve2 = x < 0 ? 0 : x; }
82 
83 };
84 
85 #endif
const G4TrackStack & operator=(const G4TrackStack &right)
G4int GetSafetyValve1() const
Definition: G4TrackStack.hh:76
void PushToStack(const G4StackedTrack &aStackedTrack)
Definition: G4TrackStack.hh:62
G4int GetNStick() const
Definition: G4TrackStack.hh:78
void SetSafetyValve2(int x)
Definition: G4TrackStack.hh:81
G4double getTotalEnergy(void) const
Definition: G4TrackStack.cc:61
G4TrackStack(size_t n)
Definition: G4TrackStack.hh:53
int G4int
Definition: G4Types.hh:78
G4int GetNTrack() const
Definition: G4TrackStack.hh:74
void TransferTo(G4TrackStack *aStack)
Definition: G4TrackStack.cc:49
G4int GetSafetyValve2() const
Definition: G4TrackStack.hh:77
G4StackedTrack PopFromStack()
Definition: G4TrackStack.hh:63
G4int operator!=(const G4TrackStack &right) const
const G4int n
void clearAndDestroy()
Definition: G4TrackStack.cc:40
double G4double
Definition: G4Types.hh:76
G4int operator==(const G4TrackStack &right) const
G4int GetMaxNTrack() const
Definition: G4TrackStack.hh:75
G4int safetyValve1
Definition: G4TrackStack.hh:69
G4int safetyValve2
Definition: G4TrackStack.hh:70