File indexing completed on 2025-01-18 09:58:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef G4MCTSIMPARTICLE_HH
0031 #define G4MCTSIMPARTICLE_HH 1
0032
0033 #include <vector>
0034 #include <string>
0035 #include <iostream>
0036
0037 #include "G4String.hh"
0038 #include "G4Types.hh"
0039 #include "G4LorentzVector.hh"
0040
0041 class G4MCTSimVertex;
0042 class G4MCTSimParticle;
0043
0044 using SimParticleList = std::vector<G4MCTSimParticle*>;
0045
0046 class G4MCTSimParticle
0047 {
0048 public:
0049
0050 G4MCTSimParticle();
0051 G4MCTSimParticle(const G4String& aname,
0052 G4int apcode, G4int atid, G4int ptid,
0053 const G4LorentzVector& p);
0054 G4MCTSimParticle(const G4String& aname,
0055 G4int apcode, G4int atid, G4int ptid,
0056 const G4LorentzVector& p, const G4MCTSimVertex* v);
0057 virtual ~G4MCTSimParticle();
0058
0059 inline G4MCTSimParticle(const G4MCTSimParticle& right);
0060 inline G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
0061
0062
0063 inline void SetParentParticle(const G4MCTSimParticle* p);
0064 inline G4MCTSimParticle* GetParentParticle() const;
0065
0066 inline void SetParticleName(std::string aname);
0067 inline const G4String& GetParticleName() const;
0068
0069 inline void SetPdgID(G4int id);
0070 inline G4int GetPdgID() const;
0071
0072 inline void SetTrackID(G4int id);
0073 inline G4int GetTrackID() const;
0074
0075 inline void SetParentTrackID(G4int id);
0076 inline G4int GetParentTrackID() const;
0077
0078 inline void SetPrimaryFlag(G4bool q);
0079 inline G4bool GetPrimaryFlag() const;
0080
0081 inline void SetMomentumAtVertex(const G4LorentzVector& p);
0082 inline const G4LorentzVector& GetMomentumAtVertex() const;
0083
0084 inline void SetVertex(const G4MCTSimVertex* v);
0085 inline G4MCTSimVertex* GetVertex() const;
0086
0087 inline void SetStoreFlag(G4bool q);
0088 inline G4bool GetStoreFlag() const;
0089
0090 G4int AssociateParticle(G4MCTSimParticle* p);
0091 G4int GetNofAssociatedParticles() const;
0092 G4MCTSimParticle* GetAssociatedParticle(G4int i) const;
0093 G4int GetTreeLevel() const;
0094 void SetStoreFlagToParentTree(G4bool q = true);
0095
0096 void Print(std::ostream& ostr = std::cout, G4bool qrevorder = false) const;
0097 void PrintSingle(std::ostream& ostr = std::cout) const;
0098
0099 protected:
0100
0101 G4MCTSimParticle* parentParticle = nullptr;
0102 std::vector<G4MCTSimParticle*> associatedParticleList;
0103
0104 G4String name;
0105 G4LorentzVector momentumAtVertex;
0106 G4MCTSimVertex* vertex = nullptr;
0107 G4int pdgID = 0;
0108 G4int trackID = 0;
0109 G4int parentTrackID = 0;
0110 G4bool primaryFlag = false;
0111 G4bool storeFlag = false;
0112 };
0113
0114
0115
0116
0117
0118 inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
0119 {
0120 *this = right;
0121 }
0122
0123 inline G4MCTSimParticle& G4MCTSimParticle::operator=(
0124 const G4MCTSimParticle& right)
0125 {
0126 parentParticle = right.parentParticle;
0127 associatedParticleList = right.associatedParticleList;
0128
0129 name = right.name;
0130 pdgID = right.pdgID;
0131 trackID = right.trackID;
0132 parentTrackID = right.parentTrackID;
0133 primaryFlag = right.primaryFlag;
0134 momentumAtVertex = right.momentumAtVertex;
0135 vertex = right.vertex;
0136
0137 return *this;
0138 }
0139
0140 inline void G4MCTSimParticle::SetParentParticle(const G4MCTSimParticle* p)
0141 {
0142 parentParticle = const_cast<G4MCTSimParticle*>(p);
0143 }
0144
0145 inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
0146 {
0147 return parentParticle;
0148 }
0149
0150 inline void G4MCTSimParticle::SetParticleName(std::string aname)
0151 {
0152 name = aname;
0153 }
0154
0155 inline const G4String& G4MCTSimParticle::GetParticleName() const
0156 {
0157 return name;
0158 }
0159
0160 inline void G4MCTSimParticle::SetPdgID(G4int id)
0161 {
0162 pdgID = id;
0163 }
0164
0165 inline G4int G4MCTSimParticle::GetPdgID() const
0166 {
0167 return pdgID;
0168 }
0169
0170 inline void G4MCTSimParticle::SetTrackID(G4int id)
0171 {
0172 trackID = id;
0173 }
0174
0175 inline G4int G4MCTSimParticle::GetTrackID() const
0176 {
0177 return trackID;
0178 }
0179
0180 inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q)
0181 {
0182 primaryFlag = q;
0183 }
0184
0185 inline G4bool G4MCTSimParticle::GetPrimaryFlag() const
0186 {
0187 return primaryFlag;
0188 }
0189
0190 inline void G4MCTSimParticle::SetParentTrackID(G4int id)
0191 {
0192 parentTrackID = id;
0193 }
0194
0195 inline G4int G4MCTSimParticle::GetParentTrackID() const
0196 {
0197 return parentTrackID;
0198 }
0199
0200 inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
0201 {
0202 momentumAtVertex = p;
0203 }
0204
0205 inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
0206 {
0207 return momentumAtVertex;
0208 }
0209
0210 inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
0211 {
0212 vertex = const_cast<G4MCTSimVertex*>(v);
0213 }
0214
0215 inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
0216 {
0217 return vertex;
0218 }
0219
0220 inline void G4MCTSimParticle::SetStoreFlag(G4bool q)
0221 {
0222 storeFlag = q;
0223 }
0224
0225 inline G4bool G4MCTSimParticle::GetStoreFlag() const
0226 {
0227 return storeFlag;
0228 }
0229
0230 #endif