Message: Simulating Neutron Physics Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Simulating Neutron Physics 

Forum: Hadronic Processes
Date: 24 Mar, 2011
From: Evan Askanazi <Evan Askanazi>

So I am looking to simulate a neutron beam with the neutron going through gas targets like Helium 3 and a liquid H2 target and also trying to simulate it going through a neutron guide tube of nickel or similar metal. So My Physics List component of the program looks like this :

#include "PhysicsList.hh"
#include "PhysicsListMessenger.hh"

#include "PhysListEmStandard.hh"
#include "PhysListEmStandardSS.hh"
#include "PhysListEmStandardGS.hh"

#include "G4EmStandardPhysics.hh"
#include "G4EmStandardPhysics_option1.hh"
#include "G4EmStandardPhysics_option2.hh"
#include "G4EmStandardPhysics_option3.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"

#include "G4Decay.hh"
#include "StepMax.hh"

#include "G4HadronElasticProcess.hh"
#include "G4NeutronHPElasticData.hh"
#include "G4ProcessManager.hh"
#include "G4NeutronHPElastic.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"

#include "G4EmProcessOptions.hh"
#include "G4UnitsTable.hh"
#include "G4LossTableManager.hh"
#include "G4ParticleDefinition.hh"

// Bosons

#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
#include "G4Gamma.hh"
#include "G4OpticalPhoton.hh"

// leptons

#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"

#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Neutron.hh"
#include "G4AntiNeutron.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"

// Hadrons

#include "G4HadronElasticPhysics.hh"
#include "G4HadronDElasticPhysics.hh"
#include "G4HadronHElasticPhysics.hh"
#include "G4HadronQElasticPhysics.hh"
#include "G4HadronInelasticQBBC.hh"
#include "G4IonBinaryCascadePhysics.hh"

#include "HadronPhysicsFTFP_BERT.hh"
#include "HadronPhysicsFTF_BIC.hh"
#include "HadronPhysicsLHEP.hh"
#include "HadronPhysicsLHEP_EMV.hh"
#include "G4HadronInelasticQBBC.hh"
#include "HadronPhysicsQGSC_BERT.hh"
#include "HadronPhysicsQGSP.hh"
#include "HadronPhysicsQGSP_BERT.hh"
#include "HadronPhysicsQGSP_BERT_HP.hh"
#include "HadronPhysicsQGSP_BIC.hh"
#include "HadronPhysicsQGSP_BIC_HP.hh"
#include "HadronPhysicsQGSP_FTFP_BERT.hh"
#include "HadronPhysicsQGS_BIC.hh"

#include "G4HadronElasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"

#include "G4NeutronHPorLElastic.hh"
#include "G4NeutronHPorLElasticData.hh"
#include "G4NeutronHPorLEInelastic.hh"
#include "G4NeutronHPorLEInelasticData.hh"
#include "G4NeutronHPorLCapture.hh"
#include "G4NeutronHPorLCaptureData.hh"
#include "G4NeutronHPorLFission.hh"
#include "G4NeutronHPorLFissionData.hh"

