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/cross_sections/src/G4NeutronInelasticXS.cc

    r1337 r1340  
    2424// ********************************************************************
    2525//
    26 // $Id: G4NeutronInelasticXS.cc,v 1.4 2010/06/03 11:50:21 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4NeutronInelasticXS.cc,v 1.6 2010/10/15 22:35:32 dennis Exp $
     27// GEANT4 tag $Name: hadr-cross-V09-03-12 $
    2828//
    2929// -------------------------------------------------------------------
     
    4747#include "G4PhysicsVector.hh"
    4848#include "G4GlauberGribovCrossSection.hh"
     49#include "G4HadronNucleonXsc.hh"
    4950#include "G4NistManager.hh"
     51#include "G4Proton.hh"
    5052
    5153#include <iostream>
    5254#include <fstream>
    5355#include <sstream>
     56
    5457using namespace std;
    5558
    5659G4NeutronInelasticXS::G4NeutronInelasticXS()
    57 {
    58   verboseLevel = 0;
    59   G4cout  << "G4NeutronInelasticXS::G4NeutronInelasticXS: Initialise " << G4endl;
    60   for(G4int i=0; i<93; ++i) {
    61     data[i] = 0;
    62     coeff[i]= 1.0;
    63   }
     60  : proton(G4Proton::Proton()), maxZ(92)
     61{
     62  //  verboseLevel = 0;
     63  if(verboseLevel > 0){
     64    G4cout  << "G4NeutronInelasticXS::G4NeutronInelasticXS Initialise for Z < "
     65            << maxZ + 1 << G4endl;
     66  }
     67  data.resize(maxZ+1, 0);
     68  coeff.resize(maxZ+1, 1.0);
    6469  ggXsection = new G4GlauberGribovCrossSection();
     70  fNucleon = new G4HadronNucleonXsc();
    6571  isInitialized = false;
    6672}
     
    6874G4NeutronInelasticXS::~G4NeutronInelasticXS()
    6975{
    70   for(G4int i=0; i<92; ++i) {
     76  for(G4int i=0; i<=maxZ; ++i) {
    7177    delete data[i];
    7278  }
     
    8187
    8288G4bool
    83 G4NeutronInelasticXS::IsZAApplicable(const G4DynamicParticle*,
    84                                      G4double /*ZZ*/, G4double /*AA*/)
     89G4NeutronInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
     90                                      G4int /*ZZ*/, G4int /*AA*/)
    8591{
    8692  return false;
     
    97103
    98104  G4int Z = G4int(elm->GetZ());
     105  if(Z < 1 || Z > maxZ) { return xs; }
    99106  G4PhysicsVector* pv = data[Z];
    100107  //  G4cout  << "G4NeutronInelasticXS::GetCrossSection e= " << ekin << " Z= " << Z << G4endl;
     
    104111    Initialise(Z);
    105112    pv = data[Z];
    106     if(!pv) return xs;
     113    if(!pv) { return xs; }
    107114  }
    108115
    109116  G4double e1 = pv->Energy(0);
    110   if(ekin <= e1) return xs;
     117  if(ekin <= e1) { return xs; }
    111118
    112119  G4int n = pv->GetVectorLength() - 1;
     
    114121  if(ekin <= e2) {
    115122    xs = pv->Value(ekin);
     123  } else if(1 == Z) {
     124    fNucleon->GetHadronNucleonXscPDG(aParticle, proton);
     125    xs = coeff[1]*fNucleon->GetInelasticHadronNucleonXsc();
    116126  } else {         
    117127    ggXsection->GetCrossSection(aParticle, elm);
     
    119129  }
    120130
    121   if(verboseLevel > 0){
     131  if(verboseLevel > 0) {
    122132    G4cout  << "ekin= " << ekin << ",  XSinel= " << xs << G4endl;
    123133  }
     
    129139G4NeutronInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
    130140{
    131   G4cout << "G4NeutronInelasticXS::BuildPhysicsTable: " << G4endl;
    132   G4cout << p.GetParticleName() << G4endl;
    133   if(p.GetParticleName() != "neutron") {
    134     return;
    135   }
    136   if(isInitialized) return;
     141  if(verboseLevel > 0){
     142    G4cout << "G4NeutronInelasticXS::BuildPhysicsTable for "
     143           << p.GetParticleName() << G4endl;
     144  }
     145  if(isInitialized || p.GetParticleName() != "neutron") { return; }
    137146  isInitialized = true;
    138 
    139147
    140148  // check environment variable
     
    154162    for(size_t i=0; i<numOfElm; ++i) {
    155163      G4int Z = G4int(((*theElmTable)[i])->GetZ());
    156       if(Z < 1) Z = 1;
    157       else if(Z > 92) Z = 92;
     164      if(Z < 1)         { Z = 1; }
     165      else if(Z > maxZ) { Z = maxZ; }
    158166      //G4cout << "Z= " << Z << G4endl;
    159167      // Initialisation
     
    173181                                 const char* p)
    174182{
    175   if(data[Z]) return;
     183  if(data[Z]) { return; }
    176184  const char* path = p;
    177185  if(!p) {
     
    215223    G4double sig1 = (*data[Z])[n];
    216224    dynParticle->SetKineticEnergy(emax);
    217     ggXsection->GetCrossSection(dynParticle, Elem);
    218     G4double sig2 = ggXsection->GetInelasticGlauberGribovXsc();
     225    G4double sig2 = 0.0;
     226    if(1 == Z) {
     227      fNucleon->GetHadronNucleonXscPDG(dynParticle, proton);
     228      sig2 = fNucleon->GetInelasticHadronNucleonXsc();
     229    } else {
     230      ggXsection->GetCrossSection(dynParticle, Elem);
     231      sig2 = ggXsection->GetInelasticGlauberGribovXsc();
     232    }
    219233    if(sig2 > 0.) { coeff[Z] = sig1/sig2; }
    220234  }
Note: See TracChangeset for help on using the changeset viewer.