00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // remove obsolete methods of SetXXX 19 Sep, 04 H.Kurashige 00030 //---------------------------------------------------------------- 00031 //---------------------------------------------------------------- 00032 // Set/Get inline functions 00033 // 00034 inline 00035 G4Track* G4VParticleChange::GetSecondary(G4int anIndex) const 00036 { 00037 return (*theListOfSecondaries)[anIndex]; 00038 } 00039 00040 inline 00041 G4int G4VParticleChange::GetNumberOfSecondaries() const 00042 { 00043 return theNumberOfSecondaries; 00044 } 00045 00046 inline 00047 void G4VParticleChange::ProposeTrackStatus(G4TrackStatus aStatus) 00048 { 00049 theStatusChange = aStatus; 00050 } 00051 00052 inline 00053 G4TrackStatus G4VParticleChange::GetTrackStatus() const 00054 { 00055 return theStatusChange; 00056 } 00057 00058 inline 00059 G4SteppingControl G4VParticleChange::GetSteppingControl() const 00060 { 00061 return theSteppingControlFlag; 00062 } 00063 00064 inline 00065 void G4VParticleChange::ProposeSteppingControl(G4SteppingControl StepControlFlag) 00066 { 00067 theSteppingControlFlag = StepControlFlag; 00068 } 00069 00070 inline 00071 G4bool G4VParticleChange::GetFirstStepInVolume() const 00072 { 00073 return theFirstStepInVolume; 00074 } 00075 00076 inline 00077 G4bool G4VParticleChange::GetLastStepInVolume() const 00078 { 00079 return theLastStepInVolume; 00080 } 00081 00082 inline 00083 void G4VParticleChange::ProposeFirstStepInVolume(G4bool flag) 00084 { 00085 theFirstStepInVolume = flag; 00086 } 00087 00088 inline 00089 void G4VParticleChange::ProposeLastStepInVolume(G4bool flag) 00090 { 00091 theLastStepInVolume = flag; 00092 } 00093 00094 //---------------------------------------------------------------- 00095 // Set/Get inline functions 00096 // 00097 00098 inline 00099 G4double G4VParticleChange::GetLocalEnergyDeposit() const 00100 { 00101 return theLocalEnergyDeposit; 00102 } 00103 00104 inline 00105 void G4VParticleChange::ProposeLocalEnergyDeposit(G4double anEnergyPart) 00106 { 00107 theLocalEnergyDeposit = anEnergyPart; 00108 } 00109 00110 inline 00111 G4double G4VParticleChange::GetNonIonizingEnergyDeposit() const 00112 { 00113 return theNonIonizingEnergyDeposit; 00114 } 00115 00116 inline 00117 void G4VParticleChange::ProposeNonIonizingEnergyDeposit(G4double anEnergyPart) 00118 { 00119 theNonIonizingEnergyDeposit = anEnergyPart; 00120 } 00121 00122 inline 00123 G4double G4VParticleChange::GetTrueStepLength() const 00124 { 00125 return theTrueStepLength; 00126 } 00127 00128 inline 00129 void G4VParticleChange::ProposeTrueStepLength(G4double aLength) 00130 { 00131 theTrueStepLength = aLength; 00132 } 00133 00134 00135 inline 00136 void G4VParticleChange::SetVerboseLevel(G4int vLevel) 00137 { 00138 verboseLevel = vLevel; 00139 } 00140 00141 inline 00142 G4int G4VParticleChange::GetVerboseLevel() const 00143 { 00144 return verboseLevel; 00145 } 00146 00147 inline 00148 G4double G4VParticleChange::GetParentWeight() const 00149 { 00150 return theParentWeight; 00151 } 00152 00153 inline 00154 G4double G4VParticleChange::GetWeight() const 00155 { 00156 return theParentWeight; 00157 } 00158 00159 00160 //---------------------------------------------------------------- 00161 // inline functions for Initialization 00162 // 00163 00164 inline 00165 void G4VParticleChange::InitializeLocalEnergyDeposit(const G4Track&) 00166 { 00167 // clear theLocalEnergyDeposited 00168 theLocalEnergyDeposit = 0.0; 00169 theNonIonizingEnergyDeposit = 0.0; 00170 } 00171 00172 inline 00173 void G4VParticleChange::InitializeSteppingControl(const G4Track& ) 00174 { 00175 // SteppingControlFlag 00176 theSteppingControlFlag = NormalCondition; 00177 } 00178 00179 inline 00180 void G4VParticleChange::Clear() 00181 { 00182 theNumberOfSecondaries = 0; 00183 theFirstStepInVolume = false; 00184 theLastStepInVolume = false; 00185 } 00186 00187 //---------------------------------------------------------------- 00188 // functions for Initialization 00189 // 00190 00191 inline void G4VParticleChange::InitializeStatusChange(const G4Track& track) 00192 { 00193 // set TrackStatus equal to the parent track's one 00194 theStatusChange = track.GetTrackStatus(); 00195 } 00196 00197 inline void G4VParticleChange::InitializeParentWeight(const G4Track& track) 00198 { 00199 // set the parent track's weight 00200 theParentWeight = track.GetWeight(); 00201 isParentWeightProposed = false; 00202 } 00203 00204 inline void G4VParticleChange::InitializeParentGlobalTime(const G4Track& track) 00205 { 00206 // set the parent track's global time at the pre-step point 00207 theParentGlobalTime = track.GetStep()->GetPreStepPoint()->GetGlobalTime(); 00208 } 00209 00210 00211 inline void G4VParticleChange::InitializeTrueStepLength(const G4Track& track) 00212 { 00213 // Reset theTrueStepLength 00214 // !! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00215 theTrueStepLength = track.GetStep()->GetStepLength(); 00216 // !! TrueStepLength should be copied from G4Step not G4Track 00217 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00218 } 00219 00220 //---------------------------------------------------------------- 00221 // methods for initialize 00222 inline 00223 void G4VParticleChange::InitializeStepInVolumeFlags(const G4Track& track) 00224 { 00225 const G4Step* aStep = track.GetStep(); 00226 theFirstStepInVolume = aStep-> IsFirstStepInVolume(); 00227 theLastStepInVolume = aStep-> IsLastStepInVolume(); 00228 } 00229 00230 inline void G4VParticleChange::InitializeSecondaries(const G4Track&) 00231 { 00232 // clear secondaries 00233 if (theNumberOfSecondaries>0) { 00234 #ifdef G4VERBOSE 00235 if (verboseLevel>0) { 00236 G4cerr << "G4VParticleChange::Initialize() Warning "; 00237 G4cerr << "theListOfSecondaries is not empty " << G4endl; 00238 G4cerr << "All objects in theListOfSecondaries are destroyed!" << G4endl; 00239 } 00240 #endif 00241 for (G4int index= 0; index<theNumberOfSecondaries; index++){ 00242 if ( (*theListOfSecondaries)[index] ){ 00243 delete (*theListOfSecondaries)[index] ; 00244 } 00245 } 00246 } 00247 theNumberOfSecondaries = 0; 00248 } 00249 00250 //---------------------------------------------------------------- 00251 // methods for handling secondaries 00252 // 00253 00254 inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries) 00255 { 00256 // check if tracks still exist in theListOfSecondaries 00257 if (theNumberOfSecondaries>0) { 00258 #ifdef G4VERBOSE 00259 if (verboseLevel>0) { 00260 G4cerr << "G4VParticleChange::SetNumberOfSecondaries() Warning "; 00261 G4cerr << "theListOfSecondaries is not empty "; 00262 } 00263 #endif 00264 for (G4int index= 0; index<theNumberOfSecondaries; index++){ 00265 if ( (*theListOfSecondaries)[index] ){ 00266 delete (*theListOfSecondaries)[index] ; 00267 } 00268 } 00269 } 00270 theNumberOfSecondaries = 0; 00271 theSizeOftheListOfSecondaries = totSecondaries; 00272 00273 // Initialize ListOfSecondaries 00274 theListOfSecondaries->Initialize(totSecondaries); 00275 } 00276 00277 inline void G4VParticleChange::Initialize(const G4Track& track) 00278 { 00279 InitializeStatusChange(track); 00280 InitializeLocalEnergyDeposit(track); 00281 InitializeSteppingControl(track); 00282 InitializeTrueStepLength(track); 00283 InitializeSecondaries(track); 00284 InitializeParentWeight(track); 00285 InitializeParentGlobalTime(track); 00286 InitializeStepInVolumeFlags(track); 00287 } 00288 00289 inline 00290 void G4VParticleChange::ClearDebugFlag() 00291 { 00292 debugFlag = false; 00293 } 00294 00295 inline 00296 void G4VParticleChange::SetDebugFlag() 00297 { 00298 debugFlag = true; 00299 } 00300 00301 inline 00302 G4bool G4VParticleChange::GetDebugFlag() const 00303 { 00304 return debugFlag; 00305 } 00306 00307 inline 00308 void G4VParticleChange::SetSecondaryWeightByProcess(G4bool flag) 00309 { 00310 fSetSecondaryWeightByProcess = flag; 00311 } 00312 00313 inline 00314 G4bool G4VParticleChange::IsSecondaryWeightSetByProcess() const 00315 { 00316 return fSetSecondaryWeightByProcess; 00317 } 00318 00319 inline 00320 void G4VParticleChange::ProposeWeight(G4double w) 00321 { 00322 theParentWeight = w; 00323 isParentWeightProposed = true; 00324 } 00325 00326 inline 00327 void G4VParticleChange::ProposeParentWeight(G4double w) 00328 { 00329 ProposeWeight(w); 00330 } 00331