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

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 8.5 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#include "G4HadTmpUtil.hh"
68
69#include <iomanip>
70
71
72G4GeneralSpaceNNCrossSection::G4GeneralSpaceNNCrossSection ()
73{
74  protonInelastic = new G4ProtonInelasticCrossSection();
75  ionProton       = new G4IonProtonCrossSection();
76  TripathiGeneral = new G4TripathiCrossSection();
77  TripathiLight   = new G4TripathiLightCrossSection();
78  Shen            = new G4IonsShenCrossSection();
79 
80  return;
81}
82
83
84G4GeneralSpaceNNCrossSection::~G4GeneralSpaceNNCrossSection ()
85{
86  delete protonInelastic;
87  delete ionProton;
88  delete TripathiGeneral;
89  delete TripathiLight;
90  delete Shen;
91}
92///////////////////////////////////////////////////////////////////////////////
93//
94
95G4bool G4GeneralSpaceNNCrossSection::IsIsoApplicable
96 (const G4DynamicParticle* theProjectile, G4int ZZ, G4int AA)
97{
98  G4bool result = protonInelastic->IsIsoApplicable(theProjectile, ZZ, AA);
99  if (!result)
100  {
101    result = ionProton->IsIsoApplicable(theProjectile, ZZ, AA);
102    if (!result)
103    {
104      result = TripathiGeneral->IsIsoApplicable(theProjectile, ZZ, AA);
105      if (!result)
106        result = Shen->IsIsoApplicable(theProjectile, ZZ, AA);
107    }
108  }
109  return result;
110}
111
112G4bool G4GeneralSpaceNNCrossSection::IsApplicable
113  (const G4DynamicParticle* theProjectile, const G4Element* theTarget)
114{
115  G4bool result = protonInelastic->IsApplicable(theProjectile, theTarget);
116  if (!result)
117  {
118    result = ionProton->IsApplicable(theProjectile, theTarget);
119    if (!result)
120    {
121      result = TripathiGeneral->IsApplicable(theProjectile, theTarget);
122      if (!result)
123        result = Shen->IsApplicable(theProjectile, theTarget);
124    }
125  }
126  return result;
127}
128///////////////////////////////////////////////////////////////////////////////
129//
130
131G4double G4GeneralSpaceNNCrossSection::GetCrossSection
132  (const G4DynamicParticle* theProjectile, const G4Element* theTarget,
133  G4double theTemperature)
134{
135  G4int nIso = theTarget->GetNumberOfIsotopes();
136  G4double xsection = 0;
137     
138  if (nIso) {
139    G4double sig;
140    G4IsotopeVector* isoVector = theTarget->GetIsotopeVector();
141    G4double* abundVector = theTarget->GetRelativeAbundanceVector();
142    G4int ZZ;
143    G4int AA;
144     
145    for (G4int i = 0; i < nIso; i++) {
146      ZZ = (*isoVector)[i]->GetZ();
147      AA = (*isoVector)[i]->GetN();
148      sig = GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
149      xsection += sig*abundVector[i];
150    }
151   
152  } else {
153    G4int ZZ = G4lrint(theTarget->GetZ());
154    G4int AA = G4lrint(theTarget->GetN());
155    xsection = GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
156  }
157   
158  return xsection;
159}
160
161
162G4double
163G4GeneralSpaceNNCrossSection::GetZandACrossSection(const G4DynamicParticle* theProjectile,
164                                                   G4int ZZ, G4int AA, G4double theTemperature)
165{
166  G4double result = 0.0;
167
168  const G4double AT = AA;
169  const G4double ZT = ZZ;
170  const G4double AP = theProjectile->GetDefinition()->GetBaryonNumber();
171  const G4double ZP = theProjectile->GetDefinition()->GetPDGCharge();
172
173  if (verboseLevel >= 2)
174  {
175    G4cout <<"In G4GeneralSpaceNNCrossSection::GetCrossSection" <<G4endl;
176    G4cout <<"Projectile A = " <<std::setw(8) <<AP
177           <<" Z = "           <<std::setw(8) <<ZP
178           <<" Energy = "      <<theProjectile->GetKineticEnergy()/AP
179           <<" MeV/nuc" <<G4endl;
180    G4cout <<"Target     A = " <<std::setw(8) <<AT
181           <<" Z = "           <<std::setw(8) <<ZT
182           <<G4endl;
183  }
184  if (theProjectile->GetDefinition()==G4Proton::Proton())
185  {
186    if (ZT>5)
187    {
188      result = protonInelastic->
189        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
190      if (verboseLevel >= 2)
191        G4cout <<"Selecting G4ProtonInelasticCrossSection" <<G4endl;
192    }
193    else
194    {
195      result = TripathiLight->
196        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
197      if (verboseLevel >= 2)
198        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
199    }
200  }
201  else if (AT==1 && ZT==1)
202  {
203    if (ZP>5)
204    {
205      result = ionProton->
206        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
207      if (verboseLevel >= 2)
208        G4cout <<"Selecting G4IonProtonCrossSection" <<G4endl;
209    }
210    else
211    {
212      result = TripathiLight->
213        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
214      if (verboseLevel >= 2)
215        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
216    }
217  }
218  else
219  {
220    if (TripathiLight->IsIsoApplicable(theProjectile, ZZ, AA))
221    {
222      result = TripathiLight->
223        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
224      if (verboseLevel >= 2)
225        G4cout <<"Selecting G4TripathiLightCrossSection" <<G4endl;
226    }
227    else if (TripathiGeneral->IsIsoApplicable(theProjectile, ZZ, AA))
228    {
229      result = TripathiGeneral->
230        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
231      if (verboseLevel >= 2)
232        G4cout <<"Selecting G4TripathiCrossSection" <<G4endl;
233    }
234    else if (Shen->IsIsoApplicable(theProjectile, ZZ, AA))
235    {
236      result = Shen->
237        GetZandACrossSection(theProjectile, ZZ, AA, theTemperature);
238      if (verboseLevel >= 2)
239        G4cout <<"Selecting G4IonsShenCrossSection" <<G4endl;
240    }
241  }
242  if (verboseLevel >= 2)
243  {
244    G4cout <<"Cross-section = " <<result/millibarn <<" mbarn" <<G4endl;
245    G4cout <<G4endl;
246  }
247
248  return result;
249}
250
Note: See TracBrowser for help on using the repository browser.