Message: Re: AlongStep DoIt ordering for G4eplusAnnihilation process Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Re: AlongStep DoIt ordering for G4eplusAnnihilation process 

Forum: Physics List
Re: Question AlongStep DoIt ordering for G4eplusAnnihilation process (Maria Gatu Johnson)
Re: Idea Re: AlongStep DoIt ordering for G4eplusAnnihilation process (Vladimir Ivanchenko)
Date: 19 Dec, 2008
From: Maria Gatu Johnson <Maria Gatu Johnson>

Thanks Vladimir. I removed the line. Of course, like you anticipated, I also ran into other problems with my user Physics List file. First, K+ was not defined. I added K+ and K-, and now it complains that K0L is not defined. I do not see that K0L is defined in your G4EmStandardPhysics.cc either. I am running a neutron simulation and I am not really interested in kaons in this case. Why do I have to include them? Is there a way around the problem?

I know you said to use the predefined G4EmStandardPhysics.cc file, but the user Physics List that I have inherited includes a lot of custom stuff that I do not want to change. It runs fine with GEANT4.5.1. I add it to the end of this entry if you want to have a look.

Maria

*****************************************************

// Anders Hjalmarsson // // Construct/define particles and physics processes // 1999/12/02 GEANT4 program // // $Id: S1S2PhysList.cc

#include "S1S2PhysList.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "G4IonConstructor.hh"

S1S2PhysList::S1S2PhysList(): G4VUserPhysicsList(),
theNeutronElasticProcess(NULL), theNeutronInelasticProcess(NULL), 
aLENeutronElasticProcess(NULL), aLENeutronInelasticProcess(NULL),
theProtonInelasticProcess(NULL),
aLEProtonInelasticProcess(NULL), thePhotoElectricEffect(NULL),
theComptonScattering(NULL), eminusMultipleScattering(NULL),
eminusIonisation(NULL), ionIonisation(NULL),
aMultipleScattering(NULL), anIonisation(NULL),
theDecayProcess(NULL), theGammaConversion(NULL),
theAnnihilation(NULL), theBremsstrahlung(NULL),
eplusMultipleScattering(NULL),eplusIonisation(NULL),
eplusBremsstrahlung(NULL),theProtonElasticProcess(NULL)
{
  currentDefaultCut = defaultCutValue =0.01*mm;
  //currentDefaultCut = defaultCutValue =0.0001*mm;
  cutForGamma = defaultCutValue;
  cutForElectron = defaultCutValue;
  cutForProton = defaultCutValue;

  SetVerboseLevel(1);
}

S1S2PhysList::~S1S2PhysList()
{
    ;
}

void S1S2PhysList::ConstructParticle()
{
    ConstructBosons();
    ConstructLeptons();
    ConstructBarions();
    ConstructAllIons();
}

void S1S2PhysList::ConstructBosons()
{
    //gamma
    G4Gamma::GammaDefinition();

    //optical photon
    G4OpticalPhoton::OpticalPhotonDefinition();
}

void S1S2PhysList::ConstructLeptons()
{
    //electron
    G4Electron::ElectronDefinition();
    G4Positron::PositronDefinition();
}

void S1S2PhysList::ConstructBarions()
{
    //neutron
    G4Neutron::NeutronDefinition();

    //proton
    G4Proton::ProtonDefinition();
    G4AntiProton::AntiProtonDefinition();
}

void S1S2PhysList::ConstructAllIons()
{
  //  Construct light ions
  G4IonConstructor pConstructor;
  pConstructor.ConstructParticle();  
}

void S1S2PhysList::ConstructProcess()
{
    AddTransportation();
    ConstructGeneral();
    ConstructEM();
    ConstructHad();
    ConstructOp();
}

#include "G4PhotoElectricEffect.hh"
#include "G4ComptonScattering.hh"
#include "G4MultipleScattering.hh"
#include "G4eplusAnnihilation.hh"
#include "G4eIonisation.hh"
#include "G4hIonisation.hh"
#include "G4eBremsstrahlung.hh"
//#include "G4hIonisation.hh"

