source: trunk/source/track/include/G4Step.icc @ 826

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

import all except CVS

File size: 8.5 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//
27// $Id: G4Step.icc,v 1.18 2007/08/08 05:58:21 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-01-patch-02 $
29//
30//
31//---------------------------------------------------------------
32//
33//-----------------------------------------------------------------
34//  In-line definitions
35//-----------------------------------------------------------------
36
37// Get/Set functions
38inline
39 G4StepPoint* G4Step::GetPreStepPoint() const
40 {
41   return fpPreStepPoint;
42 }
43
44inline
45 void G4Step::SetPreStepPoint(G4StepPoint* value)
46 {
47   fpPreStepPoint = value;
48 }
49
50inline
51 G4StepPoint* G4Step::GetPostStepPoint() const
52 {
53   return fpPostStepPoint;
54 }
55   
56inline
57 void G4Step::SetPostStepPoint(G4StepPoint* value)
58 {
59   fpPostStepPoint = value;
60 }
61
62inline
63 G4double G4Step::GetStepLength() const
64 {
65   return fStepLength;
66 }
67
68inline
69 void G4Step::SetStepLength(G4double value)
70 {
71   fStepLength = value;
72 }
73
74inline
75 G4ThreeVector G4Step::GetDeltaPosition() const
76 {
77   return fpPostStepPoint->GetPosition()
78            - fpPreStepPoint->GetPosition();
79 }
80
81inline
82 G4double G4Step::GetDeltaTime() const
83 {
84   return fpPostStepPoint->GetLocalTime()
85            - fpPreStepPoint->GetLocalTime();
86 }
87
88inline
89 G4ThreeVector G4Step::GetDeltaMomentum() const
90 {
91   return fpPostStepPoint->GetMomentum()
92            - fpPreStepPoint->GetMomentum();
93 }
94
95inline
96 G4double G4Step::GetDeltaEnergy() const
97 {
98   return fpPostStepPoint->GetKineticEnergy()
99            - fpPreStepPoint->GetKineticEnergy();
100 }
101
102inline
103 G4double G4Step::GetTotalEnergyDeposit() const
104 {
105   return fTotalEnergyDeposit;
106 }
107
108inline
109 void G4Step::SetTotalEnergyDeposit(G4double value)
110 {
111   fTotalEnergyDeposit = value;   
112 }
113
114inline
115 G4double G4Step::GetNonIonizingEnergyDeposit() const
116 {
117   return fNonIonizingEnergyDeposit;
118 }
119
120inline
121 void G4Step::SetNonIonizingEnergyDeposit(G4double value)
122 {
123   fNonIonizingEnergyDeposit = value;   
124 }
125
126inline
127 void G4Step::AddTotalEnergyDeposit(G4double value)
128 {
129   fTotalEnergyDeposit += value;   
130 }
131
132inline
133 void G4Step::ResetTotalEnergyDeposit()
134 {
135   fTotalEnergyDeposit = 0.;
136 }
137
138inline
139 void G4Step::AddNonIonizingEnergyDeposit(G4double value)
140 {
141   fNonIonizingEnergyDeposit += value;   
142 }
143
144inline
145 void G4Step::ResetNonIonizingEnergyDeposit()
146 {
147   fNonIonizingEnergyDeposit = 0.;
148 }
149
150inline
151 void G4Step::SetControlFlag(G4SteppingControl value)
152 {
153   fpSteppingControlFlag = value;     
154 }
155
156inline
157 G4SteppingControl G4Step::GetControlFlag() const
158 {
159   return fpSteppingControlFlag;     
160 }
161
162inline
163 void G4Step::CopyPostToPreStepPoint( )
164 {
165   *(fpPreStepPoint) = *(fpPostStepPoint);
166   fpPostStepPoint->SetStepStatus(fUndefined);
167 }
168
169
170//-------------------------------------------------------------
171// To implement bi-directional association between G4Step and
172// and G4Track, a combined usage of 'forward declaration' and
173// 'include' is necessary.
174//-------------------------------------------------------------
175#include "G4Track.hh"
176
177inline
178 G4Track* G4Step::GetTrack() const
179 {
180   return fpTrack;
181 }
182   
183inline
184 void G4Step::SetTrack(G4Track* value)
185 {
186   fpTrack = value;
187 }
188
189
190// Other member functions
191inline
192 void G4Step::InitializeStep( G4Track* aValue )
193 {
194   // Initialize G4Step attributes
195   fStepLength = 0.;
196   fTotalEnergyDeposit = 0.;
197   fNonIonizingEnergyDeposit = 0.;
198   fpTrack = aValue;
199   fpTrack->SetStepLength(0.);
200   
201   // Initialize G4StepPoint attributes.
202   // To avoid the circular dependency between G4Track, G4Step
203   // and G4StepPoint, G4Step has to manage the copy actions.
204   fpPreStepPoint->SetPosition(fpTrack->GetPosition());
205   fpPreStepPoint->SetGlobalTime(fpTrack->GetGlobalTime());
206   fpPreStepPoint->SetLocalTime(fpTrack->GetLocalTime());
207   fpPreStepPoint->SetProperTime(fpTrack->GetProperTime());
208   fpPreStepPoint->SetMomentumDirection(fpTrack->GetMomentumDirection());
209   fpPreStepPoint->SetKineticEnergy(fpTrack->GetKineticEnergy());
210   fpPreStepPoint->SetVelocity(fpTrack->GetVelocity());
211   fpPreStepPoint->SetTouchableHandle(fpTrack->GetTouchableHandle());
212   fpPreStepPoint->SetMaterial( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterial());
213   fpPreStepPoint->SetMaterialCutsCouple( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterialCutsCouple());
214   fpPreStepPoint->SetSensitiveDetector( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
215   fpPreStepPoint->SetPolarization(fpTrack->GetPolarization());
216   fpPreStepPoint->SetSafety(0.);
217   fpPreStepPoint->SetStepStatus(fUndefined);
218   fpPreStepPoint->SetProcessDefinedStep(0);
219   fpPreStepPoint->SetMass(fpTrack->GetDynamicParticle()->GetMass());   
220   fpPreStepPoint->SetCharge(fpTrack->GetDynamicParticle()->GetCharge());
221   fpPreStepPoint->SetWeight(fpTrack->GetWeight());
222   
223   
224   (*fpPostStepPoint) = (*fpPreStepPoint);
225 }
226
227inline
228 void G4Step::UpdateTrack( )
229 {
230   // To avoid the circular dependency between G4Track, G4Step
231   // and G4StepPoint, G4Step has to manage the update actions.
232   //  position, time
233   fpTrack->SetPosition(fpPostStepPoint->GetPosition());
234   fpTrack->SetGlobalTime(fpPostStepPoint->GetGlobalTime());
235   fpTrack->SetLocalTime(fpPostStepPoint->GetLocalTime());
236   fpTrack->SetProperTime(fpPostStepPoint->GetProperTime());
237   //  energy, momentum, polarization
238   fpTrack->SetMomentumDirection(fpPostStepPoint->GetMomentumDirection());
239   fpTrack->SetKineticEnergy(fpPostStepPoint->GetKineticEnergy());
240   fpTrack->SetPolarization(fpPostStepPoint->GetPolarization());
241   //  mass charge
242   G4DynamicParticle* pParticle = (G4DynamicParticle*)(fpTrack->GetDynamicParticle());
243   pParticle->SetMass(fpPostStepPoint->GetMass());
244   pParticle->SetCharge(fpPostStepPoint->GetCharge());
245   //  step length
246   fpTrack->SetStepLength(fStepLength);
247   // NextTouchable is updated
248   // (G4Track::Touchable points touchable of Pre-StepPoint)
249   fpTrack->SetNextTouchableHandle(fpPostStepPoint->GetTouchableHandle());
250   fpTrack->SetWeight(fpPostStepPoint->GetWeight());
251
252   // set velocity
253   fpPostStepPoint->SetVelocity(fpTrack->GetVelocity());
254}
255
256inline G4TrackVector* G4Step::GetfSecondary()  {
257   return fSecondary;
258    }
259inline G4TrackVector* G4Step::GetSecondary() const {
260   return fSecondary;
261    }
262inline void G4Step::SetSecondary(G4TrackVector* value)  {
263   fSecondary=value;
264    }
265inline G4TrackVector* G4Step::NewSecondaryVector()  {
266   fSecondary=new G4TrackVector();
267   return fSecondary;
268    }
269inline void G4Step::DeleteSecondaryVector()  {
270   delete fSecondary;
271    }
272
273inline G4bool G4Step::IsFirstStepInVolume() const
274{
275   return fFirstStepInVolume;
276}
277
278inline G4bool G4Step::IsLastStepInVolume() const
279{
280   return fLastStepInVolume;
281}
282
283
284 inline  void G4Step::SetFirstStepFlag()
285{
286   fFirstStepInVolume = true;
287}
288 
289 inline  void G4Step::ClearFirstStepFlag()
290{
291   fFirstStepInVolume = false;
292}
293
294 inline  void G4Step::SetLastStepFlag()
295{
296   fLastStepInVolume = true;
297}
298 
299 inline  void G4Step::ClearLastStepFlag()
300{
301   fLastStepInVolume = false;
302}
303
Note: See TracBrowser for help on using the repository browser.