Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleChangeForMSC Class Reference

#include <G4ParticleChangeForMSC.hh>

+ Inheritance diagram for G4ParticleChangeForMSC:

Public Member Functions

 G4ParticleChangeForMSC ()
 
virtual ~G4ParticleChangeForMSC ()
 
virtual G4StepUpdateStepForAlongStep (G4Step *Step)
 
virtual G4StepUpdateStepForPostStep (G4Step *Step)
 
virtual void Initialize (const G4Track &)
 
void ProposeMomentumDirection (const G4ThreeVector &Pfinal)
 
void ProposeMomentumDirection (G4double Px, G4double Py, G4double Pz)
 
const G4ThreeVectorGetMomentumDirection () const
 
const G4ThreeVectorGetProposedMomentumDirection () const
 
void SetProposedMomentumDirection (const G4ThreeVector &Pfinal)
 
const G4ThreeVectorGetPosition () const
 
void ProposePosition (const G4ThreeVector &finalPosition)
 
const G4ThreeVectorGetProposedPosition () const
 
void SetProposedPosition (const G4ThreeVector &finalPosition)
 
virtual void DumpInfo () const
 
virtual G4bool CheckIt (const G4Track &)
 
- Public Member Functions inherited from G4VParticleChange
 G4VParticleChange ()
 
virtual ~G4VParticleChange ()
 
G4bool operator== (const G4VParticleChange &right) const
 
G4bool operator!= (const G4VParticleChange &right) const
 
virtual G4StepUpdateStepForAtRest (G4Step *Step)
 
virtual G4StepUpdateStepForAlongStep (G4Step *Step)
 
virtual G4StepUpdateStepForPostStep (G4Step *Step)
 
virtual void Initialize (const G4Track &)
 
G4double GetTrueStepLength () const
 
void ProposeTrueStepLength (G4double truePathLength)
 
G4double GetLocalEnergyDeposit () const
 
void ProposeLocalEnergyDeposit (G4double anEnergyPart)
 
G4double GetNonIonizingEnergyDeposit () const
 
void ProposeNonIonizingEnergyDeposit (G4double anEnergyPart)
 
G4TrackStatus GetTrackStatus () const
 
void ProposeTrackStatus (G4TrackStatus status)
 
G4SteppingControl GetSteppingControl () const
 
void ProposeSteppingControl (G4SteppingControl StepControlFlag)
 
G4bool GetFirstStepInVolume () const
 
G4bool GetLastStepInVolume () const
 
void ProposeFirstStepInVolume (G4bool flag)
 
void ProposeLastStepInVolume (G4bool flag)
 
void Clear ()
 
void SetNumberOfSecondaries (G4int totSecondaries)
 
G4int GetNumberOfSecondaries () const
 
G4TrackGetSecondary (G4int anIndex) const
 
void AddSecondary (G4Track *aSecondary)
 
G4double GetWeight () const
 
G4double GetParentWeight () const
 
void ProposeWeight (G4double finalWeight)
 
void ProposeParentWeight (G4double finalWeight)
 
void SetSecondaryWeightByProcess (G4bool)
 
G4bool IsSecondaryWeightSetByProcess () const
 
void SetParentWeightByProcess (G4bool)
 
G4bool IsParentWeightSetByProcess () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int vLevel)
 
G4int GetVerboseLevel () const
 
virtual G4bool CheckIt (const G4Track &)
 
void ClearDebugFlag ()
 
void SetDebugFlag ()
 
G4bool GetDebugFlag () const
 

Protected Member Functions

 G4ParticleChangeForMSC (const G4ParticleChangeForMSC &right)
 
G4ParticleChangeForMSCoperator= (const G4ParticleChangeForMSC &right)
 
- Protected Member Functions inherited from G4VParticleChange
 G4VParticleChange (const G4VParticleChange &right)
 
G4VParticleChangeoperator= (const G4VParticleChange &right)
 
G4StepUpdateStepInfo (G4Step *Step)
 
void InitializeTrueStepLength (const G4Track &)
 
void InitializeLocalEnergyDeposit (const G4Track &)
 
void InitializeSteppingControl (const G4Track &)
 
void InitializeParentWeight (const G4Track &)
 
void InitializeParentGlobalTime (const G4Track &)
 
void InitializeStatusChange (const G4Track &)
 
void InitializeSecondaries (const G4Track &)
 
void InitializeStepInVolumeFlags (const G4Track &)
 
