Geant4  10.00.p01
G4ParticleChange.icc
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 //
27 // $Id: G4ParticleChange.icc 68795 2013-04-05 13:24:46Z gcosmo $
28 //
29 //
30 inline
31  G4Step* G4ParticleChange::UpdateStepInfo(G4Step* pStep)
32 {
33  return G4VParticleChange::UpdateStepInfo(pStep);
34 }
35 
36 inline
37  G4double G4ParticleChange::GetEnergy() const
38 {
39  return theEnergyChange;
40 }
41 
42 inline
43  void G4ParticleChange::ProposeEnergy(G4double finalEnergy)
44 {
45  theEnergyChange = finalEnergy;
46 }
47 
48 inline
49  G4double G4ParticleChange::GetVelocity() const
50 {
51  return theVelocityChange;
52 }
53 
54 inline
55  void G4ParticleChange::ProposeVelocity(G4double finalVelocity)
56 {
57  theVelocityChange = finalVelocity;
58  isVelocityChanged = true;
59 }
60 
61 inline
62  const G4ThreeVector* G4ParticleChange::GetMomentumDirection() const
63 {
64  return &theMomentumDirectionChange;
65 }
66 
67 inline
68  void G4ParticleChange::ProposeMomentumDirection(
69  G4double Px,
70  G4double Py,
71  G4double Pz )
72 {
73  theMomentumDirectionChange.setX(Px);
74  theMomentumDirectionChange.setY(Py);
75  theMomentumDirectionChange.setZ(Pz);
76 }
77 
78 inline
79  void G4ParticleChange::ProposeMomentumDirection(const G4ThreeVector& P)
80 {
81  theMomentumDirectionChange = P;
82 }
83 
84 
85 inline
86  const G4ThreeVector* G4ParticleChange::GetPolarization() const
87 {
88  return &thePolarizationChange;
89 }
90 
91 inline
92  void G4ParticleChange::ProposePolarization( const G4ThreeVector& finalPoralization)
93 {
94  thePolarizationChange = finalPoralization;
95 }
96 
97 inline
98  void G4ParticleChange::ProposePolarization(
99  G4double Px,
100  G4double Py,
101  G4double Pz )
102 {
103  thePolarizationChange.setX(Px);
104  thePolarizationChange.setY(Py);
105  thePolarizationChange.setZ(Pz);
106 }
107 
108 inline
109  const G4ThreeVector* G4ParticleChange::GetPosition() const
110 {
111  return &thePositionChange;
112 }
113 
114 inline
115  void G4ParticleChange::ProposePosition(const G4ThreeVector& finalPosition)
116 {
117  thePositionChange= finalPosition;
118 }
119 
120 inline
121  void G4ParticleChange::ProposePosition(G4double x,G4double y, G4double z)
122 {
123  thePositionChange.setX(x);
124  thePositionChange.setY(y);
125  thePositionChange.setZ(z);
126 }
127 
128 inline
129  G4double G4ParticleChange::GetProperTime() const
130 {
131  return theProperTimeChange;
132 }
133 
134 inline
135  void G4ParticleChange::ProposeProperTime(G4double tau)
136 {
137  theProperTimeChange = tau;
138 }
139 
140 inline
141  G4ThreeVector G4ParticleChange::GetGlobalPosition(const G4ThreeVector& displacement) const
142 {
143  return thePositionChange + displacement;
144 }
145 
146 inline
147  void G4ParticleChange::ProposeGlobalTime(G4double t)
148 {
149  theTimeChange = (t-theGlobalTime0) + theLocalTime0;
150 }
151 
152 inline
153  G4double G4ParticleChange::GetGlobalTime(G4double timeDelay) const
154 {
155  // Convert the time delay to the global time.
156  return theGlobalTime0 + (theTimeChange-theLocalTime0) + timeDelay;
157 }
158 
159 inline
160  void G4ParticleChange::ProposeLocalTime(G4double t)
161 {
162  theTimeChange = t;
163 }
164 
165 inline
166  G4double G4ParticleChange::GetLocalTime(G4double timeDelay) const
167 {
168  // Convert the time delay to the local time.
169  return theTimeChange + timeDelay;
170 }
171 
172 inline
173  G4double G4ParticleChange::GetMass() const
174 {
175  return theMassChange;
176 }
177 
178 inline
179  void G4ParticleChange::ProposeMass(G4double t)
180 {
181  theMassChange = t;
182 }
183 
184 inline
185  G4double G4ParticleChange::GetCharge() const
186 {
187  return theChargeChange;
188 }
189 
190 inline
191  void G4ParticleChange::ProposeCharge(G4double t)
192 {
193  theChargeChange = t;
194 }
195 
196 
197 inline
198  G4double G4ParticleChange::GetMagneticMoment() const
199 {
200  return theMagneticMomentChange;
201 }
202 
203 inline
204  void G4ParticleChange::ProposeMagneticMoment(G4double finalMagneticMoment)
205 {
206  theMagneticMomentChange = finalMagneticMoment;
207 }
208 
209 inline
210  G4ThreeVector G4ParticleChange::CalcMomentum(G4double energy,
211  G4ThreeVector direction,
212  G4double mass
213  ) const
214 {
215  G4double tMomentum = std::sqrt(energy*energy + 2*energy*mass);
216  return direction*tMomentum;
217 }
218