示例#1
0
/// Callback to construct processes (uses the G4 particle table)
void Geant4PhysicsList::constructProcesses(G4VUserPhysicsList* physics_pointer)   {
  debug("constructProcesses %p", physics_pointer);
  for (PhysicsProcesses::const_iterator i = m_discreteProcesses.begin(); i != m_discreteProcesses.end(); ++i)  {
    const string& part_name = (*i).first;
    const ParticleProcesses& procs = (*i).second;
    vector<G4ParticleDefinition*> defs(Geant4ParticleHandle::g4DefinitionsRegEx(part_name));
    if (defs.empty())  {
      except("Particle:%s Cannot find the corresponding entry in the particle table.", part_name.c_str());
    }
    for (vector<G4ParticleDefinition*>::const_iterator id = defs.begin(); id != defs.end(); ++id)  {
      G4ParticleDefinition* particle = *id;
      G4ProcessManager* mgr = particle->GetProcessManager();
      for (ParticleProcesses::const_iterator ip = procs.begin(); ip != procs.end(); ++ip)  {
        const Process& p = (*ip);
        G4VProcess* g4 = PluginService::Create<G4VProcess*>(p.name);
        if (!g4)  {   // Error no factory for this process
          except("Particle:%s -> [%s] Cannot create discrete physics process %s", 
                 part_name.c_str(), particle->GetParticleName().c_str(), p.name.c_str());
        }
        mgr->AddDiscreteProcess(g4);
        info("Particle:%s -> [%s] added discrete process %s", 
             part_name.c_str(), particle->GetParticleName().c_str(), p.name.c_str());
      }
    }
  }
  for (PhysicsProcesses::const_iterator i = m_processes.begin(); i != m_processes.end(); ++i)  {
    const string& part_name = (*i).first;
    const ParticleProcesses& procs = (*i).second;
    vector<G4ParticleDefinition*> defs(Geant4ParticleHandle::g4DefinitionsRegEx(part_name));
    if (defs.empty())  {
      except("Particle:%s Cannot find the corresponding entry in the particle table.", part_name.c_str());
    }
    for (vector<G4ParticleDefinition*>::const_iterator id = defs.begin(); id != defs.end(); ++id)  {
      G4ParticleDefinition* particle = *id;
      G4ProcessManager* mgr = particle->GetProcessManager();
      for (ParticleProcesses::const_iterator ip = procs.begin(); ip != procs.end(); ++ip)  {
        const Process& p = (*ip);
        G4VProcess* g4 = PluginService::Create<G4VProcess*>(p.name);
        if (!g4)  {   // Error no factory for this process
          except("Particle:%s -> [%s] Cannot create physics process %s", 
                 part_name.c_str(), particle->GetParticleName().c_str(), p.name.c_str());
        }
        mgr->AddProcess(g4, p.ordAtRestDoIt, p.ordAlongSteptDoIt, p.ordPostStepDoIt);
        info("Particle:%s -> [%s] added process %s with flags (%d,%d,%d)", 
             part_name.c_str(), particle->GetParticleName().c_str(), p.name.c_str(),
             p.ordAtRestDoIt, p.ordAlongSteptDoIt, p.ordPostStepDoIt);
      }
    }
  }
}
示例#2
0
void TestPhysicsList::ConstructProcess() {
  G4VUserPhysicsList::AddTransportation();
  // process added for electrons only
  G4ParticleDefinition* particle = G4Electron::ElectronDefinition();
  G4ProcessManager* process_manager = particle->GetProcessManager();
  process_manager->AddDiscreteProcess(&m_process);
}
      /// Callback to construct processes (uses the G4 particle table)
      virtual void constructProcesses(G4VUserPhysicsList* physics_list)   { 
        this->Geant4PhysicsList::constructProcesses(physics_list);
        info("+++ Constructing optical_photon processes:");
        info("+++              G4OpAbsorption G4OpRayleigh G4OpMieHG G4OpBoundaryProcess");
        G4ParticleTable*      table = G4ParticleTable::GetParticleTable();
        G4ParticleDefinition* particle = table->FindParticle("opticalphoton");
        if (0 == particle) {
          except("++ Cannot resolve 'opticalphoton' particle definition!");
        }

        G4OpBoundaryProcess*  fBoundaryProcess           = new G4OpBoundaryProcess();
        G4OpAbsorption*       fAbsorptionProcess         = new G4OpAbsorption();
        G4OpRayleigh*         fRayleighScatteringProcess = new G4OpRayleigh();
        G4OpMieHG*            fMieHGScatteringProcess    = new G4OpMieHG();

        fAbsorptionProcess->SetVerboseLevel(m_verbosity);
        fRayleighScatteringProcess->SetVerboseLevel(m_verbosity);
        fMieHGScatteringProcess->SetVerboseLevel(m_verbosity);
        fBoundaryProcess->SetVerboseLevel(m_verbosity);

        G4ProcessManager* pmanager = particle->GetProcessManager();
        pmanager->AddDiscreteProcess(fAbsorptionProcess);
        pmanager->AddDiscreteProcess(fRayleighScatteringProcess);
        pmanager->AddDiscreteProcess(fMieHGScatteringProcess);
        pmanager->AddDiscreteProcess(fBoundaryProcess);
      }
