Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleChangeForGamma.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// G4ParticleChangeForGamma class implementation
27//
28// Author: Hisaya Kurashige, 23 March 1998
29// Revision: Vladimir Ivantchenko, 15 April 2005
30// --------------------------------------------------------------------
31
33#include "G4SystemOfUnits.hh"
34#include "G4Track.hh"
35#include "G4Step.hh"
36#include "G4DynamicParticle.hh"
38
39// --------------------------------------------------------------------
41{
42 // Disable flag to avoid check of each secondary at each step
43 debugFlag = false;
44}
45
46// --------------------------------------------------------------------
48{
49 // create track
50 G4Track* aTrack = new G4Track(aParticle, theCurrentTrack->GetGlobalTime(),
52
53 // touchable handle is copied to keep the pointer
55
56 // add a secondary
58}
59
60// --------------------------------------------------------------------
73
74// --------------------------------------------------------------------
76{
77 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
78
79 pPostStepPoint->SetMomentumDirection(proposedMomentumDirection);
80 pPostStepPoint->SetPolarization(proposedPolarization);
81
82 // update velocity for scattering process and particles with mass
83 if(proposedKinEnergy > 0.0)
84 {
85 pPostStepPoint->SetKineticEnergy(proposedKinEnergy);
87 G4double v = CLHEP::c_light;
88 if(mass > 0.0) {
89 v *= std::sqrt(proposedKinEnergy*(proposedKinEnergy + 2*mass))/
90 (proposedKinEnergy + mass);
91 }
92 pPostStepPoint->SetVelocity(v);
93 }
94 else
95 {
96 pPostStepPoint->SetKineticEnergy(0.0);
97 pPostStepPoint->SetVelocity(0.0);
98 }
99
101 {
102 pPostStepPoint->SetWeight(theParentWeight);
103 }
104
107 return pStep;
108}
109
110// --------------------------------------------------------------------
112{
113 // use base-class DumpInfo
115
116 G4long oldprc = G4cout.precision(8);
117 G4cout << " -----------------------------------------------" << G4endl;
118 G4cout << " G4ParticleChangeForGamma proposes: " << G4endl;
119 G4cout << " Kinetic Energy (MeV): " << std::setw(20)
120 << proposedKinEnergy / MeV << G4endl;
121 G4cout << " Momentum Direction: " << std::setw(20)
122 << proposedMomentumDirection << G4endl;
123 G4cout << " Polarization: " << std::setw(20) << proposedPolarization
124 << G4endl;
125 G4cout.precision(oldprc);
126}
127
double G4double
Definition G4Types.hh:83
long G4long
Definition G4Types.hh:87
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4Step * UpdateStepForPostStep(G4Step *Step) final
G4Step * UpdateStepForAtRest(G4Step *pStep) final
void AddSecondary(G4DynamicParticle *aParticle)
void SetKineticEnergy(const G4double aValue)
void SetWeight(G4double aValue)
void SetVelocity(G4double v)
void SetMomentumDirection(const G4ThreeVector &aValue)
void SetPolarization(const G4ThreeVector &aValue)
void SetStepLength(G4double value)
void AddNonIonizingEnergyDeposit(G4double value)
void AddTotalEnergyDeposit(G4double value)
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetGlobalTime() const
G4ParticleDefinition * GetDefinition() const
const G4TouchableHandle & GetTouchableHandle() const
G4double theNonIonizingEnergyDeposit
void AddSecondary(G4Track *aSecondary)
virtual void DumpInfo() const
const G4Track * theCurrentTrack