Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RPGPiPlusInelastic.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: G4RPGPiPlusInelastic.cc 79697 2014-03-12 13:10:09Z gcosmo $
27 //
28 
29 #include "G4RPGPiPlusInelastic.hh"
30 #include "G4SystemOfUnits.hh"
31 #include "Randomize.hh"
32 
35  G4Nucleus& targetNucleus)
36 {
37  const G4HadProjectile *originalIncident = &aTrack;
38  if (originalIncident->GetKineticEnergy()<= 0.1) {
42  return &theParticleChange;
43  }
44 
45  // create the target particle
46 
47  G4DynamicParticle *originalTarget = targetNucleus.ReturnTargetParticle();
48  G4ReactionProduct targetParticle( originalTarget->GetDefinition() );
49 
50  G4ReactionProduct currentParticle(originalIncident->GetDefinition() );
51  currentParticle.SetMomentum( originalIncident->Get4Momentum().vect() );
52  currentParticle.SetKineticEnergy( originalIncident->GetKineticEnergy() );
53 
54  // Fermi motion and evaporation
55  // As of Geant3, the Fermi energy calculation had not been Done
56 
57  G4double ek = originalIncident->GetKineticEnergy();
58  G4double amas = originalIncident->GetDefinition()->GetPDGMass();
59 
60  G4double tkin = targetNucleus.Cinema( ek );
61  ek += tkin;
62  currentParticle.SetKineticEnergy( ek );
63  G4double et = ek + amas;
64  G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) );
65  G4double pp = currentParticle.GetMomentum().mag();
66  if( pp > 0.0 )
67  {
68  G4ThreeVector momentum = currentParticle.GetMomentum();
69  currentParticle.SetMomentum( momentum * (p/pp) );
70  }
71 
72  // calculate black track energies
73 
74  tkin = targetNucleus.EvaporationEffects( ek );
75  ek -= tkin;
76  currentParticle.SetKineticEnergy( ek );
77  et = ek + amas;
78  p = std::sqrt( std::abs((et-amas)*(et+amas)) );
79  pp = currentParticle.GetMomentum().mag();
80  if( pp > 0.0 )
81  {
82  G4ThreeVector momentum = currentParticle.GetMomentum();
83  currentParticle.SetMomentum( momentum * (p/pp) );
84  }
85 
86  G4ReactionProduct modifiedOriginal = currentParticle;
87 
88  currentParticle.SetSide( 1 ); // incident always goes in forward hemisphere
89  targetParticle.SetSide( -1 ); // target always goes in backward hemisphere
90  G4bool incidentHasChanged = false;
91  G4bool targetHasChanged = false;
92  G4bool quasiElastic = false;
93  G4FastVector<G4ReactionProduct,256> vec; // vec will contain the secondary particles
94  G4int vecLen = 0;
95  vec.Initialize( 0 );
96 
97  const G4double cutOff = 0.1;
98  if( currentParticle.GetKineticEnergy() > cutOff )
99  InitialCollision(vec, vecLen, currentParticle, targetParticle,
100  incidentHasChanged, targetHasChanged);
101 
102  CalculateMomenta( vec, vecLen,
103  originalIncident, originalTarget, modifiedOriginal,
104  targetNucleus, currentParticle, targetParticle,
105  incidentHasChanged, targetHasChanged, quasiElastic );
106 
107  SetUpChange( vec, vecLen,
108  currentParticle, targetParticle,
109  incidentHasChanged );
110 
111  delete originalTarget;
112  return &theParticleChange;
113 }
114 
115 
116 // Initial Collision
117 // selects the particle types arising from the initial collision of
118 // the projectile and target nucleon. Secondaries are assigned to
119 // forward and backward reaction hemispheres, but final state energies
120 // and momenta are not calculated here.
121 
122 void
123 G4RPGPiPlusInelastic::InitialCollision(G4FastVector<G4ReactionProduct,256>& vec,
124  G4int& vecLen,
125  G4ReactionProduct& currentParticle,
126  G4ReactionProduct& targetParticle,
127  G4bool& incidentHasChanged,
128  G4bool& targetHasChanged)
129 {
130  G4double KE = currentParticle.GetKineticEnergy()/GeV;
131 
132  G4int mult;
133  G4int partType;
134  std::vector<G4int> fsTypes;
135 
136  G4double testCharge;
137  G4double testBaryon;
138  G4double testStrange;
139 
140  // Get particle types according to incident and target types
141 
142  if (targetParticle.GetDefinition() == particleDef[pro]) {
143  mult = GetMultiplicityT32(KE);
144  fsTypes = GetFSPartTypesForPipP(mult, KE);
145  partType = fsTypes[0];
146  if (partType != pro) {
147  targetHasChanged = true;
148  targetParticle.SetDefinition(particleDef[partType]);
149  }
150 
151  testCharge = 2.0;
152  testBaryon = 1.0;
153  testStrange = 0.0;
154 
155  } else { // target was a neutron
156  mult = GetMultiplicityT12(KE);
157  fsTypes = GetFSPartTypesForPipN(mult, KE);
158  partType = fsTypes[0];
159  if (partType != neu) {
160  targetHasChanged = true;
161  targetParticle.SetDefinition(particleDef[partType]);
162  }
163 
164  testCharge = 1.0;
165  testBaryon = 1.0;
166  testStrange = 0.0;
167  }
168 
169  // Remove target particle from list
170 
171  fsTypes.erase(fsTypes.begin());
172 
173  // See if the incident particle changed type
174 
175  G4int choose = -1;
176  for(G4int i=0; i < mult-1; ++i ) {
177  partType = fsTypes[i];
178  if (partType == pip) {
179  choose = i;
180  break;
181  }
182  }
183  if (choose == -1) {
184  incidentHasChanged = true;
185  choose = G4int(G4UniformRand()*(mult-1) );
186  partType = fsTypes[choose];
187  currentParticle.SetDefinition(particleDef[partType]);
188  }
189  fsTypes.erase(fsTypes.begin()+choose);
190 
191  // Remaining particles are secondaries. Put them into vec.
192  // Improve this by randomizing secondary order, then alternate
193  // which secondary is put into forward or backward hemisphere
194 
195  G4ReactionProduct* rp(0);
196  for(G4int i=0; i < mult-2; ++i ) {
197  partType = fsTypes[i];
198  rp = new G4ReactionProduct();
199  rp->SetDefinition(particleDef[partType]);
200  (G4UniformRand() < 0.5) ? rp->SetSide(-1) : rp->SetSide(1);
201  if (partType > pim && partType < pro) rp->SetMayBeKilled(false); // kaons
202  vec.SetElement(vecLen++, rp);
203  }
204 
205  // if (mult == 2 && !incidentHasChanged && !targetHasChanged)
206  // quasiElastic = true;
207 
208  // Check conservation of charge, strangeness, baryon number
209 
210  CheckQnums(vec, vecLen, currentParticle, targetParticle,
211  testCharge, testBaryon, testStrange);
212 
213  return;
214 }
void SetElement(G4int anIndex, Type *anElement)
Definition: G4FastVector.hh:76
G4double EvaporationEffects(G4double kineticEnergy)
Definition: G4Nucleus.cc:278
void SetUpChange(G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen, G4ReactionProduct &currentParticle, G4ReactionProduct &targetParticle, G4bool &incidentHasChanged)
void SetMomentum(const G4double x, const G4double y, const G4double z)
const char * p
Definition: xmltok.h:285
void SetSide(const G4int sid)
void 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)
G4ParticleDefinition * GetDefinition() const
void Initialize(G4int items)
Definition: G4FastVector.hh:63
int G4int
Definition: G4Types.hh:78
G4DynamicParticle * ReturnTargetParticle() const
Definition: G4Nucleus.cc:241
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetStatusChange(G4HadFinalStateStatus aS)
const G4ParticleDefinition * GetDefinition() const
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:97
const G4ParticleDefinition * GetDefinition() const
G4ParticleDefinition * particleDef[18]
std::vector< G4int > GetFSPartTypesForPipP(G4int mult, G4double KE) const
bool G4bool
Definition: G4Types.hh:79
G4double GetKineticEnergy() const
G4double ek
const G4LorentzVector & Get4Momentum() const
G4double GetKineticEnergy() const
void SetEnergyChange(G4double anEnergy)
std::vector< G4int > GetFSPartTypesForPipN(G4int mult, G4double KE) const
G4double GetPDGMass() const
Hep3Vector unit() const
G4double Cinema(G4double kineticEnergy)
Definition: G4Nucleus.cc:382
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
static constexpr double GeV
Definition: G4SIunits.hh:217
G4int GetMultiplicityT12(G4double KE) const
void CheckQnums(G4FastVector< G4ReactionProduct, 256 > &vec, G4int &vecLen, G4ReactionProduct &currentParticle, G4ReactionProduct &targetParticle, G4double Q, G4double B, G4double S)
double G4double
Definition: G4Types.hh:76
void SetMomentumChange(const G4ThreeVector &aV)
G4int GetMultiplicityT32(G4double KE) const