Migration of old obsolete G4LowEnergyXXX process classes

The new Low Energy electromagnetic classes (Livermore, Penelope, Geant4-DNA) are available in the Geant4 toolkit since 2009. If you still encounter difficulties in migrating your code to these classes, please contact the Geant4 Low Energy electromagnetic Working group.

Thank you.

Contents of this page:

Purpose

Low-energy electromagnetic processes have been redesigned since the Geant4 9.3 BETA release in order to have the same model interface for all electromagnetic (EM) sub-packages: standard, Livermore, Penelope and Geant4-DNA. The main goal of this modification was to provide a possibility of combining best models from all EM packages per particle type, energy range, detector region. This migration improves a bit CPU performance and resolves long dating unsolved software flaws.

Old processes were kept for backward compatibility but after the 9.5 BETA version of Geant4, they will be fully removed, so migration of user code may be required. Users are now invited to use exclusively the new Livermore and Penelope models as explained below, or to use directly our Physics builders which implement directly these models.

Description of models

A detailed description of the Livermore and Penelope model classes is given at the following links:

Migration of Livermore Physics list

Before Geant4 9.3 BETA release, electron and gamma processes based on Livermore were added in the user code Physics list as:

#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyRayleigh.hh"

void PhysicsList::ConstructProcess()
{
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {
      pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric);
      pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
      pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
      pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
      
    } else if (particleName == "e-") {
      pmanager->AddProcess(new G4LowEnergyIonisation,     -1, 1, 1);
      pmanager->AddProcess(new G4LowEnergyBremsstrahlung, -1,-1, 2);
       
    } else if (particleName == "....

Instead, from Geant4 9.5 BETA, users should use the following code for photons (gammas) and electrons. This Physics list uses the new G4PhysicsListHelper tool.

#include "G4PhysicsListHelper.hh"

// gamma
#include "G4PhotoElectricEffect.hh"
#include "G4LivermorePhotoElectricModel.hh"

#include "G4ComptonScattering.hh"
#include "G4LivermoreComptonModel.hh"

#include "G4GammaConversion.hh"
#include "G4LivermoreGammaConversionModel.hh"

#include "G4RayleighScattering.hh" 
#include "G4LivermoreRayleighModel.hh"

// e-
#include "G4eMultipleScattering.hh"
#include "G4UniversalFluctuation.hh"

#include "G4eIonisation.hh"
#include "G4LivermoreIonisationModel.hh"

#include "G4eBremsstrahlung.hh"
#include "G4LivermoreBremsstrahlungModel.hh"

void PhysicsList::ConstructProcess()
{
  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {

      G4PhotoElectricEffect* thePhotoElectricEffect = new G4PhotoElectricEffect();
      thePhotoElectricEffect->SetModel(new G4LivermorePhotoElectricModel());
      ph->RegisterProcess(thePhotoElectricEffect, particle);

      G4ComptonScattering* theComptonScattering = new G4ComptonScattering();
      theComptonScattering->SetModel(new G4LivermoreComptonModel());
      ph->RegisterProcess(theComptonScattering, particle);

      G4GammaConversion* theGammaConversion = new G4GammaConversion();
      theGammaConversion->SetModel(new G4LivermoreGammaConversionModel());
      ph->RegisterProcess(theGammaConversion, particle);

      G4RayleighScattering* theRayleigh = new G4RayleighScattering();
      theRayleigh->SetModel(new G4LivermoreRayleighModel());
      ph->RegisterProcess(theRayleigh, particle);
    
    } else if (particleName == "e-") {

      G4eMultipleScattering* msc = new G4eMultipleScattering();
      ph->RegisterProcess(msc, particle);
      
      // Ionisation
      G4eIonisation* eIoni = new G4eIonisation();
      eIoni->SetEmModel(new G4LivermoreIonisationModel());
      eIoni->SetFluctModel(new G4UniversalFluctuation() );
      ph->RegisterProcess(eIoni, particle);
      
      // Bremsstrahlung
      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
      eBrem->SetEmModel(new G4LivermoreBremsstrahlungModel());
      ph->RegisterProcess(eBrem, particle);

    } else if (particleName == "....

Please follow the same procedure for Livermore polarized gamma models if you need them, or see our Physics builders below.

Migration of Penelope Physics list

Before Geant4 9.3 BETA release, electron, positron and gamma processes based on Penelope were added in the user code Physics list as:

#include "G4PenelopeCompton.hh"
#include "G4PenelopeGammaConversion.hh"
#include "G4PenelopePhotoElectric.hh"
#include "G4PenelopeRayleigh.hh"

#include "G4PenelopeIonisation.hh"
#include "G4PenelopeBremsstrahlung.hh"
#include "G4PenelopeAnnihilation.hh"


void PhysicsList::ConstructProcess()
{
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {
      pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric);
      pmanager->AddDiscreteProcess(new G4PenelopeCompton);
      pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion);
      pmanager->AddDiscreteProcess(new G4PenelopeRayleigh);
      
    } else if (particleName == "e-") {
      pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
      pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);
       
    } else if (particleName == "e+") {
      pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
      pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);      
      pmanager->AddProcess(new G4PenelopeAnnihilation,    0,-1, 3);

    } else if (particleName == "....

Instead, from Geant4 9.5 BETA, users should use the following code for photons (gammas), electrons and positrons. This Physics list uses the new G4PhysicsListHelper tool.

#include "G4PhysicsListHelper.hh"

// gamma
#include "G4PhotoElectricEffect.hh"
#include "G4PenelopePhotoElectricModel.hh"

#include "G4ComptonScattering.hh"
#include "G4PenelopeComptonModel.hh"

#include "G4GammaConversion.hh"
#include "G4PenelopeGammaConversionModel.hh"

#include "G4RayleighScattering.hh" 
#include "G4PenelopeRayleighModel.hh"

// e-
#include "G4eMultipleScattering.hh"
#include "G4UniversalFluctuation.hh"

#include "G4eIonisation.hh"
#include "G4PenelopeIonisationModel.hh"

#include "G4eBremsstrahlung.hh"
#include "G4PenelopeBremsstrahlungModel.hh"

// e+ only

#include "G4eplusAnnihilation.hh"
#include "G4PenelopeAnnihilationModel.hh"

void PhysicsList::ConstructProcess()
{
  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {

      G4PhotoElectricEffect* thePhotoElectricEffect = new G4PhotoElectricEffect();
      thePhotoElectricEffect->SetModel(new G4PenelopePhotoElectricModel());
      ph->RegisterProcess(thePhotoElectricEffect, particle);

      G4ComptonScattering* theComptonScattering = new G4ComptonScattering();
      theComptonScattering->SetModel(new G4PenelopeComptonModel());
      ph->RegisterProcess(theComptonScattering, particle);

      G4GammaConversion* theGammaConversion = new G4GammaConversion();
      theGammaConversion->SetModel(new G4PenelopeGammaConversionModel());
      ph->RegisterProcess(theGammaConversion, particle);

      G4RayleighScattering* theRayleigh = new G4RayleighScattering();
      theRayleigh->SetModel(new G4PenelopeRayleighModel());
      ph->RegisterProcess(theRayleigh, particle);
    
    } else if (particleName == "e-") {

      G4eMultipleScattering* msc = new G4eMultipleScattering();
      ph->RegisterProcess(msc, particle);
      
      // Ionisation
      G4eIonisation* eIoni = new G4eIonisation();
      eIoni->SetEmModel(new G4PenelopeIonisationModel());
      eIoni->SetFluctModel(new G4UniversalFluctuation() );
      ph->RegisterProcess(eIoni, particle);
      
      // Bremsstrahlung
      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
      eBrem->SetEmModel(new G4PenelopeBremsstrahlungModel());
      ph->RegisterProcess(eBrem, particle);

    } else if (particleName == "e+") {

      G4eMultipleScattering* msc = new G4eMultipleScattering();
      ph->RegisterProcess(msc, particle);
      
      // Ionisation
      G4eIonisation* eIoni = new G4eIonisation();
      eIoni->SetEmModel(new G4PenelopeIonisationModel());
      eIoni->SetFluctModel(new G4UniversalFluctuation() );
      ph->RegisterProcess(eIoni, particle);
      
      // Bremsstrahlung
      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
      eBrem->SetEmModel(new G4PenelopeBremsstrahlungModel());
      ph->RegisterProcess(eBrem, particle);

      //Annihilation
      G4eplusAnnihilation* eAnni = new G4eplusAnnihilation();
      eAnni->SetModel(new G4PenelopeAnnihilationModel());
      ph->RegisterProcess(eAnni, particle);

    } else if (particleName == ".....

Recommended Physics builders

We strongly suggest users to use directly our Physics builders which implement directly these Physics lists. In that case, the user does not need to write his/her own Physics list. At high energy, combination with standard electromagnetic Physics processes is provided.


Main Low Energy WG page

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r9 - 2012-06-13 - SebastienIncerti
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Geant4 All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback