Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclNuclei.cc

    r1337 r1340  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
    25 //
    26 // $Id: G4InuclNuclei.cc,v 1.8.2.1 2010/06/25 09:44:42 gunter Exp $
    27 // Geant4 tag: $Name: geant4-09-04-beta-01 $
     25// $Id: G4InuclNuclei.cc,v 1.22 2010/09/25 06:44:30 mkelsey Exp $
     26// Geant4 tag: $Name: hadr-casc-V09-03-85 $
    2827//
    2928// 20100301  M. Kelsey -- Add function to create unphysical nuclei for use
     
    3130// 20100319  M. Kelsey -- Add information message to makeNuclearFragment().
    3231//           Use new GetBindingEnergy() function instead of bindingEnergy().
     32// 20100622  M. Kelsey -- Use local "bindingEnergy()" function to call through.
     33// 20100627  M. Kelsey -- Test for non-physical fragments and abort job.
     34// 20100630  M. Kelsey -- Use excitation energy in G4Ions
     35// 20100714  M. Kelsey -- Use G4DynamicParticle::theDynamicalMass to deal with
     36//           excitation energy without instantianting "infinite" G4PartDefns.
     37// 20100719  M. Kelsey -- Change excitation energy without altering momentum
     38// 20100906  M. Kelsey -- Add fill() functions to rewrite contents
     39// 20100910  M. Kelsey -- Add clearExitonConfiguration() to fill() functions
     40// 20100914  M. Kelsey -- Make printout symmetric with G4InuclElemPart,
     41//              migrate to integer A and Z
     42// 20100924  M. Kelsey -- Add constructor to copy G4Fragment input, and output
     43//              functions to create G4Fragment
    3344
    3445#include "G4InuclNuclei.hh"
     46#include "G4Fragment.hh"
     47#include "G4HadronicException.hh"
    3548#include "G4InuclSpecialFunctions.hh"
    3649#include "G4Ions.hh"
     50#include "G4IonTable.hh"
     51#include "G4NucleiProperties.hh"
    3752#include "G4ParticleDefinition.hh"
    3853#include "G4ParticleTable.hh"
    39 #include "G4HadTmpUtil.hh"
    40 #include "G4NucleiProperties.hh"
    4154#include <assert.h>
    4255#include <sstream>
     
    4659
    4760
     61// Convert contents from (via constructor) and to G4Fragment
     62
     63G4InuclNuclei::G4InuclNuclei(const G4Fragment& aFragment, G4int model)
     64  : G4InuclParticle(makeDefinition(aFragment.GetA_asInt(),
     65                                   aFragment.GetZ_asInt()),
     66                    aFragment.GetMomentum()/GeV) {      // Bertini units
     67  setExitationEnergy(aFragment.GetExcitationEnergy());
     68  setModel(model);
     69
     70  // Exciton configuration must be set by hand
     71  theExitonConfiguration.protonQuasiParticles = aFragment.GetNumberOfCharged();
     72
     73  theExitonConfiguration.neutronQuasiParticles =
     74    aFragment.GetNumberOfCharged() - aFragment.GetNumberOfCharged();
     75
     76  // Split hole count evenly between protons and neutrons (arbitrary!)
     77  theExitonConfiguration.protonHoles = aFragment.GetNumberOfHoles()/2;
     78
     79  theExitonConfiguration.neutronHoles =
     80    aFragment.GetNumberOfHoles() - theExitonConfiguration.protonHoles;
     81}
     82
     83// FIXME:  Should we have a local buffer and return by const-reference instead?
     84G4Fragment G4InuclNuclei::makeG4Fragment() const {
     85  G4Fragment frag(getA(), getZ(), getMomentum()*GeV);   // From Bertini units
     86
     87  // Note:  exciton configuration has to be set piece by piece
     88  frag.SetNumberOfHoles(theExitonConfiguration.protonHoles
     89                        + theExitonConfiguration.neutronHoles);
     90
     91  frag.SetNumberOfParticles(theExitonConfiguration.protonQuasiParticles
     92                            + theExitonConfiguration.neutronQuasiParticles);
     93
     94  frag.SetNumberOfCharged(theExitonConfiguration.protonQuasiParticles);
     95
     96  return frag;
     97}
     98
     99G4InuclNuclei::operator G4Fragment() const {
     100  return makeG4Fragment();
     101}
     102
     103
     104// Overwrite data structure (avoids creating/copying temporaries)
     105
     106void G4InuclNuclei::fill(const G4LorentzVector& mom, G4int a, G4int z,
     107                         G4double exc, G4int model) {
     108  setDefinition(makeDefinition(a,z));
     109  setMomentum(mom);
     110  setExitationEnergy(exc);
     111  clearExitonConfiguration();
     112  setModel(model);
     113}
     114
     115void G4InuclNuclei::fill(G4double ekin, G4int a, G4int z, G4double exc,
     116                         G4int model) {
     117  setDefinition(makeDefinition(a,z));
     118  setKineticEnergy(ekin);
     119  setExitationEnergy(exc);
     120  clearExitonConfiguration();
     121  setModel(model);
     122}
     123
     124
     125// Change excitation energy while keeping momentum vector constant
     126
     127void G4InuclNuclei::setExitationEnergy(G4double e) {
     128  G4double ekin = getKineticEnergy();           // Current kinetic energy
     129
     130  G4double emass = getNucleiMass() + e*MeV/GeV; // From Bertini to G4 units
     131
     132  // Directly compute new kinetic energy from old
     133  G4double ekin_new = std::sqrt(emass*emass + ekin*(2.*getMass()+ekin)) - emass;
     134
     135  setMass(emass);              // Momentum is computed from mass and Ekin
     136  setKineticEnergy(ekin_new);
     137}
     138
     139
    48140// Convert nuclear configuration to standard GEANT4 pointer
    49141
     
    51143//        G4ParticleTable::GetIon() uses (Z,A)!
    52144
    53 G4ParticleDefinition*
    54 G4InuclNuclei::makeDefinition(G4double a, G4double z, G4double exc) {
     145G4ParticleDefinition* G4InuclNuclei::makeDefinition(G4int a, G4int z) {
    55146  G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
    56   G4ParticleDefinition *pd = pTable->GetIon(G4int(z), G4int(a), exc);
     147  G4ParticleDefinition *pd = pTable->GetIon(z, a, 0.);
    57148
    58149  // SPECIAL CASE:  Non-physical nuclear fragment, for final-state return
    59   if (!pd) pd = makeNuclearFragment(a,z,exc);
    60 
    61   return pd;
    62 }
     150  if (!pd) pd = makeNuclearFragment(a,z);
     151
     152  return pd;            // This could return a null pointer if above fails
     153}
     154
     155// Creates a non-standard excited nucleus
    63156
    64157// Creates a non-physical pseudo-nucleus, for return as final-state fragment
     
    66159
    67160G4ParticleDefinition*
    68 G4InuclNuclei::makeNuclearFragment(G4double a, G4double z, G4double exc) {
    69   G4int na=G4int(a), nz=G4int(z), nn=na-nz;     // # nucleon, proton, neutron
    70 
    71   // See G4IonTable.hh::GetNucleusEncoding for explanation
    72   G4int code = ((100+nz)*1000 + na)*10 + (exc>0.)?1:0;
     161G4InuclNuclei::makeNuclearFragment(G4int a, G4int z) {
     162  if (a<=0 || z<0 || a<z) {
     163    G4cerr << " >>> G4InuclNuclei::makeNuclearFragment() called with"
     164           << " impossible arguments A=" << a << " Z=" << z << G4endl;
     165    throw G4HadronicException(__FILE__, __LINE__,
     166                              "G4InuclNuclei impossible A/Z arguments");
     167  }
     168
     169  G4int code = G4IonTable::GetNucleusEncoding(z, a);
    73170
    74171  // Use local lookup table (see G4IonTable.hh) to maintain singletons
    75172  // NOTE:  G4ParticleDefinitions don't need to be explicitly deleted
    76173  //        (see comments in G4IonTable.cc::~G4IonTable)
     174
     175  // If correct nucleus already created return it
    77176  static std::map<G4int, G4ParticleDefinition*> fragmentList;
    78 
    79177  if (fragmentList.find(code) != fragmentList.end()) return fragmentList[code];
    80178
    81179  // Name string follows format in G4IonTable.cc::GetIonName(Z,A,E)
    82   std::stringstream zstr, astr, estr;
    83   zstr << nz;
    84   astr << na;
    85   estr << G4int(1000*exc+0.5);  // keV in integer form
    86 
     180  std::stringstream zstr, astr;
     181  zstr << z;
     182  astr << a;
     183 
    87184  G4String name = "Z" + zstr.str() + "A" + astr.str();
    88   if (exc>0.) name += "["+estr.str()+"]";
    89 
    90   // Simple minded mass calculation use constants in CLHEP (all in MeV)
    91   G4double mass = nz*proton_mass_c2 + nn*neutron_mass_c2
    92     + G4NucleiProperties::GetBindingEnergy(G4lrint(a),G4lrint(z)) + exc;
    93 
     185 
     186  G4double mass = getNucleiMass(a,z) *GeV/MeV;  // From Bertini to GEANT4 units
     187 
    94188  //    Arguments for constructor are as follows
    95189  //               name             mass          width         charge
     
    99193  //             stable         lifetime    decay table
    100194  //             shortlived      subType    anti_encoding Excitation-energy
    101 
     195 
    102196  G4cout << " >>> G4InuclNuclei creating temporary fragment for evaporation "
    103197         << "with non-standard PDGencoding." << G4endl;
    104 
     198 
    105199  G4Ions* fragPD = new G4Ions(name,       mass, 0., z*eplus,
    106                               0,          +1,   0,
     200                              0,          +1,   0,
    107201                              0,          0,    0,
    108                               "nucleus",  0,    na, code,
     202                              "nucleus",  0,    a, code,
    109203                              true,       0.,   0,
    110                               true, "generic",  0,  exc);
     204                              true, "generic",  0,  0.);
    111205  fragPD->SetAntiPDGEncoding(0);
    112206
    113   fragmentList[code] = fragPD;          // Store in table for next lookup
    114   return fragPD;
    115 }
    116 
    117 G4double G4InuclNuclei::getNucleiMass(G4double a, G4double z) {
    118   G4ParticleDefinition* pd = makeDefinition(a,z);
    119   return pd ? pd->GetPDGMass()*MeV/GeV : 0.;    // From G4 to Bertini units
     207  return (fragmentList[code] = fragPD);     // Store in table for next lookup
     208}
     209
     210G4double G4InuclNuclei::getNucleiMass(G4int a, G4int z, G4double exc) {
     211  // Simple minded mass calculation use constants in CLHEP (all in MeV)
     212  G4double mass = G4NucleiProperties::GetNuclearMass(a,z) + exc;
     213
     214  return mass*MeV/GeV;          // Convert from GEANT4 to Bertini units
    120215}
    121216
    122217// Assignment operator for use with std::sort()
    123218G4InuclNuclei& G4InuclNuclei::operator=(const G4InuclNuclei& right) {
    124   exitationEnergy = right.exitationEnergy;
    125219  theExitonConfiguration = right.theExitonConfiguration;
    126220  G4InuclParticle::operator=(right);
    127221  return *this;
    128222}
     223
     224// Dump particle properties for diagnostics
     225
     226void G4InuclNuclei::printParticle() const {
     227  G4InuclParticle::printParticle();
     228  G4cout << " Nucleus: " << getDefinition()->GetParticleName()
     229         << " A " << getA() << " Z " << getZ() << " mass " << getMass()
     230         << " Eex (MeV) " << getExitationEnergy() << G4endl;
     231}
Note: See TracChangeset for help on using the changeset viewer.