Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
@@ -14,6 +14,37 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
9 June 2008 - Dennis Wright (hadr-rpg-V09-01-03)
-------------------------------------------------
Remove unused variable ekIncident in G4RPGFragmentation.cc and
G4RPGTwoCluster.cc
5 May 2008 - Dennis Wright (hadr-rpg-V09-01-02)
------------------------------------------------
Fixed gcc-4.3 compiler warnings for unused variables in
G4RPGNeutronInelastic.hh, cc
G4RPGPiMinusInelastic.hh, cc
G4RPGPiPlusInelastic.hh, cc
G4RPGProtonInelastic.hh, cc
G4RPGReaction.hh, cc
G4RPGFragmentation.cc
G4RPGTwoBody.cc
G4RPGTwoCluster.cc
21 March 2008 - Dennis Wright (hadr-rpg-V09-01-01)
--------------------------------------------------
Fixed gcc-4.3 compiler warning in G4RPGInelastic.cc
21 February 2008 - Dennis Wright (hadr-rpg-V09-01-00)
-----------------------------------------------------
G4RPGInelastic: remove Rotate method, fix K0 ID problem
G4RPGFragmentation: fix energy non-conservation
G4RPGReaction.cc: add GenerateNBodyEventT method, fix energy non-conservation
in AddBlackTrackParticles
G4RPGProtonInelastic.cc, G4RPGNeutronInelastic.cc, G4RPGPiPlusInelastic.cc,
G4RPGPiMinusInelastic.cc: remove quasi-elastic flag, remove MeV units
5 December 2007 - Dennis Wright (hadr-rpg-V09-00-02)
----------------------------------------------------
Fixed array bound violation in G4RPGFragmentation.cc (pseudoParticle[7]).
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiKZeroInelastic.hh,v 1.1 2007/07/18 20:51:36 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiLambdaInelastic.hh,v 1.1 2007/07/18 20:51:36 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiNeutronInelastic.hh,v 1.1 2007/07/18 20:51:36 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiOmegaMinusInelastic.hh,v 1.1 2007/07/18 20:51:36 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiProtonInelastic.hh,v 1.1 2007/07/18 20:51:36 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiSigmaMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiSigmaPlusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiXiMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiXiZeroInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// Author: D. H. Wright
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGFragmentation.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGFragmentation.hh,v 1.2 2008/02/22 22:02:13 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 29 May 2007
@@ -72,6 +72,16 @@
private:
void
ReduceEnergiesOfSecondaries(G4int /*startingIndex*/,
G4double& /*forwardKinetic*/,
G4double& /*backwardKinetic*/,
G4FastVector<G4ReactionProduct,256>& /*vec*/,
G4int& /*vecLen*/,
G4ReactionProduct& /*forwardPseudoParticle*/,
G4ReactionProduct& /*backwardPseudoParticle*/,
G4double& /*pt*/);
G4double dndl[20];
};
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGInelastic.hh,v 1.3 2008/02/22 22:17:25 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 26 May 2007
@@ -38,6 +38,7 @@
// Base class for re-parameterized Gheisha-style models.
#include "globals.hh"
#include <vector>
#include "G4FastVector.hh"
#include "G4HadronicInteraction.hh"
#include "G4ReactionProduct.hh"
@@ -75,7 +76,7 @@ class G4RPGInelastic : public G4HadronicInteraction
G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen);
void Rotate(G4FastVector<G4ReactionProduct,256> &vec, G4int &vecLen);
// void Rotate(G4FastVector<G4ReactionProduct,256> &vec, G4int &vecLen);
void GetNormalizationConstant(const G4double availableEnergy,
G4double &n,
@@ -109,12 +110,28 @@ class G4RPGInelastic : public G4HadronicInteraction
G4RPGTwoBody twoBody;
std::pair<G4int, G4double> interpolateEnergy(G4double ke) const;
G4int sampleFlat(std::vector<G4double> sigma) const;
void CheckQnums(G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4double Q, G4double B, G4double S);
enum {pi0, pip, pim, kp, km, k0, k0b, pro, neu,
lam, sp, s0, sm, xi0, xim, om, ap, an};
static G4ParticleDefinition* particleDef[18];
private:
G4double cache;
G4ThreeVector what;
static const G4double energyScale[30];
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4RPGKLongInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGKMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4RPGKPlusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGKShortInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGKZeroInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGLambdaInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -23,52 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGNeutronInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGNeutronInelastic.hh,v 1.3 2008/05/05 21:21:54 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
// Date: 28 December 2007
//
// Class Description:
//
// Final state production model for neutron inelastic scattering
// using the re-parameterized Gheisha model.
// using the re-parameterized Gheisha model
#ifndef G4RPGNeutronInelastic_h
#define G4RPGNeutronInelastic_h 1
#include "G4RPGInelastic.hh"
#include "G4RPGNucleonInelastic.hh"
class G4RPGNeutronInelastic : public G4RPGInelastic
class G4RPGNeutronInelastic : public G4RPGNucleonInelastic
{
public: // with description
public:
G4RPGNeutronInelastic() : G4RPGInelastic("G4RPGNeutronInelastic")
{
SetMinEnergy(0.0);
SetMaxEnergy(35.*GeV);
}
G4RPGNeutronInelastic() : G4RPGNucleonInelastic("RPGNeutronInelastic")
{}
~G4RPGNeutronInelastic()
{ }
{}
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus);
private:
void Cascade(
G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec,
void InitialCollision(
G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
const G4HadProjectile* originalIncident,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged,
G4bool& quasiElastic);
G4bool& incidentHasChanged,
G4bool& targetHasChanged);
void SlowNeutron(
const G4HadProjectile* originalIncident,
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGNucleonInelastic.hh,v 1.1 2008/01/04 23:27:45 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 19 December 2007
//
#ifndef G4RPGNucleonInelastic_h
#define G4RPGNucleonInelastic_h 1
// Class Description:
// Partial cross sections, multiplicities and final state particle types
// required for proton and neutron inelastic scattering in the
// re-parameterized Gheisha model
#include "G4RPGInelastic.hh"
class G4RPGNucleonInelastic : public G4RPGInelastic
{
public:
G4RPGNucleonInelastic(const G4String& modelName = "RPGNucleonInelastic");
~G4RPGNucleonInelastic() { }
protected:
G4int GetMultiplicityT1(G4double KE) const;
G4int GetMultiplicityT0(G4double KE) const;
std::vector<G4int>
GetFSPartTypesForT1(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int>
GetFSPartTypesForT0(G4int mult, G4double KE) const;
std::vector<G4int> GetFSPartTypesForPP(G4int mult, G4double KE) const
{return GetFSPartTypesForT1(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForNN(G4int mult, G4double KE) const
{return GetFSPartTypesForT1(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForPN(G4int mult, G4double KE) const
{return GetFSPartTypesForT0(mult, KE); }
std::vector<G4int> GetFSPartTypesForNP(G4int mult, G4double KE) const
{return GetFSPartTypesForT0(mult, KE); }
static const G4int pPindex[8][2];
static const G4int pNindex[8][2];
static const G4int T1_2bfs[2][1][2];
static const G4int T1_3bfs[2][6][3];
static const G4int T1_4bfs[2][18][4];
static const G4int T1_5bfs[2][32][5];
static const G4int T1_6bfs[2][7][6];
static const G4int T1_7bfs[2][8][7];
static const G4int T1_8bfs[2][10][8];
static const G4int T1_9bfs[2][11][9];
static const G4int T0_2bfs[1][2];
static const G4int T0_3bfs[9][3];
static const G4int T0_4bfs[22][4];
static const G4int T0_5bfs[38][5];
static const G4int T0_6bfs[7][6];
static const G4int T0_7bfs[9][7];
static const G4int T0_8bfs[10][8];
static const G4int T0_9bfs[12][9];
static G4double pPtot[30];
static G4double pNtot[30];
static G4double t1_dSigma_dMult[8][30];
static G4double t0_dSigma_dMult[8][30];
static const G4float pPCrossSections[93][30];
static const G4float pNCrossSections[108][30];
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGOmegaMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -23,50 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGPiMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGPiMinusInelastic.hh,v 1.3 2008/05/05 21:21:54 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 26 May 2007
// Author: D. H. Wright
// Date: 23 November 2007
//
#ifndef G4RPGPiMinusInelastic_h
#define G4RPGPiMinusInelastic_h 1
// Class Description
// Class Description:
// Final state production model for pi- inelastic scattering
// using the re-parameterized Gheisha model.
// using the re-parameterized Gheisha model
#include "G4RPGInelastic.hh"
#include "G4RPGPionInelastic.hh"
class G4RPGPiMinusInelastic : public G4RPGInelastic
class G4RPGPiMinusInelastic : public G4RPGPionInelastic
{
public:
G4RPGPiMinusInelastic() : G4RPGInelastic("G4RPGPiMinusInelastic")
{
SetMinEnergy( 0.0 );
SetMaxEnergy( 55.*GeV );
}
G4RPGPiMinusInelastic() : G4RPGPionInelastic("RPGPiMinusInelastic")
{}
~G4RPGPiMinusInelastic() { }
~G4RPGPiMinusInelastic()
{}
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack,
G4Nucleus &targetNucleus );
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus);
private:
void Cascade( // derived from CASPIM
G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic );
void InitialCollision(
G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged);
};
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGPiPlusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGPiPlusInelastic.hh,v 1.3 2008/05/05 21:21:54 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 26 May 2007
@@ -37,35 +37,31 @@
// Final state production model for pi+ inelastic scattering
// using the re-parameterized Gheisha model
#include "G4RPGInelastic.hh"
#include "G4RPGPionInelastic.hh"
class G4RPGPiPlusInelastic : public G4RPGInelastic
class G4RPGPiPlusInelastic : public G4RPGPionInelastic
{
public:
G4RPGPiPlusInelastic() : G4RPGInelastic("G4RPGPiPlusInelastic")
{
SetMinEnergy( 0.0 );
SetMaxEnergy( 55.*GeV );
}
G4RPGPiPlusInelastic() : G4RPGPionInelastic("RPGPiPlusInelastic")
{}
~G4RPGPiPlusInelastic() { }
~G4RPGPiPlusInelastic()
{}
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack,
G4Nucleus &targetNucleus );
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus);
private:
void Cascade( // derived from CASPIP
G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic );
void InitialCollision(
G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged);
};
#endif
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGPionInelastic.hh,v 1.1 2008/01/05 00:14:03 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 15 August 2007
//
#ifndef G4RPGPionInelastic_h
#define G4RPGPionInelastic_h 1
// Class Description:
// Partial cross sections, multiplicities and final state particle types
// required for pi+ and pi- inelastic scattering in the re-parameterized
// Gheisha model
#include "G4RPGInelastic.hh"
class G4RPGPionInelastic : public G4RPGInelastic
{
public:
G4RPGPionInelastic(const G4String& modelName = "RPGPionInelastic");
~G4RPGPionInelastic() { }
protected:
G4int GetMultiplicityT12(G4double KE) const;
G4int GetMultiplicityT32(G4double KE) const;
std::vector<G4int>
GetFSPartTypesForT32(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int>
GetFSPartTypesForT12(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int> GetFSPartTypesForPipP(G4int mult, G4double KE) const
{return GetFSPartTypesForT32(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForPimN(G4int mult, G4double KE) const
{return GetFSPartTypesForT32(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForPipN(G4int mult, G4double KE) const
{return GetFSPartTypesForT12(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForPimP(G4int mult, G4double KE) const
{return GetFSPartTypesForT12(mult, KE, 0); }
static const G4int pipPindex[8][2];
static const G4int pimPindex[8][2];
static const G4int T32_2bfs[2][2][2];
static const G4int T32_3bfs[2][7][3];
static const G4int T32_4bfs[2][15][4];
static const G4int T32_5bfs[2][24][5];
static const G4int T32_6bfs[2][5][6];
static const G4int T32_7bfs[2][6][7];
static const G4int T32_8bfs[2][7][8];
static const G4int T32_9bfs[2][8][9];
static const G4int T12_2bfs[2][5][2];
static const G4int T12_3bfs[2][13][3];
static const G4int T12_4bfs[2][22][4];
static const G4int T12_5bfs[2][31][5];
static const G4int T12_6bfs[2][6][6];
static const G4int T12_7bfs[2][7][7];
static const G4int T12_8bfs[2][8][8];
static const G4int T12_9bfs[2][9][9];
static G4double pipPtot[30];
static G4double pimPtot[30];
static G4double t12_dSigma_dMult[8][30];
static G4double t32_dSigma_dMult[8][30];
static const G4float pipPCrossSections[74][30];
static const G4float pimPCrossSections[101][30];
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGPionSuppression.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 30 May 2007
@@ -23,51 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGProtonInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGProtonInelastic.hh,v 1.3 2008/05/05 21:21:54 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 26 May 2007
// Date: 28 December 2007
//
// Class Description:
//
// Final state production model for proton inelastic scattering
// using the re-parameterized Gheisha model.
// using the re-parameterized Gheisha model
#ifndef G4RPGProtonInelastic_h
#define G4RPGProtonInelastic_h 1
#include "G4RPGInelastic.hh"
#include "G4RPGNucleonInelastic.hh"
class G4RPGProtonInelastic : public G4RPGInelastic
class G4RPGProtonInelastic : public G4RPGNucleonInelastic
{
public: // with description
public:
G4RPGProtonInelastic() : G4RPGInelastic("G4RPGProtonInelastic")
{
SetMinEnergy(0.0);
SetMaxEnergy(35.*GeV);
}
G4RPGProtonInelastic() : G4RPGNucleonInelastic("RPGProtonInelastic")
{}
~G4RPGProtonInelastic()
{ }
{}
G4HadFinalState * ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus);
private:
void Cascade(G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec,
G4int& vecLen,
const G4HadProjectile* originalIncident,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged,
G4bool& quasiElastic);
void InitialCollision(
G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged);
void SlowProton(const G4HadProjectile* originalIncident,
G4Nucleus& targetNucleus);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGReaction.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGReaction.hh,v 1.3 2008/05/05 21:21:54 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 26 May 2007
@@ -71,9 +71,6 @@ public: // with description
const G4int /*npnb*/,
const G4double /*edta*/,
const G4int /*ndta*/,
const G4double /*sprob*/,
const G4double /*kineticMinimum*/,
const G4double /*kineticFactor*/,
const G4ReactionProduct& /*modifiedOriginal*/,
G4int /*PinNucleus*/,
G4int /*NinNucleus*/,
@@ -87,6 +84,10 @@ public: // with description
G4FastVector<G4ReactionProduct,256> &vec,
G4int& vecLen);
G4double GenerateNBodyEventT(const G4double totalEnergy,
const G4bool constantCrossSection,
std::vector<G4ReactionProduct*>& list);
void NuclearReaction(G4FastVector<G4ReactionProduct,4> &vec,
G4int& vecLen,
const G4HadProjectile* originalIncident,
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGSigmaMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGSigmaPlusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGStrangeProduction.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 30 May 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGTwoBody.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 30 May 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGTwoCluster.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D.H. Wright
// Date: 30 May 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGXiMinusInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// Author: D. H. Wright
// Date: 18 June 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGXiZeroInelastic.hh,v 1.1 2007/07/18 20:51:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// Author: D. H. Wright
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiKZeroInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiKZeroInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiLambdaInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiLambdaInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiNeutronInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiNeutronInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiOmegaMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// NOTE: The FORTRAN version of the cascade, CASAOM, simply called the
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiProtonInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiProtonInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiSigmaMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiSigmaMinusInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiSigmaPlusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGAntiSigmaPlusInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiXiMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// NOTE: The FORTRAN version of the cascade, CASAXM, simply called the
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGAntiXiZeroInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// NOTE: The FORTRAN version of the cascade, CASAXO, simply called the
File diff suppressed because it is too large Load Diff
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGInelastic.cc,v 1.2 2007/08/15 20:38:25 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGInelastic.cc,v 1.6 2008/03/22 00:03:24 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGInelastic.hh"
@@ -167,30 +167,30 @@ G4bool G4RPGInelastic::MarkLeadingStrangeParticle(
}
}
void G4RPGInelastic::CalculateMomenta(
G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
const G4HadProjectile *originalIncident,
const G4DynamicParticle *originalTarget,
G4ReactionProduct &modifiedOriginal,
G4Nucleus &targetNucleus,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool quasiElastic )
void
G4RPGInelastic::CalculateMomenta(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
const G4HadProjectile* originalIncident,
const G4DynamicParticle* originalTarget,
G4ReactionProduct& modifiedOriginal,
G4Nucleus& targetNucleus,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged,
G4bool quasiElastic)
{
cache = 0;
what = originalIncident->Get4Momentum().vect();
G4ReactionProduct leadingStrangeParticle;
strangeProduction.ReactionStage(originalIncident, modifiedOriginal,
incidentHasChanged, originalTarget,
targetParticle, targetHasChanged,
targetNucleus, currentParticle,
vec, vecLen,
false, leadingStrangeParticle);
// strangeProduction.ReactionStage(originalIncident, modifiedOriginal,
// incidentHasChanged, originalTarget,
// targetParticle, targetHasChanged,
// targetNucleus, currentParticle,
// vec, vecLen,
// false, leadingStrangeParticle);
if( quasiElastic )
{
@@ -265,13 +265,22 @@ void G4RPGInelastic::CalculateMomenta(
std::vector<G4ReactionProduct> savevec;
for (G4int i = 0; i < vecLen; i++) savevec.push_back(*vec[i]);
if( annihilation || (vecLen >= 6) ||
(modifiedOriginal.GetKineticEnergy()/GeV >= 1.0) &&
// Call fragmentation code if
// 1) there is annihilation, or
// 2) there are more than 5 secondaries, or
// 3) incident KE is > 1 GeV AND
// ( incident is a kaon AND rand < 0.5 OR twsup )
//
if( annihilation || vecLen > 5 ||
( modifiedOriginal.GetKineticEnergy()/GeV >= 1.0 &&
(((originalIncident->GetDefinition() == G4KaonPlus::KaonPlus() ||
originalIncident->GetDefinition() == G4KaonMinus::KaonMinus() ||
originalIncident->GetDefinition() == G4KaonZeroLong::KaonZeroLong() ||
originalIncident->GetDefinition() == G4KaonZeroShort::KaonZeroShort()) &&
rand1 < 0.5) || rand2 > twsup[vecLen]) )
rand1 < 0.5)
|| rand2 > twsup[vecLen]) ) )
finishedGenXPt =
fragmentation.ReactionStage(originalIncident, modifiedOriginal,
@@ -281,20 +290,15 @@ void G4RPGInelastic::CalculateMomenta(
vec, vecLen,
leadFlag, leadingStrangeParticle);
if( finishedGenXPt )
{
Rotate(vec, vecLen);
return;
}
if (finishedGenXPt) return;
G4bool finishedTwoClu = false;
if( modifiedOriginal.GetTotalMomentum()/MeV < 1.0 )
{
for(G4int i=0; i<vecLen; i++) delete vec[i];
if (modifiedOriginal.GetTotalMomentum() < 1.0) {
for (G4int i = 0; i < vecLen; i++) delete vec[i];
vecLen = 0;
}
else
{
} else {
// Occaisionally, GenerateXandPt will fail in the annihilation channel.
// Restore current, target and secondaries to pre-GenerateXandPt state
// before trying annihilation in TwoCluster
@@ -312,12 +316,14 @@ void G4RPGInelastic::CalculateMomenta(
}
}
pionSuppression.ReactionStage(originalIncident, modifiedOriginal,
incidentHasChanged, originalTarget,
targetParticle, targetHasChanged,
targetNucleus, currentParticle,
vec, vecLen,
false, leadingStrangeParticle);
// Big violations of energy conservation in this method - don't use
//
// pionSuppression.ReactionStage(originalIncident, modifiedOriginal,
// incidentHasChanged, originalTarget,
// targetParticle, targetHasChanged,
// targetNucleus, currentParticle,
// vec, vecLen,
// false, leadingStrangeParticle);
try
{
@@ -336,11 +342,7 @@ void G4RPGInelastic::CalculateMomenta(
}
}
if( finishedTwoClu )
{
Rotate(vec, vecLen);
return;
}
if (finishedTwoClu) return;
twoBody.ReactionStage(originalIncident, modifiedOriginal,
incidentHasChanged, originalTarget,
@@ -350,7 +352,7 @@ void G4RPGInelastic::CalculateMomenta(
false, leadingStrangeParticle);
}
/*
void G4RPGInelastic::
Rotate(G4FastVector<G4ReactionProduct,256> &vec, G4int &vecLen)
{
@@ -364,69 +366,68 @@ void G4RPGInelastic::CalculateMomenta(
vec[i]->SetMomentum(momentum);
}
}
*/
void
G4RPGInelastic::SetUpChange(G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged )
G4RPGInelastic::SetUpChange(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged )
{
theParticleChange.Clear();
G4ParticleDefinition *aKaonZL = G4KaonZeroLong::KaonZeroLong();
G4ParticleDefinition *aKaonZS = G4KaonZeroShort::KaonZeroShort();
G4ParticleDefinition* aKaonZL = G4KaonZeroLong::KaonZeroLong();
G4ParticleDefinition* aKaonZS = G4KaonZeroShort::KaonZeroShort();
G4int i;
if( currentParticle.GetDefinition() == aKaonZL )
{
if( G4UniformRand() <= 0.5 )
{
currentParticle.SetDefinition( aKaonZS );
if (currentParticle.GetDefinition() == particleDef[k0]) {
if (G4UniformRand() < 0.5) {
currentParticle.SetDefinitionAndUpdateE(aKaonZL);
incidentHasChanged = true;
} else {
currentParticle.SetDefinitionAndUpdateE(aKaonZS);
}
}
else if( currentParticle.GetDefinition() == aKaonZS )
{
if( G4UniformRand() > 0.5 )
{
currentParticle.SetDefinition( aKaonZL );
} else if (currentParticle.GetDefinition() == particleDef[k0b]) {
if (G4UniformRand() < 0.5) {
currentParticle.SetDefinitionAndUpdateE(aKaonZL);
} else {
currentParticle.SetDefinitionAndUpdateE(aKaonZS);
incidentHasChanged = true;
}
}
if( targetParticle.GetDefinition() == aKaonZL )
{
if( G4UniformRand() <= 0.5 )targetParticle.SetDefinition( aKaonZS );
}
else if( targetParticle.GetDefinition() == aKaonZS )
{
if( G4UniformRand() > 0.5 )targetParticle.SetDefinition( aKaonZL );
}
for( i=0; i<vecLen; ++i )
{
if( vec[i]->GetDefinition() == aKaonZL )
{
if( G4UniformRand() <= 0.5 )vec[i]->SetDefinition( aKaonZS );
}
else if( vec[i]->GetDefinition() == aKaonZS )
{
if( G4UniformRand() > 0.5 )vec[i]->SetDefinition( aKaonZL );
if (targetParticle.GetDefinition() == particleDef[k0] ||
targetParticle.GetDefinition() == particleDef[k0b] ) {
if (G4UniformRand() < 0.5) {
targetParticle.SetDefinitionAndUpdateE(aKaonZL);
} else {
targetParticle.SetDefinitionAndUpdateE(aKaonZS);
}
}
if( incidentHasChanged )
{
for (i = 0; i < vecLen; ++i) {
if (vec[i]->GetDefinition() == particleDef[k0] ||
vec[i]->GetDefinition() == particleDef[k0b] ) {
if (G4UniformRand() < 0.5) {
vec[i]->SetDefinitionAndUpdateE(aKaonZL);
} else {
vec[i]->SetDefinitionAndUpdateE(aKaonZS);
}
}
}
if (incidentHasChanged) {
G4DynamicParticle* p0 = new G4DynamicParticle;
p0->SetDefinition( currentParticle.GetDefinition() );
p0->SetMomentum( currentParticle.GetMomentum() );
p0->SetDefinition(currentParticle.GetDefinition() );
p0->SetMomentum(currentParticle.GetMomentum() );
theParticleChange.AddSecondary( p0 );
theParticleChange.SetStatusChange( stopAndKill );
theParticleChange.SetEnergyChange( 0.0 );
}
else
{
} else {
G4double p = currentParticle.GetMomentum().mag()/MeV;
G4ThreeVector m = currentParticle.GetMomentum();
if( p > DBL_MIN )
if (p > DBL_MIN)
theParticleChange.SetMomentumChange( m.x()/p, m.y()/p, m.z()/p );
else
theParticleChange.SetMomentumChange( 0.0, 0.0, 1.0 );
@@ -436,7 +437,7 @@ G4RPGInelastic::SetUpChange(G4FastVector<G4ReactionProduct,256> &vec,
theParticleChange.SetEnergyChange( aE );
}
if( targetParticle.GetMass() > 0.0 ) // Tgt particle can be eliminated in TwoBody
if (targetParticle.GetMass() > 0.0) // Tgt particle can be eliminated in TwoBody
{
G4ThreeVector momentum = targetParticle.GetMomentum();
momentum = momentum.rotate(cache, what);
@@ -454,8 +455,7 @@ G4RPGInelastic::SetUpChange(G4FastVector<G4ReactionProduct,256> &vec,
}
G4DynamicParticle* p;
for( i=0; i<vecLen; ++i )
{
for (i = 0; i < vecLen; ++i) {
G4double secKE = vec[i]->GetKineticEnergy();
G4ThreeVector momentum = vec[i]->GetMomentum();
G4ThreeVector dir(0.0, 0.0, 1.0);
@@ -469,5 +469,125 @@ G4RPGInelastic::SetUpChange(G4FastVector<G4ReactionProduct,256> &vec,
delete vec[i];
}
}
std::pair<G4int, G4double>
G4RPGInelastic::interpolateEnergy(G4double e) const
{
G4int index = 29;
G4double fraction = 0.0;
for (G4int i = 1; i < 30; i++) {
if (e < energyScale[i]) {
index = i-1;
fraction = (e - energyScale[index]) / (energyScale[i] - energyScale[index]);
break;
}
}
return std::pair<G4int, G4double>(index, fraction);
}
G4int
G4RPGInelastic::sampleFlat(std::vector<G4double> sigma) const
{
G4int i;
G4double sum(0.);
for (i = 0; i < G4int(sigma.size()); i++) sum += sigma[i];
G4double fsum = sum*G4UniformRand();
G4double partialSum = 0.0;
G4int channel = 0;
for (i = 0; i < G4int(sigma.size()); i++) {
partialSum += sigma[i];
if (fsum < partialSum) {
channel = i;
break;
}
}
return channel;
}
void G4RPGInelastic::CheckQnums(G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4double Q, G4double B, G4double S)
{
G4ParticleDefinition* projDef = currentParticle.GetDefinition();
G4ParticleDefinition* targDef = targetParticle.GetDefinition();
G4double chargeSum = projDef->GetPDGCharge() + targDef->GetPDGCharge();
G4double baryonSum = projDef->GetBaryonNumber() + targDef->GetBaryonNumber();
G4double strangenessSum = projDef->GetQuarkContent(3) -
projDef->GetAntiQuarkContent(3) +
targDef->GetQuarkContent(3) -
targDef->GetAntiQuarkContent(3);
G4ParticleDefinition* secDef = 0;
for (G4int i = 0; i < vecLen; i++) {
secDef = vec[i]->GetDefinition();
chargeSum += secDef->GetPDGCharge();
baryonSum += secDef->GetBaryonNumber();
strangenessSum += secDef->GetQuarkContent(3)
- secDef->GetAntiQuarkContent(3);
}
G4bool OK = true;
if (chargeSum != Q) {
G4cout << " Charge not conserved " << G4endl;
OK = false;
}
if (baryonSum != B) {
G4cout << " Baryon number not conserved " << G4endl;
OK = false;
}
if (strangenessSum != S) {
G4cout << " Strangeness not conserved " << G4endl;
OK = false;
}
if (!OK) {
G4cout << " projectile: " << projDef->GetParticleName()
<< " target: " << targDef->GetParticleName() << G4endl;
for (G4int i = 0; i < vecLen; i++) {
secDef = vec[i]->GetDefinition();
G4cout << secDef->GetParticleName() << " " ;
}
G4cout << G4endl;
}
}
const G4double G4RPGInelastic::energyScale[30] = {
0.0, 0.01, 0.013, 0.018, 0.024, 0.032, 0.042, 0.056, 0.075, 0.1,
0.13, 0.18, 0.24, 0.32, 0.42, 0.56, 0.75, 1.0, 1.3, 1.8,
2.4, 3.2, 4.2, 5.6, 7.5, 10.0, 13.0, 18.0, 24.0, 32.0 };
G4ParticleDefinition* p0 = G4PionZero::PionZero();
G4ParticleDefinition* p1 = G4PionPlus::PionPlus();
G4ParticleDefinition* p2 = G4PionMinus::PionMinus();
G4ParticleDefinition* p3 = G4KaonPlus::KaonPlus();
G4ParticleDefinition* p4 = G4KaonMinus::KaonMinus();
G4ParticleDefinition* p5 = G4KaonZero::KaonZero();
G4ParticleDefinition* p6 = G4AntiKaonZero::AntiKaonZero();
G4ParticleDefinition* p7 = G4Proton::Proton();
G4ParticleDefinition* p8 = G4Neutron::Neutron();
G4ParticleDefinition* p9 = G4Lambda::Lambda();
G4ParticleDefinition* p10 = G4SigmaPlus::SigmaPlus();
G4ParticleDefinition* p11 = G4SigmaZero::SigmaZero();
G4ParticleDefinition* p12 = G4SigmaMinus::SigmaMinus();
G4ParticleDefinition* p13 = G4XiZero::XiZero();
G4ParticleDefinition* p14 = G4XiMinus::XiMinus();
G4ParticleDefinition* p15 = G4OmegaMinus::OmegaMinus();
G4ParticleDefinition* p16 = G4AntiProton::AntiProton();
G4ParticleDefinition* p17 = G4AntiNeutron::AntiNeutron();
G4ParticleDefinition* G4RPGInelastic::particleDef[18] = {
p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14,
p15, p16, p17 };
/* end of file */
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGKMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGKMinusInelastic.hh"
@@ -25,7 +25,7 @@
//
//
// $Id: G4RPGKPlusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGKPlusInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGKZeroInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGKZeroInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGLambdaInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGLambdaInelastic.hh"
@@ -23,494 +23,336 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGNeutronInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGNeutronInelastic.cc,v 1.4 2008/05/05 21:21:55 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGNeutronInelastic.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
// #include "DumpFrame.hh"
G4HadFinalState *
G4RPGNeutronInelastic::ApplyYourself( const G4HadProjectile &aTrack,
G4Nucleus &targetNucleus )
G4HadFinalState*
G4RPGNeutronInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus)
{
theParticleChange.Clear();
const G4HadProjectile* originalIncident = &aTrack;
//
// create the target particle
//
G4DynamicParticle* originalTarget = targetNucleus.ReturnTargetParticle();
G4ReactionProduct modifiedOriginal;
modifiedOriginal = *originalIncident;
G4ReactionProduct targetParticle;
targetParticle = *originalTarget;
if( originalIncident->GetKineticEnergy()/GeV < 0.01 + 2.*G4UniformRand()/9. )
{
theParticleChange.Clear();
const G4HadProjectile *originalIncident = &aTrack;
//
// create the target particle
//
G4DynamicParticle *originalTarget = targetNucleus.ReturnTargetParticle();
if( verboseLevel > 1 )
{
const G4Material *targetMaterial = aTrack.GetMaterial();
G4cout << "G4RPGNeutronInelastic::ApplyYourself called" << G4endl;
G4cout << "kinetic energy = " << originalIncident->GetKineticEnergy()/MeV << "MeV, ";
G4cout << "target material = " << targetMaterial->GetName() << ", ";
G4cout << "target particle = " << originalTarget->GetDefinition()->GetParticleName()
<< G4endl;
}
/* not true, for example for Fe56, etc..
if( originalIncident->GetKineticEnergy()/MeV < 0.000001 )
throw G4HadronicException(__FILE__, __LINE__, "G4RPGNeutronInelastic: should be capture process!");
if( originalIncident->Get4Momentum().vect().mag()/MeV < 0.000001 )
throw G4HadronicException(__FILE__, __LINE__, "G4RPGNeutronInelastic: should be capture process!");
*/
G4ReactionProduct modifiedOriginal;
modifiedOriginal = *originalIncident;
G4ReactionProduct targetParticle;
targetParticle = *originalTarget;
if( originalIncident->GetKineticEnergy()/GeV < 0.01 + 2.*G4UniformRand()/9. )
{
SlowNeutron( originalIncident, modifiedOriginal, targetParticle, targetNucleus );
delete originalTarget;
return &theParticleChange;
}
//
// Fermi motion and evaporation
// As of Geant3, the Fermi energy calculation had not been Done
//
G4double ek = originalIncident->GetKineticEnergy()/MeV;
G4double amas = originalIncident->GetDefinition()->GetPDGMass()/MeV;
G4double tkin = targetNucleus.Cinema( ek );
ek += tkin;
modifiedOriginal.SetKineticEnergy( ek*MeV );
G4double et = ek + amas;
G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
G4double pp = modifiedOriginal.GetMomentum().mag()/MeV;
if( pp > 0.0 )
{
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
//
// calculate black track energies
//
tkin = targetNucleus.EvaporationEffects( ek );
ek -= tkin;
modifiedOriginal.SetKineticEnergy( ek*MeV );
et = ek + amas;
p = std::sqrt( std::abs((et-amas)*(et+amas)) );
pp = modifiedOriginal.GetMomentum().mag()/MeV;
if( pp > 0.0 )
{
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
const G4double cutOff = 0.1;
if( modifiedOriginal.GetKineticEnergy()/MeV <= cutOff )
{
SlowNeutron( originalIncident, modifiedOriginal, targetParticle, targetNucleus );
delete originalTarget;
return &theParticleChange;
}
G4ReactionProduct currentParticle = modifiedOriginal;
currentParticle.SetSide( 1 ); // incident always goes in forward hemisphere
targetParticle.SetSide( -1 ); // target always goes in backward hemisphere
G4bool incidentHasChanged = false;
G4bool targetHasChanged = false;
G4bool quasiElastic = false;
G4FastVector<G4ReactionProduct,256> vec; // vec will contain the secondary particles
G4int vecLen = 0;
vec.Initialize( 0 );
Cascade( vec, vecLen,
originalIncident, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic );
CalculateMomenta( vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
targetNucleus, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic );
SetUpChange( vec, vecLen,
currentParticle, targetParticle,
incidentHasChanged );
SlowNeutron(originalIncident,modifiedOriginal,targetParticle,targetNucleus );
delete originalTarget;
return &theParticleChange;
}
void
G4RPGNeutronInelastic::SlowNeutron(
const G4HadProjectile *originalIncident,
G4ReactionProduct &modifiedOriginal,
G4ReactionProduct &targetParticle,
G4Nucleus &targetNucleus )
{
const G4double A = targetNucleus.GetN(); // atomic weight
const G4double Z = targetNucleus.GetZ(); // atomic number
G4double currentKinetic = modifiedOriginal.GetKineticEnergy()/MeV;
G4double currentMass = modifiedOriginal.GetMass()/MeV;
if( A < 1.5 ) // Hydrogen
{
//
// very simple simulation of scattering angle and energy
// nonrelativistic approximation with isotropic angular
// distribution in the cms system
//
G4double cost1, eka = 0.0;
while (eka <= 0.0)
{
cost1 = -1.0 + 2.0*G4UniformRand();
eka = 1.0 + 2.0*cost1*A + A*A;
}
G4double cost = std::min( 1.0, std::max( -1.0, (A*cost1+1.0)/std::sqrt(eka) ) );
eka /= (1.0+A)*(1.0+A);
G4double ek = currentKinetic*MeV/GeV;
G4double amas = currentMass*MeV/GeV;
ek *= eka;
G4double en = ek + amas;
G4double p = std::sqrt(std::abs(en*en-amas*amas));
G4double sint = std::sqrt(std::abs(1.0-cost*cost));
G4double phi = G4UniformRand()*twopi;
G4double px = sint*std::sin(phi);
G4double py = sint*std::cos(phi);
G4double pz = cost;
targetParticle.SetMomentum( px*GeV, py*GeV, pz*GeV );
G4double pxO = originalIncident->Get4Momentum().x()/GeV;
G4double pyO = originalIncident->Get4Momentum().y()/GeV;
G4double pzO = originalIncident->Get4Momentum().z()/GeV;
G4double ptO = pxO*pxO + pyO+pyO;
if( ptO > 0.0 )
{
G4double pO = std::sqrt(pxO*pxO+pyO*pyO+pzO*pzO);
cost = pzO/pO;
sint = 0.5*(std::sqrt(std::abs((1.0-cost)*(1.0+cost)))+std::sqrt(ptO)/pO);
G4double ph = pi/2.0;
if( pyO < 0.0 )ph = ph*1.5;
if( std::abs(pxO) > 0.000001 )ph = std::atan2(pyO,pxO);
G4double cosp = std::cos(ph);
G4double sinp = std::sin(ph);
px = cost*cosp*px - sinp*py+sint*cosp*pz;
py = cost*sinp*px + cosp*py+sint*sinp*pz;
pz = -sint*px + cost*pz;
}
else
{
if( pz < 0.0 )pz *= -1.0;
}
G4double pu = std::sqrt(px*px+py*py+pz*pz);
modifiedOriginal.SetMomentum( targetParticle.GetMomentum() * (p/pu) );
modifiedOriginal.SetKineticEnergy( ek*GeV );
targetParticle.SetMomentum(
originalIncident->Get4Momentum().vect() - modifiedOriginal.GetMomentum() );
G4double pp = targetParticle.GetMomentum().mag();
G4double tarmas = targetParticle.GetMass();
targetParticle.SetTotalEnergy( std::sqrt( pp*pp + tarmas*tarmas ) );
theParticleChange.SetEnergyChange( modifiedOriginal.GetKineticEnergy() );
G4DynamicParticle *pd = new G4DynamicParticle;
pd->SetDefinition( targetParticle.GetDefinition() );
pd->SetMomentum( targetParticle.GetMomentum() );
theParticleChange.AddSecondary( pd );
return;
}
G4FastVector<G4ReactionProduct,4> vec; // vec will contain the secondary particles
G4int vecLen = 0;
vec.Initialize( 0 );
G4double theAtomicMass = targetNucleus.AtomicMass( A, Z );
G4double massVec[9];
massVec[0] = targetNucleus.AtomicMass( A+1.0, Z );
massVec[1] = theAtomicMass;
massVec[2] = 0.;
if (Z > 1.0)
massVec[2] = targetNucleus.AtomicMass( A , Z-1.0 );
massVec[3] = 0.;
if (Z > 1.0 && A > 1.0)
massVec[3] = targetNucleus.AtomicMass( A-1.0, Z-1.0 );
massVec[4] = 0.;
if (Z > 1.0 && A > 2.0 && A-2.0 > Z-1.0)
massVec[4] = targetNucleus.AtomicMass( A-2.0, Z-1.0 );
massVec[5] = 0.;
if (Z > 2.0 && A > 3.0 && A-3.0 > Z-2.0)
massVec[5] = targetNucleus.AtomicMass( A-3.0, Z-2.0 );
massVec[6] = 0.;
if (A > 1.0 && A-1.0 > Z)
massVec[6] = targetNucleus.AtomicMass( A-1.0, Z );
massVec[7] = massVec[3];
massVec[8] = 0.;
if (Z > 2.0 && A > 1.0)
massVec[8] = targetNucleus.AtomicMass( A-1.0, Z-2.0 );
twoBody.NuclearReaction(vec, vecLen, originalIncident,
targetNucleus, theAtomicMass, massVec );
theParticleChange.SetStatusChange( stopAndKill );
theParticleChange.SetEnergyChange( 0.0 );
G4DynamicParticle * pd;
for( G4int i=0; i<vecLen; ++i )
{
pd = new G4DynamicParticle();
pd->SetDefinition( vec[i]->GetDefinition() );
pd->SetMomentum( vec[i]->GetMomentum() );
theParticleChange.AddSecondary( pd );
delete vec[i];
}
}
void
G4RPGNeutronInelastic::Cascade(
G4FastVector<G4ReactionProduct,256> &vec,
G4int& vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic )
{
// derived from original FORTRAN code CASN by H. Fesefeldt (13-Sep-1987)
//
// Neutron undergoes interaction with nucleon within a nucleus. Check if it is
// energetically possible to produce pions/kaons. In not, assume nuclear excitation
// occurs and input particle is degraded in energy. No other particles are produced.
// If reaction is possible, find the correct number of pions/protons/neutrons
// produced using an interpolation to multiplicity data. Replace some pions or
// protons/neutrons by kaons or strange baryons according to the average
// multiplicity per Inelastic reaction.
//
const G4double mOriginal = originalIncident->GetDefinition()->GetPDGMass()/MeV;
const G4double etOriginal = originalIncident->GetTotalEnergy()/MeV;
const G4double targetMass = targetParticle.GetMass()/MeV;
G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
targetMass*targetMass +
2.0*targetMass*etOriginal );
G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
if( availableEnergy <= G4PionPlus::PionPlus()->GetPDGMass()/MeV )
{
quasiElastic = true;
return;
}
static G4bool first = true;
const G4int numMul = 1200;
const G4int numSec = 60;
static G4double protmul[numMul], protnorm[numSec]; // proton constants
static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants
// np = number of pi+, nm = number of pi-, nz = number of pi0
G4int counter, nt=0, np=0, nm=0, nz=0;
const G4double c = 1.25;
const G4double b[] = { 0.35, 0.0 };
if( first ) // compute normalization constants, this will only be Done once
{
first = false;
G4int i;
for( i=0; i<numMul; ++i )protmul[i] = 0.0;
for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
counter = -1;
for( np=0; np<numSec/3; ++np )
{
for( nm=std::max(0,np-1); nm<=(np+1); ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt > 0 )
{
protmul[counter] = Pmltpc(np,nm,nz,nt,b[0],c) /
(Factorial(1-np+nm)*Factorial(1+np-nm) );
protnorm[nt-1] += protmul[counter];
}
}
}
}
}
for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
counter = -1;
for( np=0; np<(numSec/3); ++np )
{
for( nm=np; nm<=(np+2); ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( (nt>0) && (nt<=numSec) )
{
neutmul[counter] = Pmltpc(np,nm,nz,nt,b[1],c) /
(Factorial(nm-np)*Factorial(2-nm+np) );
neutnorm[nt-1] += neutmul[counter];
}
}
}
}
}
for( i=0; i<numSec; ++i )
{
if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
}
} // end of initialization
const G4double expxu = 82.; // upper bound for arg. of exp
const G4double expxl = -expxu; // lower bound for arg. of exp
G4ParticleDefinition *aNeutron = G4Neutron::Neutron();
G4ParticleDefinition *aProton = G4Proton::Proton();
G4int ieab = static_cast<G4int>(availableEnergy*5.0/GeV);
const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
G4double test, w0, wp, wt, wm;
if( (availableEnergy < 2.0*GeV) && (G4UniformRand() >= supp[ieab]) )
{
// suppress high multiplicity events at low momentum
// only one pion will be produced
nm = np = nz = 0;
if( targetParticle.GetDefinition() == aNeutron )
{
test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
w0 = test/2.0;
wm = test;
if( G4UniformRand() < w0/(w0+wm) )
nz = 1;
else
nm = 1;
} else { // target is a proton
test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
w0 = test;
wp = test/2.0;
test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[0])*(-1.0+b[0])/(2.0*c*c) ) ) );
wm = test/2.0;
wt = w0+wp+wm;
wp += w0;
G4double ran = G4UniformRand();
if( ran < w0/wt )
nz = 1;
else if( ran < wp/wt )
np = 1;
else
nm = 1;
}
} else { // (availableEnergy >= 2.0*GeV) || (random number < supp[ieab])
G4double n, anpn;
GetNormalizationConstant( availableEnergy, n, anpn );
G4double ran = G4UniformRand();
G4double dum, excs = 0.0;
if( targetParticle.GetDefinition() == aProton )
{
counter = -1;
for( np=0; np<numSec/3 && ran>=excs; ++np )
{
for( nm=std::max(0,np-1); nm<=(np+1) && ran>=excs; ++nm )
{
for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt > 0 )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 ) {
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
np--; nm--; nz--;
} else { // target must be a neutron
counter = -1;
for( np=0; np<numSec/3 && ran>=excs; ++np )
{
for( nm=np; nm<=(np+2) && ran>=excs; ++nm )
{
for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( (nt>=1) && (nt<=numSec) )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 ) {
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
np--; nm--; nz--;
}
}
if( targetParticle.GetDefinition() == aProton )
//
// Fermi motion and evaporation
// As of Geant3, the Fermi energy calculation had not been Done
//
G4double ek = originalIncident->GetKineticEnergy()/MeV;
G4double amas = originalIncident->GetDefinition()->GetPDGMass()/MeV;
G4double tkin = targetNucleus.Cinema( ek );
ek += tkin;
modifiedOriginal.SetKineticEnergy( ek*MeV );
G4double et = ek + amas;
G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
G4double pp = modifiedOriginal.GetMomentum().mag()/MeV;
if( pp > 0.0 )
{
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
//
// calculate black track energies
//
tkin = targetNucleus.EvaporationEffects( ek );
ek -= tkin;
modifiedOriginal.SetKineticEnergy(ek);
et = ek + amas;
p = std::sqrt( std::abs((et-amas)*(et+amas)) );
pp = modifiedOriginal.GetMomentum().mag();
if( pp > 0.0 )
{
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
const G4double cutOff = 0.1;
if( modifiedOriginal.GetKineticEnergy()/MeV <= cutOff )
{
SlowNeutron( originalIncident, modifiedOriginal, targetParticle, targetNucleus );
delete originalTarget;
return &theParticleChange;
}
G4ReactionProduct currentParticle = modifiedOriginal;
currentParticle.SetSide( 1 ); // incident always goes in forward hemisphere
targetParticle.SetSide( -1 ); // target always goes in backward hemisphere
G4bool incidentHasChanged = false;
G4bool targetHasChanged = false;
G4bool quasiElastic = false;
G4FastVector<G4ReactionProduct,256> vec; // vec will contain sec. particles
G4int vecLen = 0;
vec.Initialize( 0 );
InitialCollision(vec, vecLen, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged);
CalculateMomenta(vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
targetNucleus, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic);
SetUpChange(vec, vecLen,
currentParticle, targetParticle,
incidentHasChanged);
delete originalTarget;
return &theParticleChange;
}
void
G4RPGNeutronInelastic::SlowNeutron(const G4HadProjectile* originalIncident,
G4ReactionProduct& modifiedOriginal,
G4ReactionProduct& targetParticle,
G4Nucleus& targetNucleus)
{
const G4double A = targetNucleus.GetN(); // atomic weight
const G4double Z = targetNucleus.GetZ(); // atomic number
G4double currentKinetic = modifiedOriginal.GetKineticEnergy()/MeV;
G4double currentMass = modifiedOriginal.GetMass()/MeV;
if( A < 1.5 ) // Hydrogen
{
//
// very simple simulation of scattering angle and energy
// nonrelativistic approximation with isotropic angular
// distribution in the cms system
//
G4double cost1, eka = 0.0;
while (eka <= 0.0)
{
switch( np-nm )
{
case 0:
if( G4UniformRand() < 0.33 )
{
currentParticle.SetDefinitionAndUpdateE( aProton );
targetParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
targetHasChanged = true;
}
break;
case 1:
targetParticle.SetDefinitionAndUpdateE( aNeutron );
targetHasChanged = true;
break;
default:
currentParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
break;
}
} else { // target must be a neutron
switch( np-nm )
{
case -1: // changed from +1 by JLC, 7Jul97
if( G4UniformRand() < 0.5 )
{
currentParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
} else {
targetParticle.SetDefinitionAndUpdateE( aProton );
targetHasChanged = true;
}
break;
case 0:
break;
default:
currentParticle.SetDefinitionAndUpdateE( aProton );
targetParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
targetHasChanged = true;
break;
}
cost1 = -1.0 + 2.0*G4UniformRand();
eka = 1.0 + 2.0*cost1*A + A*A;
}
SetUpPions( np, nm, nz, vec, vecLen );
// DEBUG --> DumpFrames::DumpFrame(vec, vecLen);
G4double cost = std::min( 1.0, std::max( -1.0, (A*cost1+1.0)/std::sqrt(eka) ) );
eka /= (1.0+A)*(1.0+A);
G4double ek = currentKinetic*MeV/GeV;
G4double amas = currentMass*MeV/GeV;
ek *= eka;
G4double en = ek + amas;
G4double p = std::sqrt(std::abs(en*en-amas*amas));
G4double sint = std::sqrt(std::abs(1.0-cost*cost));
G4double phi = G4UniformRand()*twopi;
G4double px = sint*std::sin(phi);
G4double py = sint*std::cos(phi);
G4double pz = cost;
targetParticle.SetMomentum( px*GeV, py*GeV, pz*GeV );
G4double pxO = originalIncident->Get4Momentum().x()/GeV;
G4double pyO = originalIncident->Get4Momentum().y()/GeV;
G4double pzO = originalIncident->Get4Momentum().z()/GeV;
G4double ptO = pxO*pxO + pyO+pyO;
if( ptO > 0.0 )
{
G4double pO = std::sqrt(pxO*pxO+pyO*pyO+pzO*pzO);
cost = pzO/pO;
sint = 0.5*(std::sqrt(std::abs((1.0-cost)*(1.0+cost)))+std::sqrt(ptO)/pO);
G4double ph = pi/2.0;
if( pyO < 0.0 )ph = ph*1.5;
if( std::abs(pxO) > 0.000001 )ph = std::atan2(pyO,pxO);
G4double cosp = std::cos(ph);
G4double sinp = std::sin(ph);
px = cost*cosp*px - sinp*py+sint*cosp*pz;
py = cost*sinp*px + cosp*py+sint*sinp*pz;
pz = -sint*px + cost*pz;
}
else
{
if( pz < 0.0 )pz *= -1.0;
}
G4double pu = std::sqrt(px*px+py*py+pz*pz);
modifiedOriginal.SetMomentum( targetParticle.GetMomentum() * (p/pu) );
modifiedOriginal.SetKineticEnergy( ek*GeV );
targetParticle.SetMomentum(
originalIncident->Get4Momentum().vect() - modifiedOriginal.GetMomentum() );
G4double pp = targetParticle.GetMomentum().mag();
G4double tarmas = targetParticle.GetMass();
targetParticle.SetTotalEnergy( std::sqrt( pp*pp + tarmas*tarmas ) );
theParticleChange.SetEnergyChange( modifiedOriginal.GetKineticEnergy() );
G4DynamicParticle *pd = new G4DynamicParticle;
pd->SetDefinition( targetParticle.GetDefinition() );
pd->SetMomentum( targetParticle.GetMomentum() );
theParticleChange.AddSecondary( pd );
return;
}
/* end of file */
G4FastVector<G4ReactionProduct,4> vec; // vec will contain the secondary particles
G4int vecLen = 0;
vec.Initialize( 0 );
G4double theAtomicMass = targetNucleus.AtomicMass( A, Z );
G4double massVec[9];
massVec[0] = targetNucleus.AtomicMass( A+1.0, Z );
massVec[1] = theAtomicMass;
massVec[2] = 0.;
if (Z > 1.0) massVec[2] = targetNucleus.AtomicMass(A, Z-1.0);
massVec[3] = 0.;
if (Z > 1.0 && A > 1.0) massVec[3] = targetNucleus.AtomicMass(A-1.0, Z-1.0 );
massVec[4] = 0.;
if (Z > 1.0 && A > 2.0 && A-2.0 > Z-1.0)
massVec[4] = targetNucleus.AtomicMass( A-2.0, Z-1.0 );
massVec[5] = 0.;
if (Z > 2.0 && A > 3.0 && A-3.0 > Z-2.0)
massVec[5] = targetNucleus.AtomicMass( A-3.0, Z-2.0 );
massVec[6] = 0.;
if (A > 1.0 && A-1.0 > Z) massVec[6] = targetNucleus.AtomicMass(A-1.0, Z);
massVec[7] = massVec[3];
massVec[8] = 0.;
if (Z > 2.0 && A > 1.0) massVec[8] = targetNucleus.AtomicMass( A-1.0,Z-2.0 );
twoBody.NuclearReaction(vec, vecLen, originalIncident,
targetNucleus, theAtomicMass, massVec );
theParticleChange.SetStatusChange( stopAndKill );
theParticleChange.SetEnergyChange( 0.0 );
G4DynamicParticle* pd;
for( G4int i=0; i<vecLen; ++i ) {
pd = new G4DynamicParticle();
pd->SetDefinition( vec[i]->GetDefinition() );
pd->SetMomentum( vec[i]->GetMomentum() );
theParticleChange.AddSecondary( pd );
delete vec[i];
}
}
// Initial Collision
// selects the particle types arising from the initial collision of
// the neutron and target nucleon. Secondaries are assigned to
// forward and backward reaction hemispheres, but final state energies
// and momenta are not calculated here.
void
G4RPGNeutronInelastic::InitialCollision(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged)
{
G4double KE = currentParticle.GetKineticEnergy()/GeV;
G4int mult;
G4int partType;
std::vector<G4int> fsTypes;
G4int part1;
G4int part2;
G4double testCharge;
G4double testBaryon;
G4double testStrange;
// Get particle types according to incident and target types
if (targetParticle.GetDefinition() == particleDef[neu]) {
mult = GetMultiplicityT1(KE);
fsTypes = GetFSPartTypesForNN(mult, KE);
part1 = fsTypes[0];
part2 = fsTypes[1];
currentParticle.SetDefinition(particleDef[part1]);
targetParticle.SetDefinition(particleDef[part2]);
if (part1 == pro) {
if (part2 == neu) {
if (G4UniformRand() > 0.5) {
incidentHasChanged = true;
} else {
targetHasChanged = true;
currentParticle.SetDefinition(particleDef[part2]);
targetParticle.SetDefinition(particleDef[part1]);
}
} else {
targetHasChanged = true;
incidentHasChanged = true;
}
} else { // neutron
if (part2 > neu && part2 < xi0) targetHasChanged = true;
}
testCharge = 0.0;
testBaryon = 2.0;
testStrange = 0.0;
} else { // target was a proton
mult = GetMultiplicityT0(KE);
fsTypes = GetFSPartTypesForNP(mult, KE);
part1 = fsTypes[0];
part2 = fsTypes[1];
currentParticle.SetDefinition(particleDef[part1]);
targetParticle.SetDefinition(particleDef[part2]);
if (part1 == pro) {
if (part2 == pro) {
incidentHasChanged = true;
} else if (part2 == neu) {
if (G4UniformRand() > 0.5) {
incidentHasChanged = true;
targetHasChanged = true;
} else {
currentParticle.SetDefinition(particleDef[part2]);
targetParticle.SetDefinition(particleDef[part1]);
}
} else if (part2 > neu && part2 < xi0) {
incidentHasChanged = true;
targetHasChanged = true;
}
} else { // neutron
targetHasChanged = true;
}
testCharge = 1.0;
testBaryon = 2.0;
testStrange = 0.0;
}
// if (mult == 2 && !incidentHasChanged && !targetHasChanged)
// quasiElastic = true;
// Remove incident and target from fsTypes
fsTypes.erase(fsTypes.begin());
fsTypes.erase(fsTypes.begin());
// Remaining particles are secondaries. Put them into vec.
G4ReactionProduct* rp(0);
for(G4int i=0; i < mult-2; ++i ) {
partType = fsTypes[i];
rp = new G4ReactionProduct();
rp->SetDefinition(particleDef[partType]);
(G4UniformRand() < 0.5) ? rp->SetSide(-1) : rp->SetSide(1);
vec.SetElement(vecLen++, rp);
}
// Check conservation of charge, strangeness, baryon number
CheckQnums(vec, vecLen, currentParticle, targetParticle,
testCharge, testBaryon, testStrange);
return;
}
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGOmegaMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGOmegaMinusInelastic.hh"
@@ -23,21 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGPiMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGPiMinusInelastic.cc,v 1.4 2008/05/05 21:21:55 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGPiMinusInelastic.hh"
#include "Randomize.hh"
G4HadFinalState*
G4RPGPiMinusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus)
G4Nucleus& targetNucleus)
{
const G4HadProjectile* originalIncident = &aTrack;
if (originalIncident->GetKineticEnergy() <= 0.1*MeV)
{
if (originalIncident->GetKineticEnergy()<= 0.1) {
theParticleChange.SetStatusChange(isAlive);
theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy());
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
@@ -49,18 +48,8 @@ G4RPGPiMinusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4DynamicParticle* originalTarget = targetNucleus.ReturnTargetParticle();
G4ReactionProduct targetParticle( originalTarget->GetDefinition() );
if( verboseLevel > 1 )
{
const G4Material *targetMaterial = aTrack.GetMaterial();
G4cout << "G4PionMinusInelastic::ApplyYourself called" << G4endl;
G4cout << "kinetic energy = " << originalIncident->GetKineticEnergy() << "MeV, ";
G4cout << "target material = " << targetMaterial->GetName() << ", ";
G4cout << "target particle = " << originalTarget->GetDefinition()->GetParticleName()
<< G4endl;
}
G4ReactionProduct currentParticle(
const_cast<G4ParticleDefinition *>(originalIncident->GetDefinition() ) );
const_cast<G4ParticleDefinition *>(originalIncident->GetDefinition() ) );
currentParticle.SetMomentum( originalIncident->Get4Momentum().vect() );
currentParticle.SetKineticEnergy( originalIncident->GetKineticEnergy() );
@@ -76,8 +65,7 @@ G4RPGPiMinusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4double et = ek + amas;
G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
G4double pp = currentParticle.GetMomentum().mag();
if( pp > 0.0 )
{
if( pp > 0.0 ) {
G4ThreeVector momentum = currentParticle.GetMomentum();
currentParticle.SetMomentum( momentum * (p/pp) );
}
@@ -90,8 +78,7 @@ G4RPGPiMinusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
et = ek + amas;
p = std::sqrt( std::abs((et-amas)*(et+amas)) );
pp = currentParticle.GetMomentum().mag();
if( pp > 0.0 )
{
if( pp > 0.0 ) {
G4ThreeVector momentum = currentParticle.GetMomentum();
currentParticle.SetMomentum( momentum * (p/pp) );
}
@@ -103,312 +90,124 @@ G4RPGPiMinusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4bool incidentHasChanged = false;
G4bool targetHasChanged = false;
G4bool quasiElastic = false;
G4FastVector<G4ReactionProduct,256> vec;
G4FastVector<G4ReactionProduct,256> vec; // vec will contain the secondary particles
G4int vecLen = 0;
vec.Initialize( 0 );
const G4double cutOff = 0.1*MeV;
const G4double cutOff = 0.1;
if( currentParticle.GetKineticEnergy() > cutOff )
Cascade(vec, vecLen,
originalIncident, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic);
InitialCollision(vec, vecLen, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged);
CalculateMomenta(vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
targetNucleus, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic);
SetUpChange(vec, vecLen, currentParticle, targetParticle,
SetUpChange(vec, vecLen,
currentParticle, targetParticle,
incidentHasChanged);
delete originalTarget;
return &theParticleChange;
}
// Initial Collision
// selects the particle types arising from the initial collision of
// the projectile and target nucleon. Secondaries are assigned to
// forward and backward reaction hemispheres, but final state energies
// and momenta are not calculated here.
void G4RPGPiMinusInelastic::Cascade(
G4FastVector<G4ReactionProduct,256> &vec,
G4int& vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic)
void
G4RPGPiMinusInelastic::InitialCollision(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged)
{
// Derived from H. Fesefeldt's original FORTRAN code CASPIM
//
// pi- undergoes interaction with nucleon within nucleus.
// Check if energetically possible to produce pions/kaons.
// If not assume nuclear excitation occurs and input particle
// is degraded in energy. No other particles produced.
// If reaction is possible find correct number of pions/protons/neutrons
// produced using an interpolation to multiplicity data.
// Replace some pions or protons/neutrons by kaons or strange baryons
// according to average multiplicity per inelastic reactions.
//
const G4double mOriginal = originalIncident->GetDefinition()->GetPDGMass();
const G4double etOriginal = originalIncident->GetTotalEnergy();
const G4double pOriginal = originalIncident->GetTotalMomentum();
const G4double targetMass = targetParticle.GetMass();
G4double centerofmassEnergy = std::sqrt(mOriginal*mOriginal +
targetMass*targetMass +
2.0*targetMass*etOriginal);
G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
static G4bool first = true;
const G4int numMul = 1200;
const G4int numSec = 60;
static G4double protmul[numMul], protnorm[numSec]; // proton constants
static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants
// np = number of pi+, nm = number of pi-, nz = number of pi0
G4int counter, nt=0, np=0, nm=0, nz=0;
const G4double c = 1.25;
const G4double b[] = { 0.70, 0.70 };
if( first ) // compute normalization constants, this will only be Done once
{
first = false;
G4int i;
for( i=0; i<numMul; ++i )protmul[i] = 0.0;
for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
counter = -1;
for( np=0; np<(numSec/3); ++np )
{
for( nm=std::max(0,np-1); nm<=(np+1); ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt > 0 )
{
protmul[counter] = Pmltpc(np,nm,nz,nt,b[0],c);
protnorm[nt-1] += protmul[counter];
}
}
}
}
}
for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
counter = -1;
for( np=0; np<numSec/3; ++np )
{
for( nm=np; nm<=(np+2); ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( (nt>0) && (nt<=numSec) )
{
neutmul[counter] = Pmltpc(np,nm,nz,nt,b[1],c);
neutnorm[nt-1] += neutmul[counter];
}
}
}
}
}
for( i=0; i<numSec; ++i ) {
if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
G4double KE = currentParticle.GetKineticEnergy()/GeV;
G4int mult;
G4int partType;
std::vector<G4int> fsTypes;
G4double testCharge;
G4double testBaryon;
G4double testStrange;
// Get particle types according to incident and target types
if (targetParticle.GetDefinition() == particleDef[pro]) {
mult = GetMultiplicityT12(KE);
fsTypes = GetFSPartTypesForPimP(mult, KE);
partType = fsTypes[0];
if (partType != pro) {
targetHasChanged = true;
targetParticle.SetDefinition(particleDef[partType]);
}
} // end of initialization
const G4double expxu = 82.; // upper bound for arg. of exp
const G4double expxl = -expxu; // lower bound for arg. of exp
G4ParticleDefinition *aNeutron = G4Neutron::Neutron();
G4ParticleDefinition *aProton = G4Proton::Proton();
G4ParticleDefinition *aPiZero = G4PionZero::PionZero();
G4int ieab = G4int(availableEnergy*5.0/GeV);
const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
G4double test, w0, wp, wt, wm;
if( (availableEnergy<2.0*GeV) && (G4UniformRand()>=supp[ieab]) )
{
// suppress high multiplicity events at low momentum
// only one pion will be produced
// charge exchange reaction is included in inelastic cross section
const G4double cech[] = {1.,0.95,0.79,0.32,0.19,0.16,0.14,0.12,0.10,0.08};
G4int iplab = G4int(std::min( 9.0, pOriginal/GeV*5.0 ));
if( G4UniformRand() <= cech[iplab] )
{
if( targetParticle.GetDefinition() == aProton )
{
currentParticle.SetDefinitionAndUpdateE( aPiZero ); // charge exchange
targetParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
targetHasChanged = true;
}
}
if( availableEnergy <= G4PionMinus::PionMinus()->GetPDGMass() )
{
quasiElastic = true;
return;
}
nm = np = nz = 0;
if( targetParticle.GetDefinition() == aProton )
{
test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
w0 = test;
wp = 10.0*test;
test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[0])*(-1.0+b[0])/(2.0*c*c) ) ) );
wm = test;
wt = w0+wp+wm;
wp += w0;
G4double ran = G4UniformRand();
if( ran < w0/wt )
nz = 1;
else if( ran < wp/wt )
np = 1;
else
nm = 1;
}
else // target is a neutron
{
test = std::exp( std::min( expxu, std::max( expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
w0 = test;
test = std::exp( std::min( expxu, std::max( expxl, -(-1.0+b[1])*(-1.0+b[1])/(2.0*c*c) ) ) );
wm = test;
G4double ran = G4UniformRand();
if( ran < w0/(w0+wm) )
nz = 1;
else
nm = 1;
}
}
else
{
if( availableEnergy <= G4PionMinus::PionMinus()->GetPDGMass() )
{
quasiElastic = true;
return;
}
G4double n, anpn;
GetNormalizationConstant( availableEnergy, n, anpn );
G4double ran = G4UniformRand();
G4double dum, excs = 0.0;
if( targetParticle.GetDefinition() == aProton )
{
counter = -1;
for( np=0; (np<numSec/3) && (ran>=excs); ++np )
{
for( nm=std::max(0,np-1); (nm<=(np+1)) && (ran>=excs); ++nm )
{
for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt > 0 )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 )
{
if( test >= 1.0e-10 )excs += dum*test;
}
else
excs += dum*test;
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
np--; nm--; nz--;
}
else // target must be a neutron
{
counter = -1;
for( np=0; (np<numSec/3) && (ran>=excs); ++np )
{
for( nm=np; (nm<=(np+2)) && (ran>=excs); ++nm )
{
for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( (nt>=1) && (nt<=numSec) )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 )
{
if( test >= 1.0e-10 )excs += dum*test;
}
else
excs += dum*test;
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
np--; nm--; nz--;
}
}
if( targetParticle.GetDefinition() == aProton )
{
switch( np-nm )
{
case 0:
if( G4UniformRand() >= 0.75 )
{
currentParticle.SetDefinitionAndUpdateE( aPiZero );
targetParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
targetHasChanged = true;
}
break;
case 1:
targetParticle.SetDefinitionAndUpdateE( aNeutron );
targetHasChanged = true;
break;
default:
currentParticle.SetDefinitionAndUpdateE( aPiZero );
incidentHasChanged = true;
break;
}
}
else
{
switch( np-nm )
{
case -1:
if( G4UniformRand() < 0.5 )
{
targetParticle.SetDefinitionAndUpdateE( aProton );
targetHasChanged = true;
} else {
currentParticle.SetDefinitionAndUpdateE( aPiZero );
incidentHasChanged = true;
}
break;
case 0:
break;
default:
currentParticle.SetDefinitionAndUpdateE( aPiZero );
incidentHasChanged = true;
break;
testCharge = 0.0;
testBaryon = 1.0;
testStrange = 0.0;
} else { // target was a neutron
mult = GetMultiplicityT32(KE);
fsTypes = GetFSPartTypesForPimN(mult, KE);
partType = fsTypes[0];
if (partType != neu) {
targetHasChanged = true;
targetParticle.SetDefinition(particleDef[partType]);
}
testCharge = -1.0;
testBaryon = 1.0;
testStrange = 0.0;
}
SetUpPions( np, nm, nz, vec, vecLen );
// Remove target particle from list
fsTypes.erase(fsTypes.begin());
// See if the incident particle changed type
G4int choose = -1;
for(G4int i=0; i < mult-1; ++i ) {
partType = fsTypes[i];
if (partType == pim) {
choose = i;
break;
}
}
if (choose == -1) {
incidentHasChanged = true;
choose = G4int(G4UniformRand()*(mult-1) );
partType = fsTypes[choose];
currentParticle.SetDefinition(particleDef[partType]);
}
fsTypes.erase(fsTypes.begin()+choose);
// Remaining particles are secondaries. Put them into vec.
G4ReactionProduct* rp(0);
for(G4int i=0; i < mult-2; ++i ) {
partType = fsTypes[i];
rp = new G4ReactionProduct();
rp->SetDefinition(particleDef[partType]);
(G4UniformRand() < 0.5) ? rp->SetSide(-1) : rp->SetSide(1);
if (partType > pim && partType < pro) rp->SetMayBeKilled(false); // kaons
vec.SetElement(vecLen++, rp);
}
// if (mult == 2 && !incidentHasChanged && !targetHasChanged)
// quasiElastic = true;
// Check conservation of charge, strangeness, baryon number
CheckQnums(vec, vecLen, currentParticle, targetParticle,
testCharge, testBaryon, testStrange);
return;
}
/* end of file */
@@ -23,41 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGPiPlusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGPiPlusInelastic.cc,v 1.4 2008/05/05 21:21:55 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGPiPlusInelastic.hh"
#include "Randomize.hh"
G4HadFinalState *
G4RPGPiPlusInelastic::ApplyYourself( const G4HadProjectile &aTrack,
G4Nucleus &targetNucleus )
{
const G4HadProjectile *originalIncident = &aTrack;
if (originalIncident->GetKineticEnergy()<= 0.1*MeV)
{
theParticleChange.SetStatusChange(isAlive);
theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy());
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theParticleChange;
}
G4HadFinalState*
G4RPGPiPlusInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus)
{
const G4HadProjectile *originalIncident = &aTrack;
if (originalIncident->GetKineticEnergy()<= 0.1) {
theParticleChange.SetStatusChange(isAlive);
theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy());
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theParticleChange;
}
// create the target particle
G4DynamicParticle *originalTarget = targetNucleus.ReturnTargetParticle();
// G4double targetMass = originalTarget->GetDefinition()->GetPDGMass();
G4ReactionProduct targetParticle( originalTarget->GetDefinition() );
if( verboseLevel > 1 )
{
const G4Material *targetMaterial = aTrack.GetMaterial();
G4cout << "G4RPGPiPlusInelastic::ApplyYourself called" << G4endl;
G4cout << "kinetic energy = " << originalIncident->GetKineticEnergy() << "MeV, ";
G4cout << "target material = " << targetMaterial->GetName() << ", ";
G4cout << "target particle = " << originalTarget->GetDefinition()->GetParticleName()
<< G4endl;
}
G4ReactionProduct currentParticle(
const_cast<G4ParticleDefinition *>(originalIncident->GetDefinition() ) );
currentParticle.SetMomentum( originalIncident->Get4Momentum().vect() );
@@ -106,11 +95,10 @@
G4int vecLen = 0;
vec.Initialize( 0 );
const G4double cutOff = 0.1*MeV;
const G4double cutOff = 0.1;
if( currentParticle.GetKineticEnergy() > cutOff )
Cascade( vec, vecLen,
originalIncident, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic );
InitialCollision(vec, vecLen, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged);
CalculateMomenta( vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
@@ -123,253 +111,105 @@
delete originalTarget;
return &theParticleChange;
}
}
// Initial Collision
// selects the particle types arising from the initial collision of
// the projectile and target nucleon. Secondaries are assigned to
// forward and backward reaction hemispheres, but final state energies
// and momenta are not calculated here.
void
G4RPGPiPlusInelastic::Cascade(
G4FastVector<G4ReactionProduct,256> &vec,
G4int& vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic )
{
// derived from original FORTRAN code CASPIP by H. Fesefeldt (18-Sep-1987)
//
// pi+ undergoes interaction with nucleon within nucleus.
// Check if energetically possible to produce pions/kaons.
// If not assume nuclear excitation occurs and input particle
// is degraded in energy. No other particles produced.
// If reaction is possible find correct number of pions/protons/neutrons
// produced using an interpolation to multiplicity data.
// Replace some pions or protons/neutrons by kaons or strange baryons
// according to average multiplicity per inelastic reactions.
//
const G4double mOriginal = originalIncident->GetDefinition()->GetPDGMass();
const G4double etOriginal = originalIncident->GetTotalEnergy();
const G4double pOriginal = originalIncident->GetTotalMomentum();
const G4double targetMass = targetParticle.GetMass();
G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
targetMass*targetMass +
2.0*targetMass*etOriginal );
G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
static G4bool first = true;
const G4int numMul = 1200;
const G4int numSec = 60;
static G4double protmul[numMul], protnorm[numSec]; // proton constants
static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants
// np = number of pi+, nm = number of pi-, nz = number of pi0
G4int counter, nt=0, np=0, nm=0, nz=0;
const G4double c = 1.25;
const G4double b[] = { 0.70, 0.70 };
if( first ) { // compute normalization constants, this will only be Done once
first = false;
G4int i;
for( i=0; i<numMul; ++i )protmul[i] = 0.0;
for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
counter = -1;
for( np=0; np<(numSec/3); ++np ) {
for( nm=std::max(0,np-2); nm<=np; ++nm ) {
for( nz=0; nz<numSec/3; ++nz ) {
if( ++counter < numMul ) {
nt = np+nm+nz;
if( nt > 0 ) {
protmul[counter] = Pmltpc(np,nm,nz,nt,b[0],c);
protnorm[nt-1] += protmul[counter];
}
}
}
}
}
for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
counter = -1;
for( np=0; np<numSec/3; ++np ) {
for( nm=std::max(0,np-1); nm<=(np+1); ++nm ) {
for( nz=0; nz<numSec/3; ++nz ) {
if( ++counter < numMul ) {
nt = np+nm+nz;
if( (nt>0) && (nt<=numSec) ) {
neutmul[counter] = Pmltpc(np,nm,nz,nt,b[1],c);
neutnorm[nt-1] += neutmul[counter];
}
}
}
}
}
for( i=0; i<numSec; ++i ) {
if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
}
} // end of initialization
const G4double expxu = 82.; // upper bound for arg. of exp
const G4double expxl = -expxu; // lower bound for arg. of exp
G4ParticleDefinition *aNeutron = G4Neutron::Neutron();
G4ParticleDefinition *aProton = G4Proton::Proton();
G4ParticleDefinition *aPiZero = G4PionZero::PionZero();
G4int ieab = static_cast<G4int>(availableEnergy*5.0/GeV);
const G4double supp[] = {0.,0.2,0.45,0.55,0.65,0.75,0.85,0.90,0.94,0.98};
G4double test, w0, wp, wt, wm;
if( (availableEnergy < 2.0*GeV) && (G4UniformRand() >= supp[ieab]) )
{
// suppress high multiplicity events at low momentum
// only one pion will be produced
// charge exchange reaction is included in inelastic cross section
const G4double cech[] = {1.,0.95,0.79,0.32,0.19,0.16,0.14,0.12,0.10,0.08};
G4int iplab = G4int(std::min( 9.0, pOriginal/GeV*5.0 ));
if( G4UniformRand() <= cech[iplab] )
{
if( targetParticle.GetDefinition() == aNeutron )
{
currentParticle.SetDefinitionAndUpdateE( aPiZero ); // charge exchange
targetParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
targetHasChanged = true;
}
}
if( availableEnergy <= G4PionMinus::PionMinus()->GetPDGMass() )
{
quasiElastic = true;
return;
}
nm = np = nz = 0;
if( targetParticle.GetDefinition() == aProton ) {
test = std::exp( std::min( expxu, std::max( expxl, -sqr(1.0+b[0])/(2.0*c*c) ) ) );
w0 = test;
wp = test;
if( G4UniformRand() < w0/(w0+wp) )
nz =1;
else
np = 1;
} else { // target is a neutron
test = std::exp( std::min( expxu, std::max( expxl, -sqr(1.0+b[1])/(2.0*c*c) ) ) );
w0 = test;
wp = test;
test = std::exp( std::min( expxu, std::max( expxl, -sqr(-1.0+b[1])/(2.0*c*c) ) ) );
wm = test;
wt = w0+wp+wm;
wp = w0+wp;
G4double ran = G4UniformRand();
if( ran < w0/wt )
nz = 1;
else if( ran < wp/wt )
np = 1;
else
nm = 1;
}
} else {
if( availableEnergy <= G4PionMinus::PionMinus()->GetPDGMass() )
{
quasiElastic = true;
return;
}
G4double n, anpn;
GetNormalizationConstant( availableEnergy, n, anpn );
G4double ran = G4UniformRand();
G4double dum, excs = 0.0;
if( targetParticle.GetDefinition() == aProton ) {
counter = -1;
for( np=0; (np<numSec/3) && (ran>=excs); ++np ) {
for( nm=std::max(0,np-2); (nm<=np) && (ran>=excs); ++nm ) {
for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz ) {
if( ++counter < numMul ) {
nt = np+nm+nz;
if( nt > 0 ) {
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 ) {
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs )
{
quasiElastic = true;
return; // 3 previous loops continued to the end
}
np--; nm--; nz--;
} else { // target must be a neutron
counter = -1;
for( np=0; (np<numSec/3) && (ran>=excs); ++np ) {
for( nm=std::max(0,np-1); (nm<=(np+1)) && (ran>=excs); ++nm ) {
for( nz=0; (nz<numSec/3) && (ran>=excs); ++nz ) {
if( ++counter < numMul ) {
nt = np+nm+nz;
if( (nt>=1) && (nt<=numSec) ) {
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 ) {
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return; // 3 previous loops continued to the end
}
np--; nm--; nz--;
}
void
G4RPGPiPlusInelastic::InitialCollision(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged)
{
G4double KE = currentParticle.GetKineticEnergy()/GeV;
G4int mult;
G4int partType;
std::vector<G4int> fsTypes;
G4double testCharge;
G4double testBaryon;
G4double testStrange;
// Get particle types according to incident and target types
if (targetParticle.GetDefinition() == particleDef[pro]) {
mult = GetMultiplicityT32(KE);
fsTypes = GetFSPartTypesForPipP(mult, KE);
partType = fsTypes[0];
if (partType != pro) {
targetHasChanged = true;
targetParticle.SetDefinition(particleDef[partType]);
}
if( targetParticle.GetDefinition() == aProton ) {
switch( np-nm ) {
case 1:
if( G4UniformRand() < 0.5 ) {
currentParticle.SetDefinitionAndUpdateE( aPiZero );
incidentHasChanged = true;
} else {
targetParticle.SetDefinitionAndUpdateE( aNeutron );
targetHasChanged = true;
}
break;
case 2:
currentParticle.SetDefinitionAndUpdateE( aPiZero );
targetParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
targetHasChanged = true;
break;
default:
break;
}
} else {
switch( np-nm ) {
case 0:
if( G4UniformRand() < 0.25 ) {
currentParticle.SetDefinitionAndUpdateE( aPiZero );
targetParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
targetHasChanged = true;
}
break;
case 1:
currentParticle.SetDefinitionAndUpdateE( aPiZero );
incidentHasChanged = true;
break;
default:
targetParticle.SetDefinitionAndUpdateE( aProton );
targetHasChanged = true;
break;
}
testCharge = 2.0;
testBaryon = 1.0;
testStrange = 0.0;
} else { // target was a neutron
mult = GetMultiplicityT12(KE);
fsTypes = GetFSPartTypesForPipN(mult, KE);
partType = fsTypes[0];
if (partType != neu) {
targetHasChanged = true;
targetParticle.SetDefinition(particleDef[partType]);
}
SetUpPions( np, nm, nz, vec, vecLen );
return;
testCharge = 1.0;
testBaryon = 1.0;
testStrange = 0.0;
}
/* end of file */
// Remove target particle from list
fsTypes.erase(fsTypes.begin());
// See if the incident particle changed type
G4int choose = -1;
for(G4int i=0; i < mult-1; ++i ) {
partType = fsTypes[i];
if (partType == pip) {
choose = i;
break;
}
}
if (choose == -1) {
incidentHasChanged = true;
choose = G4int(G4UniformRand()*(mult-1) );
partType = fsTypes[choose];
currentParticle.SetDefinition(particleDef[partType]);
}
fsTypes.erase(fsTypes.begin()+choose);
// Remaining particles are secondaries. Put them into vec.
// Improve this by randomizing secondary order, then alternate
// which secondary is put into forward or backward hemisphere
G4ReactionProduct* rp(0);
for(G4int i=0; i < mult-2; ++i ) {
partType = fsTypes[i];
rp = new G4ReactionProduct();
rp->SetDefinition(particleDef[partType]);
(G4UniformRand() < 0.5) ? rp->SetSide(-1) : rp->SetSide(1);
if (partType > pim && partType < pro) rp->SetMayBeKilled(false); // kaons
vec.SetElement(vecLen++, rp);
}
// if (mult == 2 && !incidentHasChanged && !targetHasChanged)
// quasiElastic = true;
// Check conservation of charge, strangeness, baryon number
CheckQnums(vec, vecLen, currentParticle, targetParticle,
testCharge, testBaryon, testStrange);
return;
}
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGPionSuppression.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGPionSuppression.hh"
@@ -23,20 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGProtonInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGProtonInelastic.cc,v 1.4 2008/05/05 21:21:55 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGProtonInelastic.hh"
#include "Randomize.hh"
G4HadFinalState*
G4RPGProtonInelastic::ApplyYourself( const G4HadProjectile &aTrack,
G4Nucleus &targetNucleus )
G4RPGProtonInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& targetNucleus )
{
theParticleChange.Clear();
const G4HadProjectile *originalIncident = &aTrack;
if (originalIncident->GetKineticEnergy()<= 0.1*MeV)
if (originalIncident->GetKineticEnergy()<= 0.1)
{
theParticleChange.SetStatusChange(isAlive);
theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy());
@@ -48,63 +48,47 @@ G4RPGProtonInelastic::ApplyYourself( const G4HadProjectile &aTrack,
// create the target particle
//
G4DynamicParticle *originalTarget = targetNucleus.ReturnTargetParticle();
if( verboseLevel > 1 )
{
const G4Material *targetMaterial = aTrack.GetMaterial();
G4cout << "G4RPGProtonInelastic::ApplyYourself called" << G4endl;
G4cout << "kinetic energy = "
<< originalIncident->GetKineticEnergy()/MeV << "MeV, ";
G4cout << "target material = "
<< targetMaterial->GetName() << ", ";
G4cout << "target particle = "
<< originalTarget->GetDefinition()->GetParticleName()
<< G4endl;
}
if( originalIncident->GetKineticEnergy()/GeV < 0.01+2.*G4UniformRand()/9. )
if (originalIncident->GetKineticEnergy()/GeV < 0.01+2.*G4UniformRand()/9. )
{
SlowProton( originalIncident, targetNucleus );
delete originalTarget;
return &theParticleChange;
}
//
// Fermi motion and evaporation
// As of Geant3, the Fermi energy calculation had not been Done
//
G4double ek = originalIncident->GetKineticEnergy()/MeV;
G4double amas = originalIncident->GetDefinition()->GetPDGMass()/MeV;
G4double ek = originalIncident->GetKineticEnergy();
G4double amas = originalIncident->GetDefinition()->GetPDGMass();
G4ReactionProduct modifiedOriginal;
modifiedOriginal = *originalIncident;
G4double tkin = targetNucleus.Cinema( ek );
ek += tkin;
modifiedOriginal.SetKineticEnergy( ek*MeV );
modifiedOriginal.SetKineticEnergy(ek);
G4double et = ek + amas;
G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
G4double pp = modifiedOriginal.GetMomentum().mag()/MeV;
if( pp > 0.0 )
{
G4double pp = modifiedOriginal.GetMomentum().mag();
if (pp > 0.0) {
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
//
// calculate black track energies
//
tkin = targetNucleus.EvaporationEffects( ek );
tkin = targetNucleus.EvaporationEffects(ek);
ek -= tkin;
modifiedOriginal.SetKineticEnergy( ek*MeV );
modifiedOriginal.SetKineticEnergy(ek);
et = ek + amas;
p = std::sqrt( std::abs((et-amas)*(et+amas)) );
pp = modifiedOriginal.GetMomentum().mag()/MeV;
if( pp > 0.0 )
{
pp = modifiedOriginal.GetMomentum().mag();
if (pp > 0.0) {
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
const G4double cutOff = 0.1;
if( modifiedOriginal.GetKineticEnergy()/MeV <= cutOff )
{
if (modifiedOriginal.GetKineticEnergy() < cutOff) {
SlowProton( originalIncident, targetNucleus );
delete originalTarget;
return &theParticleChange;
@@ -122,14 +106,13 @@ G4RPGProtonInelastic::ApplyYourself( const G4HadProjectile &aTrack,
G4int vecLen = 0;
vec.Initialize( 0 );
Cascade( vec, vecLen,
originalIncident, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic );
InitialCollision(vec, vecLen, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged);
CalculateMomenta( vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
targetNucleus, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic );
CalculateMomenta(vec, vecLen,
originalIncident, originalTarget, modifiedOriginal,
targetNucleus, currentParticle, targetParticle,
incidentHasChanged, targetHasChanged, quasiElastic);
SetUpChange( vec, vecLen,
currentParticle, targetParticle,
@@ -139,13 +122,14 @@ G4RPGProtonInelastic::ApplyYourself( const G4HadProjectile &aTrack,
return &theParticleChange;
}
void
G4RPGProtonInelastic::SlowProton(const G4HadProjectile *originalIncident,
G4Nucleus &targetNucleus )
{
const G4double A = targetNucleus.GetN(); // atomic weight
const G4double Z = targetNucleus.GetZ(); // atomic number
// G4double currentKinetic = originalIncident->GetKineticEnergy()/MeV;
// G4double currentKinetic = originalIncident->GetKineticEnergy();
//
// calculate Q-value of reactions
//
@@ -193,275 +177,118 @@ G4RPGProtonInelastic::SlowProton(const G4HadProjectile *originalIncident,
delete vec[i];
}
}
void G4RPGProtonInelastic::Cascade(
G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
const G4HadProjectile *originalIncident,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4bool &incidentHasChanged,
G4bool &targetHasChanged,
G4bool &quasiElastic )
// Initial Collision
// selects the particle types arising from the initial collision of
// the proton and target nucleon. Secondaries are assigned to forward
// and backward reaction hemispheres, but final state energies and
// momenta are not calculated here.
void
G4RPGProtonInelastic::InitialCollision(G4FastVector<G4ReactionProduct,256>& vec,
G4int& vecLen,
G4ReactionProduct& currentParticle,
G4ReactionProduct& targetParticle,
G4bool& incidentHasChanged,
G4bool& targetHasChanged)
{
// Derived from H. Fesefeldt's original FORTRAN code CASP
//
// Proton undergoes interaction with nucleon within a nucleus. Check if
// it is energetically possible to produce pions/kaons. In not, assume
// nuclear excitation occurs and input particle is degraded in energy. No
// other particles are produced.
// If reaction is possible, find the correct number of
// pions/protons/neutrons produced using an interpolation to multiplicity
// data. Replace some pions or protons/neutrons by kaons or strange
// baryons according to the average multiplicity per Inelastic reaction.
//
// The center of mass energy is based on the initial energy, before
// Fermi motion and evaporation effects are taken into account
//
const G4double mOriginal = originalIncident->GetDefinition()->GetPDGMass()/MeV;
const G4double etOriginal = originalIncident->GetTotalEnergy()/MeV;
const G4double targetMass = targetParticle.GetMass()/MeV;
G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal +
targetMass*targetMass +
2.0*targetMass*etOriginal );
G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal);
if( availableEnergy <= G4PionPlus::PionPlus()->GetPDGMass()/MeV )
{ // not energetically possible to produce pion(s)
quasiElastic = true;
return;
}
static G4bool first = true;
const G4int numMul = 1200;
const G4int numSec = 60;
static G4double protmul[numMul], protnorm[numSec]; // proton constants
static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants
// np = number of pi+, nm = number of pi-, nz = number of pi0
G4int counter, nt=0, np=0, nm=0, nz=0;
const G4double c = 1.25;
const G4double b[] = { 0.70, 0.35 };
if( first ) // compute normalization constants, this will only be Done once
{
first = false;
G4int i;
for( i=0; i<numMul; ++i )protmul[i] = 0.0;
for( i=0; i<numSec; ++i )protnorm[i] = 0.0;
counter = -1;
for( np=0; np<(numSec/3); ++np )
{
for( nm=std::max(0,np-2); nm<=np; ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt>0 && nt<=numSec )
{
protmul[counter] = Pmltpc(np,nm,nz,nt,b[0],c) /
(Factorial(2-np+nm)*Factorial(np-nm) );
protnorm[nt-1] += protmul[counter];
}
}
}
G4double KE = currentParticle.GetKineticEnergy()/GeV;
G4int mult;
G4int partType;
std::vector<G4int> fsTypes;
G4int part1;
G4int part2;
G4double testCharge;
G4double testBaryon;
G4double testStrange;
// Get particle types according to incident and target types
if (targetParticle.GetDefinition() == particleDef[pro]) {
mult = GetMultiplicityT1(KE);
fsTypes = GetFSPartTypesForPP(mult, KE);
part1 = fsTypes[0];
part2 = fsTypes[1];
currentParticle.SetDefinition(particleDef[part1]);
targetParticle.SetDefinition(particleDef[part2]);
if (part1 == pro) {
if (part2 == neu) {
if (G4UniformRand() > 0.5) {
incidentHasChanged = true;
targetParticle.SetDefinition(particleDef[part1]);
currentParticle.SetDefinition(particleDef[part2]);
} else {
targetHasChanged = true;
}
} else if (part2 > neu && part2 < xi0) {
targetHasChanged = true;
}
} else { // neutron
targetHasChanged = true;
incidentHasChanged = true;
}
for( i=0; i<numMul; ++i )neutmul[i] = 0.0;
for( i=0; i<numSec; ++i )neutnorm[i] = 0.0;
counter = -1;
for( np=0; np<numSec/3; ++np )
{
for( nm=std::max(0,np-1); nm<=(np+1); ++nm )
{
for( nz=0; nz<numSec/3; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt>0 && nt<=numSec )
{
neutmul[counter] = Pmltpc(np,nm,nz,nt,b[1],c) /
(Factorial(1-np+nm)*Factorial(1+np-nm) );
neutnorm[nt-1] += neutmul[counter];
}
}
}
testCharge = 2.0;
testBaryon = 2.0;
testStrange = 0.0;
} else { // target was a neutron
mult = GetMultiplicityT0(KE);
fsTypes = GetFSPartTypesForPN(mult, KE);
part1 = fsTypes[0];
part2 = fsTypes[1];
currentParticle.SetDefinition(particleDef[part1]);
targetParticle.SetDefinition(particleDef[part2]);
if (part1 == pro) {
if (part2 == pro) {
targetHasChanged = true;
} else if (part2 == neu) {
if (G4UniformRand() > 0.5) {
incidentHasChanged = true;
targetHasChanged = true;
targetParticle.SetDefinition(particleDef[part1]);
currentParticle.SetDefinition(particleDef[part2]);
}
} else { // hyperon
targetHasChanged = true;
}
} else { // neutron
incidentHasChanged = true;
if (part2 > neu && part2 < xi0) targetHasChanged = true;
}
for( i=0; i<numSec; ++i )
{
if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
}
} // end of initialization
const G4double expxu = 82.; // upper bound for arg. of exp
const G4double expxl = -expxu; // lower bound for arg. of exp
G4ParticleDefinition *aNeutron = G4Neutron::Neutron();
G4ParticleDefinition *aProton = G4Proton::Proton();
G4int ieab = static_cast<G4int>(availableEnergy*5.0/GeV);
const G4double supp[] = {0.,0.4,0.55,0.65,0.75,0.82,0.86,0.90,0.94,0.98};
G4double test, w0, wp, wt, wm;
if( (availableEnergy < 2.0*GeV) && (G4UniformRand() >= supp[ieab]) )
{
// suppress high multiplicity events at low momentum
// only one pion will be produced
np = nm = nz = 0;
if( targetParticle.GetDefinition() == aProton )
{
test = std::exp( std::min( expxu, std::max(
expxl, -(1.0+b[0])*(1.0+b[0])/(2.0*c*c) ) ) );
w0 = test/2.0;
wp = test;
if( G4UniformRand() < w0/(w0+wp) )
nz = 1;
else
np = 1;
}
else // target is a neutron
{
test = std::exp( std::min( expxu, std::max(
expxl, -(1.0+b[1])*(1.0+b[1])/(2.0*c*c) ) ) );
w0 = test;
wp = test/2.0;
test = std::exp( std::min( expxu, std::max(
expxl, -(-1.0+b[1])*(-1.0+b[1])/(2.0*c*c) ) ) );
wm = test/2.0;
wt = w0+wp+wm;
wp += w0;
G4double ran = G4UniformRand();
if( ran < w0/wt )
nz = 1;
else if( ran < wp/wt )
np = 1;
else
nm = 1;
}
}
else // (availableEnergy >= 2.0*GeV) || (random number < supp[ieab])
{
G4double n, anpn;
GetNormalizationConstant( availableEnergy, n, anpn );
G4double ran = G4UniformRand();
G4double dum, excs = 0.0;
if( targetParticle.GetDefinition() == aProton )
{
counter = -1;
for( np=0; np<numSec/3 && ran>=excs; ++np )
{
for( nm=std::max(0,np-2); nm<=np && ran>=excs; ++nm )
{
for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt>0 && nt<=numSec )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 )
{
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
}
else // target must be a neutron
{
counter = -1;
for( np=0; np<numSec/3 && ran>=excs; ++np )
{
for( nm=std::max(0,np-1); nm<=(np+1) && ran>=excs; ++nm )
{
for( nz=0; nz<numSec/3 && ran>=excs; ++nz )
{
if( ++counter < numMul )
{
nt = np+nm+nz;
if( nt>0 && nt<=numSec )
{
test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
if( std::fabs(dum) < 1.0 )
{
if( test >= 1.0e-10 )excs += dum*test;
} else {
excs += dum*test;
}
}
}
}
}
}
if( ran >= excs ) // 3 previous loops continued to the end
{
quasiElastic = true;
return;
}
}
np--; nm--; nz--;
}
if( targetParticle.GetDefinition() == aProton )
{
switch( np-nm )
{
case 1:
if( G4UniformRand() < 0.5 )
{
targetParticle.SetDefinitionAndUpdateE( aNeutron );
targetHasChanged = true;
} else {
currentParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
}
break;
case 2:
currentParticle.SetDefinitionAndUpdateE( aNeutron );
targetParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
targetHasChanged = true;
break;
default:
break;
}
}
else // target is a neutron
{
switch( np-nm )
{
case 0:
if( G4UniformRand() < 0.333333 )
{
currentParticle.SetDefinitionAndUpdateE( aNeutron );
targetParticle.SetDefinitionAndUpdateE( aProton );
incidentHasChanged = true;
targetHasChanged = true;
}
break;
case 1:
currentParticle.SetDefinitionAndUpdateE( aNeutron );
incidentHasChanged = true;
break;
default:
targetParticle.SetDefinitionAndUpdateE( aProton );
targetHasChanged = true;
break;
}
}
SetUpPions( np, nm, nz, vec, vecLen );
return;
testCharge = 1.0;
testBaryon = 2.0;
testStrange = 0.0;
}
/* end of file */
// Remove incident and target from fsTypes
fsTypes.erase(fsTypes.begin());
fsTypes.erase(fsTypes.begin());
// Remaining particles are secondaries. Put them into vec.
G4ReactionProduct* rp(0);
for(G4int i=0; i < mult-2; ++i ) {
partType = fsTypes[i];
rp = new G4ReactionProduct();
rp->SetDefinition(particleDef[partType]);
(G4UniformRand() < 0.5) ? rp->SetSide(-1) : rp->SetSide(1);
vec.SetElement(vecLen++, rp);
}
// Check conservation of charge, strangeness, baryon number
CheckQnums(vec, vecLen, currentParticle, targetParticle,
testCharge, testBaryon, testStrange);
return;
}
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGSigmaMinusInelastic.cc,v 1.1 2007/07/18 21:04:21 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGSigmaMinusInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGSigmaPlusInelastic.cc,v 1.1 2007/07/18 21:04:21 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGSigmaPlusInelastic.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGStrangeProduction.cc,v 1.1 2007/07/18 21:04:21 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGStrangeProduction.hh"
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGTwoBody.cc,v 1.2 2007/08/15 20:38:37 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGTwoBody.cc,v 1.4 2008/05/05 21:21:55 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGTwoBody.hh"
@@ -80,12 +80,10 @@ ReactionStage(const G4HadProjectile* /*originalIncident*/,
targetMass*targetMass +
2.0*targetMass*etCurrent ); // in GeV
if( (pCurrent < 0.1) || (cmEnergy < 0.01) ) // 2-body scattering not possible
{
if (cmEnergy < 0.01) { // 2-body scattering not possible
targetParticle.SetMass( 0.0 ); // flag that the target particle doesn't exist
}
else
{
} else {
// Projectile momentum in cm
G4double pf = targetMass*pCurrent/cmEnergy;
@@ -230,9 +228,9 @@ ReactionStage(const G4HadProjectile* /*originalIncident*/,
edta = targetNucleus.GetDTABlackTrackEnergy(); // was enp3 in fortran code
const G4double pnCutOff = 0.0001; // GeV
const G4double dtaCutOff = 0.0001; // GeV
const G4double kineticMinimum = 0.0001;
const G4double kineticFactor = -0.010;
G4double sprob = 0.0; // sprob = probability of self-absorption in heavy molecules
// const G4double kineticMinimum = 0.0001;
// const G4double kineticFactor = -0.010;
// G4double sprob = 0.0; // sprob = probability of self-absorption in heavy molecules
if( epnb >= pnCutOff )
{
npnb = G4Poisson( epnb/0.02 );
@@ -248,8 +246,7 @@ ReactionStage(const G4HadProjectile* /*originalIncident*/,
if (npnb == 0 && ndta == 0) npnb = 1;
AddBlackTrackParticles(epnb, npnb, edta, ndta, sprob, kineticMinimum,
kineticFactor, modifiedOriginal,
AddBlackTrackParticles(epnb, npnb, edta, ndta, modifiedOriginal,
PinNucleus, NinNucleus, targetNucleus,
vec, vecLen);
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4RPGTwoCluster.cc,v 1.2 2007/08/15 20:38:48 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4RPGTwoCluster.cc,v 1.5 2008/06/09 18:13:35 dennis Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGTwoCluster.hh"
@@ -127,7 +127,7 @@ ReactionStage(const G4HadProjectile* originalIncident,
G4double backwardMass = targetParticle.GetMass()/GeV;
G4double bMass = backwardMass;
G4int backwardNucleonCount = 1; // number of nucleons in backward hemisphere
// G4int backwardNucleonCount = 1; // number of nucleons in backward hemisphere
for( i=0; i<vecLen; ++i )
{
@@ -162,9 +162,9 @@ ReactionStage(const G4HadProjectile* originalIncident,
G4int nuclearExcitationCount = G4Poisson( xtarg );
if(atomicWeight<1.0001) nuclearExcitationCount = 0;
G4int extraNucleonCount = 0;
G4double extraMass = 0.0;
G4double extraNucleonMass = 0.0;
// G4int extraNucleonCount = 0;
// G4double extraMass = 0.0;
// G4double extraNucleonMass = 0.0;
if( nuclearExcitationCount > 0 )
{
G4int momentumBin = std::min( 4, G4int(pOriginal/3.0) );
@@ -182,9 +182,9 @@ ReactionStage(const G4HadProjectile* originalIncident,
pVec->SetDefinition( aProton );
else
pVec->SetDefinition( aNeutron );
++backwardNucleonCount;
++extraNucleonCount;
extraNucleonMass += pVec->GetMass()/GeV;
// Not used ++backwardNucleonCount;
// Not used ++extraNucleonCount;
// Not used extraNucleonMass += pVec->GetMass()/GeV;
}
else
{ // add a pion
@@ -195,15 +195,22 @@ ReactionStage(const G4HadProjectile* originalIncident,
pVec->SetDefinition( aPiZero );
else
pVec->SetDefinition( aPiMinus );
// DHW: add following two lines to correct energy balance
// ++backwardCount;
// backwardMass += pVec->GetMass()/GeV;
}
pVec->SetSide( -2 ); // backside particle
extraMass += pVec->GetMass()/GeV;
// Not used extraMass += pVec->GetMass()/GeV;
pVec->SetNewlyAdded( true );
vec.SetElement( vecLen++, pVec );
}
}
// Masses of particles added from cascade not included in energy balance
// Masses of particles added from cascade not included in energy balance.
// That's correct for nucleons from the intra-nuclear cascade but not for
// pions from the cascade.
G4double forwardEnergy = (centerofmassEnergy-cMass-bMass)/2.0 +cMass - forwardMass;
G4double backwardEnergy = (centerofmassEnergy-cMass-bMass)/2.0 +bMass - backwardMass;
G4double eAvailable = centerofmassEnergy - (forwardMass+backwardMass);
@@ -778,13 +785,13 @@ ReactionStage(const G4HadProjectile* originalIncident,
const G4double pnCutOff = 0.001; // GeV
const G4double dtaCutOff = 0.001; // GeV
const G4double kineticMinimum = 1.e-6;
const G4double kineticFactor = -0.005;
// const G4double kineticMinimum = 1.e-6;
// const G4double kineticFactor = -0.005;
G4double sprob = 0.0; // sprob = probability of self-absorption in
// G4double sprob = 0.0; // sprob = probability of self-absorption in
// heavy molecules
const G4double ekIncident = originalIncident->GetKineticEnergy()/GeV;
if( ekIncident >= 5.0 )sprob = std::min( 1.0, 0.6*std::log(ekIncident-4.0) );
// Not currently used (DHW 9 June 2008) const G4double ekIncident = originalIncident->GetKineticEnergy()/GeV;
// if( ekIncident >= 5.0 )sprob = std::min( 1.0, 0.6*std::log(ekIncident-4.0) );
if( epnb >= pnCutOff )
{
@@ -802,8 +809,7 @@ ReactionStage(const G4HadProjectile* originalIncident,
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
AddBlackTrackParticles(epnb, npnb, edta, ndta, sprob, kineticMinimum,
kineticFactor, modifiedOriginal,
AddBlackTrackParticles(epnb, npnb, edta, ndta, modifiedOriginal,
PinNucleus, NinNucleus, targetNucleus,
vec, vecLen );
// DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen);
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4RPGXiMinusInelastic.cc,v 1.1 2007/07/18 21:04:21 dennis Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
#include "G4RPGXiMinusInelastic.hh"