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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 <iostream>
 35 
 36 #include "G4String.hh"
 37 #include "G4Types.hh"
 38 #include "G4LorentzVector.hh"
 39 
 40 class G4MCTSimVertex;
 41 class G4MCTSimParticle;
 42 
 43 using SimParticleList = std::vector<G4MCTSimParticle*>;
 44 
 45 class G4MCTSimParticle
 46 {
 47   public:
 48 
 49     G4MCTSimParticle();
 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(const G4String& 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 
 89     G4int AssociateParticle(G4MCTSimParticle* p);
 90     G4int GetNofAssociatedParticles() const;
 91     G4MCTSimParticle* GetAssociatedParticle(G4int i) const;
 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 
100     G4MCTSimParticle* parentParticle = nullptr;
101     std::vector<G4MCTSimParticle*> associatedParticleList;
102 
103     G4String name;
104     G4LorentzVector momentumAtVertex;
105     G4MCTSimVertex* vertex = nullptr;
106     G4int pdgID = 0;
107     G4int trackID = 0;
108     G4int parentTrackID = 0;
109     G4bool primaryFlag = false;
110     G4bool storeFlag = false;
111 };
112 
113 // ====================================================================
114 // inline methods
115 // ====================================================================
116 
117 inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
118 {
119   *this = right;
120 }
121 
122 inline G4MCTSimParticle& G4MCTSimParticle::operator=(
123   const G4MCTSimParticle& right)
124 {
125   parentParticle         = right.parentParticle;
126   associatedParticleList = right.associatedParticleList;  // shallow copy
127 
128   name             = right.name;
129   pdgID            = right.pdgID;
130   trackID          = right.trackID;
131   parentTrackID    = right.parentTrackID;
132   primaryFlag      = right.primaryFlag;
133   momentumAtVertex = right.momentumAtVertex;
134   vertex           = right.vertex;
135 
136   return *this;
137 }
138 
139 inline void G4MCTSimParticle::SetParentParticle(const G4MCTSimParticle* p)
140 {
141   parentParticle = const_cast<G4MCTSimParticle*>(p);
142 }
143 
144 inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
145 {
146   return parentParticle;
147 }
148 
149 inline void G4MCTSimParticle::SetParticleName(const G4String& aname)
150 {
151   name = aname;
152 }
153 
154 inline const G4String& G4MCTSimParticle::GetParticleName() const
155 {
156   return name;
157 }
158 
159 inline void G4MCTSimParticle::SetPdgID(G4int id)
160 {
161   pdgID = id;
162 }
163 
164 inline G4int G4MCTSimParticle::GetPdgID() const
165 {
166   return pdgID;
167 }
168 
169 inline void G4MCTSimParticle::SetTrackID(G4int id)
170 {
171   trackID = id;
172 }
173 
174 inline G4int G4MCTSimParticle::GetTrackID() const
175 {
176   return trackID;
177 }
178 
179 inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q)
180 {
181   primaryFlag = q;
182 }
183 
184 inline G4bool G4MCTSimParticle::GetPrimaryFlag() const
185 {
186   return primaryFlag;
187 }
188 
189 inline void G4MCTSimParticle::SetParentTrackID(G4int id)
190 {
191   parentTrackID = id;
192 }
193 
194 inline G4int G4MCTSimParticle::GetParentTrackID() const
195 {
196   return parentTrackID;
197 }
198 
199 inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
200 {
201   momentumAtVertex = p;
202 }
203 
204 inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
205 {
206   return momentumAtVertex;
207 }
208 
209 inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
210 {
211   vertex = const_cast<G4MCTSimVertex*>(v);
212 }
213 
214 inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
215 {
216   return vertex;
217 }
218 
219 inline void G4MCTSimParticle::SetStoreFlag(G4bool q)
220 {
221   storeFlag = q;
222 }
223 
224 inline G4bool G4MCTSimParticle::GetStoreFlag() const
225 {
226   return storeFlag;
227 }
228 
229 #endif
230