Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4VParticleChange class implementation << 27 // 26 // 28 // Author: Hisaya Kurashige, 23 March 1998 << 27 // $Id: G4VParticleChange.cc,v 1.18 2006/06/29 21:15:19 gunter Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-08-01 $ >> 29 // >> 30 // >> 31 // -------------------------------------------------------------- >> 32 // GEANT 4 class implementation file >> 33 // >> 34 // >> 35 // ------------------------------------------------------------ >> 36 // Implemented for the new scheme 23 Mar. 1998 H.Kurahige >> 37 // -------------------------------------------------------------- 30 38 31 #include "G4VParticleChange.hh" 39 #include "G4VParticleChange.hh" 32 #include "G4SystemOfUnits.hh" << 40 #include "G4Track.hh" >> 41 #include "G4Step.hh" >> 42 #include "G4TrackFastVector.hh" 33 #include "G4ExceptionSeverity.hh" 43 #include "G4ExceptionSeverity.hh" 34 44 35 const G4double G4VParticleChange::accuracyForW << 45 const G4double G4VParticleChange::accuracyForWarning = 1.0e-9; 36 const G4double G4VParticleChange::accuracyForE 46 const G4double G4VParticleChange::accuracyForException = 0.001; 37 const G4int G4VParticleChange::maxError = 10; << 38 47 39 // ------------------------------------------- << 48 G4VParticleChange::G4VParticleChange(): 40 G4VParticleChange::G4VParticleChange() << 49 theNumberOfSecondaries(0), >> 50 theSizeOftheListOfSecondaries(G4TrackFastVectorSize), >> 51 theStatusChange(fAlive), >> 52 theSteppingControlFlag(NormalCondition), >> 53 theLocalEnergyDeposit(0.0), >> 54 verboseLevel(1), >> 55 theParentWeight(1.0), >> 56 fSetSecondaryWeightByProcess(false), >> 57 fSetParentWeightByProcess(true) 41 { 58 { >> 59 debugFlag = false; 42 #ifdef G4VERBOSE 60 #ifdef G4VERBOSE 43 // activate CheckIt if in VERBOSE mode << 61 // activate CHeckIt if in VERBOSE mode 44 debugFlag = true; 62 debugFlag = true; 45 #endif 63 #endif >> 64 theListOfSecondaries = new G4TrackFastVector(); 46 } 65 } 47 66 48 // ------------------------------------------- << 67 G4VParticleChange::~G4VParticleChange() { 49 void G4VParticleChange::AddSecondary(G4Track* << 68 // check if tracks still exist in theListOfSecondaries 50 { << 69 if (theNumberOfSecondaries>0) { 51 if(debugFlag) << 70 #ifdef G4VERBOSE 52 CheckSecondary(*aTrack); << 71 if (verboseLevel>0) { 53 << 72 G4cerr << "G4VParticleChange::~G4VParticleChange() Warning "; 54 if(!fSetSecondaryWeightByProcess) << 73 G4cerr << "theListOfSecondaries is not empty "; 55 aTrack->SetWeight(theParentWeight); << 74 } 56 << 75 #endif 57 // add a secondary after size check << 76 for (G4int index= 0; index<theNumberOfSecondaries; index++){ 58 if(theSizeOftheListOfSecondaries > theNumber << 77 if ( (*theListOfSecondaries)[index] ) delete (*theListOfSecondaries)[index] ; 59 { << 78 } 60 theListOfSecondaries[theNumberOfSecondarie << 61 } << 62 else << 63 { << 64 theListOfSecondaries.push_back(aTrack); << 65 ++theSizeOftheListOfSecondaries; << 66 } 79 } 67 ++theNumberOfSecondaries; << 80 delete theListOfSecondaries; 68 } 81 } 69 82 70 // ------------------------------------------- << 83 // copy and assignment operators are implemented as "shallow copy" 71 G4Step* G4VParticleChange::UpdateStepInfo(G4St << 84 G4VParticleChange::G4VParticleChange(const G4VParticleChange &right): >> 85 theNumberOfSecondaries(0), >> 86 theSizeOftheListOfSecondaries(G4TrackFastVectorSize), >> 87 theStatusChange(fAlive), >> 88 theSteppingControlFlag(NormalCondition), >> 89 theLocalEnergyDeposit(0.0), >> 90 verboseLevel(1), >> 91 theParentWeight(1.0), >> 92 fSetSecondaryWeightByProcess(false) 72 { 93 { 73 // Update the G4Step specific attributes << 94 debugFlag = false; 74 pStep->SetStepLength(theTrueStepLength); << 95 #ifdef G4VERBOSE 75 pStep->AddTotalEnergyDeposit(theLocalEnergyD << 96 // activate CHeckIt if in VERBOSE mode 76 pStep->AddNonIonizingEnergyDeposit(theNonIon << 97 debugFlag = true; 77 pStep->SetControlFlag(theSteppingControlFlag << 98 #endif 78 << 79 if(theFirstStepInVolume) << 80 { << 81 pStep->SetFirstStepFlag(); << 82 } << 83 else << 84 { << 85 pStep->ClearFirstStepFlag(); << 86 } << 87 if(theLastStepInVolume) << 88 { << 89 pStep->SetLastStepFlag(); << 90 } << 91 else << 92 { << 93 pStep->ClearLastStepFlag(); << 94 } << 95 99 96 return pStep; << 100 theListOfSecondaries = right.theListOfSecondaries; >> 101 theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries; >> 102 theNumberOfSecondaries = right.theNumberOfSecondaries; >> 103 theStatusChange = right.theStatusChange; >> 104 theTrueStepLength = right.theTrueStepLength; >> 105 theLocalEnergyDeposit = right.theLocalEnergyDeposit; >> 106 theSteppingControlFlag = right.theSteppingControlFlag; >> 107 fSetParentWeightByProcess = right.fSetParentWeightByProcess; 97 } 108 } 98 109 99 // ------------------------------------------- << 110 100 G4Step* G4VParticleChange::UpdateStepForAtRest << 111 G4VParticleChange & G4VParticleChange::operator=(const G4VParticleChange &right) 101 { 112 { 102 if(isParentWeightProposed) << 113 debugFlag = false; 103 { << 114 #ifdef G4VERBOSE 104 Step->GetPostStepPoint()->SetWeight(thePar << 115 // activate CHeckIt if in VERBOSE mode 105 } << 116 debugFlag = true; 106 return UpdateStepInfo(Step); << 117 #endif >> 118 if (this != &right) >> 119 { >> 120 theListOfSecondaries = right.theListOfSecondaries; >> 121 theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries; >> 122 theNumberOfSecondaries = right.theNumberOfSecondaries; >> 123 theStatusChange = right.theStatusChange; >> 124 theTrueStepLength = right.theTrueStepLength; >> 125 theLocalEnergyDeposit = right.theLocalEnergyDeposit; >> 126 theSteppingControlFlag = right.theSteppingControlFlag; >> 127 fSetParentWeightByProcess = right.fSetParentWeightByProcess; >> 128 } >> 129 return *this; 107 } 130 } 108 131 109 // ------------------------------------------- << 132 G4bool G4VParticleChange::operator==(const G4VParticleChange &right) const 110 G4Step* G4VParticleChange::UpdateStepForAlongS << 111 { 133 { 112 if(isParentWeightProposed) << 134 return (this == (G4VParticleChange *) &right); 113 { << 114 G4double initialWeight = Step->GetPreStepP << 115 G4double currentWeight = Step->GetPostStep << 116 G4double finalWeight = (theParentWeight << 117 Step->GetPostStepPoint()->SetWeight(finalW << 118 } << 119 return UpdateStepInfo(Step); << 120 } 135 } 121 136 122 // ------------------------------------------- << 137 123 G4Step* G4VParticleChange::UpdateStepForPostSt << 138 G4bool G4VParticleChange::operator!=(const G4VParticleChange &right) const 124 { 139 { 125 if(isParentWeightProposed) << 140 return (this != (G4VParticleChange *) &right); 126 { << 127 Step->GetPostStepPoint()->SetWeight(thePar << 128 } << 129 return UpdateStepInfo(Step); << 130 } 141 } 131 142 132 // ------------------------------------------- << 143 //---------------------------------------------------------------- >> 144 // methods for printing messages >> 145 // >> 146 133 void G4VParticleChange::DumpInfo() const 147 void G4VParticleChange::DumpInfo() const 134 { 148 { 135 auto vol = theCurrentTrack->GetVolume(); << 149 136 G4String vname = (nullptr == vol) ? G4String << 150 // Show header 137 G4long olprc = G4cout.precision(8); << 151 G4cout.precision(3); 138 G4cout << " --------------------------- << 152 G4cout << " -----------------------------------------------" 139 G4cout << " G4VParticleChange Informa << 153 << G4endl; 140 G4cout << " TrackID : " < << 154 G4cout << " G4ParticleChange Information " << std::setw(20) << G4endl; 141 << G4endl; << 155 G4cout << " -----------------------------------------------" 142 G4cout << " ParentID : " < << 156 << G4endl; 143 << G4endl; << 157 144 G4cout << " Particle : " << 158 G4cout << " # of 2ndaries : " 145 << theCurrentTrack->GetParticleDefinition() << 159 << std::setw(20) << theNumberOfSecondaries >> 160 << G4endl; >> 161 >> 162 if (theNumberOfSecondaries >0) { >> 163 G4cout << " Pointer to 2ndaries : " >> 164 << std::setw(20) << GetSecondary(0) >> 165 << G4endl; >> 166 G4cout << " (Showed only 1st one)" 146 << G4endl; 167 << G4endl; 147 G4cout << " Kinetic energy (MeV): " << 148 << theCurrentTrack->GetKineticEnergy( << 149 G4cout << " Position (mm) : " << 150 << theCurrentTrack->GetPosition() << << 151 G4cout << " Direction : " << 152 << theCurrentTrack->GetMomentumDirect << 153 G4cout << " PhysicsVolume : " < << 154 G4cout << " Material : " << 155 << theCurrentTrack->GetMaterial()->GetName( << 156 G4cout << " --------------------------- << 157 << 158 G4cout << " # of secondaries : " < << 159 << theNumberOfSecondaries << G4endl; << 160 << 161 G4cout << " --------------------------- << 162 << 163 G4cout << " Energy Deposit (MeV): " < << 164 << theLocalEnergyDeposit / MeV << G4e << 165 << 166 G4cout << " NIEL Energy Deposit (MeV): " < << 167 << theNonIonizingEnergyDeposit / MeV << 168 << 169 G4cout << " Track Status : " < << 170 if(theStatusChange == fAlive) << 171 { << 172 G4cout << " Alive"; << 173 } << 174 else if(theStatusChange == fStopButAlive) << 175 { << 176 G4cout << " StopButAlive"; << 177 } << 178 else if(theStatusChange == fStopAndKill) << 179 { << 180 G4cout << " StopAndKill"; << 181 } << 182 else if(theStatusChange == fKillTrackAndSeco << 183 { << 184 G4cout << " KillTrackAndSecondaries"; << 185 } << 186 else if(theStatusChange == fSuspend) << 187 { << 188 G4cout << " Suspend"; << 189 } << 190 else if(theStatusChange == fPostponeToNextEv << 191 { << 192 G4cout << " PostponeToNextEvent"; << 193 } << 194 G4cout << G4endl; << 195 G4cout << " TruePathLength (mm) : " < << 196 << theTrueStepLength / mm << G4endl; << 197 G4cout << " Stepping Control : " < << 198 << theSteppingControlFlag << G4endl; << 199 if(theFirstStepInVolume) << 200 { << 201 G4cout << " First step in volume" << << 202 } << 203 if(theLastStepInVolume) << 204 { << 205 G4cout << " Last step in volume" << << 206 } << 207 << 208 #ifdef G4VERBOSE << 209 if(nError == maxError) << 210 { << 211 G4cout << " ------------------------- << 212 G4cout << " G4VParticleChange warni << 213 G4cout << " ------------------------- << 214 } 168 } 215 #endif << 169 G4cout << " -----------------------------------------------" 216 << 170 << G4endl; 217 G4cout.precision(olprc); << 171 >> 172 G4cout << " Energy Deposit (MeV): " >> 173 << std::setw(20) << theLocalEnergyDeposit/MeV >> 174 << G4endl; >> 175 >> 176 G4cout << " Track Status : " >> 177 << std::setw(20); >> 178 if( theStatusChange == fAlive ){ >> 179 G4cout << " Alive"; >> 180 } else if( theStatusChange == fStopButAlive ){ >> 181 G4cout << " StopButAlive"; >> 182 } else if( theStatusChange == fStopAndKill ){ >> 183 G4cout << " StopAndKill"; >> 184 } else if( theStatusChange == fKillTrackAndSecondaries ){ >> 185 G4cout << " KillTrackAndSecondaries"; >> 186 } else if( theStatusChange == fSuspend ){ >> 187 G4cout << " Suspend"; >> 188 } else if( theStatusChange == fPostponeToNextEvent ){ >> 189 G4cout << " PostponeToNextEvent"; >> 190 } >> 191 G4cout << G4endl; >> 192 G4cout << " True Path Length (mm) : " >> 193 << std::setw(20) << theTrueStepLength/mm >> 194 << G4endl; >> 195 G4cout << " Stepping Control : " >> 196 << std::setw(20) << theSteppingControlFlag >> 197 << G4endl; >> 198 G4cout << G4endl; 218 } 199 } 219 200 220 // ------------------------------------------- << 201 G4bool G4VParticleChange::CheckIt(const G4Track& ) 221 G4bool G4VParticleChange::CheckIt([[maybe_unus << 222 { 202 { 223 G4bool isOK = true; << 203 >> 204 G4bool exitWithError = false; >> 205 G4double accuracy; 224 206 225 // Energy deposit should not be negative 207 // Energy deposit should not be negative 226 if(theLocalEnergyDeposit < 0.0) << 208 G4bool itsOKforEnergy = true; 227 { << 209 accuracy = -1.0*theLocalEnergyDeposit/MeV; 228 isOK = false; << 210 if (accuracy > accuracyForWarning) { 229 ++nError; << 211 #ifdef G4VERBOSE 230 #ifdef G4VERBOSE << 212 G4cout << " G4VParticleChange::CheckIt : "; 231 if(nError < maxError) << 213 G4cout << "the energy deposit is negative !!" << G4endl; 232 { << 214 G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl; 233 G4cout << " G4VParticleChange::CheckIt << 234 G4cout << "the energy deposit " << theLo << 235 << " MeV is negative !!" << G4endl; << 236 } << 237 #endif 215 #endif 238 theLocalEnergyDeposit = 0.0; << 216 itsOKforEnergy = false; >> 217 if (accuracy > accuracyForException) exitWithError = true; 239 } 218 } 240 << 219 241 // true path length should not be negative 220 // true path length should not be negative 242 if(theTrueStepLength < 0.0) << 221 G4bool itsOKforStepLength = true; 243 { << 222 accuracy = -1.0*theTrueStepLength/mm; 244 isOK = false; << 223 if (accuracy > accuracyForWarning) { 245 ++nError; << 224 #ifdef G4VERBOSE 246 #ifdef G4VERBOSE << 225 G4cout << " G4VParticleChange::CheckIt : "; 247 if(nError < maxError) << 226 G4cout << "the true step length is negative !!" << G4endl; 248 { << 227 G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl; 249 G4cout << " G4VParticleChange::CheckIt << 250 G4cout << "true path length " << theTrue << 251 << " mm is negative !!" << G4endl; << 252 } << 253 #endif 228 #endif 254 theTrueStepLength = (1.e-12) * mm; << 229 itsOKforStepLength = false; >> 230 if (accuracy > accuracyForException) exitWithError = true; 255 } 231 } 256 232 257 if(!isOK) << 233 G4bool itsOK = itsOKforStepLength && itsOKforEnergy ; 258 { << 234 // dump out information of this particle change 259 if(nError < maxError) << 260 { << 261 #ifdef G4VERBOSE 235 #ifdef G4VERBOSE 262 // dump out information of this particle << 236 if (! itsOK ){ 263 DumpInfo(); << 237 G4cout << " G4VParticleChange::CheckIt " <<G4endl; >> 238 DumpInfo(); >> 239 } 264 #endif 240 #endif 265 G4Exception("G4VParticleChange::CheckIt( << 241 266 "Step length and/or energy deposit are i << 242 // Exit with error 267 } << 243 if (exitWithError) { >> 244 G4Exception("G4VParticleChange::CheckIt", >> 245 "100", >> 246 EventMustBeAborted, >> 247 "step length and/or energy deposit was illegal"); >> 248 } >> 249 >> 250 // correction >> 251 if ( !itsOKforStepLength ) { >> 252 theTrueStepLength = (1.e-12)*mm; >> 253 } >> 254 if ( !itsOKforEnergy ) { >> 255 theLocalEnergyDeposit = 0.0; 268 } 256 } 269 return isOK; << 257 return itsOK; 270 } 258 } 271 259 272 // ------------------------------------------- << 273 G4bool G4VParticleChange::CheckSecondary(G4Tra 260 G4bool G4VParticleChange::CheckSecondary(G4Track& aTrack) 274 { 261 { 275 G4bool isOK = true; << 262 G4bool exitWithError = false; >> 263 G4double accuracy; 276 264 277 // MomentumDirection should be unit vector 265 // MomentumDirection should be unit vector 278 G4double ekin = aTrack.GetKineticEnergy(); << 266 G4bool itsOKforMomentum = true; 279 auto dir = aTrack.GetMomentumDirection(); << 267 accuracy = std::abs((aTrack.GetMomentumDirection()).mag2()-1.0); 280 G4double accuracy = std::abs(dir.mag2() - 1. << 268 if (accuracy > accuracyForWarning) { 281 if(accuracy > accuracyForWarning) << 269 #ifdef G4VERBOSE 282 { << 270 G4cout << " G4VParticleChange::CheckSecondary : "; 283 isOK = false; << 271 G4cout << "the Momentum direction is not unit vector !!" << G4endl; 284 ++nError; << 272 G4cout << " Difference: " << accuracy << G4endl; 285 #ifdef G4VERBOSE << 286 if(nError < maxError) << 287 { << 288 G4String mname = aTrack.GetCreatorModelN << 289 G4cout << " G4VParticleChange::CheckSeco << 290 G4cout << " the momentum direction " << << 291 << " is not unit vector !!" << G4endl; << 292 G4cout << " Difference=" << accuracy << 293 << " Ekin(MeV)=" << ekin/MeV << 294 << " " << aTrack.GetParticleDefinition << 295 << " created by " << mname << 296 << G4endl; << 297 } << 298 #endif 273 #endif 299 aTrack.SetMomentumDirection(dir.unit()); << 274 itsOKforMomentum = false; >> 275 if (accuracy > accuracyForException) exitWithError = true; 300 } 276 } 301 << 277 302 // Kinetic Energy should not be negative 278 // Kinetic Energy should not be negative 303 if(ekin < 0.0) << 279 G4bool itsOKforEnergy; 304 { << 280 accuracy = -1.0*(aTrack.GetKineticEnergy())/MeV; 305 isOK = false; << 281 if (accuracy < accuracyForWarning) { 306 ++nError; << 282 itsOKforEnergy = true; 307 #ifdef G4VERBOSE << 283 } else { 308 if(nError < maxError) << 284 #ifdef G4VERBOSE 309 { << 285 G4cout << " G4VParticleChange::CheckSecondary : "; 310 G4String mname = aTrack.GetCreatorModelN << 286 G4cout << "the kinetic energy is negative !!" << G4endl; 311 G4cout << " G4VParticleChange::CheckSeco << 287 G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl; 312 G4cout << " Ekin(MeV)=" << ekin << " is << 313 << aTrack.GetParticleDefinition()->GetP << 314 << " created by " << mname << 315 << G4endl; << 316 } << 317 #endif << 318 aTrack.SetKineticEnergy(0.0); << 319 } << 320 << 321 // Check timing of secondaries << 322 G4double time = aTrack.GetGlobalTime(); << 323 if(time < theParentGlobalTime) << 324 { << 325 isOK = false; << 326 ++nError; << 327 #ifdef G4VERBOSE << 328 if(nError < maxError) << 329 { << 330 G4String mname = aTrack.GetCreatorModelN << 331 G4cout << " G4VParticleChange::CheckSeco << 332 G4cout << " The global time of secondary << 333 G4cout << " ParentTime(ns)=" << theParen << 334 << " SecondaryTime(ns)= " << time/ns << 335 << " Difference(ns)=" << (theParentGlob << 336 << G4endl; << 337 G4cout << " Ekin(MeV)=" << ekin << 338 << aTrack.GetParticleDefinition()->GetP << 339 << " created by " << mname << G4endl; << 340 } << 341 #endif 288 #endif 342 aTrack.SetGlobalTime(theParentGlobalTime); << 289 itsOKforEnergy = false; 343 } << 290 if (accuracy < accuracyForException) { exitWithError = false;} 344 << 291 else { exitWithError = true; } 345 // Exit with error << 292 } 346 if(!isOK) << 293 G4bool itsOKforProperTime = true; 347 { << 294 //accuracy = (aTrack.GetProperTime())/ns; 348 if(nError < maxError) << 295 // if (accuracy > accuracyForWarning) { 349 { << 350 #ifdef G4VERBOSE 296 #ifdef G4VERBOSE 351 DumpInfo(); << 297 // G4cout << " G4VParticleChange::CheckSecondary : "; >> 298 // G4cout << "the proper time goes back !!" << G4endl; >> 299 // G4cout << " Difference: " << accuracy << "[ns] " <<G4endl; 352 #endif 300 #endif 353 G4Exception("G4VParticleChange::CheckSec << 301 // itsOKforProperTime = false; 354 JustWarning, "Secondary with illegal tim << 302 // if (accuracy > accuracyForException) exitWithError = true; 355 } << 303 //} >> 304 >> 305 // Exit with error >> 306 if (exitWithError) { >> 307 G4Exception("G4VParticleChange::CheckSecondary", >> 308 "10", >> 309 EventMustBeAborted, >> 310 "momentum, energy and/or proper time was illegal"); >> 311 } >> 312 >> 313 G4bool itsOK = itsOKforMomentum && itsOKforEnergy && itsOKforProperTime; >> 314 >> 315 //correction >> 316 if (!itsOKforMomentum) { >> 317 G4double vmag = (aTrack.GetMomentumDirection()).mag(); >> 318 aTrack.SetMomentumDirection((1./vmag)*aTrack.GetMomentumDirection()); >> 319 } >> 320 //if (!itsOKforProperTime) { >> 321 // aTrack.SetProperTime(0.0); >> 322 //} >> 323 if (!itsOKforEnergy) { >> 324 aTrack.SetKineticEnergy(0.0); 356 } 325 } 357 return isOK; << 326 >> 327 return itsOK; 358 } 328 } 359 329 360 // ------------------------------------------- << 330 361 G4double G4VParticleChange::GetAccuracyForWarn 331 G4double G4VParticleChange::GetAccuracyForWarning() const 362 { 332 { 363 return accuracyForWarning; 333 return accuracyForWarning; 364 } 334 } 365 335 366 // ------------------------------------------- << 367 G4double G4VParticleChange::GetAccuracyForExce 336 G4double G4VParticleChange::GetAccuracyForException() const 368 { 337 { 369 return accuracyForException; 338 return accuracyForException; 370 } 339 } 371 340 372 // ------------------------------------------- << 341 void G4VParticleChange::AddSecondary(G4Track *aTrack) 373 // Obsolete methods for parent weight << 342 { 374 // << 343 if (debugFlag) CheckSecondary(*aTrack); 375 void G4VParticleChange::SetParentWeightByProce << 344 376 G4bool G4VParticleChange::IsParentWeightSetByP << 345 if (!fSetSecondaryWeightByProcess){ >> 346 // pass the weight of parent track >> 347 aTrack->SetWeight(theParentWeight); >> 348 } >> 349 >> 350 // add a secondary after size check >> 351 if (theSizeOftheListOfSecondaries > theNumberOfSecondaries) { >> 352 theListOfSecondaries->SetElement(theNumberOfSecondaries, aTrack); >> 353 theNumberOfSecondaries++; >> 354 } else { >> 355 #ifdef G4VERBOSE >> 356 if (verboseLevel>0) { >> 357 G4cerr << "G4VParticleChange::AddSecondary() Warning "; >> 358 G4cerr << "theListOfSecondaries is full !! " << G4endl; >> 359 G4cerr << " The object will not be added in theListOfSecondaries" << G4endl; >> 360 } >> 361 #endif >> 362 } >> 363 } >> 364 >> 365 >> 366 >> 367 >> 368 >> 369 >> 370 >> 371 >> 372 >> 373 >> 374 >> 375 >> 376 >> 377 >> 378 >> 379 377 380