Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // ====================================================================
43 class G4MCTSimVertex;
45 
46 typedef std::vector<G4MCTSimParticle*> SimParticleList;
47 
49 protected:
51  std::vector<G4MCTSimParticle*> associatedParticleList;
52 
53  std::string name;
54  int pdgID;
55  int trackID;
61 
62 public:
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
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 
94  const G4LorentzVector& GetMomentumAtVertex() const;
95 
96  void SetVertex(const G4MCTSimVertex* v);
97  G4MCTSimVertex* GetVertex() const;
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 
121 inline const G4MCTSimParticle&
123 {
125  associatedParticleList= right.associatedParticleList; // shallow copy
126 
127  name= right.name;
128  pdgID= right.pdgID;
129  trackID= right.trackID;
131  primaryFlag= right.primaryFlag;
133  vertex= right.vertex;
134 
135  return *this;
136 }
137 
139 { parentParticle= const_cast<G4MCTSimParticle*>(p); }
140 
142 { return parentParticle; }
143 
144 inline void G4MCTSimParticle::SetParticleName(std::string aname)
145 { name= aname; }
146 
147 inline const std::string& G4MCTSimParticle::GetParticleName() const
148 { return name; }
149 
150 inline void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
151 
152 inline int G4MCTSimParticle::GetPdgID() const { return pdgID; }
153 
154 inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
155 
156 inline 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