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
00034
00035
00036
00037
00038 #include "G4ProjectileDiffractiveChannel.hh"
00039
00040 #include "G4HadTmpUtil.hh"
00041 #include "G4QHadronVector.hh"
00042 #include "G4ParticleTable.hh"
00043 #include "G4IonTable.hh"
00044 #include "G4Lambda.hh"
00045
00046
00047
00048
00049 G4ProjectileDiffractiveChannel::G4ProjectileDiffractiveChannel()
00050 {
00051 theQDiffraction=G4QDiffractionRatio::GetPointer();
00052 }
00053
00054 G4ProjectileDiffractiveChannel::~G4ProjectileDiffractiveChannel()
00055 {}
00056
00057 G4double G4ProjectileDiffractiveChannel::GetFraction(G4Nucleus &theNucleus,
00058 const G4DynamicParticle & thePrimary)
00059 {
00060 G4double ratio;
00061 ratio=theQDiffraction->GetRatio(thePrimary.GetTotalMomentum(),
00062 thePrimary.GetDefinition()->GetPDGEncoding(),
00063 theNucleus.GetZ_asInt(), theNucleus.GetN_asInt() );
00064 #ifdef debug_getFraction
00065 G4cout << "G4ProjectileDiffractiveChannel::ratio " << ratio << G4endl;
00066 #endif
00067
00068 return ratio;
00069 }
00070
00071 G4KineticTrackVector * G4ProjectileDiffractiveChannel::Scatter(G4Nucleus &theNucleus,
00072 const G4DynamicParticle & thePrimary)
00073 {
00074
00075
00076 G4int A=theNucleus.GetA_asInt();
00077 G4int Z=theNucleus.GetZ_asInt();
00078
00079 G4ParticleDefinition * pDef=thePrimary.GetDefinition();
00080 #ifdef debug_scatter
00081 G4cout << " ProjectileDiffractive: A, Z, proj-pdg" <<" "<< A <<" "<<Z
00082 << " "<<" " << pDef->GetParticleName()<< G4endl;
00083 #endif
00084
00085 G4QHadronVector * result(0);
00086 G4KineticTrackVector * ktv(0);
00087 G4bool tryAgain;
00088
00089 do {
00090 tryAgain = false;
00091 result=theQDiffraction->ProjFragment(pDef->GetPDGEncoding(),
00092 thePrimary.Get4Momentum(),Z, A-Z);
00093
00094 if ( result && result->size() > 0 )
00095 {
00096 ktv=new G4KineticTrackVector();
00097 std::vector<G4QHadron *>::iterator i;
00098 #ifdef debug_scatter
00099 G4int count(0);
00100 #endif
00101 for (i=result->begin(); i!=result->end(); i++)
00102 {
00103 G4int pdgCode=(*i)->GetPDGCode();
00104 G4ParticleDefinition * secDef(0);
00105 if ( pdgCode < 80000000) {
00106 secDef= G4ParticleTable::GetParticleTable()->FindParticle(pdgCode);
00107 }else {
00108 G4int qN = pdgCode % 1000;
00109 G4int qZ = (pdgCode/1000) %1000;
00110 if ( qZ < 500 && qN < 500){
00111 secDef = G4ParticleTable::GetParticleTable()->GetIon(qZ,qN+qZ, 0);
00112 if ( ! secDef )
00113 {
00114 if ( pdgCode == 90000001 ) secDef= G4Neutron::Neutron();
00115 if ( pdgCode == 91000000 ) secDef= G4Lambda::Lambda();
00116 }
00117 }
00118 }
00119
00120 if ( secDef ){
00121
00122 G4ThreeVector pos=(*i)->GetPosition();
00123 G4LorentzVector mom=(*i)->Get4Momentum();
00124
00125 G4KineticTrack * sPrim=new G4KineticTrack(secDef,
00126 (*i)->GetFormationTime(), pos, mom);
00127 ktv->push_back(sPrim);
00128
00129 #ifdef debug_scatter
00130 G4cout << "G4ProjectileDiffractive sec # " << ++count << ", "
00131 << "ChipsPDGCode=" << pdgCode << ", "
00132 << secDef->GetParticleName()
00133 << ", time(ns) " << (*i)->GetFormationTime()/ns
00134 << ", pos " << pos
00135 << ", 4mom " << (*i)->Get4Momentum()
00136 << G4endl;
00137 #endif
00138 } else {
00139 #ifdef debug_scatter
00140 G4cout << "G4ProjectileDiffractiveChannel: Particle with PDG code "<< pdgCode <<" does not converted!!!"<<G4endl;
00141 #endif
00142 tryAgain=true;
00143 }
00144 }
00145 std::for_each(result->begin(), result->end(), DeleteQHadron());
00146 delete result;
00147 result=0;
00148 }
00149
00150 if ( result ) delete result;
00151 if ( tryAgain ) {
00152 std::for_each(ktv->begin(), ktv->end(), DeleteKineticTrack());
00153 delete ktv;
00154 ktv=0;
00155 }
00156 } while ( ! ktv);
00157
00158 return ktv;
00159 }