Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4PrimaryVertex.cc
이 파일의 문서화 페이지로 가기
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 //
27 // $Id: G4PrimaryVertex.cc 110257 2018-05-17 14:20:12Z gcosmo $
28 //
29 
30 #include "G4PrimaryVertex.hh"
31 #include "G4SystemOfUnits.hh"
33 #include "G4ios.hh"
34 
36 {
38  return _instance;
39 }
40 
42 :X0(0.),Y0(0.),Z0(0.),T0(0.),theParticle(0),theTail(0),
43  nextVertex(0),tailVertex(0),numberOfParticle(0),Weight0(1.0),userInfo(0)
44 {
45 }
46 
49 :X0(x0),Y0(y0),Z0(z0),T0(t0),theParticle(0),theTail(0),
50  nextVertex(0),tailVertex(0),numberOfParticle(0),Weight0(1.0),userInfo(0)
51 {
52 }
53 
55 :T0(t0),theParticle(0),theTail(0),
56  nextVertex(0),tailVertex(0),numberOfParticle(0),Weight0(1.0),userInfo(0)
57 {
58  X0=xyz0.x();
59  Y0=xyz0.y();
60  Z0=xyz0.z();
61 }
62 
64 :theParticle(0),theTail(0),
65  nextVertex(0),tailVertex(0),userInfo(0)
66 {
68  *this = right;
69 }
70 
72 {
73  if(theParticle != 0) {
74  G4PrimaryParticle* theNext = theParticle;
75  while(theNext)
76  {
77  G4PrimaryParticle* thisPrimary = theNext;
78  theNext = thisPrimary->GetNext();
79  thisPrimary->ClearNext();
80  delete thisPrimary;
81  }
82  theParticle = 0;
83  }
84  if(nextVertex != 0) {
85  delete nextVertex;
86  nextVertex =0;
87  }
88  if(userInfo != 0) {
89  delete userInfo;
90  userInfo = 0;
91  }
92 }
93 
95 {
96  if (this != &right) {
97  X0 = right.X0;
98  Y0 = right.Y0;
99  Z0 = right.Z0;
100  T0 = right.T0;
101  Weight0 = right.Weight0;
102 
103  numberOfParticle = 0;
104  if (theParticle !=0) delete theParticle;
105  theParticle =0;
106  theTail =0;
107  if (right.theParticle !=0 ) {
108  theParticle = new G4PrimaryParticle(*(right.theParticle));
109  numberOfParticle += 1;
112  while (np !=0) { // Loop checking, 09.08.2015, K.Kurashige
113  numberOfParticle += 1;
114  theTail = np;
115  np = np->GetNext();
116  }
117  }
118 
119  if (nextVertex !=0 ) delete nextVertex;
120  nextVertex = 0;
121  tailVertex =0;
122  if (right.nextVertex !=0 ) {
123  nextVertex = new G4PrimaryVertex(*(right.nextVertex));
126  while (nv !=0) { // Loop checking, 09.08.2015, K.Kurashige
127  tailVertex = nv;
128  nv = nv->GetNext();
129  }
130  }
131 
132  // userInfo can not be copied
133  userInfo = 0;
134  }
135  return *this;
136 }
137 
139 { return (this==&right); }
140 
142 { return (this!=&right); }
143 
145 {
146  if( i >= 0 && i < numberOfParticle ) {
147  G4PrimaryParticle* particle = theParticle;
148  for( G4int j=0; j<i; j++ ){
149  if( particle == 0 ) return 0;
150  particle = particle->GetNext();
151  }
152  return particle;
153  } else {
154  return 0; }
155 }
156 
158 {
159  G4cout << "Vertex ( "
160  << X0/mm << "[mm], "
161  << Y0/mm << "[mm], "
162  << Z0/mm << "[mm], "
163  << T0/ns << "[ns] )"
164  << " Weight " << Weight0 << G4endl;
165  if(userInfo!=0) userInfo->Print();
166  G4cout << " -- Primary particles :: "
167  << " # of primaries =" << numberOfParticle << G4endl;
168  if( theParticle != 0) theParticle->Print();
169  if (nextVertex !=0 ) {
170  G4cout << "Next Vertex " << G4endl;
171  nextVertex->Print();
172  }
173 }
G4PrimaryParticle * GetPrimary(G4int i=0) const
G4PrimaryVertex * tailVertex
G4PrimaryVertex & operator=(const G4PrimaryVertex &right)
G4VUserPrimaryVertexInformation * userInfo
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
G4PART_DLL G4Allocator< G4PrimaryVertex > *& aPrimaryVertexAllocator()
G4PrimaryVertex * nextVertex
double z() const
G4int operator!=(const G4PrimaryVertex &right) const
#define G4ThreadLocalStatic
Definition: tls.hh:68
virtual ~G4PrimaryVertex()
double G4double
Definition: G4Types.hh:76
static const G4double T0[78]
G4PrimaryParticle * GetNext() const
int G4int
Definition: G4Types.hh:78
G4PrimaryVertex * GetNext() const
virtual void Print() const =0
G4int operator==(const G4PrimaryVertex &right) const
G4GLOB_DLL std::ostream G4cout
double x() const
G4PrimaryParticle * theTail
double y() const
void Print() const
#define ns
Definition: xmlparse.cc:614
G4PrimaryParticle * theParticle