| 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 | _definitions = 0;
|
|---|
| 58 | _momenta = 0;
|
|---|
| 59 | _distributionE = 0;
|
|---|
| 60 | _distributionAngle = 0;
|
|---|
| 61 | theR = 0.5;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | // Destructor
|
|---|
| 66 |
|
|---|
| 67 | G4PiMinusStopMaterial::~G4PiMinusStopMaterial()
|
|---|
| 68 | {
|
|---|
| 69 | if (_definitions != 0) delete _definitions;
|
|---|
| 70 | _definitions = 0;
|
|---|
| 71 |
|
|---|
| 72 | for (unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i];
|
|---|
| 73 | if (_momenta != 0) delete _momenta;
|
|---|
| 74 |
|
|---|
| 75 | delete _distributionE;
|
|---|
| 76 | delete _distributionAngle;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | std::vector<G4ParticleDefinition*>* G4PiMinusStopMaterial::DefinitionVector()
|
|---|
| 80 | {
|
|---|
| 81 |
|
|---|
| 82 | _definitions->push_back(G4Neutron::Neutron());
|
|---|
| 83 |
|
|---|
| 84 | G4double ranflat = G4UniformRand();
|
|---|
| 85 | if (ranflat < theR)
|
|---|
| 86 | { _definitions->push_back(G4Proton::Proton()); }
|
|---|
| 87 | else
|
|---|
| 88 | { _definitions->push_back(G4Neutron::Neutron()); }
|
|---|
| 89 |
|
|---|
| 90 | return _definitions;
|
|---|
| 91 |
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | std::vector<G4LorentzVector*>*
|
|---|
| 95 | G4PiMinusStopMaterial::P4Vector(const G4double binding,
|
|---|
| 96 | const G4double massNucleus)
|
|---|
| 97 | {
|
|---|
| 98 | // Generate energy of direct absorption products according to experimental
|
|---|
| 99 | // data. The energy distribution of the two nucleons is assumed to be the
|
|---|
| 100 | // same for protons and neutrons.
|
|---|
| 101 |
|
|---|
| 102 | G4double eKin1;
|
|---|
| 103 | G4double eKin2;
|
|---|
| 104 | G4double eRecoil;
|
|---|
| 105 |
|
|---|
| 106 | // Assume absorption on two nucleons
|
|---|
| 107 | G4int nNucleons = 2;
|
|---|
| 108 | G4double availableE = G4PionMinus::PionMinus()->GetPDGMass() - nNucleons * binding;
|
|---|
| 109 | G4LorentzVector p1;
|
|---|
| 110 | G4LorentzVector p2;
|
|---|
| 111 |
|
|---|
| 112 | do
|
|---|
| 113 | {
|
|---|
| 114 | G4double ranflat;
|
|---|
| 115 | G4double p;
|
|---|
| 116 | G4double energy;
|
|---|
| 117 | G4double mass;
|
|---|
| 118 |
|
|---|
| 119 | ranflat = G4UniformRand();
|
|---|
| 120 | eKin1 = _distributionE->Generate(ranflat);
|
|---|
| 121 | mass = (*_definitions)[0]->GetPDGMass();
|
|---|
| 122 | energy = eKin1 + mass;
|
|---|
| 123 | p = std::sqrt(energy*energy - mass*mass);
|
|---|
| 124 | G4double theta1 = pi*G4UniformRand();
|
|---|
| 125 | G4double phi1 = GenerateAngle(2.*pi);
|
|---|
| 126 | p1 = MakeP4(p,theta1,phi1,energy);
|
|---|
| 127 |
|
|---|
| 128 | ranflat = G4UniformRand();
|
|---|
| 129 | eKin2 = _distributionE->Generate(ranflat);
|
|---|
| 130 | mass = (*_definitions)[1]->GetPDGMass();
|
|---|
| 131 | energy = eKin2 + mass;
|
|---|
| 132 | p = std::sqrt(energy*energy - mass*mass);
|
|---|
| 133 | ranflat = G4UniformRand();
|
|---|
| 134 | G4double opAngle = _distributionAngle->Generate(ranflat);
|
|---|
| 135 | G4double theta2 = theta1 + opAngle;
|
|---|
| 136 | G4double phi2 = phi1 + opAngle;
|
|---|
| 137 |
|
|---|
| 138 | p2 = MakeP4(p,theta2,phi2,energy);
|
|---|
| 139 |
|
|---|
| 140 | G4double pNucleus = (p1.vect() + p2.vect()).mag();
|
|---|
| 141 | eRecoil = std::sqrt(pNucleus*pNucleus + massNucleus*massNucleus) - massNucleus;
|
|---|
| 142 |
|
|---|
| 143 | // ---- Debug
|
|---|
| 144 | // G4cout << " ---- binding = " << binding << ", nucleus mass = " << massNucleus
|
|---|
| 145 | // << ", p nucleus = " << pNucleus << G4endl;
|
|---|
| 146 | // G4cout << "eKin1,2 " << eKin1 << " " << eKin2 << " eRecoil " << eRecoil
|
|---|
| 147 | // << " availableE " << availableE << G4endl;
|
|---|
| 148 | // ----
|
|---|
| 149 |
|
|---|
| 150 | } while ((eKin1 + eKin2 + eRecoil) > availableE);
|
|---|
| 151 |
|
|---|
| 152 | _momenta->push_back(new G4LorentzVector(p1));
|
|---|
| 153 | _momenta->push_back(new G4LorentzVector(p2));
|
|---|
| 154 |
|
|---|
| 155 | return _momenta;
|
|---|
| 156 |
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 | G4double G4PiMinusStopMaterial::GenerateAngle(G4double x)
|
|---|
| 160 | {
|
|---|
| 161 | G4double ranflat = G4UniformRand();
|
|---|
| 162 | G4double value = ranflat * x;
|
|---|
| 163 | return value;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | G4LorentzVector G4PiMinusStopMaterial::MakeP4(G4double p, G4double theta, G4double phi, G4double e)
|
|---|
| 167 | {
|
|---|
| 168 | // G4LorentzVector p4;
|
|---|
| 169 | G4double px = p * std::sin(theta) * std::cos(phi);
|
|---|
| 170 | G4double py = p * std::sin(theta) * std::sin(phi);
|
|---|
| 171 | G4double pz = p * std::cos(theta);
|
|---|
| 172 | G4LorentzVector p4(px,py,pz,e);
|
|---|
| 173 | return p4;
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | G4double G4PiMinusStopMaterial::RecoilEnergy(const G4double mass)
|
|---|
| 177 | {
|
|---|
| 178 | G4ThreeVector p(0.,0.,0.);
|
|---|
| 179 |
|
|---|
| 180 | for (unsigned int i = 0; i< _momenta->size(); i++)
|
|---|
| 181 | {
|
|---|
| 182 | p = p + (*_momenta)[i]->vect();
|
|---|
| 183 | }
|
|---|
| 184 | G4double pNucleus = p.mag();
|
|---|
| 185 | G4double eNucleus = std::sqrt(pNucleus*pNucleus + mass*mass);
|
|---|
| 186 |
|
|---|
| 187 | return eNucleus;
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|