2// ********************************************************************
3// * License and Disclaimer *
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. *
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. *
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// ********************************************************************
26// G4VParticleChange inline methods implementation
28// Author: Hisaya Kurashige, 23 March 1998
29// --------------------------------------------------------------------
31inline G4Track* G4VParticleChange::GetSecondary(G4int anIndex) const
33 return (*theListOfSecondaries)[anIndex];
36inline G4int G4VParticleChange::GetNumberOfSecondaries() const
38 return theNumberOfSecondaries;
41inline void G4VParticleChange::ProposeTrackStatus(G4TrackStatus aStatus)
43 theStatusChange = aStatus;
46inline G4TrackStatus G4VParticleChange::GetTrackStatus() const
48 return theStatusChange;
51inline G4SteppingControl G4VParticleChange::GetSteppingControl() const
53 return theSteppingControlFlag;
57G4VParticleChange::ProposeSteppingControl(G4SteppingControl StepControlFlag)
59 theSteppingControlFlag = StepControlFlag;
62inline G4bool G4VParticleChange::GetFirstStepInVolume() const
64 return theFirstStepInVolume;
67inline G4bool G4VParticleChange::GetLastStepInVolume() const
69 return theLastStepInVolume;
72inline void G4VParticleChange::ProposeFirstStepInVolume(G4bool flag)
74 theFirstStepInVolume = flag;
77inline void G4VParticleChange::ProposeLastStepInVolume(G4bool flag)
79 theLastStepInVolume = flag;
82inline G4double G4VParticleChange::GetLocalEnergyDeposit() const
84 return theLocalEnergyDeposit;
87inline void G4VParticleChange::ProposeLocalEnergyDeposit(G4double anEnergyPart)
89 theLocalEnergyDeposit = anEnergyPart;
92inline G4double G4VParticleChange::GetNonIonizingEnergyDeposit() const
94 return theNonIonizingEnergyDeposit;
98G4VParticleChange::ProposeNonIonizingEnergyDeposit(G4double anEnergyPart)
100 theNonIonizingEnergyDeposit = anEnergyPart;
103inline G4double G4VParticleChange::GetTrueStepLength() const
105 return theTrueStepLength;
108inline void G4VParticleChange::ProposeTrueStepLength(G4double aLength)
110 theTrueStepLength = aLength;
113inline void G4VParticleChange::SetVerboseLevel(G4int vLevel)
115 verboseLevel = vLevel;
118inline G4int G4VParticleChange::GetVerboseLevel() const
123inline G4double G4VParticleChange::GetParentWeight() const
125 return theParentWeight;
128inline G4double G4VParticleChange::GetWeight() const
130 return theParentWeight;
133// ----------------------------------------------------------------
134// inline functions for Initialization
136inline void G4VParticleChange::InitializeLocalEnergyDeposit(const G4Track&)
138 // clear theLocalEnergyDeposited
139 theLocalEnergyDeposit = 0.0;
140 theNonIonizingEnergyDeposit = 0.0;
143inline void G4VParticleChange::InitializeSteppingControl(const G4Track&)
145 // SteppingControlFlag
146 theSteppingControlFlag = NormalCondition;
149inline void G4VParticleChange::Clear()
151 theNumberOfSecondaries = 0;
152 theFirstStepInVolume = false;
153 theLastStepInVolume = false;
156inline void G4VParticleChange::InitializeStatusChange(const G4Track& track)
158 // set TrackStatus equal to the parent track's one
159 theStatusChange = track.GetTrackStatus();
162inline void G4VParticleChange::InitializeParentWeight(const G4Track& track)
164 // set the parent track's weight
165 theParentWeight = track.GetWeight();
166 isParentWeightProposed = false;
169inline void G4VParticleChange::InitializeParentGlobalTime(const G4Track& track)
171 // set the parent track's global time at the pre-step point
172 theParentGlobalTime = track.GetStep()->GetPreStepPoint()->GetGlobalTime();
175inline void G4VParticleChange::InitializeTrueStepLength(const G4Track& track)
177 // Reset theTrueStepLength
178 // !! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
179 theTrueStepLength = track.GetStep()->GetStepLength();
180 // !! TrueStepLength should be copied from G4Step not G4Track
181 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
184inline void G4VParticleChange::InitializeStepInVolumeFlags(const G4Track& track)
186 const G4Step* aStep = track.GetStep();
187 theFirstStepInVolume = aStep->IsFirstStepInVolume();
188 theLastStepInVolume = aStep->IsLastStepInVolume();
191inline void G4VParticleChange::InitializeSecondaries(const G4Track&)
194 if(theNumberOfSecondaries > 0)
199 G4cerr << "G4VParticleChange::Initialize() Warning ";
200 G4cerr << "theListOfSecondaries is not empty " << G4endl;
201 G4cerr << "All objects in theListOfSecondaries are destroyed!" << G4endl;
204 for(G4int index = 0; index < theNumberOfSecondaries; index++)
206 if((*theListOfSecondaries)[index])
208 delete(*theListOfSecondaries)[index];
212 theNumberOfSecondaries = 0;
215// ----------------------------------------------------------------
216// methods for handling secondaries
218inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries)
220 // check if tracks still exist in theListOfSecondaries
221 if(theNumberOfSecondaries > 0)
226 G4cerr << "G4VParticleChange::SetNumberOfSecondaries() Warning ";
227 G4cerr << "theListOfSecondaries is not empty ";
230 for(G4int index = 0; index < theNumberOfSecondaries; index++)
232 if((*theListOfSecondaries)[index])
234 delete(*theListOfSecondaries)[index];
238 theNumberOfSecondaries = 0;
239 theSizeOftheListOfSecondaries = totSecondaries;
241 // Initialize ListOfSecondaries
242 theListOfSecondaries->Initialize(totSecondaries);
245inline void G4VParticleChange::Initialize(const G4Track& track)
247 InitializeStatusChange(track);
248 InitializeLocalEnergyDeposit(track);
249 InitializeSteppingControl(track);
250 InitializeTrueStepLength(track);
251 InitializeSecondaries(track);
252 InitializeParentWeight(track);
253 InitializeParentGlobalTime(track);
254 InitializeStepInVolumeFlags(track);
257inline void G4VParticleChange::ClearDebugFlag()
262inline void G4VParticleChange::SetDebugFlag()
267inline G4bool G4VParticleChange::GetDebugFlag() const
272inline void G4VParticleChange::SetSecondaryWeightByProcess(G4bool flag)
274 fSetSecondaryWeightByProcess = flag;
277inline G4bool G4VParticleChange::IsSecondaryWeightSetByProcess() const
279 return fSetSecondaryWeightByProcess;
282inline void G4VParticleChange::ProposeWeight(G4double w)
285 isParentWeightProposed = true;
288inline void G4VParticleChange::ProposeParentWeight(G4double w)