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 // ********************************************************************
27 // $Id: G4VParticleChange.icc 68795 2013-04-05 13:24:46Z gcosmo $
29 // remove obsolete methods of SetXXX 19 Sep, 04 H.Kurashige
30 //----------------------------------------------------------------
31 //----------------------------------------------------------------
32 // Set/Get inline functions
35 G4Track* G4VParticleChange::GetSecondary(G4int anIndex) const
37 return (*theListOfSecondaries)[anIndex];
41 G4int G4VParticleChange::GetNumberOfSecondaries() const
43 return theNumberOfSecondaries;
47 void G4VParticleChange::ProposeTrackStatus(G4TrackStatus aStatus)
49 theStatusChange = aStatus;
53 G4TrackStatus G4VParticleChange::GetTrackStatus() const
55 return theStatusChange;
59 G4SteppingControl G4VParticleChange::GetSteppingControl() const
61 return theSteppingControlFlag;
65 void G4VParticleChange::ProposeSteppingControl(G4SteppingControl StepControlFlag)
67 theSteppingControlFlag = StepControlFlag;
71 G4bool G4VParticleChange::GetFirstStepInVolume() const
73 return theFirstStepInVolume;
77 G4bool G4VParticleChange::GetLastStepInVolume() const
79 return theLastStepInVolume;
83 void G4VParticleChange::ProposeFirstStepInVolume(G4bool flag)
85 theFirstStepInVolume = flag;
89 void G4VParticleChange::ProposeLastStepInVolume(G4bool flag)
91 theLastStepInVolume = flag;
94 //----------------------------------------------------------------
95 // Set/Get inline functions
99 G4double G4VParticleChange::GetLocalEnergyDeposit() const
101 return theLocalEnergyDeposit;
105 void G4VParticleChange::ProposeLocalEnergyDeposit(G4double anEnergyPart)
107 theLocalEnergyDeposit = anEnergyPart;
111 G4double G4VParticleChange::GetNonIonizingEnergyDeposit() const
113 return theNonIonizingEnergyDeposit;
117 void G4VParticleChange::ProposeNonIonizingEnergyDeposit(G4double anEnergyPart)
119 theNonIonizingEnergyDeposit = anEnergyPart;
123 G4double G4VParticleChange::GetTrueStepLength() const
125 return theTrueStepLength;
129 void G4VParticleChange::ProposeTrueStepLength(G4double aLength)
131 theTrueStepLength = aLength;
136 void G4VParticleChange::SetVerboseLevel(G4int vLevel)
138 verboseLevel = vLevel;
142 G4int G4VParticleChange::GetVerboseLevel() const
148 G4double G4VParticleChange::GetParentWeight() const
150 return theParentWeight;
154 G4double G4VParticleChange::GetWeight() const
156 return theParentWeight;
160 //----------------------------------------------------------------
161 // inline functions for Initialization
165 void G4VParticleChange::InitializeLocalEnergyDeposit(const G4Track&)
167 // clear theLocalEnergyDeposited
168 theLocalEnergyDeposit = 0.0;
169 theNonIonizingEnergyDeposit = 0.0;
173 void G4VParticleChange::InitializeSteppingControl(const G4Track& )
175 // SteppingControlFlag
176 theSteppingControlFlag = NormalCondition;
180 void G4VParticleChange::Clear()
182 theNumberOfSecondaries = 0;
183 theFirstStepInVolume = false;
184 theLastStepInVolume = false;
187 //----------------------------------------------------------------
188 // functions for Initialization
191 inline void G4VParticleChange::InitializeStatusChange(const G4Track& track)
193 // set TrackStatus equal to the parent track's one
194 theStatusChange = track.GetTrackStatus();
197 inline void G4VParticleChange::InitializeParentWeight(const G4Track& track)
199 // set the parent track's weight
200 theParentWeight = track.GetWeight();
201 isParentWeightProposed = false;
204 inline void G4VParticleChange::InitializeParentGlobalTime(const G4Track& track)
206 // set the parent track's global time at the pre-step point
207 theParentGlobalTime = track.GetStep()->GetPreStepPoint()->GetGlobalTime();
211 inline void G4VParticleChange::InitializeTrueStepLength(const G4Track& track)
213 // Reset theTrueStepLength
214 // !! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
215 theTrueStepLength = track.GetStep()->GetStepLength();
216 // !! TrueStepLength should be copied from G4Step not G4Track
217 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
220 //----------------------------------------------------------------
221 // methods for initialize
223 void G4VParticleChange::InitializeStepInVolumeFlags(const G4Track& track)
225 const G4Step* aStep = track.GetStep();
226 theFirstStepInVolume = aStep-> IsFirstStepInVolume();
227 theLastStepInVolume = aStep-> IsLastStepInVolume();
230 inline void G4VParticleChange::InitializeSecondaries(const G4Track&)
233 if (theNumberOfSecondaries>0) {
235 if (verboseLevel>0) {
236 G4cerr << "G4VParticleChange::Initialize() Warning ";
237 G4cerr << "theListOfSecondaries is not empty " << G4endl;
238 G4cerr << "All objects in theListOfSecondaries are destroyed!" << G4endl;
241 for (G4int index= 0; index<theNumberOfSecondaries; index++){
242 if ( (*theListOfSecondaries)[index] ){
243 delete (*theListOfSecondaries)[index] ;
247 theNumberOfSecondaries = 0;
250 //----------------------------------------------------------------
251 // methods for handling secondaries
254 inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries)
256 // check if tracks still exist in theListOfSecondaries
257 if (theNumberOfSecondaries>0) {
259 if (verboseLevel>0) {
260 G4cerr << "G4VParticleChange::SetNumberOfSecondaries() Warning ";
261 G4cerr << "theListOfSecondaries is not empty ";
264 for (G4int index= 0; index<theNumberOfSecondaries; index++){
265 if ( (*theListOfSecondaries)[index] ){
266 delete (*theListOfSecondaries)[index] ;
270 theNumberOfSecondaries = 0;
271 theSizeOftheListOfSecondaries = totSecondaries;
273 // Initialize ListOfSecondaries
274 theListOfSecondaries->Initialize(totSecondaries);
277 inline void G4VParticleChange::Initialize(const G4Track& track)
279 InitializeStatusChange(track);
280 InitializeLocalEnergyDeposit(track);
281 InitializeSteppingControl(track);
282 InitializeTrueStepLength(track);
283 InitializeSecondaries(track);
284 InitializeParentWeight(track);
285 InitializeParentGlobalTime(track);
286 InitializeStepInVolumeFlags(track);
290 void G4VParticleChange::ClearDebugFlag()
296 void G4VParticleChange::SetDebugFlag()
302 G4bool G4VParticleChange::GetDebugFlag() const
308 void G4VParticleChange::SetSecondaryWeightByProcess(G4bool flag)
310 fSetSecondaryWeightByProcess = flag;
314 G4bool G4VParticleChange::IsSecondaryWeightSetByProcess() const
316 return fSetSecondaryWeightByProcess;
320 void G4VParticleChange::ProposeWeight(G4double w)
323 isParentWeightProposed = true;
327 void G4VParticleChange::ProposeParentWeight(G4double w)