processes/hadronic/stopping/src/G4PiMinusStopMaterial.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //      File name:     G4PiMinusStopMaterial
00027 //
00028 //      Author:        Maria Grazia Pia (pia@genova.infn.it)
00029 // 
00030 //      Creation date: 8 May 1998
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 // Constructor
00055 
00056 G4PiMinusStopMaterial::G4PiMinusStopMaterial()
00057   
00058 {
00059   _definitions = 0;
00060   _momenta = 0;
00061   _distributionE = 0;
00062   _distributionAngle = 0;
00063 
00064 }
00065 
00066 
00067 // Destructor
00068 
00069 G4PiMinusStopMaterial::~G4PiMinusStopMaterial()
00070 {
00071   //  _definitions->clear();
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   // Generate energy of direct absorption products according to experimental data
00102   // The energy distribution of the two nucleons is assumed to be the same 
00103   // for protons and neutrons  
00104 
00105 
00106   G4double eKin1;
00107   G4double eKin2;
00108   G4double eRecoil;
00109 
00110   // Assume absorption on two nucleons
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       // ---- Debug     
00148       //      G4cout << " ---- binding = " << binding << ", nucleus mass = " << massNucleus 
00149       //             << ", p nucleus = " << pNucleus << G4endl;
00150       //      G4cout << "eKin1,2 " << eKin1 << " " << eKin2 << " eRecoil " << eRecoil 
00151       //             << " availableE " << availableE << G4endl;
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   //  G4LorentzVector p4;
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 

Generated on Fri Apr 11 17:10:41 2008 for Geant4 by  doxygen 1.4.7