00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define INCLXX_IN_GEANT4_MODE 1
00034
00035 #include "globals.hh"
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "G4INCLBinaryCollisionAvatar.hh"
00045 #include "G4INCLElasticChannel.hh"
00046 #include "G4INCLRecombinationChannel.hh"
00047 #include "G4INCLDeltaProductionChannel.hh"
00048 #include "G4INCLCrossSections.hh"
00049 #include "G4INCLKinematicsUtils.hh"
00050 #include "G4INCLRandom.hh"
00051 #include "G4INCLParticleTable.hh"
00052 #include "G4INCLPauliBlocking.hh"
00053 #include "G4INCLPionNucleonChannel.hh"
00054 #include "G4INCLStore.hh"
00055 #include "G4INCLBook.hh"
00056 #include "G4INCLLogger.hh"
00057 #include <string>
00058 #include <sstream>
00059
00060
00061 namespace G4INCL {
00062
00063 const G4double BinaryCollisionAvatar::cutNN = 1910;
00064 const G4double BinaryCollisionAvatar::cutNNSquared = cutNN*cutNN;
00065
00066 BinaryCollisionAvatar::BinaryCollisionAvatar(G4double time, G4double crossSection,
00067 G4INCL::Nucleus *n, G4INCL::Particle *p1, G4INCL::Particle *p2)
00068 : InteractionAvatar(time, n, p1, p2), theCrossSection(crossSection)
00069 {
00070 setType(CollisionAvatarType);
00071 }
00072
00073 BinaryCollisionAvatar::~BinaryCollisionAvatar() {
00074 }
00075
00076 G4INCL::IChannel* BinaryCollisionAvatar::getChannel() const {
00077
00078
00079
00080 if(particle1->isNucleon()
00081 && particle2->isNucleon()
00082 && theNucleus->getStore()->getBook()->getAcceptedCollisions()!=0) {
00083 const G4double energyCM2 = KinematicsUtils::squareTotalEnergyInCM(particle1, particle2);
00084
00085 if(energyCM2 < cutNNSquared) {
00086 DEBUG("CM energy = sqrt(" << energyCM2 << ") MeV < sqrt(" << cutNNSquared
00087 << ") MeV = cutNN" << "; returning a NULL channel" << std::endl);
00088 InteractionAvatar::restoreParticles();
00089 return NULL;
00090 }
00091 }
00092
00112 ThreeVector minimumDistance = particle1->getPosition();
00113 minimumDistance -= particle2->getPosition();
00114 const G4double betaDotX = boostVector.dot(minimumDistance);
00115 const G4double minDist = Math::tenPi*(minimumDistance.mag2() + betaDotX*betaDotX / (1.-boostVector.mag2()));
00116 if(minDist > theCrossSection) {
00117 DEBUG("CM distance of approach is too small: " << minDist << ">" <<
00118 theCrossSection <<"; returning a NULL channel" << std::endl);
00119 InteractionAvatar::restoreParticles();
00120 return NULL;
00121 }
00122
00123 if(particle1->isNucleon() && particle2->isNucleon()) {
00124 G4double elasticCX = CrossSections::elastic(particle1,
00125 particle2);
00126 G4double deltaProductionCX = CrossSections::deltaProduction(particle1,
00127 particle2);
00128
00129 G4bool isElastic = true;
00130 if(elasticCX/(elasticCX + deltaProductionCX) < Random::shoot()) {
00131
00132 isElastic = false;
00133 }
00134
00135 if(isElastic) {
00136 DEBUG("NN interaction: elastic channel chosen" << std::endl);
00137 return new ElasticChannel(theNucleus, particle1, particle2);
00138 } else {
00139
00140 DEBUG("NN interaction: inelastic channel chosen" << std::endl);
00141 return new DeltaProductionChannel(particle1, particle2, theNucleus);
00142 }
00143 } else if((particle1->isNucleon() && particle2->isDelta()) ||
00144 (particle1->isDelta() && particle2->isNucleon())) {
00145 G4double elasticCX = CrossSections::elastic(particle1,
00146 particle2);
00147 G4double recombinationCX = CrossSections::recombination(particle1,
00148 particle2);
00149
00150 G4bool isElastic = true;
00151 if(elasticCX/(elasticCX + recombinationCX) < Random::shoot()) {
00152
00153 isElastic = false;
00154 }
00155
00156 if(isElastic) {
00157 DEBUG("NDelta interaction: elastic channel chosen" << std::endl);
00158 return new ElasticChannel(theNucleus, particle1, particle2);
00159 } else {
00160 DEBUG("NDelta interaction: recombination channel chosen" << std::endl);
00161 return new RecombinationChannel(theNucleus, particle1, particle2);
00162 }
00163 } else if(particle1->isDelta() && particle2->isDelta()) {
00164 DEBUG("DeltaDelta interaction: elastic channel chosen" << std::endl);
00165 return new ElasticChannel(theNucleus, particle1, particle2);
00166 } else if((particle1->isNucleon() && particle2->isPion()) ||
00167 (particle1->isPion() && particle2->isNucleon())) {
00168 return new PionNucleonChannel(particle1, particle2, theNucleus, shouldUseLocalEnergy());
00169 } else {
00170 DEBUG("BinaryCollisionAvatar can only handle nucleons (for the moment)."
00171 << std::endl
00172 << particle1->print()
00173 << std::endl
00174 << particle2->print()
00175 << std::endl);
00176 InteractionAvatar::restoreParticles();
00177 return NULL;
00178 }
00179 }
00180
00181 void BinaryCollisionAvatar::preInteraction() {
00182 InteractionAvatar::preInteraction();
00183 }
00184
00185 FinalState *BinaryCollisionAvatar::postInteraction(FinalState *fs) {
00186
00187
00188 fs = InteractionAvatar::postInteraction(fs);
00189
00190 switch(fs->getValidity()) {
00191 case PauliBlockedFS:
00192 theNucleus->getStore()->getBook()->incrementBlockedCollisions();
00193 break;
00194 case NoEnergyConservationFS:
00195 case ParticleBelowFermiFS:
00196 case ParticleBelowZeroFS:
00197 break;
00198 case ValidFS:
00199 theNucleus->getStore()->getBook()->incrementAcceptedCollisions();
00200 if(theNucleus->getStore()->getBook()->getAcceptedCollisions() == 1) {
00201 G4double t = theNucleus->getStore()->getBook()->getCurrentTime();
00202 theNucleus->getStore()->getBook()->setFirstCollisionTime(t);
00203 theNucleus->getStore()->getBook()->setFirstCollisionXSec(oldXSec);
00204 }
00205 }
00206 return fs;
00207 }
00208
00209 std::string BinaryCollisionAvatar::dump() const {
00210 std::stringstream ss;
00211 ss << "(avatar " << theTime <<" 'nn-collision" << std::endl
00212 << "(list " << std::endl
00213 << particle1->dump()
00214 << particle2->dump()
00215 << "))" << std::endl;
00216 return ss.str();
00217 }
00218
00219 }