source: trunk/source/persistency/mctruth/include/G4MCTSimVertex.hh @ 1202

Last change on this file since 1202 was 818, checked in by garnier, 16 years ago

import all except CVS

File size: 6.1 KB
Line 
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
45class G4MCTSimVertex {
46private:
47  int  inParticleTrackID;
48  std::vector<int> outParticleTrackIDList;
49
50  int id; // assigned independently from G4
51  G4ThreeVector position;
52  double time;
53  std::string volumeName;
54  int volumeNumber;
55  std::string creatorProcessName;
56  G4bool storeFlag;
57 
58public:
59  G4MCTSimVertex();
60  G4MCTSimVertex(const G4ThreeVector& x, double t);
61  G4MCTSimVertex(const G4ThreeVector& x, double t, 
62               std::string vname, int ncopy, std::string pname);
63  ~G4MCTSimVertex();
64 
65  // copy constructor and assignment operator
66  G4MCTSimVertex(const G4MCTSimVertex& right);
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// ====================================================================
107inline G4MCTSimVertex::G4MCTSimVertex(const G4MCTSimVertex& right)
108{
109  *this= right;
110}
111 
112inline const G4MCTSimVertex& 
113  G4MCTSimVertex::operator=(const G4MCTSimVertex& right)
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
128inline void G4MCTSimVertex::SetID(int i) { id= i; }
129inline int  G4MCTSimVertex::GetID() const { return id; }
130
131inline  void G4MCTSimVertex::SetPosition(const G4ThreeVector& x)
132{ position= x; }
133
134inline  const G4ThreeVector& G4MCTSimVertex::GetPosition() const
135{ return position; }
136
137inline  void G4MCTSimVertex::SetTime(double t)
138{ time= t; }
139
140inline double G4MCTSimVertex::GetTime() const
141{ return time; }
142
143inline  void G4MCTSimVertex::SetVolumeName(std::string vname)
144{ volumeName= vname; }
145
146inline  const std::string& G4MCTSimVertex::GetVolumeName() const
147{ return volumeName; }
148
149inline void G4MCTSimVertex::SetVolumeNumber(int n)
150{ volumeNumber= n; }
151
152inline int G4MCTSimVertex::GetVolumeNumber() const
153{ return volumeNumber; }
154
155inline  void G4MCTSimVertex::SetCreatorProcessName(std::string pname)
156{ creatorProcessName= pname; }
157
158inline  const std::string& G4MCTSimVertex::GetCreatorProcessName() const
159{ return creatorProcessName; }
160
161inline void G4MCTSimVertex::SetStoreFlag(G4bool q) { storeFlag= q; }
162
163inline G4bool G4MCTSimVertex::GetStoreFlag() const { return storeFlag; }
164
165inline void G4MCTSimVertex::SetInParticle(const G4MCTSimParticle* in)
166{ inParticleTrackID= in-> GetTrackID(); }
167
168inline void G4MCTSimVertex::SetInParticle(int in)
169{ inParticleTrackID= in; }
170
171inline int G4MCTSimVertex::GetInParticleTrackID() const
172{ return inParticleTrackID; }
173
174inline int G4MCTSimVertex::GetNofOutParticles() const
175{ return outParticleTrackIDList.size(); }
176
177inline int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out)
178{ 
179  outParticleTrackIDList.push_back(out->GetTrackID());
180  return outParticleTrackIDList.size();
181}
182
183inline int G4MCTSimVertex::AddOutParticle(int out)
184{
185  outParticleTrackIDList.push_back(out);
186  return outParticleTrackIDList.size();
187}
188
189inline int G4MCTSimVertex::GetOutParticleTrackID(int i) const
190{
191  int size= outParticleTrackIDList.size();
192  if(i>=0 && i< size) return outParticleTrackIDList[i];
193  else return 0;   
194}
195
196#endif
Note: See TracBrowser for help on using the repository browser.