source: trunk/source/processes/hadronic/stopping/src/G4PiMinusStopMaterial.cc @ 962

Last change on this file since 962 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 5.9 KB
Line 
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//      File name:     G4PiMinusStopMaterial
27//
28//      Author:        Maria Grazia Pia (pia@genova.infn.it)
29//
30//      Creation date: 8 May 1998
31//
32// -------------------------------------------------------------------
33
34#include "G4ios.hh"
35
36#include "G4PiMinusStopMaterial.hh"
37
38#include <vector>
39
40#include "globals.hh"
41#include "Randomize.hh"
42#include "G4Proton.hh"
43#include "G4Neutron.hh"
44#include "G4PionMinus.hh"
45#include "G4ParticleTypes.hh"
46#include "G4ReactionKinematics.hh"
47#include "G4DynamicParticleVector.hh"
48#include "G4LorentzVector.hh"
49#include "G4NucleiPropertiesTable.hh"
50#include "G4PiMinusStopMaterial.hh"
51#include "G4DistributionGenerator.hh"
52
53
54// Constructor
55
56G4PiMinusStopMaterial::G4PiMinusStopMaterial()
57 
58{
59  _definitions = 0;
60  _momenta = 0;
61  _distributionE = 0;
62  _distributionAngle = 0;
63
64}
65
66
67// Destructor
68
69G4PiMinusStopMaterial::~G4PiMinusStopMaterial()
70{
71  //  _definitions->clear();
72  if (_definitions != 0) delete _definitions;
73  _definitions = 0;
74
75  for(unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i];
76  if (_momenta != 0) delete _momenta;
77
78  delete _distributionE;
79  delete _distributionAngle;
80}
81
82std::vector<G4ParticleDefinition*>* G4PiMinusStopMaterial::DefinitionVector()
83{
84
85  _definitions->push_back(G4Neutron::Neutron());
86
87  G4double ranflat = G4UniformRand();
88  if (ranflat < theR)
89    { _definitions->push_back(G4Proton::Proton()); }
90  else
91    { _definitions->push_back(G4Neutron::Neutron()); }
92 
93  return _definitions;
94
95}
96
97std::vector<G4LorentzVector*>* G4PiMinusStopMaterial::P4Vector(const G4double binding,
98                                                                      const G4double massNucleus)
99{
100
101  // Generate energy of direct absorption products according to experimental data
102  // The energy distribution of the two nucleons is assumed to be the same
103  // for protons and neutrons 
104
105
106  G4double eKin1;
107  G4double eKin2;
108  G4double eRecoil;
109
110  // Assume absorption on two nucleons
111  G4int nNucleons = 2;
112  G4double availableE = G4PionMinus::PionMinus()->GetPDGMass() - nNucleons * binding;
113  G4LorentzVector p1;
114  G4LorentzVector p2;
115
116  do 
117    { 
118      G4double ranflat;
119      G4double p;
120      G4double energy;
121      G4double mass;
122
123      ranflat = G4UniformRand();
124      eKin1 = _distributionE->Generate(ranflat);
125      mass = (*_definitions)[0]->GetPDGMass();
126      energy = eKin1 + mass;
127      p = std::sqrt(energy*energy - mass*mass);
128      G4double theta1 = pi*G4UniformRand();
129      G4double phi1 = GenerateAngle(2.*pi);
130      p1 = MakeP4(p,theta1,phi1,energy);
131
132      ranflat = G4UniformRand();
133      eKin2 = _distributionE->Generate(ranflat);
134      mass = (*_definitions)[1]->GetPDGMass();
135      energy = eKin2 + mass;
136      p = std::sqrt(energy*energy - mass*mass);
137      ranflat = G4UniformRand();
138      G4double opAngle = _distributionAngle->Generate(ranflat);
139      G4double theta2 = theta1 + opAngle;
140      G4double phi2 = phi1 + opAngle;
141 
142      p2 = MakeP4(p,theta2,phi2,energy);
143
144      G4double pNucleus = (p1.vect() + p2.vect()).mag();
145      eRecoil = std::sqrt(pNucleus*pNucleus + massNucleus*massNucleus) - massNucleus;
146
147      // ---- Debug     
148      //      G4cout << " ---- binding = " << binding << ", nucleus mass = " << massNucleus
149      //             << ", p nucleus = " << pNucleus << G4endl;
150      //      G4cout << "eKin1,2 " << eKin1 << " " << eKin2 << " eRecoil " << eRecoil
151      //             << " availableE " << availableE << G4endl;
152      // ----
153
154    }  while ((eKin1 + eKin2 + eRecoil) > availableE);
155 
156  _momenta->push_back(new G4LorentzVector(p1));
157  _momenta->push_back(new G4LorentzVector(p2));
158
159  return _momenta;
160
161}
162
163G4double G4PiMinusStopMaterial::GenerateAngle(G4double x)
164{
165  G4double ranflat = G4UniformRand();
166  G4double value = ranflat * x;
167  return value;
168}
169
170G4LorentzVector G4PiMinusStopMaterial::MakeP4(G4double p, G4double theta, G4double phi, G4double e)
171{
172  //  G4LorentzVector p4;
173  G4double px = p * std::sin(theta) * std::cos(phi);
174  G4double py = p * std::sin(theta) * std::sin(phi);
175  G4double pz = p * std::cos(theta);
176  G4LorentzVector p4(px,py,pz,e);
177  return p4;
178}
179
180G4double G4PiMinusStopMaterial::RecoilEnergy(const G4double mass)
181{
182  G4ThreeVector p(0.,0.,0.);
183 
184  for (unsigned int i = 0; i< _momenta->size(); i++)
185    {
186      p = p + (*_momenta)[i]->vect();
187    }
188  G4double pNucleus = p.mag();
189  G4double eNucleus = std::sqrt(pNucleus*pNucleus + mass*mass);
190
191  return eNucleus;
192}
193
194
195
196
197
198
199
200
201
202
Note: See TracBrowser for help on using the repository browser.