source: trunk/source/track/include/G4ParticleChangeForGamma.hh@ 1309

Last change on this file since 1309 was 1058, checked in by garnier, 17 years ago

file release beta

File size: 7.8 KB
RevLine 
[826]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//
27// $Id: G4ParticleChangeForGamma.hh,v 1.9 2008/01/11 19:57:12 vnivanch Exp $
[1058]28// GEANT4 tag $Name: geant4-09-02-ref-02 $
[826]29//
30//
31// ------------------------------------------------------------
32// GEANT 4 class header file
33//
34//
35// ------------------------------------------------------------
36// 15 April 2005 V.Ivanchenko for gamma EM processes
37//
38// Modified:
39// 30.05.05 : add UpdateStepForAtRest (V.Ivanchenko)
40// 04.12.05 : apply UpdateStepForPostStep in any case (mma)
41// 26.08.06 : Add->Set polarization;
42// add const method to access track;
43// add weight modification (V.Ivanchenko)
44//
45// ------------------------------------------------------------
46//
47// Class Description
48// This class is a concrete class for ParticleChange for gamma processes
49//
50#ifndef G4ParticleChangeForGamma_h
51#define G4ParticleChangeForGamma_h 1
52
53#include "globals.hh"
54#include "G4ios.hh"
55#include "G4VParticleChange.hh"
56
57class G4DynamicParticle;
58
59class G4ParticleChangeForGamma: public G4VParticleChange
60{
61public:
62 // default constructor
63 G4ParticleChangeForGamma();
64
65 // destructor
66 virtual ~G4ParticleChangeForGamma();
67
68 // with description
69 // ----------------------------------------------------
70 // --- the following methods are for updating G4Step -----
71
72 G4Step* UpdateStepForAtRest(G4Step* pStep);
73 G4Step* UpdateStepForPostStep(G4Step* Step);
74 // A physics process gives the final state of the particle
75 // based on information of G4Track
76
77 void InitializeForPostStep(const G4Track&);
78 //Initialize all propoerties by using G4Track information
79
80 void AddSecondary(G4DynamicParticle* aParticle);
81 // Add next secondary
82
83 G4double GetProposedKineticEnergy() const;
84 void SetProposedKineticEnergy(G4double proposedKinEnergy);
85 // Get/Set the final kinetic energy of the current particle.
86
87 const G4ThreeVector& GetProposedMomentumDirection() const;
88 void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz);
89 void ProposeMomentumDirection(const G4ThreeVector& Pfinal);
90 // Get/Propose the MomentumDirection vector: it is the final momentum direction.
91
92 const G4ThreeVector& GetProposedPolarization() const;
93 void ProposePolarization(const G4ThreeVector& dir);
94 void ProposePolarization(G4double Px, G4double Py, G4double Pz);
95
96 const G4Track* GetCurrentTrack() const;
97
98 virtual void DumpInfo() const;
99
100 // for Debug
101 virtual G4bool CheckIt(const G4Track&);
102
103protected:
104 // hide copy constructor and assignment operaor as protected
105 G4ParticleChangeForGamma(const G4ParticleChangeForGamma &right);
106 G4ParticleChangeForGamma & operator=(const G4ParticleChangeForGamma &right);
107
108private:
109
110 const G4Track* currentTrack;
111 // The pointer to G4Track
112
113 G4double proposedKinEnergy;
114 // The final kinetic energy of the current particle.
115
116 G4ThreeVector proposedMomentumDirection;
117 // The final momentum direction of the current particle.
118
119 G4ThreeVector proposedPolarization;
120 // The final polarization of the current particle.
121};
122
123// ------------------------------------------------------------
124
125inline G4double G4ParticleChangeForGamma::GetProposedKineticEnergy() const
126{
127 return proposedKinEnergy;
128}
129
130inline void G4ParticleChangeForGamma::SetProposedKineticEnergy(G4double energy)
131{
132 proposedKinEnergy = energy;
133}
134
135inline
136 const G4ThreeVector& G4ParticleChangeForGamma::GetProposedMomentumDirection() const
137{
138 return proposedMomentumDirection;
139}
140
141inline
142 void G4ParticleChangeForGamma::ProposeMomentumDirection(const G4ThreeVector& dir)
143{
144 proposedMomentumDirection = dir;
145}
146
147inline
148 void G4ParticleChangeForGamma::ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
149{
150 proposedMomentumDirection.setX(Px);
151 proposedMomentumDirection.setY(Py);
152 proposedMomentumDirection.setZ(Pz);
153}
154
155inline const G4Track* G4ParticleChangeForGamma::GetCurrentTrack() const
156{
157 return currentTrack;
158}
159
160inline
161 const G4ThreeVector& G4ParticleChangeForGamma::GetProposedPolarization() const
162{
163 return proposedPolarization;
164}
165
166inline
167 void G4ParticleChangeForGamma::ProposePolarization(const G4ThreeVector& dir)
168{
169 proposedPolarization = dir;
170}
171
172inline
173 void G4ParticleChangeForGamma::ProposePolarization(G4double Px, G4double Py, G4double Pz)
174{
175 proposedPolarization.setX(Px);
176 proposedPolarization.setY(Py);
177 proposedPolarization.setZ(Pz);
178}
179
180inline void G4ParticleChangeForGamma::InitializeForPostStep(const G4Track& track)
181{
182 theStatusChange = track.GetTrackStatus();
183 theLocalEnergyDeposit = 0.0;
184 theNonIonizingEnergyDeposit = 0.0;
185 InitializeSecondaries(track);
186 theParentWeight = track.GetWeight();
187 proposedKinEnergy = track.GetKineticEnergy();
188 proposedMomentumDirection = track.GetMomentumDirection();
189 proposedPolarization = track.GetPolarization();
190 currentTrack = &track;
191}
192
193//----------------------------------------------------------------
194// method for updating G4Step
195//
196
197inline G4Step* G4ParticleChangeForGamma::UpdateStepForAtRest(G4Step* pStep)
198{
199 pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
200 pStep->SetStepLength( 0.0 );
201 if (!fSetParentWeightByProcess)
202 pStep->GetPostStepPoint()->SetWeight( theParentWeight );
203 return pStep;
204}
205
206inline G4Step* G4ParticleChangeForGamma::UpdateStepForPostStep(G4Step* pStep)
207{
208 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
209 pPostStepPoint->SetKineticEnergy( proposedKinEnergy );
210 pPostStepPoint->SetMomentumDirection( proposedMomentumDirection );
211 pPostStepPoint->SetPolarization( proposedPolarization );
212
213 // update weight
214 // this feature is commented out, it should be overwritten in case
215 // if energy loss processes will use biasing
216 if (!fSetParentWeightByProcess)
217 pPostStepPoint->SetWeight( theParentWeight );
218
219 pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
220 pStep->AddNonIonizingEnergyDeposit( theNonIonizingEnergyDeposit );
221 return pStep;
222}
223
224inline void G4ParticleChangeForGamma::AddSecondary(G4DynamicParticle* aParticle)
225{
226 // create track
227 G4Track* aTrack = new G4Track(aParticle, currentTrack->GetGlobalTime(),
228 currentTrack->GetPosition());
229
230 // Touchable handle is copied to keep the pointer
231 aTrack->SetTouchableHandle(currentTrack->GetTouchableHandle());
232
233 // add a secondary
234 G4VParticleChange::AddSecondary(aTrack);
235}
236
237#endif
238
Note: See TracBrowser for help on using the repository browser.