Skip to content
Snippets Groups Projects
Commit 291183ff authored by Zhou Zhihao's avatar Zhou Zhihao
Browse files

Update 3 files

- /src/MyPhysicsMessenger.cc
- /README.md
- /README_English.md
parent 67ba3fde
No related branches found
No related tags found
No related merge requests found
...@@ -38,12 +38,12 @@ Geant4默认使用波尔模型计算mu-和介子被原子俘获后跃迁释放 ...@@ -38,12 +38,12 @@ Geant4默认使用波尔模型计算mu-和介子被原子俘获后跃迁释放
## 示例 ## 示例
以G4beamline-3.06为例 以G4beamline-3.06为例
1. 在${g4bl_source_path}/g4bl/BLCMDphysicsList.cc中引入头文件MyPhysics.hh 1. 在${g4bl_source_path}/g4bl/BLCMDphysics.cc中引入头文件MyPhysics.hh
2.return physicsLists;前添加 2.G4VModularPhysicsList *pl = dynamic_cast<G4VModularPhysicsList*>(physicsList);下面添加
MyPhysics* myPhysics = new MyPhysics(); MyPhysics* myPhysics = new MyPhysics();
physicsList->RegisterPhysics(myPhysics); pl->RegisterPhysics(myPhysics);
3. 修改${g4bl_source_path}/g4bl/CMakeLists.txt 3. 修改${g4bl_source_path}/g4bl/CMakeLists.txt
1> include_directories(/path_to_MyMuonMinusAtomicCapture) 1> 添加include_directories(/path_to_MyMuonMinusAtomicCapture/include)和link_directories(/path_to_libMyMuonMinusAtomicCapture.so)
2> 修改 2> 修改
target_link_libraries(g4bl ${LIBS}) target_link_libraries(g4bl ${LIBS})
......
...@@ -41,15 +41,16 @@ make ...@@ -41,15 +41,16 @@ make
Taking G4beamline-3.06 as an example: Taking G4beamline-3.06 as an example:
1. Introduce the header file MyMuonMinusAtomicCapture.hh in ${g4bl_source_path}/g4bl/BLCMDphysicsList.cc 1. Introduce the header file MyMuonMinusAtomicCapture.hh in ${g4bl_source_path}/g4bl/BLCMDphysics.cc
Add Add
`MyPhysics* myPhysics = new MyPhysics();` `MyPhysics* myPhysics = new MyPhysics();`
`physicsList->RegisterPhysics(myPhysics);` `pl->RegisterPhysics(myPhysics);`
before after
`return physicsLists;` `G4VModularPhysicsList *pl = dynamic_cast<G4VModularPhysicsList*>(physicsList);`
2. Modify g4bls​ourcep​ath/g4bl/CMakeLists.txt 2. Modify g4bls​ourcep​ath/g4bl/CMakeLists.txt
1> Add 1> Add
`include_d​irectories(/patht​oM​yMuonMinusAtomicCapture)` `include_d​irectories(/path_t​o_M​yMuonMinusAtomicCapture/include)`
`link_directories(/path_t​o_libM​yMuonMinusAtomicCapture.so)`
2> Change 2> Change
`target_l​ink_l​ibraries(g4bl ${LIBS})` `target_l​ink_l​ibraries(g4bl ${LIBS})`
to to
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include "G4HadronicInteractionRegistry.hh" #include "G4HadronicInteractionRegistry.hh"
#include "G4RunManager.hh" #include "G4RunManager.hh"
#include "G4ParticleTable.hh"
#include "G4GenericMuonicAtom.hh"
#include "G4MuonicAtomDecay.hh"
MyPhysicsMessenger::MyPhysicsMessenger(MyPhysics* phy) MyPhysicsMessenger::MyPhysicsMessenger(MyPhysics* phy)
: fMyPhysics(phy) : fMyPhysics(phy)
...@@ -61,14 +65,20 @@ void MyPhysicsMessenger::Work() { ...@@ -61,14 +65,20 @@ void MyPhysicsMessenger::Work() {
if (muMinus) { if (muMinus) {
G4ProcessManager* processManager = muMinus->GetProcessManager(); G4ProcessManager* processManager = muMinus->GetProcessManager();
if (processManager) { if (processManager) {
MyMuonMinusAtomicCapture* mymmac = new MyMuonMinusAtomicCapture; MyMuonMinusAtomicCapture* myMinusMuonicCapture = new MyMuonMinusAtomicCapture("myMuonMinusAtomicCapture");
if (mymmac) { //跃迁之后,考虑缪子原子,构建Muonic Atom并为其注册一些过程
G4GenericMuonicAtom* genericMuonicAtom = G4GenericMuonicAtom::Definition();
processManager->AddRestProcess(mymmac); G4ParticleTable* pt = G4ParticleTable::GetParticleTable();
} else { pt->SetGenericMuonicAtom(genericMuonicAtom);
G4cout << "MyMuonMinusAtomicCapture construction process failed. exit!" << G4endl; G4ProcessManager* pManager = new G4ProcessManager(genericMuonicAtom);
exit(0); genericMuonicAtom->SetProcessManager(pManager);
} pManager->AddRestProcess(new G4MuonicAtomDecay);
if (myMinusMuonicCapture) {
processManager->AddRestProcess(myMinusMuonicCapture);
} else {
G4cout << "MyMuonMinusAtomicCapture construction process failed. exit!" << G4endl;
exit(0);
}
} else { } else {
G4cout << "Can't get ProcessManager of mu-" << G4endl; G4cout << "Can't get ProcessManager of mu-" << G4endl;
exit(0); exit(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment