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

📄 mt01primarygeneratoraction.cc~

📁 利用linux环境下蒙特卡罗计算工具geant4实现伽玛射线与探测器乘积能量的模拟过程
💻 CC~
字号:
//// ********************************************************************// * 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: ExN01PrimaryGeneratorAction.cc,v 1.5 2002/05/14 01:50:31 asaim Exp $// GEANT4 tag $Name: geant4-07-00-patch-01 $//#include "mt01PrimaryGeneratorAction.hh"#include "G4Event.hh"#include "G4ParticleGun.hh"#include "G4ParticleTable.hh"#include "G4ParticleDefinition.hh"   #include "globals.hh"mt01PrimaryGeneratorAction::mt01PrimaryGeneratorAction(){  G4int n_particle = 1;  particleGun = new G4ParticleGun(n_particle);  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();  G4String particleName;   particleGun->SetParticleDefinition(particleTable->FindParticle(particleName="gamma"));  particleGun->SetParticleEnergy(10.*MeV);  particleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, 0.0));}mt01PrimaryGeneratorAction::~mt01PrimaryGeneratorAction(){  delete particleGun;}void mt01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){   G4int i = anEvent->GetEventID() % 100000000;  G4ThreeVector v(0.0,0.0,-1);  switch(i){ case 0:  particleGun->SetParticleEnergy(112.*keV);  break; case 100000:  particleGun->SetParticleEnergy(200.*keV);    break;case 200000:  particleGun->SetParticleEnergy(300.*keV);  break; case 300000:  particleGun->SetParticleEnergy(400.*keV);  break;  case 400000:  particleGun->SetParticleEnergy(500.*keV);  break; case 500000:  particleGun->SetParticleEnergy(662.*keV);   break; case 600000:  particleGun->SetParticleEnergy(700.*keV); break;   case 700000:  particleGun->SetParticleEnergy(800.*keV); break;   case 800000:  particleGun->SetParticleEnergy(900.*keV);  break;  case 900000:  particleGun->SetParticleEnergy(1130.*keV);    break; case 1000000:  particleGun->SetParticleEnergy(1460.*keV);  break;  case 1100000:  particleGun->SetParticleEnergy(2615.*keV);  break; case 1200000:  particleGun->SetParticleEnergy(4000.*keV);   break; case 1300000:  particleGun->SetParticleEnergy(5000.*keV);   break; case 1400000:  particleGun->SetParticleEnergy(6000.*keV);  break;   case 1500000:  particleGun->SetParticleEnergy(7000.*keV);  break;   case 1600000:  particleGun->SetParticleEnergy(8000.*keV);  break;   case 1700000:  particleGun->SetParticleEnergy(9000.*keV);  break;   case 1800000:  particleGun->SetParticleEnergy(10000.*keV);  break;   }   EventEnergy=particleGun->GetParticleEnergy()/keV;    G4cout<<EventEnergy<<G4endl;  particleGun->SetParticleMomentumDirection(v);particleGun->GeneratePrimaryVertex(anEvent);}

⌨️ 快捷键说明

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