#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PhysicsList::PhysicsList() : G4VModularPhysicsList()
{
  pMessenger = new PhysicsListMessenger(this); 

  // EM physics
  emName = G4String("local");
  emPhysicsList = new PhysListEmStandard(emName);

  defaultCutValue = 1.*mm;

  cutForGamma     = defaultCutValue;
  cutForElectron  = defaultCutValue;
  cutForPositron  = defaultCutValue;

 helIsRegisted  = false;
  bicIsRegisted  = false;
  biciIsRegisted = false;

  SetVerboseLevel(1);

  RegisterPhysics( new G4EmStandardPhysics(1));
  RegisterPhysics( new G4EmExtraPhysics("extra EM"));  
  RegisterPhysics( new G4DecayPhysics("decay",1) );
  RegisterPhysics( new G4HadronElasticPhysics("elastic",1,true));
   RegisterPhysics( new HadronPhysicsQGSP_BERT_HP("hadronQGSP_BERT_HP",true));

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PhysicsList::~PhysicsList()
{
  delete emPhysicsList;
  delete pMessenger;  
 for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::ConstructParticle()
{
  // pseudo-particles
  G4Geantino::GeantinoDefinition();
  G4ChargedGeantino::ChargedGeantinoDefinition();

  // gamma
  G4Gamma::GammaDefinition();

  // leptons
  G4Electron::ElectronDefinition();
  G4Positron::PositronDefinition();
  G4MuonPlus::MuonPlusDefinition();
  G4MuonMinus::MuonMinusDefinition();

  G4NeutrinoE::NeutrinoEDefinition();
  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
  G4NeutrinoMu::NeutrinoMuDefinition();
  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();  

G4Proton::ProtonDefinition();
  G4AntiProton::AntiProtonDefinition();
  G4Neutron::NeutronDefinition();
  G4AntiNeutron::AntiNeutronDefinition();

 G4PionPlus::PionPlusDefinition();
  G4PionMinus::PionMinusDefinition();

// mesons
  G4MesonConstructor mConstructor;
  mConstructor.ConstructParticle();

  // barions
  //  G4BaryonConstructor bConstructor;
  // bConstructor.ConstructParticle();

  // ions
  G4IonConstructor iConstructor;
  iConstructor.ConstructParticle();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::ConstructProcess()
{
  AddTransportation();
  emPhysicsList->ConstructProcess();

 ConstructAllInteractionProcesses();

 for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();

 AddDecay();  
  AddStepMax();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::ConstructAllInteractionProcesses()

{
G4ProcessManager* pManager = 0;
 pManager = G4Neutron::Neutron()->GetProcessManager();

G4HadronElasticProcess* neutronElasticProcess = new G4HadronElasticProcess();
   G4NeutronHPorLElastic* theHPElasticModel = new G4NeutronHPorLElastic();
   G4NeutronHPorLElasticData* theHPElasticData = new G4NeutronHPorLElasticData();
   neutronElasticProcess->RegisterMe(theHPElasticModel);
   neutronElasticProcess->AddDataSet(theHPElasticData);

G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess("inelastic-neutron");
   G4NeutronHPorLEInelastic* theHPInelasticModel = new G4NeutronHPorLEInelastic();
   G4NeutronHPorLEInelasticData* neutronHPInelasticCrossSection =new G4NeutronHPorLEInelasticData();
   neutronInelasticProcess->RegisterMe(theHPInelasticModel);
   neutronInelasticProcess->AddDataSet(neutronHPInelasticCrossSection);

G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess("fission-neutron");
   G4NeutronHPorLFission* neutronHPFissionModel = new G4NeutronHPorLFission();
   G4NeutronHPorLFissionData* neutronHPFissionCrossSection = new G4NeutronHPorLFissionData();
   neutronFissionProcess->RegisterMe(neutronHPFissionModel);
   neutronFissionProcess->AddDataSet(neutronHPFissionCrossSection);

G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess("capture-neutron");
   G4NeutronHPorLCapture* neutronHPCaptureModel = new G4NeutronHPorLCapture();
   G4NeutronHPorLCaptureData* neutronHPCaptureCrossSection = new G4NeutronHPorLCaptureData();
   neutronCaptureProcess->RegisterMe(neutronHPCaptureModel);
   neutronCaptureProcess->AddDataSet(neutronHPCaptureCrossSection);

   pManager->AddProcess(neutronElasticProcess);

   pManager->AddProcess(neutronCaptureProcess);
   pManager->AddProcess(neutronFissionProcess);
      pManager->DumpInfo();

}

void PhysicsList::AddDecay()
{
  // Add Decay Process

  G4Decay* fDecayProcess = new G4Decay();

  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();

    if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 

      pmanager ->AddProcess(fDecayProcess);

      // set ordering for PostStepDoIt and AtRestDoIt
      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);

    }
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::AddStepMax()
{
  // Step limitation seen as a process
  StepMax* stepMaxProcess = new StepMax();

  theParticleIterator->reset();
  while ((*theParticleIterator)()){
      G4ParticleDefinition* particle = theParticleIterator->value();
      G4ProcessManager* pmanager = particle->GetProcessManager();

      if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
        {
	  pmanager ->AddDiscreteProcess(stepMaxProcess);
        }
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::AddPhysicsList(const G4String& name)
{
  if (verboseLevel>-1) {
    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
  }

  if (name == emName) return;

  if (name == "local") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new PhysListEmStandard(name);

  } else if (name == "emstandard_opt0") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmStandardPhysics();

  } else if (name == "emstandard_opt1") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmStandardPhysics_option1();

  } else if (name == "emstandard_opt2") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmStandardPhysics_option2();

  } else if (name == "emstandard_opt3") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmStandardPhysics_option3();

  } else if (name == "standardSS") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new PhysListEmStandardSS(name);

  } 

 else if (name == "standardGS") {

    emName = name;
    delete emPhysicsList;
    emPhysicsList = new PhysListEmStandardGS(name);

  } else if (name == "empenelope"){
    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmPenelopePhysics();

  } else if (name == "emlivermore"){
    emName = name;
    delete emPhysicsList;
    emPhysicsList = new G4EmLivermorePhysics();

  } 

else if (name == "elastic" && !helIsRegisted) {
    hadronPhys.push_back( new G4HadronElasticPhysics());
    helIsRegisted = true;

  } else if (name == "DElastic" && !helIsRegisted) {
    hadronPhys.push_back( new G4HadronDElasticPhysics());
    helIsRegisted = true;

  } else if (name == "HElastic" && !helIsRegisted) {
    hadronPhys.push_back( new G4HadronHElasticPhysics());
    helIsRegisted = true;

  } else if (name == "QElastic" && !helIsRegisted) {
    hadronPhys.push_back( new G4HadronQElasticPhysics());
    helIsRegisted = true;

  } else if (name == "binary" && !bicIsRegisted) {
    hadronPhys.push_back(new G4HadronInelasticQBBC());
    bicIsRegisted = true;

  } else if (name == "binary_ion" && !biciIsRegisted) {
    hadronPhys.push_back(new G4IonBinaryCascadePhysics());
    biciIsRegisted = true;

  }

else {

    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
           << " is not defined"
           << G4endl;
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::SetCuts()
{
  if (verboseLevel >0){
    G4cout << "PhysicsList::SetCuts:";
    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
  }

  // set cut values for gamma at first and for e- second and next for e+,
  // because some processes for e+/e- need cut values for gamma
  SetCutValue(cutForGamma, "gamma");
  SetCutValue(cutForElectron, "e-");
  SetCutValue(cutForPositron, "e+");

  if (verboseLevel>0) DumpCutValuesTable();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::SetCutForGamma(G4double cut)
{
  cutForGamma = cut;
  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::SetCutForElectron(G4double cut)
{
  cutForElectron = cut;
  SetParticleCuts(cutForElectron, G4Electron::Electron());
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PhysicsList::SetCutForPositron(G4double cut)
{
  cutForPositron = cut;
  SetParticleCuts(cutForPositron, G4Positron::Positron());
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

And when i try to run it, the message I get when I type /run/initialize into the GEANT4 run command line is :

G4NeutronHPNames: Sorry, this material does not come near to any data.
G4NeutronHPNames: Please make sure G4NEUTRONHPDATA points to the
                  directory, the neutron scattering data are located in.
G4NeutronHPNames: The material was: A=1, Z=1
In src/G4NeutronHPNames.cc, line 243:

And it basically repeats this message for a bunch of materials. It still runs but it only shows the neutron transportation in the PhysicsList, no other process is shown. I also noticed that if I dont use the PorL option and just do G4NeutronHPElastic as opposed to G4NeutronHPorLElastic, that it does not run at all then i get the error message :

G4NeutronHPNames: Sorry, this material does not come near to any data.
G4NeutronHPNames: Please make sure NeutronHPCrossSections points to the
                  directory, the neutron scattering data are located in.
G4NeutronHPNames: The material was: A=1, Z=1
terminate called after throwing an instance of 'G4HadronicException'
  what():  19G4HadronicException
Aborted

I had thought this meant that I have the right variables pointing to my Geant4 library I have downloaded. I am using Geant4 version 4.9.4 if that hepls explain anything. I thought this had meant that is no high precision neutron data in the libraries and/or there is not enough evaluated data to make an entry. Is that what is happening or is something else wrong here ? I had thought there should be some neutron reactions but again they only get transported. Thank you for any help you may have.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Idea: Re: Simulating Neutron Physics   (Vladimir Ivanchenko - 25 Mar, 2011)
1 None: Re: Simulating Neutron Physics   (Koi, Tatsumi - 25 Mar, 2011)
1 None: Re: Simulating Neutron Physics   (Evan Askanazi - 25 Mar, 2011)
... 1 Message(s)
2 None: Re: Simulating Neutron Physics   (Evan Askanazi - 25 Mar, 2011)
 Add Message Add Message
to: "Simulating Neutron Physics"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]