[819] | 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 | // File name: G4PiMinusStopMaterial |
---|
| 27 | // |
---|
| 28 | // Author: Maria Grazia Pia (pia@genova.infn.it) |
---|
| 29 | // |
---|
| 30 | // Creation date: 8 May 1998 |
---|
| 31 | // |
---|
| 32 | // ------------------------------------------------------------------- |
---|
| 33 | |
---|
| 34 | #include "G4ios.hh" |
---|
| 35 | |
---|
| 36 | #include "G4PiMinusStopMaterial.hh" |
---|
| 37 | |
---|
| 38 | #include <vector> |
---|
| 39 | |
---|
| 40 | #include "globals.hh" |
---|
| 41 | #include "Randomize.hh" |
---|
| 42 | #include "G4Proton.hh" |
---|
| 43 | #include "G4Neutron.hh" |
---|
| 44 | #include "G4PionMinus.hh" |
---|
| 45 | #include "G4ParticleTypes.hh" |
---|
| 46 | #include "G4ReactionKinematics.hh" |
---|
| 47 | #include "G4DynamicParticleVector.hh" |
---|
| 48 | #include "G4LorentzVector.hh" |
---|
| 49 | #include "G4PiMinusStopMaterial.hh" |
---|
| 50 | #include "G4DistributionGenerator.hh" |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | // Constructor |
---|
| 54 | |
---|
| 55 | G4PiMinusStopMaterial::G4PiMinusStopMaterial() |
---|
| 56 | |
---|
| 57 | { |
---|
| 58 | _definitions = 0; |
---|
| 59 | _momenta = 0; |
---|
| 60 | _distributionE = 0; |
---|
| 61 | _distributionAngle = 0; |
---|
| 62 | |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | // Destructor |
---|
| 67 | |
---|
| 68 | G4PiMinusStopMaterial::~G4PiMinusStopMaterial() |
---|
| 69 | { |
---|
| 70 | // _definitions->clear(); |
---|
| 71 | if (_definitions != 0) delete _definitions; |
---|
| 72 | _definitions = 0; |
---|
| 73 | |
---|
| 74 | for(unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i]; |
---|
| 75 | if (_momenta != 0) delete _momenta; |
---|
| 76 | |
---|
| 77 | delete _distributionE; |
---|
| 78 | delete _distributionAngle; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | std::vector<G4ParticleDefinition*>* G4PiMinusStopMaterial::DefinitionVector() |
---|
| 82 | { |
---|
| 83 | |
---|
| 84 | _definitions->push_back(G4Neutron::Neutron()); |
---|
| 85 | |
---|
| 86 | G4double ranflat = G4UniformRand(); |
---|
| 87 | if (ranflat < theR) |
---|
| 88 | { _definitions->push_back(G4Proton::Proton()); } |
---|
| 89 | else |
---|
| 90 | { _definitions->push_back(G4Neutron::Neutron()); } |
---|
| 91 | |
---|
| 92 | return _definitions; |
---|
| 93 | |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | std::vector<G4LorentzVector*>* G4PiMinusStopMaterial::P4Vector(const G4double binding, |
---|
| 97 | const G4double massNucleus) |
---|
| 98 | { |
---|
| 99 | |
---|
| 100 | // Generate energy of direct absorption products according to experimental data |
---|
| 101 | // The energy distribution of the two nucleons is assumed to be the same |
---|
| 102 | // for protons and neutrons |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | G4double eKin1; |
---|
| 106 | G4double eKin2; |
---|
| 107 | G4double eRecoil; |
---|
| 108 | |
---|
| 109 | // Assume absorption on two nucleons |
---|
| 110 | G4int nNucleons = 2; |
---|
| 111 | G4double availableE = G4PionMinus::PionMinus()->GetPDGMass() - nNucleons * binding; |
---|
| 112 | G4LorentzVector p1; |
---|
| 113 | G4LorentzVector p2; |
---|
| 114 | |
---|
| 115 | do |
---|
| 116 | { |
---|
| 117 | G4double ranflat; |
---|
| 118 | G4double p; |
---|
| 119 | G4double energy; |
---|
| 120 | G4double mass; |
---|
| 121 | |
---|
| 122 | ranflat = G4UniformRand(); |
---|
| 123 | eKin1 = _distributionE->Generate(ranflat); |
---|
| 124 | mass = (*_definitions)[0]->GetPDGMass(); |
---|
| 125 | energy = eKin1 + mass; |
---|
| 126 | p = std::sqrt(energy*energy - mass*mass); |
---|
| 127 | G4double theta1 = pi*G4UniformRand(); |
---|
| 128 | G4double phi1 = GenerateAngle(2.*pi); |
---|
| 129 | p1 = MakeP4(p,theta1,phi1,energy); |
---|
| 130 | |
---|
| 131 | ranflat = G4UniformRand(); |
---|
| 132 | eKin2 = _distributionE->Generate(ranflat); |
---|
| 133 | mass = (*_definitions)[1]->GetPDGMass(); |
---|
| 134 | energy = eKin2 + mass; |
---|
| 135 | p = std::sqrt(energy*energy - mass*mass); |
---|
| 136 | ranflat = G4UniformRand(); |
---|
| 137 | G4double opAngle = _distributionAngle->Generate(ranflat); |
---|
| 138 | G4double theta2 = theta1 + opAngle; |
---|
| 139 | G4double phi2 = phi1 + opAngle; |
---|
| 140 | |
---|
| 141 | p2 = MakeP4(p,theta2,phi2,energy); |
---|
| 142 | |
---|
| 143 | G4double pNucleus = (p1.vect() + p2.vect()).mag(); |
---|
| 144 | eRecoil = std::sqrt(pNucleus*pNucleus + massNucleus*massNucleus) - massNucleus; |
---|
| 145 | |
---|
| 146 | // ---- Debug |
---|
| 147 | // G4cout << " ---- binding = " << binding << ", nucleus mass = " << massNucleus |
---|
| 148 | // << ", p nucleus = " << pNucleus << G4endl; |
---|
| 149 | // G4cout << "eKin1,2 " << eKin1 << " " << eKin2 << " eRecoil " << eRecoil |
---|
| 150 | // << " availableE " << availableE << G4endl; |
---|
| 151 | // ---- |
---|
| 152 | |
---|
| 153 | } while ((eKin1 + eKin2 + eRecoil) > availableE); |
---|
| 154 | |
---|
| 155 | _momenta->push_back(new G4LorentzVector(p1)); |
---|
| 156 | _momenta->push_back(new G4LorentzVector(p2)); |
---|
| 157 | |
---|
| 158 | return _momenta; |
---|
| 159 | |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | G4double G4PiMinusStopMaterial::GenerateAngle(G4double x) |
---|
| 163 | { |
---|
| 164 | G4double ranflat = G4UniformRand(); |
---|
| 165 | G4double value = ranflat * x; |
---|
| 166 | return value; |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | G4LorentzVector G4PiMinusStopMaterial::MakeP4(G4double p, G4double theta, G4double phi, G4double e) |
---|
| 170 | { |
---|
| 171 | // G4LorentzVector p4; |
---|
| 172 | G4double px = p * std::sin(theta) * std::cos(phi); |
---|
| 173 | G4double py = p * std::sin(theta) * std::sin(phi); |
---|
| 174 | G4double pz = p * std::cos(theta); |
---|
| 175 | G4LorentzVector p4(px,py,pz,e); |
---|
| 176 | return p4; |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | G4double G4PiMinusStopMaterial::RecoilEnergy(const G4double mass) |
---|
| 180 | { |
---|
| 181 | G4ThreeVector p(0.,0.,0.); |
---|
| 182 | |
---|
| 183 | for (unsigned int i = 0; i< _momenta->size(); i++) |
---|
| 184 | { |
---|
| 185 | p = p + (*_momenta)[i]->vect(); |
---|
| 186 | } |
---|
| 187 | G4double pNucleus = p.mag(); |
---|
| 188 | G4double eNucleus = std::sqrt(pNucleus*pNucleus + mass*mass); |
---|
| 189 | |
---|
| 190 | return eNucleus; |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | |
---|
| 201 | |
---|