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 #include "globals.hh"
00030 #include "G4SystemOfUnits.hh"
00031 #include "G4HadronicException.hh"
00032 #include "G4ios.hh"
00033 #include "G4VCrossSectionSource.hh"
00034 #include "G4ParticleDefinition.hh"
00035 #include "G4KineticTrack.hh"
00036 #include "G4CrossSectionVector.hh"
00037 #include "G4CrossSectionSourcePtr.hh"
00038 #include "G4Proton.hh"
00039 #include "G4Neutron.hh"
00040
00041 G4VCrossSectionSource::G4VCrossSectionSource()
00042 { }
00043
00044
00045 G4VCrossSectionSource::~G4VCrossSectionSource()
00046 { }
00047
00048
00049 G4ParticleDefinition * G4VCrossSectionSource::
00050 FindKeyParticle(const G4KineticTrack& trk1,const G4KineticTrack& trk2) const
00051 {
00052 G4ParticleDefinition * result;
00053
00054 G4ParticleDefinition * p1 = trk1.GetDefinition();
00055 G4ParticleDefinition * p2 = trk2.GetDefinition();
00056
00057 if( (p1==G4Proton::Proton() && p2==G4Proton::Proton() ) ||
00058 (p1==G4Neutron::Neutron() && p2==G4Neutron::Neutron()) )
00059 {
00060 result = G4Proton::Proton();
00061 }
00062 else if( (p1==G4Neutron::Neutron() && p2==G4Proton::Proton()) ||
00063 (p2==G4Neutron::Neutron() && p1==G4Proton::Proton()) )
00064 {
00065 result = G4Neutron::Neutron();
00066 }
00067 else
00068 {
00069 throw G4HadronicException(__FILE__, __LINE__, "G4VCrossSectionSource: unklnown particles in FindKeyParticle");
00070 }
00071 return result;
00072 }
00073
00074 G4bool G4VCrossSectionSource::operator==(const G4VCrossSectionSource &right) const
00075 {
00076 return (this == (G4VCrossSectionSource *) &right);
00077 }
00078
00079
00080 G4bool G4VCrossSectionSource::operator!=(const G4VCrossSectionSource &right) const
00081 {
00082 return (this != (G4VCrossSectionSource *) &right);
00083 }
00084
00085
00086 void G4VCrossSectionSource::Print() const
00087 {
00088 G4int nComponents = 0;
00089 const G4CrossSectionVector* components = GetComponents();
00090 if (components)
00091 {
00092 nComponents = components->size();
00093 }
00094 G4cout << "---- " << this->Name() << " ---- has " << nComponents << " components" <<G4endl;
00095 G4int i;
00096 for (i=0; i<nComponents; i++)
00097 {
00098 G4cout << "-" << this->Name() << " - Component " << i << ": " <<G4endl;
00099
00100 G4CrossSectionSourcePtr componentPtr = (*components)[i];
00101 G4VCrossSectionSource* component = componentPtr();
00102 component->Print();
00103 }
00104 }
00105
00106
00107 void G4VCrossSectionSource::PrintAll(const G4KineticTrack& trk1, const G4KineticTrack& trk2) const
00108 {
00109 G4double sqrtS = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
00110 G4double sigma = CrossSection(trk1,trk2) / millibarn;
00111 G4cout << "---- " << Name() << ": "
00112 << "Ecm = " << sqrtS / GeV << " GeV - "
00113 << " Cross section = " << sigma << " mb "
00114 << G4endl;
00115
00116 G4int nComponents = 0;
00117 const G4CrossSectionVector* components = GetComponents();
00118 if (components != 0)
00119 {
00120 nComponents = components->size();
00121 }
00122 G4int i;
00123 for (i=0; i<nComponents; i++)
00124 {
00125 G4cout << "* Component " << i << ": ";
00126 G4CrossSectionSourcePtr componentPtr = (*components)[i];
00127 G4VCrossSectionSource* component = componentPtr();
00128 component->PrintAll(trk1,trk2);
00129 }
00130 }
00131
00132
00133 G4bool G4VCrossSectionSource::InLimits(G4double e, G4double eLow, G4double eHigh) const
00134 {
00135 G4bool answer = false;
00136 if (e >= eLow && e <= eHigh) answer = true;
00137 return answer;
00138 }
00139
00140 G4double G4VCrossSectionSource::LowLimit() const
00141 {
00142 return 0.;
00143 }
00144
00145
00146 G4double G4VCrossSectionSource::HighLimit() const
00147 {
00148 return DBL_MAX;
00149 }
00150
00151 G4bool G4VCrossSectionSource::IsValid(G4double e) const
00152 {
00153 G4bool answer = false;
00154 if (e >= LowLimit() && e <= HighLimit()) answer = true;
00155 return answer;
00156 }
00157
00158 const G4ParticleDefinition* G4VCrossSectionSource::FindLightParticle(const G4KineticTrack& trk1,
00159 const G4KineticTrack& trk2) const
00160 {
00161 G4double mass1 = trk1.GetDefinition()->GetPDGMass();
00162 G4double mass2 = trk2.GetDefinition()->GetPDGMass();
00163 if (mass1 < mass2)
00164 {
00165 return trk1.GetDefinition();
00166 }
00167 else
00168 {
00169 return trk2.GetDefinition();
00170 }
00171 }
00172
00173
00174 G4double G4VCrossSectionSource::FcrossX(G4double e, G4double e0,
00175 G4double sigma, G4double eParam, G4double power) const
00176 {
00177 G4double result = 0.;
00178
00179 G4double denom = eParam*eParam + (e-e0)*(e-e0);
00180 if (denom > 0.)
00181 {
00182 G4double value = (2.* eParam * sigma * (e-e0) / denom) * std::pow(((e0 + eParam) / e), power);
00183 result = std::max(0., value);
00184 }
00185 return result;
00186 }
00187
00188 G4double G4VCrossSectionSource::GetTransversePionMass() const
00189 {
00190
00191 const G4double transversePionMass = 0.3 * GeV;
00192 return transversePionMass;
00193 }
00194
00195
00196 G4double G4VCrossSectionSource::GetMinStringMass() const
00197 {
00198
00199 const G4double minStringMass = 0.52 * GeV;
00200 return minStringMass;
00201 }
00202
00203
00204