Geant4_10
G4INCLCrossSections.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 "G4INCLCrossSections.hh"
38 #include "G4INCLKinematicsUtils.hh"
39 #include "G4INCLParticleTable.hh"
40 #include "G4INCLLogger.hh"
41 // #include <cassert>
42 
43 namespace G4INCL {
44 
45  namespace {
46  G4ThreadLocal ICrossSections *theCrossSections;
47  }
48 
49  namespace CrossSections {
50  G4double elastic(Particle const * const p1, Particle const * const p2) {
51  return theCrossSections->elastic(p1,p2);
52  }
53 
54  G4double total(Particle const * const p1, Particle const * const p2) {
55  return theCrossSections->total(p1,p2);
56  }
57 
58  G4double pionNucleon(Particle const * const p1, Particle const * const p2) {
59  return theCrossSections->pionNucleon(p1,p2);
60  }
61 
62  G4double recombination(Particle const * const p1, Particle const * const p2) {
63  return theCrossSections->recombination(p1,p2);
64  }
65 
66  G4double deltaProduction(Particle const * const p1, Particle const * const p2) {
67  return theCrossSections->deltaProduction(p1,p2);
68  }
69 
71  return theCrossSections->calculateNNAngularSlope(energyCM, iso);
72  }
73 
74  G4double interactionDistancePiN(const G4double projectileKineticEnergy) {
75  ThreeVector nullVector;
76  ThreeVector unitVector(0., 0., 1.);
77 
78  Particle piPlusProjectile(PiPlus, unitVector, nullVector);
79  piPlusProjectile.setEnergy(piPlusProjectile.getMass()+projectileKineticEnergy);
80  piPlusProjectile.adjustMomentumFromEnergy();
81  Particle piZeroProjectile(PiZero, unitVector, nullVector);
82  piZeroProjectile.setEnergy(piZeroProjectile.getMass()+projectileKineticEnergy);
83  piZeroProjectile.adjustMomentumFromEnergy();
84  Particle piMinusProjectile(PiMinus, unitVector, nullVector);
85  piMinusProjectile.setEnergy(piMinusProjectile.getMass()+projectileKineticEnergy);
86  piMinusProjectile.adjustMomentumFromEnergy();
87 
88  Particle protonTarget(Proton, nullVector, nullVector);
89  Particle neutronTarget(Neutron, nullVector, nullVector);
90  const G4double sigmapipp = total(&piPlusProjectile, &protonTarget);
91  const G4double sigmapipn = total(&piPlusProjectile, &neutronTarget);
92  const G4double sigmapi0p = total(&piZeroProjectile, &protonTarget);
93  const G4double sigmapi0n = total(&piZeroProjectile, &neutronTarget);
94  const G4double sigmapimp = total(&piMinusProjectile, &protonTarget);
95  const G4double sigmapimn = total(&piMinusProjectile, &neutronTarget);
96  /* We compute the interaction distance from the largest of the pi-N cross
97  * sections. Note that this is different from INCL4.6, which just takes the
98  * average of the six, and will in general lead to a different geometrical
99  * cross section.
100  */
101  const G4double largestSigma = std::max(sigmapipp, std::max(sigmapipn, std::max(sigmapi0p, std::max(sigmapi0n, std::max(sigmapimp,sigmapimn)))));
102  const G4double interactionDistance = std::sqrt(largestSigma/Math::tenPi);
103 
104  return interactionDistance;
105  }
106 
107  G4double interactionDistanceNN(const ParticleSpecies &aSpecies, const G4double kineticEnergy) {
108 // assert(aSpecies.theType==Proton || aSpecies.theType==Neutron || aSpecies.theType==Composite);
109 // assert(aSpecies.theA>0);
110  ThreeVector nullVector;
111  ThreeVector unitVector(0.,0.,1.);
112 
113  const G4double kineticEnergyPerNucleon = kineticEnergy / aSpecies.theA;
114 
115  Particle protonProjectile(Proton, unitVector, nullVector);
116  protonProjectile.setEnergy(protonProjectile.getMass()+kineticEnergyPerNucleon);
117  protonProjectile.adjustMomentumFromEnergy();
118  Particle neutronProjectile(Neutron, unitVector, nullVector);
119  neutronProjectile.setEnergy(neutronProjectile.getMass()+kineticEnergyPerNucleon);
120  neutronProjectile.adjustMomentumFromEnergy();
121 
122  Particle protonTarget(Proton, nullVector, nullVector);
123  Particle neutronTarget(Neutron, nullVector, nullVector);
124  const G4double sigmapp = total(&protonProjectile, &protonTarget);
125  const G4double sigmapn = total(&protonProjectile, &neutronTarget);
126  const G4double sigmann = total(&neutronProjectile, &neutronTarget);
127  /* We compute the interaction distance from the largest of the NN cross
128  * sections. Note that this is different from INCL4.6, which just takes the
129  * average of the four, and will in general lead to a different geometrical
130  * cross section.
131  */
132  const G4double largestSigma = std::max(sigmapp, std::max(sigmapn, sigmann));
133  const G4double interactionDistance = std::sqrt(largestSigma/Math::tenPi);
134 
135  return interactionDistance;
136  }
137 
139  theCrossSections = c;
140  }
141 
143  delete theCrossSections;
144  theCrossSections = NULL;
145  }
146  }
147 }
G4double getMass() const
Get the cached particle mass.
G4double deltaProduction(Particle const *const p1, Particle const *const p2)
G4double recombination(Particle const *const p1, Particle const *const p2)
const G4double tenPi
G4double interactionDistanceNN(const ParticleSpecies &aSpecies, const G4double kineticEnergy)
Compute the &quot;interaction distance&quot;.
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
void setCrossSections(ICrossSections *c)
void setEnergy(G4double energy)
G4double calculateNNAngularSlope(G4double energyCM, G4int iso)
Calculate the slope of the NN DDXS.
G4double pionNucleon(Particle const *const p1, Particle const *const p2)
G4double total(Particle const *const p1, Particle const *const p2)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double interactionDistancePiN(const G4double projectileKineticEnergy)
Compute the &quot;interaction distance&quot;.
Abstract interface for the cross-section classes.
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13
const ThreeVector & adjustMomentumFromEnergy()
Rescale the momentum to match the total energy.
G4double elastic(Particle const *const p1, Particle const *const p2)