Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RPGPionSuppression.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4RPGPionSuppression.cc 79697 2014-03-12 13:10:09Z gcosmo $
27 //
28 
29 #include <iostream>
30 #include <signal.h>
31 
32 #include "G4RPGPionSuppression.hh"
33 #include "G4SystemOfUnits.hh"
34 #include "Randomize.hh"
36 
38  : G4RPGReaction() {}
39 
40 
42 ReactionStage(const G4HadProjectile* /*originalIncident*/,
43  G4ReactionProduct& modifiedOriginal,
44  G4bool& incidentHasChanged,
45  const G4DynamicParticle* /*originalTarget*/,
46  G4ReactionProduct& targetParticle,
47  G4bool& targetHasChanged,
48  const G4Nucleus& targetNucleus,
49  G4ReactionProduct& currentParticle,
51  G4int& vecLen,
52  G4bool /*leadFlag*/,
53  G4ReactionProduct& /*leadingStrangeParticle*/)
54 {
55  // This code was originally in the fortran code TWOCLU
56  //
57  // Suppress charged pions, for various reasons
58  //
59  G4double mOriginal = modifiedOriginal.GetMass()/GeV;
60  G4double etOriginal = modifiedOriginal.GetTotalEnergy()/GeV;
61  G4double targetMass = targetParticle.GetDefinition()->GetPDGMass()/GeV;
62  G4double cmEnergy = std::sqrt( mOriginal*mOriginal + targetMass*targetMass +
63  2.0*targetMass*etOriginal );
64  G4double eAvailable = cmEnergy - mOriginal - targetMass;
65  for (G4int i = 0; i < vecLen; i++) eAvailable -= vec[i]->GetMass()/GeV;
66 
67  const G4double atomicWeight = targetNucleus.GetA_asInt();
68  const G4double atomicNumber = targetNucleus.GetZ_asInt();
69  const G4double pOriginal = modifiedOriginal.GetTotalMomentum()/GeV;
70 
76  G4double piMass = aPiPlus->GetPDGMass()/GeV;
77  G4double nucleonMass = aNeutron->GetPDGMass()/GeV;
78 
79  const G4bool antiTest =
80  modifiedOriginal.GetDefinition() != G4AntiProton::AntiProton() &&
81  modifiedOriginal.GetDefinition() != G4AntiNeutron::AntiNeutron() &&
82  modifiedOriginal.GetDefinition() != G4AntiLambda::AntiLambda() &&
83  modifiedOriginal.GetDefinition() != G4AntiSigmaPlus::AntiSigmaPlus() &&
84  modifiedOriginal.GetDefinition() != G4AntiSigmaMinus::AntiSigmaMinus() &&
85  modifiedOriginal.GetDefinition() != G4AntiXiZero::AntiXiZero() &&
86  modifiedOriginal.GetDefinition() != G4AntiXiMinus::AntiXiMinus() &&
87  modifiedOriginal.GetDefinition() != G4AntiOmegaMinus::AntiOmegaMinus();
88 
89  if( antiTest && (
90  currentParticle.GetDefinition() == aPiPlus ||
91  currentParticle.GetDefinition() == aPiZero ||
92  currentParticle.GetDefinition() == aPiMinus ) &&
93  ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
94  ( G4UniformRand() <= atomicWeight/300.0 ) )
95  {
96  if (eAvailable > nucleonMass - piMass) {
97  if( G4UniformRand() > atomicNumber/atomicWeight )
98  currentParticle.SetDefinitionAndUpdateE( aNeutron );
99  else
100  currentParticle.SetDefinitionAndUpdateE( aProton );
101  incidentHasChanged = true;
102  }
103  }
104 
105  if( antiTest && (
106  targetParticle.GetDefinition() == aPiPlus ||
107  targetParticle.GetDefinition() == aPiZero ||
108  targetParticle.GetDefinition() == aPiMinus ) &&
109  ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
110  ( G4UniformRand() <= atomicWeight/300.0 ) )
111  {
112  if (eAvailable > nucleonMass - piMass) {
113  if( G4UniformRand() > atomicNumber/atomicWeight )
114  targetParticle.SetDefinitionAndUpdateE( aNeutron );
115  else
116  targetParticle.SetDefinitionAndUpdateE( aProton );
117  targetHasChanged = true;
118  }
119  }
120 
121  for( G4int i=0; i<vecLen; ++i )
122  {
123  if( antiTest && (
124  vec[i]->GetDefinition() == aPiPlus ||
125  vec[i]->GetDefinition() == aPiZero ||
126  vec[i]->GetDefinition() == aPiMinus ) &&
127  ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
128  ( G4UniformRand() <= atomicWeight/300.0 ) )
129  {
130  if (eAvailable > nucleonMass - piMass) {
131  if( G4UniformRand() > atomicNumber/atomicWeight )
132  vec[i]->SetDefinitionAndUpdateE( aNeutron );
133  else
134  vec[i]->SetDefinitionAndUpdateE( aProton );
135  }
136  }
137  }
138 
139  return true;
140 }
141 
142 
143  /* end of file */
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4double GetTotalMomentum() const
static G4AntiOmegaMinus * AntiOmegaMinus()
static G4AntiSigmaPlus * AntiSigmaPlus()
int G4int
Definition: G4Types.hh:78
static G4AntiSigmaMinus * AntiSigmaMinus()
const G4ParticleDefinition * GetDefinition() const
#define G4UniformRand()
Definition: Randomize.hh:97
G4bool ReactionStage(const G4HadProjectile *, G4ReactionProduct &, G4bool &, const G4DynamicParticle *, G4ReactionProduct &, G4bool &, const G4Nucleus &, G4ReactionProduct &, G4FastVector< G4ReactionProduct, 256 > &, G4int &, G4bool, G4ReactionProduct &)
static G4AntiProton * AntiProton()
Definition: G4AntiProton.cc:93
bool G4bool
Definition: G4Types.hh:79
static G4AntiXiMinus * AntiXiMinus()
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
void SetDefinitionAndUpdateE(const G4ParticleDefinition *aParticleDefinition)
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4PionZero * PionZero()
Definition: G4PionZero.cc:108
G4double GetTotalEnergy() const
G4double GetPDGMass() const
static G4AntiLambda * AntiLambda()
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
static constexpr double GeV
Definition: G4SIunits.hh:217
static G4AntiXiZero * AntiXiZero()
double G4double
Definition: G4Types.hh:76
G4double GetMass() const
static G4AntiNeutron * AntiNeutron()