Geant4_10
G4INCLElasticChannel.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 // INCL++ intra-nuclear cascade model
27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28 // Davide Mancusi, CEA
29 // Alain Boudard, CEA
30 // Sylvie Leray, CEA
31 // Joseph Cugnon, University of Liege
32 //
33 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 #include "G4INCLElasticChannel.hh"
38 #include "G4INCLRandom.hh"
39 #include "G4INCLKinematicsUtils.hh"
40 #include "G4INCLParticleTable.hh"
41 #include "G4INCLCrossSections.hh"
42 #include "G4INCLGlobals.hh"
43 
44 namespace G4INCL {
45 
47  :particle1(p1), particle2(p2)
48  {
49  }
50 
52  {
53  }
54 
56  {
57  ParticleType p1TypeOld = particle1->getType();
58  ParticleType p2TypeOld = particle2->getType();
59 
60  /* Concerning the way we calculate the lab momentum, see the considerations
61  * in CrossSections::elasticNNLegacy().
62  */
63  const G4double s = KinematicsUtils::squareTotalEnergyInCM(particle1, particle2);
65 
66  const G4int isospin = ParticleTable::getIsospin(particle1->getType()) +
67  ParticleTable::getIsospin(particle2->getType());
68 
69  // Calculate the outcome of the channel:
70  G4double psq = particle1->getMomentum().mag2();
71  G4double pnorm = std::sqrt(psq);
73  G4double btmax = 4.0 * psq * b;
74  G4double z = std::exp(-btmax);
75  G4double ranres = Random::shoot();
76  G4double y = 1.0 - ranres * (1.0 - z);
77  G4double T = std::log(y)/b;
78  G4int iexpi = 0;
79  G4double apt = 1.0;
80 
81  // Handle np case
82  if((particle1->getType() == Proton && particle2->getType() == Neutron) ||
83  (particle1->getType() == Neutron && particle2->getType() == Proton)) {
84  if(pl > 800.0) {
85  const G4double x = 0.001 * pl; // Transform to GeV
86  apt = (800.0/pl)*(800.0/pl);
87  G4double cpt = std::max(6.23 * std::exp(-1.79*x), 0.3);
88  G4double alphac = 100.0 * 1.0e-6;
89  G4double aaa = (1 + apt) * (1 - std::exp(-btmax))/b;
90  G4double argu = psq * alphac;
91 
92  if(argu >= 8) {
93  argu = 0.0;
94  } else {
95  argu = std::exp(-4.0 * argu);
96  }
97 
98  G4double aac = cpt * (1.0 - argu)/alphac;
99  G4double fracpn = aaa/(aac + aaa);
100  if(Random::shoot() > fracpn) {
101  z = std::exp(-4.0 * psq *alphac);
102  iexpi = 1;
103  y = 1.0 - ranres*(1.0 - z);
104  T = std::log(y)/alphac;
105  }
106  }
107  }
108 
109  G4double ctet = 1.0 + 0.5*T/psq;
110  if(std::abs(ctet) > 1.0) ctet = Math::sign(ctet);
111  G4double stet = std::sqrt(1.0 - ctet*ctet);
113 
114  G4double fi = Math::twoPi * rndm;
115  G4double cfi = std::cos(fi);
116  G4double sfi = std::sin(fi);
117 
118  G4double xx = particle1->getMomentum().perp2();
119  G4double zz = std::pow(particle1->getMomentum().getZ(), 2);
120 
121  if(xx >= (zz * 1.0e-8)) {
122  ThreeVector p = particle1->getMomentum();
123  G4double yn = std::sqrt(xx);
124  G4double zn = yn * pnorm;
125  G4double ex[3], ey[3], ez[3];
126  ez[0] = p.getX() / pnorm;
127  ez[1] = p.getY() / pnorm;
128  ez[2] = p.getZ() / pnorm;
129 
130  // Vector Ex is chosen arbitrarily:
131  ex[0] = p.getY() / yn;
132  ex[1] = -p.getX() / yn;
133  ex[2] = 0.0;
134 
135  ey[0] = p.getX() * p.getZ() / zn;
136  ey[1] = p.getY() * p.getZ() / zn;
137  ey[2] = -xx/zn;
138 
139  G4double pX = (ex[0]*cfi*stet + ey[0]*sfi*stet + ez[0]*ctet) * pnorm;
140  G4double pY = (ex[1]*cfi*stet + ey[1]*sfi*stet + ez[1]*ctet) * pnorm;
141  G4double pZ = (ex[2]*cfi*stet + ey[2]*sfi*stet + ez[2]*ctet) * pnorm;
142 
143  ThreeVector p1momentum = ThreeVector(pX, pY, pZ);
144  particle1->setMomentum(p1momentum);
145  particle2->setMomentum(-p1momentum);
146  } else { // if(xx < (zz * 1.0e-8)) {
147  G4double momZ = particle1->getMomentum().getZ();
148  G4double pX = momZ * cfi * stet;
149  G4double pY = momZ * sfi * stet;
150  G4double pZ = momZ * ctet;
151 
152  ThreeVector p1momentum(pX, pY, pZ);
153  particle1->setMomentum(p1momentum);
154  particle2->setMomentum(-p1momentum);
155  }
156 
157  // Handle backward scattering here.
158 
159  if((particle1->getType() == Proton && particle2->getType() == Neutron) ||
160  (particle1->getType() == Neutron && particle2->getType() == Proton)) {
161  rndm = Random::shoot();
162  apt = 1.0;
163  if(pl > 800.0) {
164  apt = std::pow(800.0/pl, 2);
165  }
166  if(iexpi == 1 || rndm > 1.0/(1.0 + apt)) {
167  particle1->setType(p2TypeOld);
168  particle2->setType(p1TypeOld);
169  }
170  }
171 
172  // Note: there is no need to update the kinetic energies of the particles,
173  // as this is elastic scattering.
174 
175  FinalState *fs = new FinalState();
176  fs->addModifiedParticle(particle1);
177  fs->addModifiedParticle(particle2);
178 
179  return fs;
180 
181  }
182 
183 }
DOUBLE PRECISION function rndm(RDUMMY)
Definition: dpm25nulib.f:1460
const XML_Char * s
Definition: expat.h:262
G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)
const char * p
Definition: xmltok.h:285
const G4INCL::ThreeVector & getMomentum() const
Double_t xx
Definition: macro.C:10
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
ElasticChannel(Particle *p1, Particle *p2)
G4double mag2() const
Double_t y
Definition: plot.C:279
tuple b
Definition: test.py:12
tuple pl
Definition: readPY.py:5
G4double perp2() const
G4double calculateNNAngularSlope(G4double energyCM, G4int iso)
Calculate the slope of the NN DDXS.
Double_t zz
Definition: macro.C:12
G4int getIsospin(const ParticleType t)
Get the isospin of a particle.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4INCL::ParticleType getType() const
void setType(ParticleType t)
const G4double twoPi
tuple z
Definition: test.py:28
G4double getX() const
G4double shoot()
Definition: G4INCLRandom.cc:74
G4double momentumInLab(Particle const *const p1, Particle const *const p2)
gives the momentum in the lab frame of two particles.
double G4double
Definition: G4Types.hh:76
G4int sign(const T t)
const G4double effectiveNucleonMass
void addModifiedParticle(Particle *p)
G4double getZ() const
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
G4double getY() const