Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MCTSimParticle.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// G4MCTSimParticle
27
28// Author: Youhei Morita, 12.09.2001
29// --------------------------------------------------------------------
30#ifndef G4MCTSIMPARTICLE_HH
31#define G4MCTSIMPARTICLE_HH 1
32
33#include <vector>
34#include <string>
35#include <iostream>
36
37#include "G4String.hh"
38#include "G4Types.hh"
39#include "G4LorentzVector.hh"
40
41class G4MCTSimVertex;
43
44using SimParticleList = std::vector<G4MCTSimParticle*>;
45
47{
48 public:
49
51 G4MCTSimParticle(const G4String& aname,
52 G4int apcode, G4int atid, G4int ptid,
53 const G4LorentzVector& p);
54 G4MCTSimParticle(const G4String& aname,
55 G4int apcode, G4int atid, G4int ptid,
56 const G4LorentzVector& p, const G4MCTSimVertex* v);
57 virtual ~G4MCTSimParticle();
58
59 inline G4MCTSimParticle(const G4MCTSimParticle& right);
60 inline G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
61 // copy constructor and assignment operator
62
63 inline void SetParentParticle(const G4MCTSimParticle* p);
64 inline G4MCTSimParticle* GetParentParticle() const;
65
66 inline void SetParticleName(std::string aname);
67 inline const G4String& GetParticleName() const;
68
69 inline void SetPdgID(G4int id);
70 inline G4int GetPdgID() const;
71
72 inline void SetTrackID(G4int id);
73 inline G4int GetTrackID() const;
74
75 inline void SetParentTrackID(G4int id);
76 inline G4int GetParentTrackID() const;
77
78 inline void SetPrimaryFlag(G4bool q);
79 inline G4bool GetPrimaryFlag() const;
80
81 inline void SetMomentumAtVertex(const G4LorentzVector& p);
82 inline const G4LorentzVector& GetMomentumAtVertex() const;
83
84 inline void SetVertex(const G4MCTSimVertex* v);
85 inline G4MCTSimVertex* GetVertex() const;
86
87 inline void SetStoreFlag(G4bool q);
88 inline G4bool GetStoreFlag() const;
89
93 G4int GetTreeLevel() const;
94 void SetStoreFlagToParentTree(G4bool q = true);
95
96 void Print(std::ostream& ostr = std::cout, G4bool qrevorder = false) const;
97 void PrintSingle(std::ostream& ostr = std::cout) const;
98
99 protected:
100
102 std::vector<G4MCTSimParticle*> associatedParticleList;
103
112};
113
114// ====================================================================
115// inline methods
116// ====================================================================
117
119{
120 *this = right;
121}
122
124 const G4MCTSimParticle& right)
125{
127 associatedParticleList = right.associatedParticleList; // shallow copy
128
129 name = right.name;
130 pdgID = right.pdgID;
131 trackID = right.trackID;
133 primaryFlag = right.primaryFlag;
135 vertex = right.vertex;
136
137 return *this;
138}
139
141{
142 parentParticle = const_cast<G4MCTSimParticle*>(p);
143}
144
146{
147 return parentParticle;
148}
149
150inline void G4MCTSimParticle::SetParticleName(std::string aname)
151{
152 name = aname;
153}
154
156{
157 return name;
158}
159
161{
162 pdgID = id;
163}
164
166{
167 return pdgID;
168}
169
171{
172 trackID = id;
173}
174
176{
177 return trackID;
178}
179
181{
182 primaryFlag = q;
183}
184
186{
187 return primaryFlag;
188}
189
191{
192 parentTrackID = id;
193}
194
196{
197 return parentTrackID;
198}
199
201{
203}
204
206{
207 return momentumAtVertex;
208}
209
211{
212 vertex = const_cast<G4MCTSimVertex*>(v);
213}
214
216{
217 return vertex;
218}
219
221{
222 storeFlag = q;
223}
224
226{
227 return storeFlag;
228}
229
230#endif
std::vector< G4MCTSimParticle * > SimParticleList
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4MCTSimParticle * GetParentParticle() const
void Print(std::ostream &ostr=std::cout, G4bool qrevorder=false) const
G4MCTSimVertex * GetVertex() const
G4bool GetStoreFlag() const
void SetStoreFlagToParentTree(G4bool q=true)
virtual ~G4MCTSimParticle()
G4int GetTrackID() const
void SetTrackID(G4int id)
const G4LorentzVector & GetMomentumAtVertex() const
G4MCTSimParticle * parentParticle
G4MCTSimParticle * GetAssociatedParticle(G4int i) const
void SetStoreFlag(G4bool q)
G4MCTSimParticle & operator=(const G4MCTSimParticle &right)
void SetParentTrackID(G4int id)
void SetVertex(const G4MCTSimVertex *v)
G4LorentzVector momentumAtVertex
G4int GetParentTrackID() const
G4int GetTreeLevel() const
void SetParentParticle(const G4MCTSimParticle *p)
void SetParticleName(std::string aname)
void SetMomentumAtVertex(const G4LorentzVector &p)
const G4String & GetParticleName() const
void SetPrimaryFlag(G4bool q)
G4MCTSimVertex * vertex
void PrintSingle(std::ostream &ostr=std::cout) const
G4int GetPdgID() const
G4int AssociateParticle(G4MCTSimParticle *p)
void SetPdgID(G4int id)
G4int GetNofAssociatedParticles() const
G4bool GetPrimaryFlag() const
std::vector< G4MCTSimParticle * > associatedParticleList