Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleChangeForTransport.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// G4ParticleChangeForTransport class implementation
27//
28// Author: Hisaya Kurashige, 10 May 1998
29// --------------------------------------------------------------------
30
32#include "G4TouchableHandle.hh"
33#include "G4Track.hh"
34#include "G4Step.hh"
35#include "G4TrackFastVector.hh"
36#include "G4DynamicParticle.hh"
37
38// --------------------------------------------------------------------
40{
41 // Disable flag that is enabled in G4VParticleChange if G4VERBOSE.
42 debugFlag = false;
43}
44
45// --------------------------------------------------------------------
47{
48 // Update the G4Step specific attributes
49 return UpdateStepInfo(pStep);
50}
51
52// --------------------------------------------------------------------
54{
55 // Smooth curved tajectory representation: let the Step know about
56 // the auxiliary trajectory points (jacek 30/10/2002)
57 pStep->SetPointerToVectorOfAuxiliaryPoints(fpVectorOfAuxiliaryPointsPointer);
58
59 // Most of the code assumes that transportation is always the first process,
60 // so the pre- and post-step point are still equal.
61 G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
62 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
63
64 // update momentum direction and energy
65 if(isMomentumChanged)
66 {
68 pPostStepPoint->SetKineticEnergy(theEnergyChange);
69 }
71 pPostStepPoint->SetVelocity(theVelocityChange);
72
73 // update polarization
75
76 // update position and time
77 pPostStepPoint->SetPosition(thePositionChange);
78 pPostStepPoint->AddGlobalTime(theTimeChange - pPreStepPoint->GetLocalTime());
79 pPostStepPoint->AddLocalTime(theTimeChange - pPreStepPoint->GetLocalTime());
80 pPostStepPoint->SetProperTime(theProperTimeChange);
81
82#ifdef G4VERBOSE
84#endif
85
86 // Update the G4Step specific attributes
89
90 return pStep;
91}
92
93// --------------------------------------------------------------------
95{
96 // A physics process always calculates the final state of the particle
97
98 // Change volume only if some kinetic energy remains
99 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
100 if(pPostStepPoint->GetKineticEnergy() > 0.0)
101 {
102 // update next touchable
103 // (touchable can be changed only at PostStepDoIt)
104 pPostStepPoint->SetTouchableHandle(theTouchableHandle);
105
106 pPostStepPoint->SetMaterial(theMaterialChange);
107 pPostStepPoint->SetMaterialCutsCouple(theMaterialCutsCoupleChange);
108 pPostStepPoint->SetSensitiveDetector(theSensitiveDetectorChange);
109 }
110 if(this->GetFirstStepInVolume())
111 {
112 pStep->SetFirstStepFlag();
113 }
114 else
115 {
116 pStep->ClearFirstStepFlag();
117 }
118 if(this->GetLastStepInVolume())
119 {
120 pStep->SetLastStepFlag();
121 }
122 else
123 {
124 pStep->ClearLastStepFlag();
125 }
126 // It used to call base class's method
127 // - but this would copy uninitialised data members
128 // return G4ParticleChange::UpdateStepForPostStep(pStep);
129
130 // Copying what the base class does would instead
131 // - also not useful
132 // return G4VParticleChange::UpdateStepInfo(pStep);
133
134 return pStep;
135}
136
137// --------------------------------------------------------------------
139{
140 // use base-class DumpInfo
142 G4cout << " Touchable (pointer) : " << std::setw(20)
143 << theTouchableHandle() << G4endl;
144}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4Step * UpdateStepForAtRest(G4Step *Step) final
G4Step * UpdateStepForPostStep(G4Step *Step) final
G4Step * UpdateStepForAlongStep(G4Step *Step) final
void DumpInfo() const override
G4ThreeVector thePositionChange
G4ThreeVector theMomentumDirectionChange
G4Step * UpdateStepInfo(G4Step *Step)
G4double theProperTimeChange
G4ThreeVector thePolarizationChange
void SetSensitiveDetector(G4VSensitiveDetector *)
void SetKineticEnergy(const G4double aValue)
void SetMaterial(G4Material *)
void SetVelocity(G4double v)
void SetTouchableHandle(const G4TouchableHandle &apValue)
void SetProperTime(const G4double aValue)
void SetMaterialCutsCouple(const G4MaterialCutsCouple *)
void AddGlobalTime(const G4double aValue)
G4double GetLocalTime() const
void SetPosition(const G4ThreeVector &aValue)
G4double GetKineticEnergy() const
void AddLocalTime(const G4double aValue)
void SetMomentumDirection(const G4ThreeVector &aValue)
void SetPolarization(const G4ThreeVector &aValue)
Definition: G4Step.hh:62
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *vec)
void SetLastStepFlag()
void SetStepLength(G4double value)
G4StepPoint * GetPreStepPoint() const
void SetControlFlag(G4SteppingControl StepControlFlag)
void ClearLastStepFlag()
void SetFirstStepFlag()
void ClearFirstStepFlag()
G4StepPoint * GetPostStepPoint() const
G4bool GetFirstStepInVolume() const
virtual G4bool CheckIt(const G4Track &)
G4SteppingControl theSteppingControlFlag
G4bool GetLastStepInVolume() const
const G4Track * theCurrentTrack