Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4eplusAnnihilation.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 // $Id: G4eplusAnnihilation.cc 101249 2016-11-10 08:52:15Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4eplusAnnihilation
34 //
35 // Author: Vladimir Ivanchenko on base of Michel Maire code
36 //
37 // Creation date: 02.08.2004
38 //
39 // Modifications:
40 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
41 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
42 // 03-05-05 suppress Integral option (mma)
43 // 04-05-05 Make class to be default (V.Ivanchenko)
44 // 25-01-06 remove cut dependance in AtRestDoIt (mma)
45 // 09-08-06 add SetModel(G4VEmModel*) (mma)
46 // 12-09-06, move SetModel(G4VEmModel*) in G4VEmProcess (mma)
47 // 30-05-12 propagate parent weight to secondaries (D. Sawkey)
48 //
49 
50 //
51 // -------------------------------------------------------------------
52 //
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
56 #include "G4eplusAnnihilation.hh"
57 #include "G4PhysicalConstants.hh"
58 #include "G4MaterialCutsCouple.hh"
59 #include "G4Gamma.hh"
60 #include "G4Positron.hh"
61 #include "G4eeToTwoGammaModel.hh"
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
65 using namespace std;
66 
68  : G4VEmProcess(name), isInitialised(false)
69 {
70  theGamma = G4Gamma::Gamma();
71  SetIntegral(true);
72  SetBuildTableFlag(false);
73  SetStartFromNullFlag(false);
74  SetSecondaryParticle(theGamma);
76  enableAtRestDoIt = true;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80 
82 {}
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
85 
87 {
88  return (&p == G4Positron::Positron());
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92 
95 {
96  *condition = NotForced;
97  return 0.0;
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
101 
103 {
104  if(!isInitialised) {
105  isInitialised = true;
106  if(!EmModel(1)) { SetEmModel(new G4eeToTwoGammaModel(),1); }
109  AddEmModel(1, EmModel(1));
110  }
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
114 
116 {}
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
119 
121  const G4Step& )
122 //
123 // Performs the e+ e- annihilation when both particles are assumed at rest.
124 // It generates two back to back photons with energy = electron_mass.
125 // The angular distribution is isotropic.
126 // GEANT4 internal units
127 //
128 // Note : Effects due to binding of atomic electrons are negliged.
129 {
131  CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
132 
133  G4double cosTeta = 2.*rndmEngine->flat()-1.;
134  G4double sinTeta = sqrt((1.-cosTeta)*(1.0 + cosTeta));
135  G4double phi = twopi * rndmEngine->flat();
136  G4ThreeVector dir(sinTeta*cos(phi), sinTeta*sin(phi), cosTeta);
137  phi = twopi * rndmEngine->flat();
138  G4double cosphi = cos(phi);
139  G4double sinphi = sin(phi);
140  G4ThreeVector pol(cosphi, sinphi, 0.0);
141  pol.rotateUz(dir);
142 
143  // e+ parameters
144  G4double weight = aTrack.GetWeight();
145  G4double time = aTrack.GetGlobalTime();
146 
147  // add gammas
149  G4DynamicParticle* dp =
150  new G4DynamicParticle(theGamma, dir, electron_mass_c2);
151  dp->SetPolarization(pol.x(),pol.y(),pol.z());
152  G4Track* track = new G4Track(dp, time, aTrack.GetPosition());
153  track->SetTouchableHandle(aTrack.GetTouchableHandle());
154  track->SetWeight(weight);
156 
157  dp = new G4DynamicParticle(theGamma,-dir, electron_mass_c2);
158  pol.set(-sinphi, cosphi, 0.0);
159  pol.rotateUz(dir);
160  dp->SetPolarization(pol.x(),pol.y(),pol.z());
161  track = new G4Track(dp, time, aTrack.GetPosition());
162  track->SetTouchableHandle(aTrack.GetTouchableHandle());
163  track->SetWeight(weight);
165 
166  // Kill the incident positron
167  //
169  return &fParticleChange;
170 }
171 
172 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void set(double x, double y, double z)
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData) override
G4double condition(const G4ErrorSymMatrix &m)
const XML_Char * name
Definition: expat.h:151
double x() const
void SetBuildTableFlag(G4bool val)
G4VEmModel * EmModel(G4int index=1) const
const char * p
Definition: xmltok.h:285
const G4ThreeVector & GetPosition() const
G4ParticleChangeForGamma fParticleChange
G4double MaxKinEnergy() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
virtual double flat()=0
void SetStartFromNullFlag(G4bool val)
G4bool enableAtRestDoIt
Definition: G4VProcess.hh:350
double z() const
void SetWeight(G4double aValue)
static constexpr double twopi
Definition: G4SIunits.hh:76
static constexpr double electron_mass_c2
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:724
void SetEmModel(G4VEmModel *, G4int index=1)
bool G4bool
Definition: G4Types.hh:79
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:38
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition) override
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
Definition: G4Step.hh:76
void SetIntegral(G4bool val)
virtual void PrintInfo() override
G4double GetGlobalTime() const
G4eplusAnnihilation(const G4String &name="annihil")
void SetPolarization(G4double polX, G4double polY, G4double polZ)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void AddSecondary(G4Track *aSecondary)
const G4TouchableHandle & GetTouchableHandle() const
void AddEmModel(G4int, G4VEmModel *, const G4Region *region=nullptr)
static G4Positron * Positron()
Definition: G4Positron.cc:94
void SetNumberOfSecondaries(G4int totSecondaries)
void SetSecondaryParticle(const G4ParticleDefinition *p)
double y() const
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
G4double GetWeight() const
virtual G4bool IsApplicable(const G4ParticleDefinition &p) final
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
virtual void InitialiseProcess(const G4ParticleDefinition *) override
void SetLowEnergyLimit(G4double)
Definition: G4VEmModel.hh:731
void InitializeForPostStep(const G4Track &)
G4ForceCondition
G4double MinKinEnergy() const