Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MCTSimVertex.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 // G4MCTSimVertex.hh
27 //
28 // ====================================================================
29 #ifndef MCT_SIM_VERTEX_H
30 #define MCT_SIM_VERTEX_H
31 
32 #include "G4Types.hh"
33 #include <iostream>
34 #include <vector>
35 #include <string>
36 #include "G4ThreeVector.hh"
37 #include "G4MCTSimParticle.hh"
38 
39 // ====================================================================
40 //
41 // class definition
42 //
43 // ====================================================================
44 
46 private:
47  int inParticleTrackID;
48  std::vector<int> outParticleTrackIDList;
49 
50  int id; // assigned independently from G4
52  double time;
53  std::string volumeName;
54  int volumeNumber;
55  std::string creatorProcessName;
56  G4bool storeFlag;
57 
58 public:
60  G4MCTSimVertex(const G4ThreeVector& x, double t);
61  G4MCTSimVertex(const G4ThreeVector& x, double t,
62  std::string vname, int ncopy, std::string pname);
64 
65  // copy constructor and assignment operator
67  const G4MCTSimVertex& operator=(const G4MCTSimVertex& right);
68 
69  // set/get functions
70  void SetID(int i);
71  int GetID() const;
72 
73  void SetPosition(const G4ThreeVector& x);
74  const G4ThreeVector& GetPosition() const;
75 
76  void SetTime(double t);
77  double GetTime() const;
78 
79  void SetVolumeName(std::string vname);
80  const std::string& GetVolumeName() const;
81 
82  void SetVolumeNumber(int n);
83  int GetVolumeNumber() const;
84 
85  void SetCreatorProcessName(std::string pname);
86  const std::string& GetCreatorProcessName() const;
87 
88  void SetStoreFlag(G4bool q);
89  G4bool GetStoreFlag() const;
90 
91  // methods...
92  void SetInParticle(const G4MCTSimParticle* in);
93  void SetInParticle(int in);
94  int GetInParticleTrackID() const;
95 
96  int GetNofOutParticles() const;
97  int AddOutParticle(const G4MCTSimParticle* out);
98  int AddOutParticle(int out);
99  int GetOutParticleTrackID(int i) const;
100 
101  void Print(std::ostream& ostr= std::cout) const;
102 };
103 
104 // ====================================================================
105 // inline functions
106 // ====================================================================
108 {
109  *this= right;
110 }
111 
112 inline const G4MCTSimVertex&
114 {
115  inParticleTrackID= right.inParticleTrackID;
116  outParticleTrackIDList= right.outParticleTrackIDList;
117 
118  id= right.id;
119  position= right.position;
120  time= right.time;
121  volumeName= right.volumeName;
122  volumeNumber= right.volumeNumber;
123  creatorProcessName= right.creatorProcessName;
124 
125  return *this;
126 }
127 
128 inline void G4MCTSimVertex::SetID(int i) { id= i; }
129 inline int G4MCTSimVertex::GetID() const { return id; }
130 
132 { position= x; }
133 
135 { return position; }
136 
137 inline void G4MCTSimVertex::SetTime(double t)
138 { time= t; }
139 
140 inline double G4MCTSimVertex::GetTime() const
141 { return time; }
142 
143 inline void G4MCTSimVertex::SetVolumeName(std::string vname)
144 { volumeName= vname; }
145 
146 inline const std::string& G4MCTSimVertex::GetVolumeName() const
147 { return volumeName; }
148 
150 { volumeNumber= n; }
151 
153 { return volumeNumber; }
154 
156 { creatorProcessName= pname; }
157 
158 inline const std::string& G4MCTSimVertex::GetCreatorProcessName() const
159 { return creatorProcessName; }
160 
161 inline void G4MCTSimVertex::SetStoreFlag(G4bool q) { storeFlag= q; }
162 
163 inline G4bool G4MCTSimVertex::GetStoreFlag() const { return storeFlag; }
164 
166 { inParticleTrackID= in-> GetTrackID(); }
167 
169 { inParticleTrackID= in; }
170 
172 { return inParticleTrackID; }
173 
175 { return outParticleTrackIDList.size(); }
176 
178 {
179  outParticleTrackIDList.push_back(out->GetTrackID());
180  return outParticleTrackIDList.size();
181 }
182 
184 {
185  outParticleTrackIDList.push_back(out);
186  return outParticleTrackIDList.size();
187 }
188 
190 {
191  int size= outParticleTrackIDList.size();
192  if(i>=0 && i< size) return outParticleTrackIDList[i];
193  else return 0;
194 }
195 
196 #endif