G4bool CheckSecondary (G4Track &)
 
G4double GetAccuracyForWarning () const
 
G4double GetAccuracyForException () const
 

Additional Inherited Members

- Protected Attributes inherited from G4VParticleChange
G4TrackFastVectortheListOfSecondaries = nullptr
 
G4TrackStatus theStatusChange = fAlive
 
G4SteppingControl theSteppingControlFlag = NormalCondition
 
G4double theLocalEnergyDeposit = 0.0
 
G4double theNonIonizingEnergyDeposit = 0.0
 
G4double theTrueStepLength = 0.0
 
G4double theParentWeight = 1.0
 
G4double theParentGlobalTime = 0.0
 
G4int theNumberOfSecondaries = 0
 
G4int theSizeOftheListOfSecondaries = 0
 
G4int verboseLevel = 1
 
G4bool theFirstStepInVolume = false
 
G4bool theLastStepInVolume = false
 
G4bool isParentWeightProposed = false
 
G4bool fSetSecondaryWeightByProcess = false
 
G4bool debugFlag = false
 
- Static Protected Attributes inherited from G4VParticleChange
static const G4double accuracyForWarning = 1.0e-9
 
static const G4double accuracyForException = 0.001
 

Detailed Description

Definition at line 46 of file G4ParticleChangeForMSC.hh.

Constructor & Destructor Documentation

◆ G4ParticleChangeForMSC() [1/2]

G4ParticleChangeForMSC::G4ParticleChangeForMSC ( )

Definition at line 40 of file G4ParticleChangeForMSC.cc.

◆ ~G4ParticleChangeForMSC()

G4ParticleChangeForMSC::~G4ParticleChangeForMSC ( )
virtual

Definition at line 46 of file G4ParticleChangeForMSC.cc.

47{
48}

◆ G4ParticleChangeForMSC() [2/2]

G4ParticleChangeForMSC::G4ParticleChangeForMSC ( const G4ParticleChangeForMSC right)
protected

Definition at line 51 of file G4ParticleChangeForMSC.cc.

53 : G4VParticleChange(right)
54{
55 theMomentumDirection = right.theMomentumDirection;
56 thePosition = right.thePosition;
57}

Member Function Documentation

◆ CheckIt()

G4bool G4ParticleChangeForMSC::CheckIt ( const G4Track aTrack)
virtual

Reimplemented from G4VParticleChange.

Definition at line 136 of file G4ParticleChangeForMSC.cc.

137{
138 G4bool itsOK = true;
139 G4bool exitWithError = false;
140
141 G4double accuracy;
142
143 // check
144
145 // MomentumDirection should be unit vector
146 accuracy = std::fabs(theMomentumDirection.mag2() - 1.0);
147 if(accuracy > accuracyForWarning)
148 {
149 itsOK = false;
150 exitWithError = (accuracy > accuracyForException);
151#ifdef G4VERBOSE
152 G4cout << " G4ParticleChangeForMSC::CheckIt : ";
153 G4cout << "the Momentum Change is not unit vector !!"
154 << " Difference: " << accuracy << G4endl;
156 << " E=" << aTrack.GetKineticEnergy() / MeV
157 << " pos=" << aTrack.GetPosition().x() / m << ", "
158 << aTrack.GetPosition().y() / m << ", "
159 << aTrack.GetPosition().z() / m << G4endl;
160#endif
161 }
162
163 // dump out information of this particle change
164#ifdef G4VERBOSE
165 if(!itsOK) { DumpInfo(); }
166#endif
167
168 // exit with error
169 if(exitWithError)
170 {
171 G4Exception("G4ParticleChangeForMSC::CheckIt()", "300", EventMustBeAborted,
172 "momentum direction was illegal");
173 }
174 // correction
175 if(!itsOK)
176 {
177 G4double vmag = theMomentumDirection.mag();
178 theMomentumDirection = (1. / vmag) * theMomentumDirection;
179 }
180
181 itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
182 return itsOK;
183}
@ EventMustBeAborted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double mag2() const
double y() const
double mag() const
virtual void DumpInfo() const
const G4String & GetParticleName() const
const G4ThreeVector & GetPosition() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
virtual G4bool CheckIt(const G4Track &)
static const G4double accuracyForException
static const G4double accuracyForWarning

◆ DumpInfo()

void G4ParticleChangeForMSC::DumpInfo ( ) const
virtual

Reimplemented from G4VParticleChange.

