Geant4 9.6.0
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.hh
27//
28// ====================================================================
29#ifndef MCT_SIM_PARTICLE_H
30#define MCT_SIM_PARTICLE_H
31
32#include "G4Types.hh"
33#include <vector>
34#include <string>
35#include <iostream>
36#include "G4LorentzVector.hh"
37
38// ====================================================================
39//
40// class definition
41//
42// ====================================================================
43class G4MCTSimVertex;
45
46typedef std::vector<G4MCTSimParticle*> SimParticleList;
47
49protected:
51 std::vector<G4MCTSimParticle*> associatedParticleList;
52
53 std::string name;
54 int pdgID;
61
62public:
64 G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
65 const G4LorentzVector& p);
66 G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
67 const G4LorentzVector& p, const G4MCTSimVertex* v);
68 virtual ~G4MCTSimParticle();
69
70 // copy constructor and assignment operator
72 const G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
73
74 // set/get functions
77
78 void SetParticleName(std::string aname);
79 const std::string& GetParticleName() const;
80
81 void SetPdgID(int id);
82 int GetPdgID() const;
83
84 void SetTrackID(int id);
85 int GetTrackID() const;
86
87 void SetParentTrackID(int id);
88 int GetParentTrackID() const;
89
90 void SetPrimaryFlag(G4bool q);
91 G4bool GetPrimaryFlag() const;
92
95
96 void SetVertex(const G4MCTSimVertex* v);
98
99 void SetStoreFlag(G4bool q);
100 G4bool GetStoreFlag() const;
101
102 // methods...
104 int GetNofAssociatedParticles() const;
106 int GetTreeLevel() const;
107 void SetStoreFlagToParentTree(G4bool q=true);
108
109 void Print(std::ostream& ostr= std::cout, G4bool qrevorder=false) const;
110 void PrintSingle(std::ostream& ostr= std::cout) const;
111};
112
113// ====================================================================
114// inline functions
115// ====================================================================
117{
118 *this= right;
119}
120
121inline const G4MCTSimParticle&
123{
125 associatedParticleList= right.associatedParticleList; // shallow copy
126
127 name= right.name;
128 pdgID= right.pdgID;
129 trackID= right.trackID;
133 vertex= right.vertex;
134
135 return *this;
136}
137
139{ parentParticle= const_cast<G4MCTSimParticle*>(p); }
140
142{ return parentParticle; }
143
144inline void G4MCTSimParticle::SetParticleName(std::string aname)
145{ name= aname; }
146
147inline const std::string& G4MCTSimParticle::GetParticleName() const
148{ return name; }
149
150inline void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
151
152inline int G4MCTSimParticle::GetPdgID() const { return pdgID; }
153
154inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
155
156inline int G4MCTSimParticle::GetTrackID() const { return trackID; }
157
159
161
163{ parentTrackID= id; }
164
166{ return parentTrackID; }
167
169{ momentumAtVertex= p; }
170
172{ return momentumAtVertex; }
173
175{ vertex= const_cast<G4MCTSimVertex*>(v); }
176
178{ return vertex; }
179
181
183
184#endif
std::vector< G4MCTSimParticle * > SimParticleList
bool G4bool
Definition: G4Types.hh:67
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)
void SetTrackID(int id)
virtual ~G4MCTSimParticle()
int AssociateParticle(G4MCTSimParticle *p)
const std::string & GetParticleName() const
G4MCTSimParticle * GetAssociatedParticle(int i) const
const G4LorentzVector & GetMomentumAtVertex() const
G4MCTSimParticle * parentParticle
int GetTrackID() const
int GetTreeLevel() const
void SetStoreFlag(G4bool q)
void SetParentTrackID(int id)
void SetVertex(const G4MCTSimVertex *v)
G4LorentzVector momentumAtVertex
void SetParentParticle(const G4MCTSimParticle *p)
int GetNofAssociatedParticles() const
void SetParticleName(std::string aname)
void SetMomentumAtVertex(const G4LorentzVector &p)
void SetPrimaryFlag(G4bool q)
G4MCTSimVertex * vertex
void PrintSingle(std::ostream &ostr=std::cout) const
void SetPdgID(int id)
int GetParentTrackID() const
G4bool GetPrimaryFlag() const
std::vector< G4MCTSimParticle * > associatedParticleList
const G4MCTSimParticle & operator=(const G4MCTSimParticle &right)