Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChangeForLoss.cc,v 1.18 2010-07-21 09:30:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -43,6 +42,7 @@
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
#include "G4ParticleChangeForLoss.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
@@ -108,16 +108,17 @@ G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(
|
||||
}
|
||||
}
|
||||
delete theListOfSecondaries;
|
||||
|
||||
theListOfSecondaries = right.theListOfSecondaries;
|
||||
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
|
||||
theListOfSecondaries = new G4TrackFastVector();
|
||||
theNumberOfSecondaries = right.theNumberOfSecondaries;
|
||||
for (G4int index = 0; index<theNumberOfSecondaries; index++){
|
||||
G4Track* newTrack = new G4Track(*((*right.theListOfSecondaries)[index] ));
|
||||
theListOfSecondaries->SetElement(index, newTrack); }
|
||||
|
||||
theStatusChange = right.theStatusChange;
|
||||
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
|
||||
theSteppingControlFlag = right.theSteppingControlFlag;
|
||||
theParentWeight = right.theParentWeight;
|
||||
isParentWeightProposed = right.isParentWeightProposed;
|
||||
isParentWeightSetByProcess = right.isParentWeightSetByProcess;
|
||||
fSetSecondaryWeightByProcess = right.fSetSecondaryWeightByProcess;
|
||||
|
||||
currentTrack = right.currentTrack;
|
||||
@@ -166,21 +167,24 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
|
||||
// Energy should not be lager than initial value
|
||||
accuracy = ( proposedKinEnergy - aTrack.GetKineticEnergy())/MeV;
|
||||
if (accuracy > accuracyForWarning) {
|
||||
itsOK = false;
|
||||
exitWithError = (accuracy > accuracyForException);
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "G4ParticleChangeForLoss::CheckIt: ";
|
||||
G4cout << "KinEnergy become larger than the initial value!" << G4endl;
|
||||
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
|
||||
G4cout << "KinEnergy become larger than the initial value!"
|
||||
<< " Difference: " << accuracy << "[MeV] " <<G4endl;
|
||||
G4cout << aTrack.GetDefinition()->GetParticleName()
|
||||
<< " E=" << aTrack.GetKineticEnergy()/MeV
|
||||
<< " pos=" << aTrack.GetPosition().x()/m
|
||||
<< ", " << aTrack.GetPosition().y()/m
|
||||
<< ", " << aTrack.GetPosition().z()/m
|
||||
<<G4endl;
|
||||
#endif
|
||||
itsOK = false;
|
||||
if (accuracy > accuracyForException) exitWithError = true;
|
||||
}
|
||||
|
||||
// dump out information of this particle change
|
||||
#ifdef G4VERBOSE
|
||||
if (!itsOK) {
|
||||
G4cout << "G4ParticleChangeForLoss::CheckIt " << G4endl;
|
||||
DumpInfo();
|
||||
}
|
||||
if (!itsOK) DumpInfo();
|
||||
#endif
|
||||
|
||||
// Exit with error
|
||||
@@ -224,20 +228,8 @@ G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
|
||||
pPostStepPoint->SetVelocity(pStep->GetTrack()->CalculateVelocity());
|
||||
pStep->GetTrack()->SetKineticEnergy(pStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
|
||||
if (isParentWeightProposed) {
|
||||
// update weight
|
||||
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4double newWeight= theParentWeight/(pPreStepPoint->GetWeight())
|
||||
* (pPostStepPoint->GetWeight());
|
||||
if (isParentWeightSetByProcess) pPostStepPoint->SetWeight( newWeight );
|
||||
if (!fSetSecondaryWeightByProcess) {
|
||||
//Set weight of secondary tracks
|
||||
for (G4int index= 0; index<theNumberOfSecondaries; index++){
|
||||
if ( (*theListOfSecondaries)[index] ) {
|
||||
((*theListOfSecondaries)[index])->SetWeight(newWeight); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isParentWeightProposed ){
|
||||
pPostStepPoint->SetWeight( theParentWeight );
|
||||
}
|
||||
|
||||
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
|
||||
@@ -255,16 +247,8 @@ G4Step* G4ParticleChangeForLoss::UpdateStepForPostStep(G4Step* pStep)
|
||||
pPostStepPoint->SetVelocity(pStep->GetTrack()->CalculateVelocity());
|
||||
pPostStepPoint->SetPolarization( proposedPolarization );
|
||||
|
||||
if (isParentWeightProposed) {
|
||||
if (isParentWeightSetByProcess) pPostStepPoint->SetWeight( theParentWeight );
|
||||
if (!fSetSecondaryWeightByProcess) {
|
||||
// Set weight of secondary tracks
|
||||
for (G4int index= 0; index<theNumberOfSecondaries; index++){
|
||||
if ( (*theListOfSecondaries)[index] ) {
|
||||
((*theListOfSecondaries)[index])->SetWeight( theParentWeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isParentWeightProposed ){
|
||||
pPostStepPoint->SetWeight( theParentWeight );
|
||||
}
|
||||
|
||||
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
|
||||
|
||||
Reference in New Issue
Block a user