musrsim/geant4/LEMuSR/G4Modified/track/include/G4VParticleChange.icc
2006-02-22 01:23:06 +00:00

346 lines
8.6 KiB
Plaintext

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VParticleChange.icc,v 1.11 2004/05/08 15:28:13 kurasige Exp $
// GEANT4 tag $Name: geant4-06-02-ref-01 $
//
//----------------------------------------------------------------
// Virtual methods for updating G4Step
//
inline G4Step* G4VParticleChange::UpdateStepInfo(G4Step* pStep)
{
// Update the G4Step specific attributes
pStep->SetStepLength( theTrueStepLength );
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
pStep->SetControlFlag( theSteppingControlFlag );
return pStep;
}
inline
G4Step* G4VParticleChange::UpdateStepForAtRest(G4Step* Step)
{
if (!fSetParentWeightByProcess){
Step->GetPostStepPoint()->SetWeight( theParentWeight );
}
return UpdateStepInfo(Step);
}
inline
G4Step* G4VParticleChange::UpdateStepForAlongStep(G4Step* Step)
{
if (!fSetParentWeightByProcess){
G4double newWeight= theParentWeight/(Step->GetPreStepPoint()->GetWeight())*(Step->GetPostStepPoint()->GetWeight());
Step->GetPostStepPoint()->SetWeight( newWeight );
}
return UpdateStepInfo(Step);
}
inline
G4Step* G4VParticleChange::UpdateStepForPostStep(G4Step* Step)
{
if (!fSetParentWeightByProcess){
Step->GetPostStepPoint()->SetWeight( theParentWeight );
}
return UpdateStepInfo(Step);
}
//----------------------------------------------------------------
// Set/Get inline functions
//
inline
G4Track* G4VParticleChange::GetSecondary(G4int anIndex) const
{
return (*theListOfSecondaries)[anIndex];
}
inline
G4int G4VParticleChange::GetNumberOfSecondaries() const
{
return theNumberOfSecondaries;
}
inline
void G4VParticleChange::ProposeTrackStatus(G4TrackStatus aStatus)
{
theStatusChange = aStatus;
}
inline
G4TrackStatus G4VParticleChange::GetTrackStatus() const
{
return theStatusChange;
}
inline
G4SteppingControl G4VParticleChange::GetSteppingControl() const
{
return theSteppingControlFlag;
}
inline
void G4VParticleChange::ProposeSteppingControl(G4SteppingControl StepControlFlag)
{
theSteppingControlFlag = StepControlFlag;
}
//----------------------------------------------------------------
// Set/Get inline functions
//
inline
G4double G4VParticleChange::GetLocalEnergyDeposit() const
{
return theLocalEnergyDeposit;
}
inline
void G4VParticleChange::ProposeLocalEnergyDeposit(G4double anEnergyPart)
{
theLocalEnergyDeposit = anEnergyPart;
}
inline
G4double G4VParticleChange::GetTrueStepLength() const
{
return theTrueStepLength;
}
inline
void G4VParticleChange::ProposeTrueStepLength(G4double aLength)
{
theTrueStepLength = aLength;
}
inline
void G4VParticleChange::SetVerboseLevel(G4int vLevel)
{
verboseLevel = vLevel;
}
inline
G4int G4VParticleChange::GetVerboseLevel() const
{
return verboseLevel;
}
inline
G4double G4VParticleChange::GetParentWeight() const
{
return theParentWeight;
}
//----------------------------------------------------------------
// inline functions for Initialization
//
inline
void G4VParticleChange::InitializeLocalEnergyDeposit(const G4Track&)
{
// clear theLocalEnergyDeposited
theLocalEnergyDeposit = 0.0;
}
inline
void G4VParticleChange::InitializeSteppingControl(const G4Track& )
{
// SteppingControlFlag
theSteppingControlFlag = NormalCondition;
}
inline
void G4VParticleChange::Clear()
{
theNumberOfSecondaries = 0;
}
//----------------------------------------------------------------
// functions for Initialization
//
inline void G4VParticleChange::InitializeStatusChange(const G4Track& track)
{
// set TrackStatus equal to the parent track's one
theStatusChange = track.GetTrackStatus();
}
inline void G4VParticleChange::InitializeParentWeight(const G4Track& track)
{
// set the parent track's weight
theParentWeight = track.GetWeight();
}
inline void G4VParticleChange::InitializeTrueStepLength(const G4Track& track)
{
// Reset theTrueStepLength
// !! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
theTrueStepLength = track.GetStep()->GetStepLength();
// !! TrueStepLength should be copied from G4Step not G4Track
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
inline void G4VParticleChange::InitializeSecondaries(const G4Track&)
{
// clear secondaries
if (theNumberOfSecondaries>0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::Initialize() Warning ";
G4cerr << "theListOfSecondaries is not empty " << G4endl;
G4cerr << "All objects in theListOfSecondaries are destroyed!" << G4endl;
}
#endif
for (G4int index= 0; index<theNumberOfSecondaries; index++){
if ( (*theListOfSecondaries)[index] ){
delete (*theListOfSecondaries)[index] ;
}
}
}
theNumberOfSecondaries = 0;
}
//----------------------------------------------------------------
// methods for handling secondaries
//
inline void G4VParticleChange::SetNumberOfSecondaries(G4int totSecondaries)
{
// check if tracks still exist in theListOfSecondaries
if (theNumberOfSecondaries>0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VParticleChange::SetNumberOfSecondaries() Warning ";
G4cerr << "theListOfSecondaries is not empty ";
}
#endif
for (G4int index= 0; index<theNumberOfSecondaries; index++){
if ( (*theListOfSecondaries)[index] ){
delete (*theListOfSecondaries)[index] ;
}
}
}
theNumberOfSecondaries = 0;
theSizeOftheListOfSecondaries = totSecondaries;
// Initialize ListOfSecondaries
theListOfSecondaries->Initialize(totSecondaries);
}
inline void G4VParticleChange::Initialize(const G4Track& track)
{
InitializeStatusChange(track);
InitializeLocalEnergyDeposit(track);
InitializeSteppingControl(track);
InitializeTrueStepLength(track);
InitializeSecondaries(track);
InitializeParentWeight(track);
}
inline
void G4VParticleChange::ClearDebugFlag()
{
debugFlag = false;
}
inline
void G4VParticleChange::SetDebugFlag()
{
debugFlag = true;
}
inline
G4bool G4VParticleChange::GetDebugFlag() const
{
return debugFlag;
}
inline
void G4VParticleChange::SetSecondaryWeightByProcess(G4bool flag)
{
fSetSecondaryWeightByProcess = flag;
}
inline
G4bool G4VParticleChange::IsSecondaryWeightSetByProcess() const
{
return fSetSecondaryWeightByProcess;
}
inline
void G4VParticleChange::ProposeParentWeight(G4double w)
{
theParentWeight = w;
}
inline
void G4VParticleChange::SetParentWeightByProcess(G4bool flag)
{
fSetParentWeightByProcess = flag;
}
inline
G4bool G4VParticleChange::IsParentWeightSetByProcess() const
{
return fSetParentWeightByProcess;
}
// Following methods will be removed in release 7.0
inline
void G4VParticleChange::SetStatusChange(G4TrackStatus aStatus)
{
ProposeTrackStatus(aStatus);
}
inline
G4TrackStatus G4VParticleChange::GetStatusChange() const
{
return GetTrackStatus();
}
inline
void G4VParticleChange::SetSteppingControl(G4SteppingControl StepControlFlag)
{
ProposeSteppingControl(StepControlFlag);
}
inline
void G4VParticleChange::SetLocalEnergyDeposit(G4double anEnergyPart)
{
ProposeLocalEnergyDeposit(anEnergyPart);
}
inline
void G4VParticleChange::SetTrueStepLength(G4double aLength)
{
ProposeTrueStepLength(aLength);
}
inline
void G4VParticleChange::SetParentWeight(G4double w)
{
ProposeParentWeight(w);
}