Definition at line 114 of file G4ParticleChangeForMSC.cc.

115{
116 // use base-class DumpInfo
118
119 G4int oldprc = G4cout.precision(3);
120 G4cout << " Position - x (mm) : " << std::setw(20)
121 << thePosition.x() / mm << G4endl;
122 G4cout << " Position - y (mm) : " << std::setw(20)
123 << thePosition.y() / mm << G4endl;
124 G4cout << " Position - z (mm) : " << std::setw(20)
125 << thePosition.z() / mm << G4endl;
126 G4cout << " Momentum Direct - x : " << std::setw(20)
127 << theMomentumDirection.x() << G4endl;
128 G4cout << " Momentum Direct - y : " << std::setw(20)
129 << theMomentumDirection.y() << G4endl;
130 G4cout << " Momentum Direct - z : " << std::setw(20)
131 << theMomentumDirection.z() << G4endl;
132 G4cout.precision(oldprc);
133}
int G4int
Definition: G4Types.hh:85
virtual void DumpInfo() const

Referenced by CheckIt().

◆ GetMomentumDirection()

const G4ThreeVector * G4ParticleChangeForMSC::GetMomentumDirection ( ) const

◆ GetPosition()

const G4ThreeVector * G4ParticleChangeForMSC::GetPosition ( ) const

◆ GetProposedMomentumDirection()

const G4ThreeVector * G4ParticleChangeForMSC::GetProposedMomentumDirection ( ) const

◆ GetProposedPosition()

const G4ThreeVector * G4ParticleChangeForMSC::GetProposedPosition ( ) const

◆ Initialize()

virtual void G4ParticleChangeForMSC::Initialize ( const G4Track )
virtual

Reimplemented from G4VParticleChange.

Referenced by G4VMultipleScattering::PostStepDoIt().

◆ operator=()

G4ParticleChangeForMSC & G4ParticleChangeForMSC::operator= ( const G4ParticleChangeForMSC right)
protected

Definition at line 61 of file G4ParticleChangeForMSC.cc.

62{
63 if(this != &right)
64 {
72
73 theMomentumDirection = right.theMomentumDirection;
74 thePosition = right.thePosition;
75 }
76 return *this;
77}
G4TrackStatus theStatusChange
G4TrackFastVector * theListOfSecondaries
G4SteppingControl theSteppingControlFlag

◆ ProposeMomentumDirection() [1/2]

◆ ProposeMomentumDirection() [2/2]

void G4ParticleChangeForMSC::ProposeMomentumDirection ( G4double  Px,
G4double  Py,
G4double  Pz 
)

◆ ProposePosition()

void G4ParticleChangeForMSC::ProposePosition ( const G4ThreeVector finalPosition)

◆ SetProposedMomentumDirection()

void G4ParticleChangeForMSC::SetProposedMomentumDirection ( const G4ThreeVector Pfinal)

◆ SetProposedPosition()

void G4ParticleChangeForMSC::SetProposedPosition ( const G4ThreeVector finalPosition)

◆ UpdateStepForAlongStep()

G4Step * G4ParticleChangeForMSC::UpdateStepForAlongStep ( G4Step Step)
virtual

Reimplemented from G4VParticleChange.

Definition at line 80 of file G4ParticleChangeForMSC.cc.

81{
82 // update the G4Step specific attributes
83 pStep->SetStepLength(theTrueStepLength);
84 theStatusChange = pStep->GetTrack()->GetTrackStatus();
85
86 // multiple scattering calculates the final state of the particle
87 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
88
89 // update momentum direction
90 pPostStepPoint->SetMomentumDirection(theMomentumDirection);
91
92 // update position
93 pPostStepPoint->SetPosition(thePosition);
94 return pStep;
95}
void SetPosition(const G4ThreeVector &aValue)
void SetMomentumDirection(const G4ThreeVector &aValue)

◆ UpdateStepForPostStep()

G4Step * G4ParticleChangeForMSC::UpdateStepForPostStep ( G4Step Step)
virtual

Reimplemented from G4VParticleChange.

Definition at line 98 of file G4ParticleChangeForMSC.cc.

99{
100 // multiple scattering calculates the final state of the particle
101 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
102
103 // update momentum direction
104 pPostStepPoint->SetMomentumDirection(theMomentumDirection);
105
106 // update position
107 pPostStepPoint->SetPosition(thePosition);
108
109 // update the G4Step specific attributes
110 return pStep;
111}

The documentation for this class was generated from the following files: