⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mt01physicslist.bakcc

📁 利用linux环境下蒙特卡罗计算工具geant4实现伽玛射线与探测器乘积能量的模拟过程
💻 BAKCC
字号:
//// ********************************************************************// * DISCLAIMER                                                       *// *                                                                  *// * The following disclaimer summarizes all the specific disclaimers *// * of contributors to this software. The specific disclaimers,which *// * govern, are listed with their locations in:                      *// *   http://cern.ch/geant4/license                                  *// *                                                                  *// * Neither the authors of this software system, nor their employing *// * institutes,nor the agencies providing financial support for this *// * work  make  any representation or  warranty, express or implied, *// * regarding  this  software system or assume any liability for its *// * use.                                                             *// *                                                                  *// * This  code  implementation is the  intellectual property  of the *// * GEANT4 collaboration.                                            *// * By copying,  distributing  or modifying the Program (or any work *// * based  on  the Program)  you indicate  your  acceptance of  this *// * statement, and all its terms.                                    *// ********************************************************************////// $Id: ExN01PhysicsList.cc,v 1.5 2002/01/09 17:23:48 ranjard Exp $// GEANT4 tag $Name: geant4-07-00-patch-01 $//// #include "mt01PhysicsList.hh"#include "G4ParticleTypes.hh"#include "G4ProductionCutsTable.hh"#include "G4ProcessManager.hh"#include "globals.hh"#include "G4ParticleDefinition.hh"#include "G4ParticleWithCuts.hh"#include "G4ParticleTable.hh"#include "G4ios.hh"mt01PhysicsList::mt01PhysicsList(){defaultCutValue=0.001*mm; cutForGamma =defaultCutValue; cutForElectron=defaultCutValue; cutForProton=0.001*mm; G4double cutValue =0.001*mm; G4ProductionCuts *cuts=new G4ProductionCuts; cuts->SetProductionCut(cutValue);}mt01PhysicsList::~mt01PhysicsList(){;}void mt01PhysicsList::ConstructParticle(){  // In this method, static member functions should be called  // for all particles which you want to use.  // This ensures that objects of these particle types will be  // created in the program.   G4Geantino::GeantinoDefinition();  ConstructBosons();  ConstructLeptons();  ConstructMesons();  ConstructBaryons();  ConstructIons();  }void mt01PhysicsList::ConstructBosons(){  // pseudo-particles  G4Geantino::GeantinoDefinition();  G4ChargedGeantino::ChargedGeantinoDefinition();  // gamma  G4Gamma::GammaDefinition();}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::ConstructLeptons(){  // leptons  //  e+/-  G4Electron::ElectronDefinition();  G4Positron::PositronDefinition();  // mu+/-  G4MuonPlus::MuonPlusDefinition();  G4MuonMinus::MuonMinusDefinition();  // nu_e  G4NeutrinoE::NeutrinoEDefinition();  G4AntiNeutrinoE::AntiNeutrinoEDefinition();  // nu_mu  G4NeutrinoMu::NeutrinoMuDefinition();  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::ConstructIons(){//  Ions G4Alpha::AlphaDefinition();}void mt01PhysicsList::ConstructMesons(){  //  mesons  //    light mesons  G4PionPlus::PionPlusDefinition();  G4PionMinus::PionMinusDefinition();  G4PionZero::PionZeroDefinition();  G4Eta::EtaDefinition();  G4EtaPrime::EtaPrimeDefinition();  G4KaonPlus::KaonPlusDefinition();  G4KaonMinus::KaonMinusDefinition();  G4KaonZero::KaonZeroDefinition();  G4AntiKaonZero::AntiKaonZeroDefinition();  G4KaonZeroLong::KaonZeroLongDefinition();  G4KaonZeroShort::KaonZeroShortDefinition();}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::ConstructBaryons(){  //  barions  G4Proton::ProtonDefinition();  G4AntiProton::AntiProtonDefinition();  G4Neutron::NeutronDefinition();  G4AntiNeutron::AntiNeutronDefinition();}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::ConstructProcess(){  // Define transportation process  AddTransportation();  ConstructEM();  ConstructGeneral();  }#include "G4ComptonScattering.hh"#include "G4GammaConversion.hh"#include "G4PhotoElectricEffect.hh"#include "G4MultipleScattering.hh"#include "G4eIonisation.hh"#include "G4eBremsstrahlung.hh"#include "G4eplusAnnihilation.hh"#include "G4MuIonisation.hh"#include "G4MuBremsstrahlung.hh"#include "G4MuPairProduction.hh"#include "G4hIonisation.hh"#include "G4StepLimiter.hh"#include "G4UserSpecialCuts.hh"#include "G4LowEnergyCompton.hh"#include "G4LowEnergyGammaConversion.hh"#include "G4LowEnergyPhotoElectric.hh"#include "G4LowEnergyRayleigh.hh"// e+#include "G4LowEnergyIonisation.hh"#include "G4LowEnergyBremsstrahlung.hh"#include "G4hLowEnergyIonisation.hh"//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::ConstructEM(){  theParticleIterator->reset();  while( (*theParticleIterator)() ){    G4ParticleDefinition* particle = theParticleIterator->value();    G4ProcessManager* pmanager = particle->GetProcessManager();    G4String particleName = particle->GetParticleName();         if (particleName == "gamma") {      // gamma                pmanager->AddDiscreteProcess(new G4LowEnergyCompton);       pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);       LePeprocess = new G4LowEnergyPhotoElectric();       LePeprocess->ActivateAuger(true);      LePeprocess->SetCutForLowEnSecPhotons(0.0050 * keV);       LePeprocess->SetCutForLowEnSecElectrons(0.0050 * keV);      pmanager->AddDiscreteProcess(LePeprocess);      pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh("Rayleigh"));      //pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);      //pmanager->AddDiscreteProcess(new G4ComptonScattering);      //pmanager->AddDiscreteProcess(new G4GammaConversion);          } else if (particleName == "e-") {      //electron      //pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);      //pmanager->AddProcess(new G4eIonisation,       -1, 2,2);      //pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);      //LeIoprocess = new G4LowEnergyIonisation("IONI");     // LeIoprocess->ActivateAuger(true);      //eIoProcess = new G4eIonisation("stdIONI");      //LeIoprocess->SetCutForLowEnSecPhotons(0.1*keV);      //LeIoprocess->SetCutForLowEnSecElectrons(0.1*keV);     // pmanager->AddProcess(LeIoprocess, -1,  2, 2);      // LeBrprocess = new G4LowEnergyBremsstrahlung();     // pmanager->AddProcess(LeBrprocess, -1, -1, 3);     pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);            LeIoprocess = new G4LowEnergyIonisation("IONI");      LeIoprocess->ActivateAuger(true);      //eIoProcess = new G4eIonisation("stdIONI");      LeIoprocess->SetCutForLowEnSecPhotons(0.1*keV);      LeIoprocess->SetCutForLowEnSecElectrons(0.1*keV);      pmanager->AddProcess(LeIoprocess, -1,  2, 2);       LeBrprocess = new G4LowEnergyBremsstrahlung();      pmanager->AddProcess(LeBrprocess, -1, -1, 3);    } else if (particleName == "e+") {      //positron      pmanager->AddProcess(new G4MultipleScattering,-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 G4MultipleScattering,-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 ((!particle->IsShortLived()) &&	       (particle->GetPDGCharge() != 0.0) && 	       (particle->GetParticleName() != "chargedgeantino")) {      //all others charged particles except geantino      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);      pmanager->AddProcess(new G4hIonisation,       -1, 2,2);      ///pmanager->AddProcess(new G4StepLimiter,       -1,-1,3);               ///pmanager->AddProcess(new G4UserSpecialCuts,   -1,-1,4);      }    else if (particleName == "proton") {      //proton      G4hLowEnergyIonisation* hIoni = new G4hLowEnergyIonisation;      hIoni->SetFluorescence(true);      pmanager->AddProcess(new G4MultipleScattering,-1,1,1);      pmanager->AddProcess(hIoni,-1, 2,2);    }    else if (   particleName == "alpha" )      {		pmanager->AddProcess(new G4MultipleScattering,-1,1,1);	G4hLowEnergyIonisation* iIon = new G4hLowEnergyIonisation() ;	pmanager->AddProcess(iIon,-1,2,2);      }  }}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......#include "G4Decay.hh"void mt01PhysicsList::ConstructGeneral(){  // Add Decay Process  G4Decay* 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);    }  }}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......void mt01PhysicsList::SetCuts(){  // uppress error messages even in case e/gamma/proton do not exist              // G4int temp = GetVerboseLevel();    // SetVerboseLevel(0);                                                             //  " G4VUserPhysicsList::SetCutsWithDefault" method sets   //   the default cut value for all particle types   //  SetCutsWithDefault();     //G4double cutValue = 0.001 * mm;      //G4ProductionCuts* cuts = new G4ProductionCuts;  //cuts->SetProductionCut(cutValue);  // Retrieve verbose level  //SetVerboseLevel(temp);    G4double defaultCutValue = 1*keV; G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(250*eV,100*GeV);  cutForGamma = defaultCutValue;  cutForElectron = defaultCutValue;  cutForProton    = defaultCutValue;   SetCutValue(cutForGamma,"gamma");   SetCutValue(cutForElectron,"e-");   SetCutValue(cutForElectron,"e+");   SetCutValue(cutForProton, "proton");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -