Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleChangeForLoss.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4ParticleChangeForLoss class implementation
27//
28// Author: Hisaya Kurashige, 23 March 1998
29// Revision: Vladimir Ivantchenko, 16 January 2004
30// --------------------------------------------------------------------
31
33#include "G4SystemOfUnits.hh"
35
36// --------------------------------------------------------------------
38{
39 // Disable flag that is enabled in G4VParticleChange if G4VERBOSE.
40 debugFlag = false;
41}
42
43// --------------------------------------------------------------------
45{
46 // use base-class DumpInfo
48
49 G4long oldprc = G4cout.precision(8);
50 G4cout << " -----------------------------------------------" << G4endl;
51 G4cout << " G4ParticleChangeForLoss proposes: " << G4endl;
52 G4cout << " Charge (eplus) : " << std::setw(20)
53 << currentCharge / eplus << G4endl;
54 G4cout << " Kinetic Energy (MeV): " << std::setw(20)
55 << proposedKinEnergy / MeV << G4endl;
56 G4cout << " Momentum Direct - x : " << std::setw(20)
57 << proposedMomentumDirection.x() << G4endl;
58 G4cout << " Momentum Direct - y : " << std::setw(20)
59 << proposedMomentumDirection.y() << G4endl;
60 G4cout << " Momentum Direct - z : " << std::setw(20)
61 << proposedMomentumDirection.z() << G4endl;
62 G4cout.precision(oldprc);
63}
64
65// --------------------------------------------------------------------
67{
68 const G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
69 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
70
71 // accumulate change of the kinetic energy
72 G4double preKinEnergy = pPreStepPoint->GetKineticEnergy();
73 G4double kinEnergy =
74 pPostStepPoint->GetKineticEnergy() + (proposedKinEnergy - preKinEnergy);
75
76 pPostStepPoint->SetCharge(currentCharge);
77
78 // calculate velocity
79 if(kinEnergy > 0.0)
80 {
81 pPostStepPoint->SetKineticEnergy(kinEnergy);
82
83 // assuming that mass>0, zero mass particles do not have energy loss
84 pPostStepPoint->SetVelocity(CLHEP::c_light*ComputeBeta(kinEnergy));
85 }
86 else
87 {
88 pPostStepPoint->SetKineticEnergy(0.0);
89 pPostStepPoint->SetVelocity(0.0);
90 }
91
93 {
94 pPostStepPoint->SetWeight(theParentWeight);
95 }
96
99 return pStep;
100}
101
102// --------------------------------------------------------------------
104{
105 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
106
107 pPostStepPoint->SetCharge(currentCharge);
108 pPostStepPoint->SetMomentumDirection(proposedMomentumDirection);
109 if(proposedKinEnergy > 0.0)
110 {
111 pPostStepPoint->SetKineticEnergy(proposedKinEnergy);
112
113 // assuming that mass>0, zero mass particles do not have energy loss
114 pPostStepPoint->SetVelocity(CLHEP::c_light*ComputeBeta(proposedKinEnergy));
115 }
116 else
117 {
118 pPostStepPoint->SetKineticEnergy(0.0);
119 pPostStepPoint->SetVelocity(0.0);
120 }
121 pPostStepPoint->SetPolarization(proposedPolarization);
122
124 {
125 pPostStepPoint->SetWeight(theParentWeight);
126 }
127
130 return pStep;
131}
double G4double
Definition G4Types.hh:83
long G4long
Definition G4Types.hh:87
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double y() const
G4Step * UpdateStepForAlongStep(G4Step *step) final
G4Step * UpdateStepForPostStep(G4Step *step) final
void SetKineticEnergy(const G4double aValue)
void SetWeight(G4double aValue)
void SetCharge(G4double value)
void SetVelocity(G4double v)
G4double GetKineticEnergy() const
void SetMomentumDirection(const G4ThreeVector &aValue)
void SetPolarization(const G4ThreeVector &aValue)
void AddNonIonizingEnergyDeposit(G4double value)
void AddTotalEnergyDeposit(G4double value)
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
G4double ComputeBeta(G4double kinEnergy)
G4double theNonIonizingEnergyDeposit
virtual void DumpInfo() const