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

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 8.6 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.22 2010/10/18 23:52:04 kurasige Exp $
28// GEANT4 tag $Name: track-V09-03-09 $
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
88
89inline
90 G4double G4Step::GetTotalEnergyDeposit() const
91 {
92   return fTotalEnergyDeposit;
93 }
94
95inline
96 void G4Step::SetTotalEnergyDeposit(G4double value)
97 {
98   fTotalEnergyDeposit = value;   
99 }
100
101inline
102 G4double G4Step::GetNonIonizingEnergyDeposit() const
103 {
104   return fNonIonizingEnergyDeposit;
105 }
106
107inline
108 void G4Step::SetNonIonizingEnergyDeposit(G4double value)
109 {
110   fNonIonizingEnergyDeposit = value;   
111 }
112
113inline
114 void G4Step::AddTotalEnergyDeposit(G4double value)
115 {
116   fTotalEnergyDeposit += value;   
117 }
118
119inline
120 void G4Step::ResetTotalEnergyDeposit()
121 {
122   fTotalEnergyDeposit = 0.;
123   fNonIonizingEnergyDeposit = 0.;   
124 }
125
126inline
127 void G4Step::AddNonIonizingEnergyDeposit(G4double value)
128 {
129   fNonIonizingEnergyDeposit += value;   
130 }
131
132inline
133 void G4Step::ResetNonIonizingEnergyDeposit()
134 {
135   fNonIonizingEnergyDeposit = 0.;
136 }
137
138inline
139 void G4Step::SetControlFlag(G4SteppingControl value)
140 {
141   fpSteppingControlFlag = value;     
142 }
143
144inline
145 G4SteppingControl G4Step::GetControlFlag() const
146 {
147   return fpSteppingControlFlag;     
148 }
149
150inline
151 void G4Step::CopyPostToPreStepPoint( )
152 {
153   //This method is called at the beggining of each step
154   *(fpPreStepPoint) = *(fpPostStepPoint);
155   fpPostStepPoint->SetStepStatus(fUndefined);
156   // clear secondary in current
157   fSecondary->secondaryInCurrent.clear();
158}
159
160
161//-------------------------------------------------------------
162// To implement bi-directional association between G4Step and
163// and G4Track, a combined usage of 'forward declaration' and
164// 'include' is necessary.
165//-------------------------------------------------------------
166#include "G4Track.hh"
167
168inline
169 G4Track* G4Step::GetTrack() const
170 {
171   return fpTrack;
172 }
173   
174inline
175 void G4Step::SetTrack(G4Track* value)
176 {
177   fpTrack = value;
178 }
179
180
181// Other member functions
182inline
183 void G4Step::InitializeStep( G4Track* aValue )
184 {
185   // Initialize G4Step attributes
186   fStepLength = 0.;
187   fTotalEnergyDeposit = 0.;
188   fNonIonizingEnergyDeposit = 0.;
189   fpTrack = aValue;
190   fpTrack->SetStepLength(0.);
191   
192   // Initialize G4StepPoint attributes.
193   // To avoid the circular dependency between G4Track, G4Step
194   // and G4StepPoint, G4Step has to manage the copy actions.
195   fpPreStepPoint->SetPosition(fpTrack->GetPosition());
196   fpPreStepPoint->SetGlobalTime(fpTrack->GetGlobalTime());
197   fpPreStepPoint->SetLocalTime(fpTrack->GetLocalTime());
198   fpPreStepPoint->SetProperTime(fpTrack->GetProperTime());
199   fpPreStepPoint->SetMomentumDirection(fpTrack->GetMomentumDirection());
200   fpPreStepPoint->SetKineticEnergy(fpTrack->GetKineticEnergy());
201   fpPreStepPoint->SetVelocity(fpTrack->GetVelocity());
202   fpPreStepPoint->SetTouchableHandle(fpTrack->GetTouchableHandle());
203   fpPreStepPoint->SetMaterial( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterial());
204   fpPreStepPoint->SetMaterialCutsCouple( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterialCutsCouple());
205   fpPreStepPoint->SetSensitiveDetector( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
206   fpPreStepPoint->SetPolarization(fpTrack->GetPolarization());
207   fpPreStepPoint->SetSafety(0.);
208   fpPreStepPoint->SetStepStatus(fUndefined);
209   fpPreStepPoint->SetProcessDefinedStep(0);
210   fpPreStepPoint->SetMass(fpTrack->GetDynamicParticle()->GetMass());   
211   fpPreStepPoint->SetCharge(fpTrack->GetDynamicParticle()->GetCharge());
212   fpPreStepPoint->SetWeight(fpTrack->GetWeight());
213   
214   // clear secondary in current       
215   fSecondary->secondaryInCurrent.clear();
216 
217   (*fpPostStepPoint) = (*fpPreStepPoint);
218 }
219
220inline
221 void G4Step::UpdateTrack( )
222 {
223   // To avoid the circular dependency between G4Track, G4Step
224   // and G4StepPoint, G4Step has to manage the update actions.
225   //  position, time
226   fpTrack->SetPosition(fpPostStepPoint->GetPosition());
227   fpTrack->SetGlobalTime(fpPostStepPoint->GetGlobalTime());
228   fpTrack->SetLocalTime(fpPostStepPoint->GetLocalTime());
229   fpTrack->SetProperTime(fpPostStepPoint->GetProperTime());
230   //  energy, momentum, polarization
231   fpTrack->SetMomentumDirection(fpPostStepPoint->GetMomentumDirection());
232   fpTrack->SetKineticEnergy(fpPostStepPoint->GetKineticEnergy());
233   fpTrack->SetPolarization(fpPostStepPoint->GetPolarization());
234   //  mass charge
235   G4DynamicParticle* pParticle = (G4DynamicParticle*)(fpTrack->GetDynamicParticle());
236   pParticle->SetMass(fpPostStepPoint->GetMass());
237   pParticle->SetCharge(fpPostStepPoint->GetCharge());
238   //  step length
239   fpTrack->SetStepLength(fStepLength);
240   // NextTouchable is updated
241   // (G4Track::Touchable points touchable of Pre-StepPoint)
242   fpTrack->SetNextTouchableHandle(fpPostStepPoint->GetTouchableHandle());
243   fpTrack->SetWeight(fpPostStepPoint->GetWeight());
244
245
246   // set velocity
247   fpPostStepPoint->SetVelocity(fpTrack->GetVelocity());
248}
249
250inline   
251 const std::vector<const G4Track*>* G4Step::GetSecondaryInCurrentStep() const
252{
253  return  &fSecondary->secondaryInCurrent;
254}
255
256inline const G4TrackVector* G4Step::GetSecondary() const 
257{
258   return fSecondary;
259}
260
261inline G4TrackVector* G4Step::GetfSecondary() 
262{
263   return fSecondary;
264}
265
266inline void G4Step::SetSecondary(G4TrackVector* value) 
267{
268   fSecondary=value;
269}
270
271inline
272 G4TrackVector* G4Step::NewSecondaryVector() 
273{
274   fSecondary=new G4TrackVector();
275   return fSecondary;
276}
277
278inline void G4Step::DeleteSecondaryVector()  {
279   delete fSecondary;
280    }
281
282inline G4bool G4Step::IsFirstStepInVolume() const
283{
284   return fFirstStepInVolume;
285}
286
287inline G4bool G4Step::IsLastStepInVolume() const
288{
289   return fLastStepInVolume;
290}
291
292
293 inline  void G4Step::SetFirstStepFlag()
294{
295   fFirstStepInVolume = true;
296}
297 
298 inline  void G4Step::ClearFirstStepFlag()
299{
300   fFirstStepInVolume = false;
301}
302
303 inline  void G4Step::SetLastStepFlag()
304{
305   fLastStepInVolume = true;
306}
307 
308 inline  void G4Step::ClearLastStepFlag()
309{
310   fLastStepInVolume = false;
311}
312
Note: See TracBrowser for help on using the repository browser.