Geant4-11
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 "G4Types.hh"
38#include "G4LorentzVector.hh"
39
40class G4MCTSimVertex;
42
43using SimParticleList = std::vector<G4MCTSimParticle*>;
44
46{
47 public:
48
50 G4MCTSimParticle(const G4String& aname,
51 G4int apcode, G4int atid, G4int ptid,
52 const G4LorentzVector& p);
53 G4MCTSimParticle(const G4String& aname,
54 G4int apcode, G4int atid, G4int ptid,
55 const G4LorentzVector& p, const G4MCTSimVertex* v);
56 virtual ~G4MCTSimParticle();
57
58 inline G4MCTSimParticle(const G4MCTSimParticle& right);
59 inline G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
60 // copy constructor and assignment operator
61
62 inline void SetParentParticle(const G4MCTSimParticle* p);
63 inline G4MCTSimParticle* GetParentParticle() const;
64
65 inline void SetParticleName(std::string aname);
66 inline const G4String& GetParticleName() const;
67
68 inline void SetPdgID(G4int id);
69 inline G4int GetPdgID() const;
70
71 inline void SetTrackID(G4int id);
72 inline G4int GetTrackID() const;
73
74 inline void SetParentTrackID(G4int id);
75 inline G4int GetParentTrackID() const;
76
77 inline void SetPrimaryFlag(G4bool q);
78 inline G4bool GetPrimaryFlag() const;
79
80 inline void SetMomentumAtVertex(const G4LorentzVector& p);
81 inline const G4LorentzVector& GetMomentumAtVertex() const;
82
83 inline void SetVertex(const G4MCTSimVertex* v);
84 inline G4MCTSimVertex* GetVertex() const;
85
86 inline void SetStoreFlag(G4bool q);
87 inline G4bool GetStoreFlag() const;
88
92 G4int GetTreeLevel() const;
93 void SetStoreFlagToParentTree(G4bool q = true);
94
95 void Print(std::ostream& ostr = std::cout, G4bool qrevorder = false) const;
96 void PrintSingle(std::ostream& ostr = std::cout) const;
97
98 protected:
99
101 std::vector<G4MCTSimParticle*> associatedParticleList;
102
111};
112
113// ====================================================================
114// inline methods
115// ====================================================================
116
118{
119 *this = right;
120}
121
123 const G4MCTSimParticle& right)
124{
126 associatedParticleList = right.associatedParticleList; // shallow copy
127
128 name = right.name;
129 pdgID = right.pdgID;
130 trackID = right.trackID;
132 primaryFlag = right.primaryFlag;
134 vertex = right.vertex;
135
136 return *this;
137}
138
140{
141 parentParticle = const_cast<G4MCTSimParticle*>(p);
142}
143
145{
146 return parentParticle;
147}
148
149inline void G4MCTSimParticle::SetParticleName(std::string aname)
150{
151 name = aname;
152}
153
155{
156 return name;
157}
158
160{
161 pdgID = id;
162}
163
165{
166 return pdgID;
167}
168
170{
171 trackID = id;
172}
173
175{
176 return trackID;
177}
178
180{
181 primaryFlag = q;
182}
183
185{
186 return primaryFlag;
187}
188
190{
191 parentTrackID = id;
192}
193
195{
196 return parentTrackID;
197}
198
200{
202}
203
205{
206 return momentumAtVertex;
207}
208
210{
211 vertex = const_cast<G4MCTSimVertex*>(v);
212}
213
215{
216 return vertex;
217}
218
220{
221 storeFlag = q;
222}
223
225{
226 return storeFlag;
227}
228
229#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