source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclNuclei.cc @ 1316

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 5.4 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// * 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// $Id: G4InuclNuclei.cc,v 1.8 2010/04/07 17:28:35 mkelsey Exp $
26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
27//
28// 20100301  M. Kelsey -- Add function to create unphysical nuclei for use
29//           as temporary final-state fragments.
30// 20100319  M. Kelsey -- Add information message to makeNuclearFragment().
31//           Use new GetBindingEnergy() function instead of bindingEnergy().
32
33#include "G4InuclNuclei.hh"
34#include "G4InuclSpecialFunctions.hh"
35#include "G4Ions.hh"
36#include "G4ParticleDefinition.hh"
37#include "G4ParticleTable.hh"
38#include "G4HadTmpUtil.hh"
39#include "G4NucleiProperties.hh"
40#include <assert.h>
41#include <sstream>
42#include <map>
43
44using namespace G4InuclSpecialFunctions;
45
46
47// Convert nuclear configuration to standard GEANT4 pointer
48
49// WARNING:  Opposite conventions!  G4InuclNuclei uses (A,Z) everywhere, while
50//        G4ParticleTable::GetIon() uses (Z,A)!
51
52G4ParticleDefinition* 
53G4InuclNuclei::makeDefinition(G4double a, G4double z, G4double exc) {
54  G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
55  G4ParticleDefinition *pd = pTable->GetIon(G4int(z), G4int(a), exc);
56
57  // SPECIAL CASE:  Non-physical nuclear fragment, for final-state return
58  if (!pd) pd = makeNuclearFragment(a,z,exc);
59
60  return pd;
61}
62
63// Creates a non-physical pseudo-nucleus, for return as final-state fragment
64// from G4IntraNuclearCascader
65
66G4ParticleDefinition* 
67G4InuclNuclei::makeNuclearFragment(G4double a, G4double z, G4double exc) {
68  G4int na=G4int(a), nz=G4int(z), nn=na-nz;     // # nucleon, proton, neutron
69
70  // See G4IonTable.hh::GetNucleusEncoding for explanation
71  G4int code = ((100+nz)*1000 + na)*10 + (exc>0.)?1:0;
72
73  // Use local lookup table (see G4IonTable.hh) to maintain singletons
74  // NOTE:  G4ParticleDefinitions don't need to be explicitly deleted
75  //        (see comments in G4IonTable.cc::~G4IonTable)
76  static std::map<G4int, G4ParticleDefinition*> fragmentList;
77
78  if (fragmentList.find(code) != fragmentList.end()) return fragmentList[code];
79
80  // Name string follows format in G4IonTable.cc::GetIonName(Z,A,E)
81  std::stringstream zstr, astr, estr;
82  zstr << nz;
83  astr << na;
84  estr << G4int(1000*exc+0.5);  // keV in integer form
85
86  G4String name = "Z" + zstr.str() + "A" + astr.str();
87  if (exc>0.) name += "["+estr.str()+"]";
88
89  // Simple minded mass calculation use constants in CLHEP (all in MeV)
90  G4double mass = nz*proton_mass_c2 + nn*neutron_mass_c2
91    + G4NucleiProperties::GetBindingEnergy(G4lrint(a),G4lrint(z)) + exc;
92
93  //    Arguments for constructor are as follows
94  //               name             mass          width         charge
95  //             2*spin           parity  C-conjugation
96  //          2*Isospin       2*Isospin3       G-parity
97  //               type    lepton number  baryon number   PDG encoding
98  //             stable         lifetime    decay table
99  //             shortlived      subType    anti_encoding Excitation-energy
100
101  G4cout << " >>> G4InuclNuclei creating temporary fragment for evaporation "
102         << "with non-standard PDGencoding." << G4endl;
103
104  G4Ions* fragPD = new G4Ions(name,       mass, 0., z*eplus,
105                              0,          +1,   0,
106                              0,          0,    0,
107                              "nucleus",  0,    na, code,
108                              true,       0.,   0,
109                              true, "generic",  0,  exc);
110  fragPD->SetAntiPDGEncoding(0);
111
112  fragmentList[code] = fragPD;          // Store in table for next lookup
113  return fragPD;
114}
115
116G4double G4InuclNuclei::getNucleiMass(G4double a, G4double z) {
117  G4ParticleDefinition* pd = makeDefinition(a,z);
118  return pd ? pd->GetPDGMass()*MeV/GeV : 0.;    // From G4 to Bertini units
119}
120
121// Assignment operator for use with std::sort()
122G4InuclNuclei& G4InuclNuclei::operator=(const G4InuclNuclei& right) {
123  exitationEnergy = right.exitationEnergy;
124  theExitonConfiguration = right.theExitonConfiguration;
125  G4InuclParticle::operator=(right);
126  return *this;
127}
Note: See TracBrowser for help on using the repository browser.