示例#4
0
void FastSimPhysics::ConstructProcess() {
   G4FastSimulationManagerProcess* fastSimProcess = new G4FastSimulationManagerProcess("G4FSMP");
   aParticleIterator->reset();
   // Fast simulation manager process is available for all the particles
   while( (*aParticleIterator)() ) {
      G4ParticleDefinition* particle = aParticleIterator->value();
      G4ProcessManager* process_manager = particle->GetProcessManager();
      process_manager->AddDiscreteProcess(fastSimProcess);
   }
}
示例#5
0
/// Callback to construct particle decays
void Geant4PhysicsListActionSequence::constructDecays(G4VUserPhysicsList* physics_pointer)  {
  G4ParticleTable* pt = G4ParticleTable::GetParticleTable();
  G4ParticleTable::G4PTblDicIterator* iter = pt->GetIterator();
  // Add Decay Process
  G4Decay* decay = new G4Decay();
  info("ConstructDecays %p",physics_pointer);
  iter->reset();
  while ((*iter)())  {
    G4ParticleDefinition* p = iter->value();
    G4ProcessManager* mgr = p->GetProcessManager();
    if (decay->IsApplicable(*p))  {
      mgr->AddProcess(decay);
      // set ordering for PostStepDoIt and AtRestDoIt
      mgr->SetProcessOrdering(decay, idxPostStep);
      mgr->SetProcessOrdering(decay, idxAtRest);
    }
  }
}
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);

    }
  }
}
示例#7
0
void Geant4ExtraParticles::constructProcess(Constructor& ctor) {
  G4ParticleTable::G4PTblDicIterator* ParticleIterator = ctor.particleIterator();
#if G4VERSION_NUMBER < 940
  if ( 0 == _scatter ) _scatter=new G4hMultipleScattering();
  if ( 0 == _ionise ) _ionise=new G4hIonisation()
  if ( 0 == _decay ) _decay=new G4Decay()
#endif
  while((*ParticleIterator)()) {
    G4ParticleDefinition* pdef = ParticleIterator->value();
    G4ProcessManager* pmgr = pdef->GetProcessManager();
    if (pdef->GetParticleType() == "extra") {
      if (pdef->GetPDGCharge() != 0) {
#if G4VERSION_NUMBER < 940
        pmgr->AddProcess(_scatter, -1,  1, 1); // multiple scattering
        pmgr->AddProcess(_ionise,  -1,  2, 2); // ionisation
        pmgr->AddProcess(_decay,   -1, -1, 2); // decay
#else
        pmgr->AddProcess(new G4hMultipleScattering(), -1,  1, 1); //multiple scattering
        pmgr->AddProcess(new G4hIonisation(),  -1,  2, 2); // ionisation
        pmgr->AddProcess(new G4Decay(),   -1, -1, 2); // decay 
#endif

      } else {

#if G4VERSION_NUMBER < 940
        pmgr->AddProcess(_scatter=new G4hMultipleScattering(), -1,  1, 1); // multiple scattering
        pmgr->AddProcess(_decay=new G4Decay(),   -1, -1, 2); // decay
#else
        //	pmgr->AddProcess(new G4hMultipleScattering(), -1,  1, 1); // multiple scattering
        pmgr->AddProcess(new G4Decay(),   -1, -1, 2); // decay 
#endif

      }
    }
  }
}
void PhysListEmStandardSS::ConstructProcess()
{
  // Add standard EM Processes

  aParticleIterator->reset();
  while( (*aParticleIterator)() ){
    G4ParticleDefinition* particle = aParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {
      // gamma
      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
      pmanager->AddDiscreteProcess(new G4ComptonScattering);
      pmanager->AddDiscreteProcess(new G4GammaConversion);
      
    } else if (particleName == "e-") {
      //electron
      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
      pmanager->AddDiscreteProcess(new G4CoulombScattering);            
            
    } else if (particleName == "e+") {
      //positron
      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
      pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
      pmanager->AddDiscreteProcess(new G4CoulombScattering);            
            
    } else if (particleName == "mu+" || 
               particleName == "mu-"    ) {
      //muon
      pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
      pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
      pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);
      pmanager->AddDiscreteProcess(new G4CoulombScattering);              
             
    } else if (particleName == "alpha" || particleName == "He3") {
      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
      G4CoulombScattering* cs = new G4CoulombScattering();
      //cs->AddEmModel(0, new G4IonCoulombScatteringModel());
      cs->SetBuildTableFlag(false);
      pmanager->AddDiscreteProcess(cs);

    } else if (particleName == "GenericIon" ) { 
      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);      
      G4CoulombScattering* cs = new G4CoulombScattering();
      cs->AddEmModel(0, new G4IonCoulombScatteringModel());
      cs->SetBuildTableFlag(false);
      pmanager->AddDiscreteProcess(cs);
     
    } else if ((!particle->IsShortLived()) &&
               (particle->GetPDGCharge() != 0.0) && 
               (particle->GetParticleName() != "chargedgeantino")) {
      //all others charged particles except geantino
      pmanager->AddDiscreteProcess(new G4CoulombScattering);            
      pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
    }
  }
  
  // Em options
  //
  // Main options and setting parameters are shown here.
  // Several of them have default values.
  //
  G4EmProcessOptions emOptions;
  
  //physics tables
  //
  emOptions.SetMinEnergy(100*eV);        //default    
  emOptions.SetMaxEnergy(100*TeV);        //default  
  emOptions.SetDEDXBinning(12*20);        //default=12*7  
  emOptions.SetLambdaBinning(12*20);        //default=12*7
  emOptions.SetSplineFlag(true);        //default
      
  //energy loss
  //
  emOptions.SetStepFunction(0.2, 100*um);        //default=(0.2, 1*mm)      
  emOptions.SetLinearLossLimit(1.e-2);                //default
   
  //ionization
  //
  emOptions.SetSubCutoff(false);        //default  

  // scattering
  emOptions.SetPolarAngleLimit(0.0);
}
示例#9
0
void Physics::ConstructEM() {

   theParticleIterator->reset();

   while( ( *theParticleIterator )() ) {

      G4ParticleDefinition * particle = theParticleIterator->value();
      G4ProcessManager * pmanager = particle->GetProcessManager();
      G4String particleName = particle->GetParticleName();
     
      if (particleName == "gamma") {

         pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
         pmanager->AddDiscreteProcess(new G4ComptonScattering); 
         pmanager->AddDiscreteProcess(new G4GammaConversion);
         pmanager->AddDiscreteProcess(new G4CoulombScattering);
         pmanager->AddDiscreteProcess(new G4RayleighScattering);
      
      }
      else if( particleName == "e-" ) {

         if( Run_Type == "Recon" ) {
            pmanager->AddProcess(new G4eIonisation,          -1,  1, 1 );
         }
         else {
            pmanager->AddProcess(new G4eMultipleScattering,  -1,  1, 1 );
            pmanager->AddProcess(new G4eIonisation,          -1,  2, 2 );
				if (fullBrem && supBrem)
				{
					std::cout<<"\n\nCANNOT USE FULL AND SUPPRESSED PHOTON BREMSSTRAHLUNG SIMULTANEOUSLY!\n\n";
					std::cout<<"USING FULL BREMSSTRAHLUNG FOR ELECTRONS!\n\n";
					supBrem = false;
				}
				else if (fullBrem)
				{
					pmanager->AddProcess(new G4eBremsstrahlung,     -1, -1, 3 );
				}
				else if (supBrem)
				{
					G4eBremsstrahlung * eBremP = new G4eBremsstrahlung;
            	bremPhotonSuppression * bremSup = new bremPhotonSuppression;
					bremSup->RegisterProcess(eBremP);
       			pmanager->AddProcess(bremSup,                    -1, -1, 3 );
				}
				else
				{
					std::cout<<"\n\nNO ELECTRON BREMSSTRAHLUNG INCLUDED!\n\n";
				}
         }

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

         if( Run_Type == "Recon" ) {
            pmanager->AddProcess(new G4eIonisation,          -1,  1, 1 );
         }
         else {
            pmanager->AddProcess(new G4eMultipleScattering,  -1,  1, 1 );
            pmanager->AddProcess(new G4eIonisation,          -1,  2, 2 );
		if (fullBrem && supBrem)
		{
			std::cout<<"\n\nCANNOT USE FULL AND SUPPRESSED PHOTON BREMSSTRAHLUNG SIMULTANEOUSLY!\n\n";
			std::cout<<"USING FULL BREMSSTRAHLUNG FOR POSITRONS!\n\n";
			supBrem = false;
		}
		else if (fullBrem)
		{
			pmanager->AddProcess(new G4eBremsstrahlung,     -1, -1, 3 );
		}
		else if (supBrem)
		{
			G4eBremsstrahlung * eBremP = new G4eBremsstrahlung;
			bremPhotonSuppression * bremSup = new bremPhotonSuppression;
			bremSup->RegisterProcess(eBremP);
			pmanager->AddProcess(bremSup,                    -1, -1, 3 );
		}
		else
		{
			std::cout<<"\n\nNO POSITRON BREMSSTRAHLUNG INCLUDED!\n\n";
		}
            pmanager->AddProcess(new G4eplusAnnihilation,     0, -1, 4 );
         }

      }
      else if( particleName == "mu+" ||
               particleName == "mu-" ) {

         pmanager->AddProcess(new G4MuMultipleScattering, -1,  1, 1 );
         pmanager->AddProcess(new G4MuIonisation,         -1,  2, 2 );
			if (fullBrem && supBrem)
			{
				std::cout<<"\n\nCANNOT USE FULL AND SUPPRESSED PHOTON BREMSSTRAHLUNG SIMULTANEOUSLY!\n\n";
				std::cout<<"USING FULL BREMSSTRAHLUNG FOR MUONS!\n\n";
				supBrem = false;
			}
			else if (fullBrem)
			{
				pmanager->AddProcess(new G4MuBremsstrahlung,     -1, -1, 3 );
			}
			else if (supBrem)
			{
				G4MuBremsstrahlung * eBremP = new G4MuBremsstrahlung;
         	bremPhotonSuppression * bremSup = new bremPhotonSuppression;
				bremSup->RegisterProcess(eBremP);
    			pmanager->AddProcess(bremSup,                    -1, -1, 3 );
			}
			else
			{
				std::cout<<"\n\nNO MUON BREMSSTRAHLUNG INCLUDED!\n\n";
			}

         pmanager->AddProcess(new G4MuPairProduction,     -1, -1, 4 );       
     
      }

      // All others charged particles except chargedgeantino.

      else if( !( particle->IsShortLived() ) && 
               particle->GetPDGCharge() != 0.0 && 
               particle->GetParticleName() != "chargedgeantino" ) {

         if( Run_Type == "Recon" ) {
            pmanager->AddProcess(new G4hIonisation,          -1,  1, 1 );
         }
         else {
            pmanager->AddProcess(new G4hMultipleScattering,  -1,  1, 1 );
            pmanager->AddProcess(new G4hIonisation,          -1,  2, 2 );
				if (fullBrem && supBrem)
				{
					std::cout<<"\n\nCANNOT USE FULL AND SUPPRESSED PHOTON BREMSSTRAHLUNG SIMULTANEOUSLY!\n\n";
					std::cout<<"USING FULL BREMSSTRAHLUNG FOR HADRONS!\n\n";
					supBrem = false;
				}
				else if (fullBrem)
				{
					pmanager->AddProcess(new G4hBremsstrahlung,     -1, -1, 3 );
				}
				else if (supBrem)
				{
					G4hBremsstrahlung * eBremP = new G4hBremsstrahlung;
            	bremPhotonSuppression * bremSup = new bremPhotonSuppression;
					bremSup->RegisterProcess(eBremP);
       			pmanager->AddProcess(bremSup,                    -1, -1, 3 );
				}
				else
				{
					std::cout<<"\n\nNO HADRON BREMSSTRAHLUNG INCLUDED!\n\n";
				}

            pmanager->AddProcess(new G4hPairProduction,      -1, -1, 4 );
         }

         // Step limit.
         //pmanager->AddProcess(new G4StepLimiter,         -1, -1, 3 );         
         //pmanager->AddProcess(new G4UserSpecialCuts,     -1, -1, 4 );  
      }
   }
}
void PhysListEmStandardGS::ConstructProcess()
{
  // Add standard EM Processes
  //

  aParticleIterator->reset();
  while( (*aParticleIterator)() ){
    G4ParticleDefinition* particle = aParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();
     
    if (particleName == "gamma") {
      // gamma
      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
      pmanager->AddDiscreteProcess(new G4ComptonScattering);
      pmanager->AddDiscreteProcess(new G4GammaConversion);
      
    } else if (particleName == "e-") {
      //electron
      G4eMultipleScattering* msc = new G4eMultipleScattering();
      msc->AddEmModel(0, new G4GoudsmitSaundersonMscModel());
      pmanager->AddProcess(msc,                       -1, 1, 1);      
      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
            
    } else if (particleName == "e+") {
      //positron
      G4eMultipleScattering* msc = new G4eMultipleScattering();
      msc->AddEmModel(0, new G4GoudsmitSaundersonMscModel());      
      pmanager->AddProcess(msc,                       -1, 1, 1);            
      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
            
    } else if (particleName == "mu+" || 
               particleName == "mu-"    ) {
      //muon  
      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
             
    } else if( particleName == "proton" ||
               particleName == "pi-" ||
               particleName == "pi+"    ) {
      //proton  
      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
     
    } else if( particleName == "alpha" || 
               particleName == "He3"    ) {
      //alpha 
      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);
            
    } else if( particleName == "GenericIon" ) {
      //Ions 
      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
      G4ionIonisation* ionIoni = new G4ionIonisation();
      ionIoni->SetEmModel(new G4IonParametrisedLossModel());
      pmanager->AddProcess(ionIoni,                   -1, 2, 2);      
      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);      
      
    } else if ((!particle->IsShortLived()) &&
               (particle->GetPDGCharge() != 0.0) && 
               (particle->GetParticleName() != "chargedgeantino")) {
      //all others charged particles except geantino
      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    }
  }

  // Em options
  //
  // Main options and setting parameters are shown here.
  // Several of them have default values.
  //
  G4EmProcessOptions emOptions;
  
  //physics tables
  //
  emOptions.SetMinEnergy(100*eV);        //default    
  emOptions.SetMaxEnergy(100*TeV);        //default  
  emOptions.SetDEDXBinning(12*20);        //default=12*7
  emOptions.SetLambdaBinning(12*20);        //default=12*7
  emOptions.SetSplineFlag(true);        //default
      
  //multiple coulomb scattering
  //
  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
  emOptions.SetMscRangeFactor(0.04);        //default
  emOptions.SetMscGeomFactor (2.5);        //default       
  emOptions.SetSkin(3.);                //default
      
  //energy loss
  //
  emOptions.SetStepFunction(0.2, 100*um);        //default=(0.2, 1*mm)   
  emOptions.SetLinearLossLimit(1.e-2);                //default
   
  //ionization
  //
  emOptions.SetSubCutoff(false);        //default
}