Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4ShortLivedTable.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$
28//
29//
30// ------------------------------------------------------------
31// GEANT 4 class header file
32//
33// History: first implementation,
34// based on object model of June 27, 98 H.Kurashige
35// ------------------------------------------------------------
36// added clear() 20 Mar.,08 H.Kurashige
37// added Remove() 06 Nov.,98 H.Kurashige
38
39#ifndef G4ShortLivedTable_h
40#define G4ShortLivedTable_h 1
41
42#include "G4ios.hh"
43#include "globals.hh"
45
46#include <vector>
47
48class G4ParticleTable;
49
51{
52 // Class Description
53 // G4ShortLivedTable is the table of pointer to G4ParticleDefinition
54 // In G4ShortLivedTable, each G4ParticleDefinition pointer is stored
55 //
56
57 public:
58 // Use STL Vector as list of shortlives
59 typedef std::vector<const G4ParticleDefinition*> G4ShortLivedList;
60
61 public:
63
64 protected:
65 // Copy constructor and assignment operator
68
69 public: // With Description
70 virtual ~G4ShortLivedTable();
71
73 // return true if the particle is shortlived particle
74
75 void DumpTable(const G4String &particle_name = "ALL") const;
76 // dump information of particles specified by name
77
78 G4int Entries() const;
79 // return number of particles in the list
80
81 G4bool Contains(const G4ParticleDefinition *particle) const;
82 // return true if the list contains the specified particle
83
84 void Insert(const G4ParticleDefinition* particle);
85 // add the particle in the list
86
87 void Remove(const G4ParticleDefinition* particle);
88 // remove the particle (not delete) from the list
89
91 // return the i-th particle in the list
92
93 G4int size() const;
94 // return number of particles in the list
95
96 void clear();
97 // remove all particles (not delete) from the list
98
99 protected://Without Description
100 G4int GetVerboseLevel() const;
101
102 private:
103 G4ShortLivedList* fShortLivedList;
104
105};
106
108{
109 G4ShortLivedList::iterator i;
110 for (i = fShortLivedList->begin(); i!= fShortLivedList->end(); ++i) {
111 if (**i==*particle) return true;
112 }
113 return false;
114}
115
117{
118 return fShortLivedList->size();
119}
120
122{
123 return fShortLivedList->size();
124}
125
126
127inline
129{
130 if ( (index >=0 ) && (index < Entries()) ) {
131 return const_cast<G4ParticleDefinition*>( (*fShortLivedList)[index] );
132 } else {
133 return 0;
134 }
135}
136
137
138
139#endif
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4bool IsShortLived(const G4ParticleDefinition *) const
void Remove(const G4ParticleDefinition *particle)
virtual ~G4ShortLivedTable()
void DumpTable(const G4String &particle_name="ALL") const
std::vector< const G4ParticleDefinition * > G4ShortLivedList
G4ShortLivedTable & operator=(const G4ShortLivedTable &)
G4int GetVerboseLevel() const
G4bool Contains(const G4ParticleDefinition *particle) const
G4ParticleDefinition * GetParticle(G4int index) const
void Insert(const G4ParticleDefinition *particle)