void S1S2PhysList::ConstructEM()
{
    theParticleIterator -> reset();
    while((*theParticleIterator)())
    {
        G4ParticleDefinition* particle = theParticleIterator -> value();
        G4ProcessManager* pmanager = particle -> GetProcessManager();
        G4String particleName = particle -> GetParticleName();
	if(particleName == "gamma")
	  {
	    //Construct processes for gamma
	    thePhotoElectricEffect = new G4PhotoElectricEffect();
	    theComptonScattering = new G4ComptonScattering();
	    theGammaConversion = new G4GammaConversion();
	    //Add processes for gamm
	    pmanager -> AddDiscreteProcess(thePhotoElectricEffect);
	    pmanager -> AddDiscreteProcess(theComptonScattering);
	    pmanager -> AddProcess(theGammaConversion);
	  }
	else if(particleName == "e-")
	  {
	    //Construct processes for electron
	    eminusMultipleScattering = new G4MultipleScattering();
	    eminusIonisation = new G4eIonisation();
	    theBremsstrahlung = new G4eBremsstrahlung();

	    //Add processes for electron
	    pmanager -> AddProcess(eminusMultipleScattering);
	    pmanager -> AddProcess(eminusIonisation);
	    pmanager -> AddProcess(theBremsstrahlung);
	    //Set ordering for AlongStepDoIt
	    pmanager -> SetProcessOrdering(eminusMultipleScattering, idxAlongStep, 1);
	    pmanager -> SetProcessOrdering(eminusIonisation, idxAlongStep, 2);
	    pmanager -> SetProcessOrdering(theBremsstrahlung, idxAlongStep, 3);
	    //Set ordering for PostStepDoIt
	    pmanager -> SetProcessOrdering(eminusMultipleScattering, idxPostStep, 1);
	    pmanager -> SetProcessOrdering(eminusIonisation, idxPostStep, 2);
	    pmanager -> SetProcessOrdering(theBremsstrahlung, idxPostStep, 3);
	  }
	else if(particleName == "e+")
	{
	    //Construct processes for electron
	    eplusMultipleScattering = new G4MultipleScattering();
	    eplusIonisation = new G4eIonisation();
	    eplusBremsstrahlung = new G4eBremsstrahlung();
	    theAnnihilation = new G4eplusAnnihilation();
	    //Add processes for electron
	    pmanager -> AddProcess(eplusMultipleScattering);
	    pmanager -> AddProcess(eplusIonisation);
	    pmanager -> AddProcess(eplusBremsstrahlung);
	    pmanager -> AddProcess(theAnnihilation);
	    //Set ordering for AlongStepDoIt
	    pmanager -> SetProcessOrdering(eplusMultipleScattering, idxAlongStep, 1);
	    pmanager -> SetProcessOrdering(eplusIonisation, idxAlongStep, 2);
	    pmanager -> SetProcessOrdering(eplusBremsstrahlung, idxAlongStep, 3);
	    pmanager -> SetProcessOrdering(theAnnihilation, idxAlongStep, 4);
	    //Set ordering for PostStepDoIt
	    pmanager -> SetProcessOrdering(eplusMultipleScattering, idxPostStep, 1);
	    pmanager -> SetProcessOrdering(eplusIonisation, idxPostStep, 2);
	    pmanager -> SetProcessOrdering(eplusBremsstrahlung, idxPostStep, 3);
	    pmanager -> SetProcessOrdering(theAnnihilation, idxPostStep, 4);
	}	
	else if(particleName == "GenericIon")
	{
	    ionIonisation = new G4hIonisation();
	    aMultipleScattering = new G4MultipleScattering();
	    //Add processes
	    pmanager -> AddDiscreteProcess(ionIonisation);
	    pmanager -> AddDiscreteProcess(aMultipleScattering);
	    //Set ordering for AlongStepDoIt
	    pmanager -> SetProcessOrdering(ionIonisation, idxAlongStep, 2);
	    pmanager -> SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
	    //Set ordering for PostStepDoIt
	    pmanager -> SetProcessOrdering(ionIonisation, idxPostStep, 2);
	    pmanager -> SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
	}
	else if((!particle -> IsShortLived()) &&
		 (particle -> GetPDGCharge() != 0.0)) 
	{
	    //All other charged particles
	    aMultipleScattering = new G4MultipleScattering();
	    anIonisation = new G4hIonisation();
	    //Add processes
	    pmanager -> AddDiscreteProcess(aMultipleScattering);
	    pmanager -> AddDiscreteProcess(anIonisation);
	    //Set ordering for AlongStepDoIt
	    pmanager -> SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
	    pmanager -> SetProcessOrdering(anIonisation, idxAlongStep, 2);
	    //Set ordering for PostStepDoIt
	    pmanager -> SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
	    pmanager -> SetProcessOrdering(anIonisation, idxPostStep, 2);
	}
    }
    G4cout<<"Construct EM over"<<G4endl;
}

