Geant4  10.01.p03
G4INCLBinaryCollisionAvatar.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 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 /*
39  * G4INCLBinaryCollisionAvatar.cc
40  *
41  * \date Jun 5, 2009
42  * \author Pekka Kaitaniemi
43  */
44 
46 #include "G4INCLElasticChannel.hh"
50 #include "G4INCLCrossSections.hh"
51 #include "G4INCLKinematicsUtils.hh"
52 #include "G4INCLRandom.hh"
53 #include "G4INCLParticleTable.hh"
54 #include "G4INCLPauliBlocking.hh"
58 #include "G4INCLStore.hh"
59 #include "G4INCLBook.hh"
60 #include "G4INCLLogger.hh"
61 #include <string>
62 #include <sstream>
63 // #include <cassert>
64 
65 namespace G4INCL {
66 
67  // WARNING: if you update the default cutNN value, make sure you update the
68  // cutNNSquared variable, too.
70  G4ThreadLocal G4double BinaryCollisionAvatar::cutNNSquared = 3648100.0; // 1910.0 * 1910.0
71 
74  : InteractionAvatar(time, n, p1, p2), theCrossSection(crossSection),
75  isParticle1Spectator(false),
76  isParticle2Spectator(false),
77  isElastic(false)
78  {
80  }
81 
83  }
84 
86  // We already check cutNN at avatar creation time, but we have to check it
87  // again here. For composite projectiles, we might have created independent
88  // avatars with no cutNN before any collision took place.
89  if(particle1->isNucleon()
90  && particle2->isNucleon()
93  // Below a certain cut value we don't do anything:
94  if(energyCM2 < cutNNSquared) {
95  INCL_DEBUG("CM energy = sqrt(" << energyCM2 << ") MeV < sqrt(" << cutNNSquared
96  << ") MeV = cutNN" << "; returning a NULL channel" << '\n');
98  return NULL;
99  }
100  }
101 
121  ThreeVector minimumDistance = particle1->getPosition();
122  minimumDistance -= particle2->getPosition();
123  const G4double betaDotX = boostVector.dot(minimumDistance);
124  const G4double minDist = Math::tenPi*(minimumDistance.mag2() + betaDotX*betaDotX / (1.-boostVector.mag2()));
125  if(minDist > theCrossSection) {
126  INCL_DEBUG("CM distance of approach is too small: " << minDist << ">" <<
127  theCrossSection <<"; returning a NULL channel" << '\n');
129  return NULL;
130  }
131 
133  if(particle1->isNucleon() && particle2->isNucleon()) {
135  const G4double deltaProductionCX = CrossSections::NNToNDelta(particle1, particle2);
136  const G4double onePiProductionCX = CrossSections::NNToxPiNN(1,particle1, particle2);
137  const G4double twoPiProductionCX = CrossSections::NNToxPiNN(2,particle1, particle2);
138  const G4double threePiProductionCX = CrossSections::NNToxPiNN(3,particle1, particle2);
139  const G4double fourPiProductionCX = CrossSections::NNToxPiNN(4,particle1, particle2);
141 
142  const G4double rChannel=Random::shoot() * totCX;
143 
144  if(elasticCX > rChannel) {
145  // Elastic NN channel
146  isElastic = true;
147  INCL_DEBUG("NN interaction: elastic channel chosen" << '\n');
148  return new ElasticChannel(particle1, particle2);
149  } else if((elasticCX + deltaProductionCX) > rChannel) {
150  isElastic = false;
151  // NN -> N Delta channel is chosen
152  INCL_DEBUG("NN interaction: Delta channel chosen" << '\n');
154  } else if(elasticCX + deltaProductionCX + onePiProductionCX > rChannel) {
155  isElastic = false;
156  // NN -> PiNN channel is chosen
157  INCL_DEBUG("NN interaction: one Pion channel chosen" << '\n');
159  } else if(elasticCX + deltaProductionCX + onePiProductionCX + twoPiProductionCX > rChannel) {
160  isElastic = false;
161  // NN -> 2PiNN channel is chosen
162  INCL_DEBUG("NN interaction: two Pions channel chosen" << '\n');
164  } else if(elasticCX + deltaProductionCX + onePiProductionCX + twoPiProductionCX + threePiProductionCX > rChannel) {
165  isElastic = false;
166  // NN -> 3PiNN channel is chosen
167  INCL_DEBUG("NN interaction: three Pions channel chosen" << '\n');
169  } else if (elasticCX + deltaProductionCX + onePiProductionCX + twoPiProductionCX + threePiProductionCX + fourPiProductionCX > rChannel) {
170  isElastic = false;
171  // NN -> 4PiNN channel is chosen
172  INCL_DEBUG("NN interaction: four Pions channel chosen" << '\n');
174  } else {
175  INCL_WARN("inconsistency with NN Cross Sections: returning an elastic channel" << '\n');
176  isElastic = true;
177  return new ElasticChannel(particle1, particle2);
178  }
179 
181  } else if((particle1->isNucleon() && particle2->isDelta()) ||
182  (particle1->isDelta() && particle2->isNucleon())) {
185 
186  if(elasticCX/(elasticCX + recombinationCX) < Random::shoot()) {
187  isElastic = false;
188  } else
189  isElastic = true;
190 
191  if(isElastic) {
192 // Elastic N Delta channel
193  INCL_DEBUG("NDelta interaction: elastic channel chosen" << '\n');
194  return new ElasticChannel(particle1, particle2);
195  } else { // Recombination
196 // N Delta -> NN channel is chosen
197  INCL_DEBUG("NDelta interaction: recombination channel chosen" << '\n');
199  }
200 
202  } else if(particle1->isDelta() && particle2->isDelta()) {
203  isElastic = true;
204  INCL_DEBUG("DeltaDelta interaction: elastic channel chosen" << '\n');
205  return new ElasticChannel(particle1, particle2);
206 
208  } else if(isPiN) {
210  const G4double deltaProductionCX = CrossSections::piNToDelta(particle1, particle2);
211  const G4double onePiProductionCX = CrossSections::piNToxPiN(2,particle1, particle2);
212  const G4double twoPiProductionCX = CrossSections::piNToxPiN(3,particle1, particle2);
213  const G4double threePiProductionCX = CrossSections::piNToxPiN(4,particle1, particle2);
215 // assert(std::fabs(totCX-elasticCX-deltaProductionCX-onePiProductionCX-twoPiProductionCX-threePiProductionCX)<1.);
216 
217  const G4double rChannel=Random::shoot() * totCX;
218 
219  if(elasticCX > rChannel) {
220  // Elastic PiN channel
221  isElastic = true;
222  INCL_DEBUG("PiN interaction: elastic channel chosen" << '\n');
224  } else if(elasticCX + deltaProductionCX > rChannel) {
225  isElastic = false;
226  // PiN -> Delta channel is chosen
227  INCL_DEBUG("PiN interaction: Delta channel chosen" << '\n');
229  } else if(elasticCX + deltaProductionCX + onePiProductionCX > rChannel) {
230  isElastic = false;
231  // PiN -> PiNPi channel is chosen
232  INCL_DEBUG("PiN interaction: one Pion channel chosen" << '\n');
234  } else if(elasticCX + deltaProductionCX + onePiProductionCX + twoPiProductionCX > rChannel) {
235  isElastic = false;
236  // PiN -> PiN2Pi channel is chosen
237  INCL_DEBUG("PiN interaction: two Pions channel chosen" << '\n');
239  } else if(elasticCX + deltaProductionCX + onePiProductionCX + twoPiProductionCX + threePiProductionCX > rChannel) {
240  isElastic = false;
241  // PiN -> PiN3Pi channel is chosen
242  INCL_DEBUG("PiN interaction: three Pions channel chosen" << '\n');
244  } else {
245  INCL_WARN("inconsistency with PiN Cross Sections: returning an elastic channel" << '\n');
246  isElastic = true;
248  }
249  } else {
250  INCL_DEBUG("BinaryCollisionAvatar can only handle nucleons (for the moment)."
251  << '\n'
252  << particle1->print()
253  << '\n'
254  << particle2->print()
255  << '\n');
257  return NULL;
258  }
259  }
260 
265  }
266 
268  // Call the postInteraction method of the parent class
269  // (provides Pauli blocking and enforces energy conservation)
271 
272  switch(fs->getValidity()) {
273  case PauliBlockedFS:
275  break;
278  case ParticleBelowZeroFS:
279  break;
280  case ValidFS:
281  Book &theBook = theNucleus->getStore()->getBook();
282  theBook.incrementAcceptedCollisions();
283  if(theBook.getAcceptedCollisions() == 1) {
284  // Store time and cross section of the first collision
285  G4double t = theBook.getCurrentTime();
286  theBook.setFirstCollisionTime(t);
288 
289  // Store position and momentum of the spectator on the first
290  // collision
292  INCL_ERROR("First collision must be within a target spectator and a non-target spectator");
293  }
297  } else {
300  }
301 
302  // Store the elasticity of the first collision
304  }
305  }
306  return;
307  }
308 
309  std::string BinaryCollisionAvatar::dump() const {
310  std::stringstream ss;
311  ss << "(avatar " << theTime <<" 'nn-collision" << '\n'
312  << "(list " << '\n'
313  << particle1->dump()
314  << particle2->dump()
315  << "))" << '\n';
316  return ss.str();
317  }
318 
319 }
FinalStateValidity getValidity() const
void incrementBlockedCollisions()
Definition: G4INCLBook.hh:73
G4double dot(const ThreeVector &v) const
Dot product.
Channel generates a final state of an avatar.
G4int getAcceptedCollisions() const
Definition: G4INCLBook.hh:100
G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)
const G4double tenPi
#define INCL_ERROR(x)
G4bool isTargetSpectator() const
const G4INCL::ThreeVector & getMomentum() const
Get the momentum vector.
Store * getStore() const
G4bool isDelta() const
Is it a Delta?
std::string print() const
G4double NDeltaToNN(Particle const *const p1, Particle const *const p2)
#define INCL_WARN(x)
#define G4ThreadLocal
Definition: tls.hh:89
virtual void postInteraction(FinalState *)
G4double mag2() const
Get the square of the length.
static G4ThreadLocal Particle * backupParticle2
void incrementAcceptedCollisions()
Definition: G4INCLBook.hh:72
Final state of an interaction.
void setType(AvatarType t)
Book & getBook()
Return the pointer to the Book object which keeps track of various counters.
Definition: G4INCLStore.hh:259
void setFirstCollisionXSec(const G4double x)
Definition: G4INCLBook.hh:85
const G4double p2
const G4double p1
static G4ThreadLocal Particle * backupParticle1
G4double NNToNDelta(Particle const *const p1, Particle const *const p2)
const G4int n
void setFirstCollisionTime(const G4double t)
Definition: G4INCLBook.hh:82
static G4ThreadLocal G4double cutNNSquared
static G4ThreadLocal G4double cutNN
Delta-nucleon recombination channel.
G4double total(Particle const *const p1, Particle const *const p2)
const G4INCL::ThreeVector & getPosition() const
Set the position vector.
std::string dump() const
G4double piNToDelta(Particle const *const p1, Particle const *const p2)
G4bool isNucleon() const
Is this a nucleon?
G4double shoot()
Generate flat distribution of random numbers.
Definition: G4INCLRandom.cc:93
G4double piNToxPiN(const G4int xpi, Particle const *const p1, Particle const *const p2)
void restoreParticles() const
Restore the state of both particles.
G4double mag() const
Get the length of the vector.
BinaryCollisionAvatar(G4double, G4double, G4INCL::Nucleus *, G4INCL::Particle *, G4INCL::Particle *)
double G4double
Definition: G4Types.hh:76
G4double getCurrentTime() const
Definition: G4INCLBook.hh:98
#define INCL_DEBUG(x)
void setFirstCollisionIsElastic(const G4bool e)
Definition: G4INCLBook.hh:94
G4double NNToxPiNN(const G4int xpi, Particle const *const p1, Particle const *const p2)
void setFirstCollisionSpectatorMomentum(const G4double x)
Definition: G4INCLBook.hh:91
G4double elastic(Particle const *const p1, Particle const *const p2)
void setFirstCollisionSpectatorPosition(const G4double x)
Definition: G4INCLBook.hh:88