source: trunk/source/processes/hadronic/cross_sections/src/G4GeneralSpaceNNCrossSection.cc @ 1253

Last change on this file since 1253 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 8.6 KB
Line 
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// *                                                                  *
21// * Parts of this code which have been  developed by QinetiQ Ltd     *
22// * under contract to the European Space Agency (ESA) are the        *
23// * intellectual property of ESA. Rights to use, copy, modify and    *
24// * redistribute this software for general public use are granted    *
25// * in compliance with any licensing, distribution and development   *
26// * policy adopted by the Geant4 Collaboration. This code has been   *
27// * written by QinetiQ Ltd for the European Space Agency, under ESA  *
28// * contract 17191/03/NL/LvH (Aurora Programme).                     *
29// *                                                                  *
30// * By using,  copying,  modifying or  distributing the software (or *
31// * any work based  on the software)  you  agree  to acknowledge its *
32// * use  in  resulting  scientific  publications,  and indicate your *
33// * acceptance of all terms of the Geant4 Software license.          *
34// ********************************************************************
35//
36// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37//
38// MODULE:              G4GeneralSpaceNNCrossSection.cc
39//
40// Version:             B.1
41// Date:                15/04/04
42// Author:              P R Truscott
43// Organisation:        QinetiQ Ltd, UK
44// Customer:            ESA/ESTEC, NOORDWIJK
45// Contract:            17191/03/NL/LvH
46//
47// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48//
49// CHANGE HISTORY
50// --------------
51//
52// 6 October 2003, P R Truscott, QinetiQ Ltd, UK
53// Created.
54//
55// 15 March 2004, P R Truscott, QinetiQ Ltd, UK
56// Beta release
57//
58// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59///////////////////////////////////////////////////////////////////////////////
60//
61#include "G4GeneralSpaceNNCrossSection.hh"
62#include "G4DynamicParticle.hh"
63#include "G4Element.hh"
64#include "G4ParticleDefinition.hh"
65#include "G4ParticleTable.hh"
66#include "G4IonTable.hh"
67
68#include <iomanip>
69///////////////////////////////////////////////////////////////////////////////
70//
71G4GeneralSpaceNNCrossSection::G4GeneralSpaceNNCrossSection ()
72{
73  protonInelastic = new G4ProtonInelasticCrossSection();
74  ionProton       = new G4IonProtonCrossSection();
75  TripathiGeneral = new G4TripathiCrossSection();
76  TripathiLight   = new G4TripathiLightCrossSection();
77  Shen            = new G4IonsShenCrossSection();
78 
79  return;
80}
81///////////////////////////////////////////////////////////////////////////////
82//
83G4GeneralSpaceNNCrossSection::~G4GeneralSpaceNNCrossSection ()
84{
85  delete protonInelastic;
86  delete ionProton;
87  delete TripathiGeneral;
88  delete TripathiLight;
89  delete Shen;
90}
91///////////////////////////////////////////////////////////////////////////////
92//
93
94G4bool G4GeneralSpaceNNCrossSection::IsZAApplicable
95 (const G4DynamicParticle* theProjectile, G4double ZZ, G4double AA)
96{
97  G4bool result = protonInelastic->IsZAApplicable(theProjectile, ZZ, AA);
98  if (!result)
99  {
100    result = ionProton->IsZAApplicable(theProjectile, ZZ, AA);
101    if (!result)
102    {
103      result = TripathiGeneral->IsZAApplicable(theProjectile, ZZ, AA);
104      if (!result)
105        result = Shen->IsZAApplicable(theProjectile, ZZ, AA);
106    }
107  }
108  return result;
109}
110
111G4bool G4GeneralSpaceNNCrossSection::IsApplicable
112  (const G4DynamicParticle* theProjectile, const G4Element* theTarget)
113{
114  G4bool result = protonInelastic->IsApplicable(theProjectile, theTarget);
115  if (!result)
116  {
117    result = ionProton->IsApplicable(theProjectile, theTarget);
118    if (!result)
119    {
120      result = TripathiGeneral->IsApplicable(theProjectile, theTarget);
121      if (!result)
122        result = Shen->IsApplicable(theProjectile, theTarget);
123    }
124  }
125  return result;
126}
127///////////////////////////////////////////////////////////////////////////////
128//
129
130G4double G4GeneralSpaceNNCrossSection::GetCrossSection
131  (const G4DynamicParticle* theProjectile, const G4Element* theTarget,
132  G4double theTemperature)
133{
134  G4int nIso = theTarget->GetNumberOfIsotopes();
135  G4double xsection = 0;
136     
137  if (nIso) {
138    G4double sig;
139    G4IsotopeVector* isoVector = theTarget->GetIsotopeVector();
140    G4double* abundVector = theTarget->GetRelativeAbundanceVector();
141    G4double ZZ;
142    G4double AA;
143     
144    for (G4int i = 0; i < nIso; i++) {
145      ZZ = G4double( (*isoVector)[i]->GetZ() );
146      AA = G4double( (*isoVector)[i]->GetN() );
147      sig = GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
148      xsection += sig*abundVector[i];
149    }
150   
151  } else {
152    xsection =
153      GetIsoZACrossSection(theProjectile, theTarget->GetZ(), theTarget->GetN(),
154                           theTemperature);
155  }
156   
157  return xsection;
158}
159
160
161G4double G4GeneralSpaceNNCrossSection::GetIsoZACrossSection
162  (const G4DynamicParticle* theProjectile, G4double ZZ, G4double AA,
163   G4double theTemperature)
164{
165  G4double result = 0.0;
166
167  const G4double AT = AA;
168  const G4double ZT = ZZ;
169  const G4double AP = theProjectile->GetDefinition()->GetBaryonNumber();
170  const G4double ZP = theProjectile->GetDefinition()->GetPDGCharge();
171
172  if (verboseLevel >= 2)
173  {
174    G4cout <<"In G4GeneralSpaceNNCrossSection::GetCrossSection" <<G4endl;
175    G4cout <<"Projectile A = " <<std::setw(8) <<AP
176           <<" Z = "           <<std::setw(8) <<ZP
177           <<" Energy = "      <<theProjectile->GetKineticEnergy()/AP
178           <<" MeV/nuc" <<G4endl;
179    G4cout <<"Target     A = " <<std::setw(8) <<AT
180           <<" Z = "           <<std::setw(8) <<ZT
181           <<G4endl;
182  }
183  if (theProjectile->GetDefinition()==G4Proton::Proton())
184  {
185    if (ZT>5)
186    {
187      result = protonInelastic->
188        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
189      if (verboseLevel >= 2)
190        G4cout <<"Selecting G4ProtonInelasticCrossSection" <<G4endl;
191    }
192    else
193    {
194      result = TripathiLight->
195        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
196      if (verboseLevel >= 2)
197        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
198    }
199  }
200  else if (AT==1 && ZT==1)
201  {
202    if (ZP>5)
203    {
204      result = ionProton->
205        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
206      if (verboseLevel >= 2)
207        G4cout <<"Selecting G4IonProtonCrossSection" <<G4endl;
208    }
209    else
210    {
211      result = TripathiLight->
212        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
213      if (verboseLevel >= 2)
214        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
215    }
216  }
217  else
218  {
219    if (TripathiLight->IsZAApplicable(theProjectile, ZZ, AA))
220    {
221      result = TripathiLight->
222        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
223      if (verboseLevel >= 2)
224        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
225    }
226    else if (TripathiGeneral->IsZAApplicable(theProjectile, ZZ, AA))
227    {
228      result = TripathiGeneral->
229        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
230      if (verboseLevel >= 2)
231        G4cout <<"Selecting G4TripathiCrossSection" <<G4endl;
232    }
233    else if (Shen->IsZAApplicable(theProjectile, ZZ, AA))
234    {
235      result = Shen->
236        GetIsoZACrossSection(theProjectile, ZZ, AA, theTemperature);
237      if (verboseLevel >= 2)
238        G4cout <<"Selecting G4IonsShenCrossSection" <<G4endl;
239    }
240  }
241  if (verboseLevel >= 2)
242  {
243    G4cout <<"Cross-section = " <<result/millibarn <<" mbarn" <<G4endl;
244    G4cout <<G4endl;
245  }
246
247  return result;
248}
249///////////////////////////////////////////////////////////////////////////////
250//
Note: See TracBrowser for help on using the repository browser.