#include "G4HadronElasticProcess.hh"
#include "G4NeutronHPElastic.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4NeutronHPInelastic.hh"
#include "G4LElastic.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4LEProtonInelastic.hh"
#include "G4HadronInelasticProcess.hh"
#include "G4LENeutronInelastic.hh"

void S1S2PhysList::ConstructHad()
{
  theParticleIterator -> reset();
  while((*theParticleIterator)())
    {
      G4ParticleDefinition* particle = theParticleIterator -> value();
      G4ProcessManager* pmanager = particle -> GetProcessManager();
      G4String particleName = particle -> GetParticleName();

      if(particleName == "neutron")
	{
	  //Construct elastic processes for neutrons
	  theNeutronElasticProcess = new G4HadronElasticProcess();
	  aLENeutronElasticProcess = new G4NeutronHPElastic();
	  aNeutronEleaticProcess = new G4LElastic();
	  aNeutronEleaticProcess -> SetMinEnergy(20.0*MeV);
	  theNeutronElasticProcess -> RegisterMe(aNeutronEleaticProcess);
	  theNeutronElasticProcess -> RegisterMe(aLENeutronElasticProcess);
	  //Add elastic process
	  pmanager -> AddDiscreteProcess(theNeutronElasticProcess);
	  //Construct inelastic process for neutrons
	  theNeutronInelasticProcess = new G4NeutronInelasticProcess();
	  //aLENeutronInelasticProcess = new G4NeutronHPInelastic();
	  aLENeutronInelasticProcess = new G4LENeutronInelastic();
	  theNeutronInelasticProcess -> RegisterMe(aLENeutronInelasticProcess);
	  //Add inelastic process
	  pmanager -> AddDiscreteProcess(theNeutronInelasticProcess);
	  //Construct capture process for neutrons
	  theNeutronCaptureProcess = new G4HadronCaptureProcess();
	  aNeutronCaptureProcess = new G4NeutronHPCapture();
	  //Add capture process
	  theNeutronCaptureProcess -> RegisterMe(aNeutronCaptureProcess);
	}
      else if(particleName == "proton")
	{
	  //Construct processes for protons;
	  theProtonElasticProcess = new G4HadronElasticProcess();
	  aLEProtonElasticProcess = new G4LElastic();
	  theProtonElasticProcess -> RegisterMe(aLEProtonElasticProcess);
	  //Add elastic process
	  pmanager -> AddDiscreteProcess(theProtonElasticProcess);
	  //Construct inelastic process for protons
	  theProtonInelasticProcess = new G4ProtonInelasticProcess();
	  aLEProtonInelasticProcess = new G4LEProtonInelastic();
	  theProtonInelasticProcess -> RegisterMe(aLEProtonInelasticProcess);
	  //Add process
	  pmanager -> AddDiscreteProcess(theProtonInelasticProcess);
	}
    }
  G4cout<<"Construct Had Over"<<G4endl;
}

#include "G4Scintillation.hh"
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4OpBoundaryProcess.hh"

void S1S2PhysList::ConstructOp()
{
  /**
     G4Scintillation *theScintillationProcess = new G4Scintillation("Scintillation");
     G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
     //G4OpRayleigh*   theRayleighScatteringProcess = new G4OpRayleigh();
     G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();

     //theScintillationProcess->SetVerboseLevel(1);
     //theAbsorptionProcess->SetVerboseLevel(1);
     //theRayleighScatteringProcess->SetVerboseLevel(1);
     //theBoundaryProcess->SetVerboseLevel(1);

     theScintillationProcess->SetTrackSecondariesFirst(true);
     theScintillationProcess->SetScintillationYield(100./MeV);
     theScintillationProcess->SetResolutionScale(1.0);
     theScintillationProcess->SetScintillationTime(1.5*ns);

     G4OpticalSurfaceModel themodel = unified;
     theBoundaryProcess -> SetModel(themodel);

     theParticleIterator -> reset();
     while((*theParticleIterator)())
     {
     G4ParticleDefinition* particle = theParticleIterator -> value();
     G4ProcessManager* pmanager =  particle -> GetProcessManager();
     G4String particleName = particle -> GetParticleName();
     if(theScintillationProcess->IsApplicable(*particle))
     {
     pmanager->AddProcess(theScintillationProcess);
     pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
     pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
     }
     if(particleName == "opticalphoton")
     {
     pmanager->AddDiscreteProcess(theAbsorptionProcess);
     //pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
     pmanager->AddDiscreteProcess(theBoundaryProcess);
     }
     }
  **/
}

#include "G4Decay.hh"

void S1S2PhysList::ConstructGeneral()
{
    theDecayProcess = new G4Decay();
    theParticleIterator -> reset();
    while((*theParticleIterator)())
    {
        G4ParticleDefinition* particle = theParticleIterator -> value();
        G4ProcessManager* pmanager =  particle -> GetProcessManager();
        if(theDecayProcess -> IsApplicable(*particle))
	{
	    pmanager -> AddProcess(theDecayProcess);
	    //Set ordering for PostStepDoIt and AtRestDoIt
	    pmanager -> SetProcessOrdering(theDecayProcess, idxPostStep);
	    pmanager -> SetProcessOrdering(theDecayProcess, idxAtRest);
	}
    }
    G4cout<<"Construct General Over"<<G4endl;
}

void S1S2PhysList::SetCuts()
{
  if(currentDefaultCut != defaultCutValue)
    {
      if(cutForGamma == currentDefaultCut)
	{
	  cutForGamma = defaultCutValue;
	}
      if(cutForElectron == currentDefaultCut)
	{
	  cutForElectron = defaultCutValue;
	}
      if(cutForProton == currentDefaultCut)
	{
	  cutForProton = defaultCutValue;
	}
      currentDefaultCut = defaultCutValue;
    }
 if(verboseLevel>0)
    {
      G4cout<<"S1S2PhysicList::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");
      G4cout<<"Cut For Gamma Over"<<G4endl;
      SetCutValue(cutForElectron, "e-");
      SetCutValue(cutForElectron, "e+");
      G4cout<<"Cut For Electron Over"<<G4endl;
	// set cut values for proton and anti_proton before all other hadrons
        // because some processes for hadrons need cut values for proton/anti_proton
      SetCutValue(cutForProton, "proton");
      SetCutValue(cutForProton, "anti_proton");

        // set a cut value to all particles
        SetCutValueForOthers(defaultCutValue);
        if(verboseLevel>0)
	{
	    DumpCutValuesTable();
	}
    }
 G4cout<<"Set Cuts Over"<<G4endl;
}

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

1 Idea: Re: AlongStep DoIt ordering for G4eplusAnnihilation process   (Vladimir Ivanchenko - 19 Dec, 2008)
 Add Message Add Message
to: "Re: AlongStep DoIt ordering for G4eplusAnnihilation process"

 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 ]