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 #include "G4ios.hh"
00035
00036 #include "G4PiMinusStopMaterial.hh"
00037
00038 #include <vector>
00039
00040 #include "globals.hh"
00041 #include "Randomize.hh"
00042 #include "G4Proton.hh"
00043 #include "G4Neutron.hh"
00044 #include "G4PionMinus.hh"
00045 #include "G4ParticleTypes.hh"
00046 #include "G4ReactionKinematics.hh"
00047 #include "G4DynamicParticleVector.hh"
00048 #include "G4LorentzVector.hh"
00049 #include "G4NucleiPropertiesTable.hh"
00050 #include "G4PiMinusStopMaterial.hh"
00051 #include "G4DistributionGenerator.hh"
00052
00053
00054
00055
00056 G4PiMinusStopMaterial::G4PiMinusStopMaterial()
00057
00058 {
00059 _definitions = 0;
00060 _momenta = 0;
00061 _distributionE = 0;
00062 _distributionAngle = 0;
00063
00064 }
00065
00066
00067
00068
00069 G4PiMinusStopMaterial::~G4PiMinusStopMaterial()
00070 {
00071
00072 if (_definitions != 0) delete _definitions;
00073 _definitions = 0;
00074
00075 for(unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i];
00076 if (_momenta != 0) delete _momenta;
00077
00078 delete _distributionE;
00079 delete _distributionAngle;
00080 }
00081
00082 std::vector<G4ParticleDefinition*>* G4PiMinusStopMaterial::DefinitionVector()
00083 {
00084
00085 _definitions->push_back(G4Neutron::Neutron());
00086
00087 G4double ranflat = G4UniformRand();
00088 if (ranflat < theR)
00089 { _definitions->push_back(G4Proton::Proton()); }
00090 else
00091 { _definitions->push_back(G4Neutron::Neutron()); }
00092
00093 return _definitions;
00094
00095 }
00096
00097 std::vector<G4LorentzVector*>* G4PiMinusStopMaterial::P4Vector(const G4double binding,
00098 const G4double massNucleus)
00099 {
00100
00101
00102
00103
00104
00105
00106 G4double eKin1;
00107 G4double eKin2;
00108 G4double eRecoil;
00109
00110
00111 G4int nNucleons = 2;
00112 G4double availableE = G4PionMinus::PionMinus()->GetPDGMass() - nNucleons * binding;
00113 G4LorentzVector p1;
00114 G4LorentzVector p2;
00115
00116 do
00117 {
00118 G4double ranflat;
00119 G4double p;
00120 G4double energy;
00121 G4double mass;
00122
00123 ranflat = G4UniformRand();
00124 eKin1 = _distributionE->Generate(ranflat);
00125 mass = (*_definitions)[0]->GetPDGMass();
00126 energy = eKin1 + mass;
00127 p = std::sqrt(energy*energy - mass*mass);
00128 G4double theta1 = pi*G4UniformRand();
00129 G4double phi1 = GenerateAngle(2.*pi);
00130 p1 = MakeP4(p,theta1,phi1,energy);
00131
00132 ranflat = G4UniformRand();
00133 eKin2 = _distributionE->Generate(ranflat);
00134 mass = (*_definitions)[1]->GetPDGMass();
00135 energy = eKin2 + mass;
00136 p = std::sqrt(energy*energy - mass*mass);
00137 ranflat = G4UniformRand();
00138 G4double opAngle = _distributionAngle->Generate(ranflat);
00139 G4double theta2 = theta1 + opAngle;
00140 G4double phi2 = phi1 + opAngle;
00141
00142 p2 = MakeP4(p,theta2,phi2,energy);
00143
00144 G4double pNucleus = (p1.vect() + p2.vect()).mag();
00145 eRecoil = std::sqrt(pNucleus*pNucleus + massNucleus*massNucleus) - massNucleus;
00146
00147
00148
00149
00150
00151
00152
00153
00154 } while ((eKin1 + eKin2 + eRecoil) > availableE);
00155
00156 _momenta->push_back(new G4LorentzVector(p1));
00157 _momenta->push_back(new G4LorentzVector(p2));
00158
00159 return _momenta;
00160
00161 }
00162
00163 G4double G4PiMinusStopMaterial::GenerateAngle(G4double x)
00164 {
00165 G4double ranflat = G4UniformRand();
00166 G4double value = ranflat * x;
00167 return value;
00168 }
00169
00170 G4LorentzVector G4PiMinusStopMaterial::MakeP4(G4double p, G4double theta, G4double phi, G4double e)
00171 {
00172
00173 G4double px = p * std::sin(theta) * std::cos(phi);
00174 G4double py = p * std::sin(theta) * std::sin(phi);
00175 G4double pz = p * std::cos(theta);
00176 G4LorentzVector p4(px,py,pz,e);
00177 return p4;
00178 }
00179
00180 G4double G4PiMinusStopMaterial::RecoilEnergy(const G4double mass)
00181 {
00182 G4ThreeVector p(0.,0.,0.);
00183
00184 for (unsigned int i = 0; i< _momenta->size(); i++)
00185 {
00186 p = p + (*_momenta)[i]->vect();
00187 }
00188 G4double pNucleus = p.mag();
00189 G4double eNucleus = std::sqrt(pNucleus*pNucleus + mass*mass);
00190
00191 return eNucleus;
00192 }
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202