Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: Brachy.cc
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - ExDiane example
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyAnalysisManager.hh,v 1.3 2006/06/29 17:30:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorConstruction.hh,v 1.3 2006/06/29 17:30:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ****************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionI.hh,v 1.3 2006/06/29 17:31:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ****************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionIr.hh,v 1.3 2006/06/29 17:31:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ****************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionLeipzig.hh,v 1.3 2006/06/29 17:31:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//Author: Susanna Guatelli
|
||||
//
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *****************************************
|
||||
//
|
||||
// $Id: BrachyDetectorMessenger.hh,v 1.3 2006/06/29 17:31:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
#ifndef BrachyDetectorMessenger_h
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyEventAction.hh,v 1.3 2006/06/29 17:31:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// Code developed by:
|
||||
// S.Guatelli
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
// Code developed by: Susanna Guatelli
|
||||
//
|
||||
// $Id: BrachyFactory.hh,v 1.2 2006/06/29 17:31:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyFactoryI.hh,v 1.2 2006/06/29 17:32:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyFactoryIr.hh,v 1.2 2006/06/29 17:32:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyFactoryLeipzig.hh,v 1.2 2006/06/29 17:32:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyMaterial.hh,v 1.2 2006/06/29 17:32:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPhantomHit.hh,v 1.3 2006/06/29 17:32:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// ********************************
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPhantomROGeometry.hh,v 1.3 2006/06/29 17:32:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPhantomSD.hh,v 1.2 2006/06/29 17:32:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPhysicsList.hh,v 1.3 2006/06/29 17:32:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorAction.hh,v 1.2 2006/06/29 17:32:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// ********************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorActionI.hh,v 1.3 2006/06/29 17:32:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//Author: Susanna Guatelli
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorActionIr.hh,v 1.3 2006/06/29 17:32:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// *************************************************
|
||||
// * *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyRunAction.hh,v 1.3 2006/06/29 17:32:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//Author: Susanna Guatelli
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyRunMessenger.hh,v 1.3 2006/06/29 17:32:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//Author: Susanna Guatelli
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachySimulation.hh
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - Brachytherapy example
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyAnalysisManager.cc,v 1.3 2006/06/29 17:32:37 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// ****************************************
|
||||
//
|
||||
// $Id: BrachyDetectorConstruction.cc,v 1.3 2006/06/29 17:32:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPhantomROGeometry.hh"
|
||||
#include "BrachyPhantomSD.hh"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// ****************************************
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionI.cc,v 1.3 2006/06/29 17:32:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "BrachyDetectorConstructionI.hh"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// ****************************************
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionIr.cc,v 1.3 2006/06/29 17:32:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "BrachyDetectorConstructionIr.hh"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorConstructionLeipzig.cc,v 1.3 2006/06/29 17:32:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachyDetectorMessenger.cc,v 1.3 2006/06/29 17:33:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyEventAction.cc,v 1.3 2006/06/29 17:33:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyEventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyFactory.cc,v 1.3 2006/06/29 17:33:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include"BrachyFactory.hh"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyFactoryI.cc,v 1.2 2006/06/29 17:33:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyFactoryI.hh"
|
||||
#include "BrachyPrimaryGeneratorActionI.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyFactoryIr.cc,v 1.3 2006/06/29 17:33:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "BrachyFactoryIr.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyFactoryLeipzig.cc,v 1.3 2006/06/29 17:33:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyMaterial.cc,v 1.3 2006/06/29 17:33:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "G4MaterialPropertiesTable.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// ********************************
|
||||
//
|
||||
// $Id: BrachyPhantomHit.cc,v 1.3 2006/06/29 17:33:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPhantomHit.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// ************************************
|
||||
//
|
||||
// $Id: BrachyPhantomROGeometry.cc,v 1.3 2006/06/29 17:33:25 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPhantomROGeometry.hh"
|
||||
#include "BrachyDummySD.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// ********************************
|
||||
//
|
||||
// $Id: BrachyPhantomSD.cc,v 1.4 2006/06/29 17:33:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPhantomSD.hh"
|
||||
#include "BrachyPhantomHit.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// **********************************
|
||||
//
|
||||
// $Id: BrachyPhysicsList.cc,v 1.3 2006/06/29 17:33:29 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPhysicsList.hh"
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// ********************************************
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorAction.cc,v 1.2 2006/06/29 17:33:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "BrachyPrimaryGeneratorAction.hh"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// ********************************************
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorActionI.cc,v 1.4 2006/06/29 17:33:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPrimaryGeneratorActionI.hh"
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// ********************************************
|
||||
//
|
||||
// $Id: BrachyPrimaryGeneratorActionIr.cc,v 1.4 2006/06/29 17:33:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
#include "BrachyPrimaryGeneratorActionIr.hh"
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// *******************************
|
||||
//
|
||||
// $Id: BrachyRunAction.cc,v 1.3 2006/06/29 17:33:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "BrachyRunAction.hh"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// S.Guatelli
|
||||
//
|
||||
// $Id: BrachyRunMessenger.cc,v 1.3 2006/06/29 17:33:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: BrachySimulation.cc
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - Brachytherapy example
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
$Id: History,v 1.1 2007/11/16 04:02:10 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
16 Nov. 2007 K.Murakami
|
||||
- commited to G4 CVS.
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
$Id: README,v 1.2 2007/11/16 14:04:05 kmura Exp $
|
||||
==========================================================================
|
||||
Geant4 MPI Interface
|
||||
|
||||
Author:
|
||||
Koichi Murakami (KEK) / Koichi.Murakami@kek.jp
|
||||
==========================================================================
|
||||
|
||||
About the interface
|
||||
===================
|
||||
G4MPI is a native interface with MPI libraries. The directory contains
|
||||
a Geant4 UI library and a couple of parallelized examples.
|
||||
Using this interface, users applications can be parllelized with
|
||||
different MPI compliant libraries, such as LAM/MPI, MPICH2, OpenMPI,
|
||||
and so on.
|
||||
|
||||
System Requirements:
|
||||
-------------------
|
||||
* Platform
|
||||
|
||||
- Linux (32bit/64bit)
|
||||
- MacOS (Tiger)
|
||||
|
||||
|
||||
* MPI implementation
|
||||
|
||||
- LAM/MPI (7.1.3)
|
||||
http://www.lam-mpi.org/
|
||||
|
||||
- MPICH2 (1.0.6p1)
|
||||
http://www.mcs.anl.gov/research/projects/mpich2/
|
||||
|
||||
- Open MPI (1.2.4)
|
||||
http://www.open-mpi.org/
|
||||
|
||||
|
||||
* Optional
|
||||
- ROOT for histogramming/analysis
|
||||
|
||||
|
||||
G4MPI UI library
|
||||
----------------
|
||||
G4MPI UI library is provided in the "mpi_interface" directory.
|
||||
Start with building the G4MPI UI library according to the instruction
|
||||
in the directory.
|
||||
|
||||
|
||||
How to make parallel applications:
|
||||
----------------------------------
|
||||
* An example of a main program:
|
||||
|
||||
#include "G4MPImanager.hh"
|
||||
#include "G4MPIsession.hh"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// At first, G4MPImanager/G4MPIsession should be created.
|
||||
G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
|
||||
|
||||
// MPI session (G4MPIsession) instead of G4UIterminal
|
||||
G4MPIsession* session= g4MPI-> GetMPIsession();
|
||||
|
||||
// LAM users can use G4tcsh.
|
||||
G4String prompt= "G4MPI";
|
||||
G4UItcsh* tcsh= new G4UItcsh(prompt);
|
||||
session-> SetShell(tcsh);
|
||||
|
||||
// user application setting
|
||||
G4RunManager* runManager= new G4RunManager();
|
||||
|
||||
// ....
|
||||
|
||||
// After user application setting, just start a MPI session.
|
||||
// MPIsession treats both interactive and batch modes.
|
||||
session-> SessionStart();
|
||||
|
||||
// Finally, terminate the program
|
||||
delete g4MPI;
|
||||
delete runManager;
|
||||
}
|
||||
|
||||
|
||||
* Notes about session shell:
|
||||
|
||||
LAM/MPI users can use "G4tcsh" as an interactive session shell.
|
||||
For other users (Open MPI/MPICH2), plese use G4csh (default).
|
||||
|
||||
|
||||
How to use:
|
||||
-----------
|
||||
* MPI runtime rnvironment
|
||||
|
||||
1. Make hosts/cluster configuration of your MPI environment.
|
||||
|
||||
2. Launch MPI runtime environment, typically executing
|
||||
lamboot (LAM) / mpdboot (MPICH2).
|
||||
|
||||
* How to run
|
||||
For example,
|
||||
|
||||
> mpiexec -n # <your application>
|
||||
|
||||
Instead, "mpirun" command is more convenient for LAM users.
|
||||
|
||||
|
||||
MPI G4UI commands:
|
||||
------------------
|
||||
G4UI commands handling the G4MPI interface are placed in /mpi/.
|
||||
|
||||
Command directory path : /mpi/
|
||||
|
||||
Guidance :
|
||||
MPI control commands
|
||||
|
||||
Sub-directories :
|
||||
Commands :
|
||||
verbose * Set verbose level.
|
||||
status * Show mpi status.
|
||||
execute * Execute a macro file. (=/control/execute)
|
||||
beamOn * Start a parallel run w/ thread.
|
||||
.beamOn * Start a parallel run w/o thread. (=/run/beamOn)
|
||||
masterWeight * Set weight for master node.
|
||||
showSeeds * Show seeds of MPI nodes.
|
||||
setMasterSeed * Set a master seed for the seed generator.
|
||||
setSeed * Set a seed for a specified node.
|
||||
|
||||
* Notes:
|
||||
While "/run/beamOn" is executed in foreground, the "/mpi/beamOn"
|
||||
command invokes beam-on in background, so you can input UI commands
|
||||
even while event processing.
|
||||
|
||||
The original "/control/execute" and "/run/beamOn" are overwritten
|
||||
with "/mpi/execute" and "/mpi/.beamOn" commands, customized for
|
||||
the MPI interface.
|
||||
|
||||
|
||||
Examples
|
||||
========
|
||||
There are a couple of examples for Geant4 MPI applications.
|
||||
|
||||
In some cases, you need to set some additional environment variables
|
||||
for running examples:
|
||||
|
||||
- G4LEVELGAMMADATA : directory path for the data of
|
||||
"low energy electromagnetic processes".
|
||||
|
||||
For running ROOT applications,
|
||||
|
||||
- ROOTSYS : root path of the ROOT package
|
||||
- LD_LIBRARY_PATH : add ROOT library path, such as $(ROOTSYS)/lib/root
|
||||
|
||||
|
||||
[exMPI01]
|
||||
A simple application.
|
||||
|
||||
* Geometry : chamber / calorimeter
|
||||
* Primary : particle gun (200 MeV electron as default)
|
||||
* Physics List : standard EM
|
||||
|
||||
- Particles are transported in a geometry without any scoring.
|
||||
- Learn how to parallelize your G4 session.
|
||||
|
||||
|
||||
[exMPI02] (ROOT application)
|
||||
An example of dosimetry in a water phantom.
|
||||
|
||||
* Geometry : water phantom
|
||||
* Primary : particle gun (200 MeV proton as default)
|
||||
* Physics List : QGSP_BIC
|
||||
|
||||
- Score dose distribution in a water phantom.
|
||||
- Learn how to paralleize your applications.
|
||||
- Create a ROOT file containing histograms in each node.
|
||||
* treat multiple outputs properly:
|
||||
each slave node generate a ROOT file, whose file name should
|
||||
be different from each other.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# $Id: GNUmakefile,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4 MPI aplication
|
||||
# ===========================================================
|
||||
name := exMPI01#
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
G4WORKDIR := .
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
include ../mpi_interface/G4MPI.gmk
|
||||
|
||||
LDLIBS1 += -lG4UImpi
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
$Id: History,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
exMPI01 History
|
||||
---------------
|
||||
|
||||
16 Nov. 2007 K.Murakami
|
||||
- commited to G4 CVS.
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
$Id: README,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Example MPI01
|
||||
-------------
|
||||
|
||||
A simple application.
|
||||
|
||||
* Geometry : chamber / calorimeter
|
||||
* Primary : particle gun (200 MeV electron as default)
|
||||
* Physics List : standard EM
|
||||
|
||||
- Particles are transported in a geometry without any scoring.
|
||||
- Learn how to parallelized your G4 session.
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: exMPI01.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// exMPI01.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
// my application
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
// MPI session
|
||||
#include "G4MPImanager.hh"
|
||||
#include "G4MPIsession.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// random engine
|
||||
//CLHEP::HepJamesRandom randomEngine;
|
||||
CLHEP::Ranlux64Engine randomEngine;
|
||||
CLHEP::HepRandom::setTheEngine(&randomEngine);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// MPI session
|
||||
// --------------------------------------------------------------------
|
||||
// At first, G4MPImanager/G4MPIsession should be created.
|
||||
G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
|
||||
|
||||
// MPI session (G4MPIsession) instead of G4UIterminal
|
||||
// Terminal availability depends on your MPI implementation.
|
||||
G4MPIsession* session= g4MPI-> GetMPIsession();
|
||||
|
||||
// LAM/MPI users can use G4tcsh.
|
||||
G4String prompt= "[40;01;33m";
|
||||
prompt+= "G4MPI";
|
||||
prompt+= "[40;31m(%s)[40;36m[%/][00;30m:";
|
||||
|
||||
G4UItcsh* tcsh= new G4UItcsh(prompt);
|
||||
tcsh-> SetLsColor(BLUE,RED);
|
||||
session-> SetShell(tcsh);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// user application setting
|
||||
// --------------------------------------------------------------------
|
||||
G4RunManager* runManager= new G4RunManager();
|
||||
|
||||
// setup your application
|
||||
runManager-> SetUserInitialization(new DetectorConstruction);
|
||||
runManager-> SetUserInitialization(new PhysicsList);
|
||||
runManager-> SetUserAction(new PrimaryGeneratorAction);
|
||||
|
||||
runManager-> Initialize();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
G4VisExecutive* visManager= new G4VisExecutive;
|
||||
visManager-> Initialize();
|
||||
G4cout << G4endl;
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ready for go
|
||||
// MPIsession treats both interactive and batch modes.
|
||||
// Just start your session as below.
|
||||
// --------------------------------------------------------------------
|
||||
session-> SessionStart();
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// termination
|
||||
// --------------------------------------------------------------------
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
|
||||
delete g4MPI;
|
||||
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef DETECTOR_CONSTRUCTION_H
|
||||
#define DETECTOR_CONSTRUCTION_H
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction {
|
||||
|
||||
public:
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Materials.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Materials.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef MATERIALS_H
|
||||
#define MATERIALS_H
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class Materials {
|
||||
|
||||
public:
|
||||
Materials();
|
||||
~Materials();
|
||||
|
||||
void Construct();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Particles.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Particles.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef PARTICLES_H
|
||||
#define PARTICLES_H
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class Particles : public G4VPhysicsConstructor {
|
||||
|
||||
public:
|
||||
Particles();
|
||||
~Particles();
|
||||
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsList.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsList.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef PHYSICS_LIST_H
|
||||
#define PHYSICS_LIST_H
|
||||
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class PhysicsList: public G4VModularPhysicsList {
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList();
|
||||
|
||||
virtual void SetCuts();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsListEMstd.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsListEMstd.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef PHYSICS_LIST_EM_STD_H
|
||||
#define PHYSICS_LIST_EM_STD_H
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class PhysicsListEMstd : public G4VPhysicsConstructor {
|
||||
|
||||
public:
|
||||
PhysicsListEMstd();
|
||||
~PhysicsListEMstd();
|
||||
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.hh,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PrimaryGeneratorAction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef PRIMARY_GENERATOR_ACTION_H
|
||||
#define PRIMARY_GENERATOR_ACTION_H
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
|
||||
|
||||
private:
|
||||
G4ParticleGun* particleGun;
|
||||
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event* anEvent);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "Materials.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
// constants (detector parameters)
|
||||
static const G4double DXYZ_AREA= 32.*cm;
|
||||
static const G4double DW= 10.*cm;
|
||||
|
||||
////////////////////////////////////////////
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
///////////////////////////////////////////////////
|
||||
{
|
||||
// material definition
|
||||
Materials* materialConstruction= new Materials;
|
||||
materialConstruction-> Construct();
|
||||
|
||||
G4Material* mate;
|
||||
G4VisAttributes* va;
|
||||
|
||||
// ==============================================================
|
||||
// world volume
|
||||
// ==============================================================
|
||||
G4Box* areaSolid= new G4Box("AREA",
|
||||
DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
|
||||
|
||||
G4Material* vacuum= G4Material::GetMaterial("Vacuum");
|
||||
G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
|
||||
G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
|
||||
areaLV, 0, false, 0);
|
||||
// vis. attributes
|
||||
va= new G4VisAttributes(G4Color(1.,1.,1.));
|
||||
va-> SetVisibility(false);
|
||||
areaLV-> SetVisAttributes(va);
|
||||
|
||||
// ==============================================================
|
||||
// detectors
|
||||
// ==============================================================
|
||||
// voxel
|
||||
const G4double dvoxel= 10.*mm;
|
||||
const G4double dl= 10.*cm;
|
||||
|
||||
G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
|
||||
mate= G4Material::GetMaterial("Vacuum");
|
||||
G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
|
||||
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
|
||||
va-> SetVisibility(false);
|
||||
lvoxel-> SetVisAttributes(va);
|
||||
|
||||
G4int ix, iz;
|
||||
G4int index=0;
|
||||
for (iz=0; iz<5; iz++) {
|
||||
for (ix=-7; ix<=7; ix++) {
|
||||
G4double x0= (2.*ix)*cm;
|
||||
G4double z0= (-13.+2.*iz)*cm;
|
||||
new G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
|
||||
lvoxel, "voxel", areaLV, false, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
// tube
|
||||
//G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
|
||||
G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
|
||||
0., 360.*deg);
|
||||
mate= G4Material::GetMaterial("Al");
|
||||
G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
|
||||
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
|
||||
ltube-> SetVisAttributes(va);
|
||||
|
||||
G4RotationMatrix* rmtube= new G4RotationMatrix;
|
||||
rmtube-> rotateX(-90.*deg);
|
||||
new G4PVPlacement(rmtube, G4ThreeVector(),
|
||||
ltube, "tube", lvoxel, false, 0);
|
||||
|
||||
// cal
|
||||
const G4double dxycal= 25.*mm;
|
||||
const G4double dzcal= 3.*cm;
|
||||
|
||||
G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
|
||||
mate= G4Material::GetMaterial("CsI");
|
||||
G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
|
||||
va= new G4VisAttributes(G4Color(0.5,0.5,0.));
|
||||
lcal-> SetVisAttributes(va);
|
||||
|
||||
index= 0;
|
||||
for (ix=-2; ix<=2; ix++) {
|
||||
G4double x0= (5.*ix)*cm;
|
||||
new G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
|
||||
lcal, "cal", areaLV, false, index);
|
||||
index++;
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Materials.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Materials.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "Materials.hh"
|
||||
#include "G4Material.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////
|
||||
Materials::Materials()
|
||||
//////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
Materials::~Materials()
|
||||
///////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
void Materials::Construct()
|
||||
///////////////////////////
|
||||
{
|
||||
G4double A, Z;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Elements
|
||||
// ------------------------------------------------------------------------
|
||||
G4Element* elH = new G4Element("Hydrogen","H", Z=1., A=1.00794*g/mole);
|
||||
G4Element* elC = new G4Element("Carbon", "C", Z=6., A= 12.011 *g/mole);
|
||||
G4Element* elN = new G4Element("Nitrogen","N", Z=7., A= 14.00674*g/mole);
|
||||
G4Element* elO = new G4Element("Oxygen", "O", Z=8., A= 15.9994*g/mole);
|
||||
G4Element* elNa = new G4Element("Sodium", "Na", Z=11., A= 22.989768*g/mole);
|
||||
G4Element* elSi = new G4Element("Silicon", "Si", Z=14., A= 28.0855*g/mole);
|
||||
G4Element* elAr = new G4Element("Argon", "Ar", Z=18., A= 39.948*g/mole);
|
||||
G4Element* elI = new G4Element("Iodine", "I", Z=53., A= 126.90447*g/mole);
|
||||
G4Element* elCs = new G4Element("Cesium", "Cs", Z=55., A= 132.90543*g/mole);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Materials
|
||||
// ------------------------------------------------------------------------
|
||||
G4double density, massfraction;
|
||||
G4int natoms, nel;
|
||||
|
||||
// temperature of experimental hall is controlled at 20 degree.
|
||||
const G4double expTemp= STP_Temperature+20.*kelvin;
|
||||
|
||||
// vacuum
|
||||
density= universe_mean_density;
|
||||
G4Material* Vacuum= new G4Material("Vacuum", density, nel=2);
|
||||
Vacuum-> AddElement(elN, .7);
|
||||
Vacuum-> AddElement(elO, .3);
|
||||
|
||||
// air
|
||||
density= 1.2929e-03 *g/cm3; // at 20 degree
|
||||
G4Material* Air= new G4Material("Air", density, nel=3,
|
||||
kStateGas, expTemp);
|
||||
G4double ttt= 75.47+23.20+1.28;
|
||||
Air-> AddElement(elN, massfraction= 75.47/ttt);
|
||||
Air-> AddElement(elO, massfraction= 23.20/ttt);
|
||||
Air-> AddElement(elAr, massfraction= 1.28/ttt);
|
||||
|
||||
// Ar gas
|
||||
A= 39.948 *g/mole;
|
||||
const G4double denAr= 1.782e-03 *g/cm3 * STP_Temperature/expTemp;
|
||||
G4Material* Ar= new G4Material("ArgonGas", Z=18., A, denAr,
|
||||
kStateGas, expTemp);
|
||||
|
||||
// ethane (C2H6)
|
||||
const G4double denEthane= 1.356e-3 *g/cm3 * STP_Temperature/expTemp;
|
||||
G4Material* Ethane= new G4Material("Ethane", denEthane, nel=2,
|
||||
kStateGas, expTemp);
|
||||
Ethane-> AddElement(elC, natoms=2);
|
||||
Ethane-> AddElement(elH, natoms=6);
|
||||
|
||||
// Ar(50%) + ethane(50%) mixture
|
||||
density= (denAr+denEthane)/2.;
|
||||
G4Material* ArEthane= new G4Material("ArEthane", density, nel=2,
|
||||
kStateGas, expTemp);
|
||||
ArEthane-> AddMaterial(Ar, massfraction= denAr/density/2.);
|
||||
ArEthane-> AddMaterial(Ethane, massfraction= denEthane/density/2.);
|
||||
|
||||
// silicon
|
||||
A= 28.0855 *g/mole;
|
||||
density= 2.33 *g/cm3;
|
||||
new G4Material("SiliconWafer", Z=14., A, density);
|
||||
|
||||
// alminium
|
||||
A= 26.98 *g/mole;
|
||||
density= 2.70 *g/cm3;
|
||||
new G4Material("Al", Z=13., A, density);
|
||||
|
||||
// iron
|
||||
A= 55.847 *g/mole;
|
||||
density= 7.87 *g/cm3;
|
||||
new G4Material("Iron", Z=26., A, density);
|
||||
|
||||
// lead
|
||||
A= 207.2 *g/mole;
|
||||
density= 11.35 *g/cm3;
|
||||
new G4Material("Lead", Z=82., A, density);
|
||||
|
||||
// scintillator (Polystyene(C6H5CH=CH2))
|
||||
density= 1.032 *g/cm3;
|
||||
G4Material* Scinti= new G4Material("Scinti", density, nel=2);
|
||||
Scinti-> AddElement(elC, natoms=8);
|
||||
Scinti-> AddElement(elH, natoms=8);
|
||||
|
||||
// quartz (SiO2, crystalline)
|
||||
density= 2.64 *g/cm3;
|
||||
G4Material* Quartz= new G4Material("Quartz", density, nel= 2);
|
||||
Quartz-> AddElement(elSi, natoms=1);
|
||||
Quartz-> AddElement(elO, natoms=2);
|
||||
|
||||
// NaI crystal
|
||||
density= 3.67 *g/cm3;
|
||||
G4Material* NaI= new G4Material("NaI", density, nel= 2);
|
||||
NaI-> AddElement(elNa, natoms=1);
|
||||
NaI-> AddElement(elI, natoms=1);
|
||||
|
||||
// CsI crystal
|
||||
density= 4.51 *g/cm3;
|
||||
G4Material* CsI= new G4Material("CsI", density, nel= 2);
|
||||
CsI-> AddElement(elCs, natoms=1);
|
||||
CsI-> AddElement(elI, natoms=1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Particles.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Particles.cc
|
||||
// Physics list for defining particles
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "Particles.hh"
|
||||
|
||||
#include "G4LeptonConstructor.hh"
|
||||
#include "G4BosonConstructor.hh"
|
||||
#include "G4MesonConstructor.hh"
|
||||
#include "G4BaryonConstructor.hh"
|
||||
#include "G4ShortLivedConstructor.hh"
|
||||
#include "G4IonConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////
|
||||
Particles::Particles()
|
||||
: G4VPhysicsConstructor("Particles")
|
||||
//////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
Particles::~Particles()
|
||||
///////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
void Particles::ConstructParticle()
|
||||
///////////////////////////////////
|
||||
{
|
||||
G4LeptonConstructor::ConstructParticle();
|
||||
G4BosonConstructor::ConstructParticle();
|
||||
G4MesonConstructor::ConstructParticle();
|
||||
G4BaryonConstructor::ConstructParticle();
|
||||
G4ShortLivedConstructor::ConstructParticle();
|
||||
G4IonConstructor::ConstructParticle();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
void Particles::ConstructProcess()
|
||||
//////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsList.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsList.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "PhysicsList.hh"
|
||||
#include "Particles.hh"
|
||||
#include "PhysicsListEMstd.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
///////////////////////////
|
||||
PhysicsList::PhysicsList()
|
||||
: G4VModularPhysicsList()
|
||||
////////////////////////////
|
||||
{
|
||||
// default cut value (1.0mm)
|
||||
defaultCutValue = 1.*mm;
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// particles
|
||||
RegisterPhysics(new Particles);
|
||||
|
||||
// EM Physics
|
||||
RegisterPhysics(new PhysicsListEMstd);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
PhysicsList::~PhysicsList()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
void PhysicsList::SetCuts()
|
||||
///////////////////////////
|
||||
{
|
||||
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
|
||||
// the default cut value for all particle types
|
||||
SetCutsWithDefault();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsListEMstd.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsListEMstd.cc
|
||||
// Physics list for electron/positron/gamma
|
||||
// EM-standard package w/ default parameters
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "PhysicsListEMstd.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4AntiNeutrinoE.hh"
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4MultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////
|
||||
PhysicsListEMstd::PhysicsListEMstd()
|
||||
: G4VPhysicsConstructor("EM-std")
|
||||
////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
PhysicsListEMstd::~PhysicsListEMstd()
|
||||
/////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
void PhysicsListEMstd::ConstructParticle()
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
void PhysicsListEMstd::ConstructProcess()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
G4ProcessManager* pm;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// gamma physics
|
||||
// ----------------------------------------------------------
|
||||
pm= G4Gamma::Gamma()-> GetProcessManager();
|
||||
pm-> AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pm-> AddDiscreteProcess(new G4ComptonScattering);
|
||||
pm-> AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// electron physics
|
||||
// ----------------------------------------------------------
|
||||
G4MultipleScattering* msc= new G4MultipleScattering;
|
||||
G4eIonisation* eion= new G4eIonisation;
|
||||
G4eBremsstrahlung* ebrems= new G4eBremsstrahlung;
|
||||
|
||||
pm= G4Electron::Electron()->GetProcessManager();
|
||||
pm-> AddProcess(msc, ordInActive, 1, 1);
|
||||
pm-> AddProcess(eion, ordInActive, 2, 2);
|
||||
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// positron physics
|
||||
// ----------------------------------------------------------
|
||||
msc= new G4MultipleScattering;
|
||||
eion= new G4eIonisation;
|
||||
ebrems= new G4eBremsstrahlung;
|
||||
G4eplusAnnihilation* annihilation= new G4eplusAnnihilation;
|
||||
|
||||
pm= G4Positron::Positron()-> GetProcessManager();
|
||||
pm-> AddProcess(msc, ordInActive, 1, 1);
|
||||
pm-> AddProcess(eion, ordInActive, 2, 2);
|
||||
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
|
||||
pm-> AddProcess(annihilation, 0, ordInActive, 4);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.1 2007/11/16 14:16:46 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// PrimaryGeneratorAction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////////////////
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
particleGun= new G4ParticleGun;
|
||||
|
||||
G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle= particleTable-> FindParticle("e-");
|
||||
|
||||
particleGun-> SetParticleDefinition(particle);
|
||||
particleGun-> SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-14.9*cm));
|
||||
particleGun-> SetParticleEnergy(200.*MeV);
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
/////////////////////////////////////////////////
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
////////////////////////////////////////////////////////////////
|
||||
{
|
||||
particleGun-> GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/vis/open OGLIX
|
||||
|
||||
/vis/scene/create
|
||||
/vis/scene/add/volume
|
||||
|
||||
/vis/sceneHandler/attach
|
||||
|
||||
/vis/viewer/set/viewpointThetaPhi 90. 270.
|
||||
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#/vis/scene/endOfEventAction refresh
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# $Id: GNUmakefile,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4 MPI aplication
|
||||
# ===========================================================
|
||||
name := exMPI02#
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
G4WORKDIR := .
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
include ../mpi_interface/G4MPI.gmk
|
||||
|
||||
LDLIBS1 += -lG4UImpi
|
||||
|
||||
ifdef ROOTSYS
|
||||
CPPFLAGS += -I$(shell $(ROOTSYS)/bin/root-config --incdir)
|
||||
LDLIBS += $(shell $(ROOTSYS)/bin/root-config --libs)
|
||||
endif
|
||||
|
||||
ifeq ($(G4SYSTEM),Linux-g++)
|
||||
LDLIBS += -Wl,-rpath,$(shell $(ROOTSYS)/bin/root-config --libdir)
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
$Id: History,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
exMPI02 History
|
||||
---------------
|
||||
|
||||
16 Nov. 2007 K.Murakami
|
||||
- commited to G4 CVS.
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
$Id: README,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Example MPI02
|
||||
-------------
|
||||
|
||||
An example of dosimetry in a water phantom.
|
||||
|
||||
* Geometry : water phantom
|
||||
* Primary : broad beam (200 MeV proton)
|
||||
* Physics List : QGSP_BIC
|
||||
You need to set an additional environment variable;
|
||||
$G4LEVELGAMMADATA indicates a directory path for the data of
|
||||
"low energy electromagnetic processes".
|
||||
* Analysis : ROOT histogramming
|
||||
ROOT should be installed under $ROOTSYS.
|
||||
|
||||
- Score dose distribution in a water phantom.
|
||||
- Learn how to paralleized your applications.
|
||||
- Create a ROOT file containing histograms/trees in each node.
|
||||
* treat multiple outputs properly:
|
||||
each slave node generate a ROOT file, whose file name should
|
||||
be different from each other.
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: exMPI02.cc,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// exMPI02.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
// my application
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "MedicalBeam.hh"
|
||||
#include "QGSP_BIC.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
// MPI session
|
||||
#include "G4MPImanager.hh"
|
||||
#include "G4MPIsession.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// random engine
|
||||
//CLHEP::Ranlux64Engine randomEngine;
|
||||
//CLHEP::HepRandom::setTheEngine(&randomEngine);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// MPI session
|
||||
// --------------------------------------------------------------------
|
||||
// At first, G4MPImanager/G4MPIsession should be created.
|
||||
G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
|
||||
|
||||
// MPI session (G4MPIsession) instead of G4UIterminal
|
||||
// Terminal availability depends on your MPI implementation.
|
||||
G4MPIsession* session= g4MPI-> GetMPIsession();
|
||||
|
||||
// LAM/MPI users can use G4tcsh.
|
||||
G4String prompt= "[40;01;33m";
|
||||
prompt+= "G4MPI";
|
||||
prompt+= "[40;31m(%s)[40;36m[%/][00;30m:";
|
||||
|
||||
G4UItcsh* tcsh= new G4UItcsh(prompt);
|
||||
tcsh-> SetLsColor(BLUE,RED);
|
||||
session-> SetShell(tcsh);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// user application setting
|
||||
// --------------------------------------------------------------------
|
||||
G4RunManager* runManager= new G4RunManager();
|
||||
|
||||
// setup your application
|
||||
runManager-> SetUserInitialization(new DetectorConstruction);
|
||||
runManager-> SetUserInitialization(new QGSP_BIC);
|
||||
runManager-> SetUserAction(new MedicalBeam);
|
||||
runManager-> SetUserAction(new RunAction);
|
||||
runManager-> SetUserAction(new EventAction);
|
||||
|
||||
runManager-> Initialize();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
G4VisExecutive* visManager= new G4VisExecutive;
|
||||
visManager-> Initialize();
|
||||
G4cout << G4endl;
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ready for go
|
||||
// MPIsession treats both interactive and batch modes.
|
||||
// Just start your session as below.
|
||||
// --------------------------------------------------------------------
|
||||
session-> SessionStart();
|
||||
|
||||
|
||||
// termination
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
|
||||
delete g4MPI;
|
||||
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Analysis.hh,v 1.1 2007/11/16 14:29:32 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Analysis.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef ANALYSIS_MANAGER_H
|
||||
#define ANALYSIS_MANAGER_H
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class TH1D;
|
||||
class TH2D;
|
||||
|
||||
class Analysis {
|
||||
private:
|
||||
static Analysis* myanalysis;
|
||||
|
||||
TH2D* incident_map;
|
||||
TH1D* incident_x_hist;
|
||||
|
||||
TH2D* dose_map;
|
||||
TH1D* dose_hist;
|
||||
|
||||
Analysis(); // protected
|
||||
|
||||
G4bool incidentFlag;
|
||||
|
||||
public:
|
||||
~Analysis();
|
||||
|
||||
static Analysis* GetAnalysis();
|
||||
|
||||
void Update();
|
||||
void Clear();
|
||||
void Save(const G4String& fname);
|
||||
|
||||
void FillIncident(const G4ThreeVector& p);
|
||||
void FillDose(const G4ThreeVector& p, G4double dedx);
|
||||
|
||||
void ClearIncidentFlag();
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
|
||||
inline void Analysis::ClearIncidentFlag()
|
||||
{ incidentFlag= false; }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.hh,v 1.1 2007/11/16 14:29:32 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.hh
|
||||
//
|
||||
// Q
|
||||
// ====================================================================
|
||||
#ifndef DETECTOR_CONSTRUCTION_H
|
||||
#define DETECTOR_CONSTRUCTION_H
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction {
|
||||
|
||||
public:
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.hh,v 1.2 2007/12/10 16:28:34 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// EventAction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef EVENT_ACTION_H
|
||||
#define EVENT_ACTION_H
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class EventAction : public G4UserEventAction {
|
||||
|
||||
public:
|
||||
EventAction();
|
||||
~EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* aevent);
|
||||
virtual void EndOfEventAction(const G4Event* aevent);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: MedicalBeam.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// MedicalBeam.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef MEDICAL_BEAM_H
|
||||
#define MEDICAL_BEAM_H
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class MedicalBeam : public G4VUserPrimaryGeneratorAction {
|
||||
public:
|
||||
enum FieldShape{ SQUARE=0, CIRCLE };
|
||||
|
||||
protected:
|
||||
G4ParticleDefinition* particle;
|
||||
G4double kineticE;
|
||||
G4ThreeVector sourcePosition;
|
||||
|
||||
G4double SSD; // (SSD= Source Skin Depth)
|
||||
FieldShape fieldShape;
|
||||
G4double fieldXY[2];
|
||||
G4double fieldR;
|
||||
|
||||
// local methods...
|
||||
G4ThreeVector GenerateBeamDirection() const;
|
||||
|
||||
public:
|
||||
MedicalBeam();
|
||||
~MedicalBeam();
|
||||
|
||||
// set/get functions...
|
||||
void SetParticleDefinition(G4ParticleDefinition* pd);
|
||||
const G4ParticleDefinition* GetParticleDefinition() const;
|
||||
|
||||
void SetKineticE(G4double e);
|
||||
G4double GetKineticE() const;
|
||||
|
||||
void SetSourcePosition(const G4ThreeVector& pos);
|
||||
G4ThreeVector GetSourcePosition() const;
|
||||
|
||||
void SetFieldShape(FieldShape shape);
|
||||
FieldShape GetFieldShape() const;
|
||||
|
||||
void SetSSD(G4double ssd);
|
||||
G4double GetSSD() const;
|
||||
|
||||
void SetFieldXY(G4double fx, G4double fy);
|
||||
G4double GetFieldX() const;
|
||||
G4double GetFieldY() const;
|
||||
|
||||
void SetFieldR(G4double r);
|
||||
G4double GetFieldR() const;
|
||||
|
||||
// methods...
|
||||
virtual void GeneratePrimaries(G4Event* anEvent);
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
inline void MedicalBeam::SetParticleDefinition(G4ParticleDefinition* pd)
|
||||
{ particle= pd; }
|
||||
|
||||
inline const G4ParticleDefinition* MedicalBeam::GetParticleDefinition() const
|
||||
{ return particle; }
|
||||
|
||||
inline void MedicalBeam::SetKineticE(G4double e)
|
||||
{ kineticE= e; }
|
||||
|
||||
inline G4double MedicalBeam::GetKineticE() const
|
||||
{ return kineticE; }
|
||||
|
||||
inline void MedicalBeam::SetSourcePosition(const G4ThreeVector& pos)
|
||||
{ sourcePosition= pos; }
|
||||
|
||||
inline G4ThreeVector MedicalBeam::GetSourcePosition() const
|
||||
{ return sourcePosition; }
|
||||
|
||||
inline void MedicalBeam::SetFieldShape(MedicalBeam::FieldShape shape)
|
||||
{ fieldShape= shape; }
|
||||
|
||||
inline MedicalBeam::FieldShape MedicalBeam::GetFieldShape() const
|
||||
{ return fieldShape; }
|
||||
|
||||
inline void MedicalBeam::SetSSD(G4double ssd)
|
||||
{ SSD= ssd; }
|
||||
|
||||
inline G4double MedicalBeam::GetSSD() const
|
||||
{ return SSD; }
|
||||
|
||||
inline void MedicalBeam::SetFieldXY(G4double fx, G4double fy)
|
||||
{ fieldXY[0]= fx; fieldXY[1]= fy; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldX() const
|
||||
{ return fieldXY[0]; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldY() const
|
||||
{ return fieldXY[1]; }
|
||||
|
||||
inline void MedicalBeam::SetFieldR(G4double r)
|
||||
{ fieldR= r; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldR() const
|
||||
{ return fieldR; }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.hh,v 1.2 2007/12/10 16:28:39 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// RunAction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef RUN_ACTION_H
|
||||
#define RUN_ACTION_H
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class RunAction : public G4UserRunAction {
|
||||
|
||||
public:
|
||||
RunAction();
|
||||
~RunAction();
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run* arun);
|
||||
virtual void EndOfRunAction(const G4Run* arun);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelParam.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelParam.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef VOXEL_PARAM_H
|
||||
#define VOXEL_PARAM_H
|
||||
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class VoxelParam : public G4VPVParameterisation {
|
||||
|
||||
public:
|
||||
VoxelParam();
|
||||
~VoxelParam();
|
||||
|
||||
virtual void ComputeTransformation(const G4int id,
|
||||
G4VPhysicalVolume* vol) const;
|
||||
|
||||
virtual void ComputeDimensions(G4Box& box, const G4int id,
|
||||
const G4VPhysicalVolume* vol) const;
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Sphere&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Torus&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Para&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Hype&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Tubs&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelSD.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelSD.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef VOXEL_SD_H
|
||||
#define VOXEL_SD_H
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class VoxelSD : public G4VSensitiveDetector {
|
||||
|
||||
public:
|
||||
VoxelSD(const G4String& name);
|
||||
~VoxelSD();
|
||||
|
||||
// virtual methods
|
||||
virtual G4bool ProcessHits(G4Step* astep, G4TouchableHistory* rohist);
|
||||
virtual void Initialize(G4HCofThisEvent* HCTE);
|
||||
virtual void EndOfEvent(G4HCofThisEvent* HCTE);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,179 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Analysis.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Analysis.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ROOT headers
|
||||
#include "TROOT.h"
|
||||
#include "TFile.h"
|
||||
#include "TH1.h"
|
||||
#include "TH2.h"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
Analysis* Analysis::myanalysis= 0;
|
||||
|
||||
|
||||
////////////////////
|
||||
Analysis::Analysis()
|
||||
////////////////////
|
||||
{
|
||||
// ROOT style
|
||||
gROOT->Reset();
|
||||
|
||||
// define histograms
|
||||
incident_map = new TH2D("incident map", "Incident Distributuon",
|
||||
50, -5., 5.,
|
||||
50, -5., 5.);
|
||||
incident_map-> GetXaxis()-> SetTitle("X (cm)");
|
||||
incident_map-> GetYaxis()-> SetTitle("Y (cm)");
|
||||
incident_map-> SetStats(0);
|
||||
|
||||
incident_x_hist = new TH1D("incident x", "Incident X", 100, -5., 5.);
|
||||
incident_x_hist-> GetXaxis()-> SetTitle("X (cm)");
|
||||
incident_x_hist-> SetFillColor(kRed);
|
||||
|
||||
dose_map = new TH2D("dose map", "Dose Distribution",
|
||||
500, 0., 50.,
|
||||
200, -10., 10.);
|
||||
dose_map-> GetXaxis()-> SetTitle("Z (cm)");
|
||||
dose_map-> GetYaxis()-> SetTitle("X (cm)");
|
||||
dose_map-> SetStats(0);
|
||||
|
||||
dose_hist = new TH1D("dose", "Dose Distribution", 500, 0., 50.);
|
||||
dose_hist-> GetXaxis()-> SetTitle("Z (cm)");
|
||||
dose_hist-> GetYaxis()-> SetTitle("Dose (GeV)");
|
||||
dose_hist-> SetFillColor(kBlue);
|
||||
dose_hist-> SetStats(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
Analysis::~Analysis()
|
||||
/////////////////////
|
||||
{
|
||||
delete incident_map;
|
||||
delete incident_x_hist;
|
||||
delete dose_map;
|
||||
delete dose_hist;
|
||||
|
||||
myanalysis=0;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
Analysis* Analysis::GetAnalysis()
|
||||
/////////////////////////////////
|
||||
{
|
||||
if (myanalysis == 0) {
|
||||
myanalysis = new Analysis();
|
||||
}
|
||||
|
||||
return myanalysis;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
void Analysis::Update()
|
||||
///////////////////////
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
void Analysis::Clear()
|
||||
//////////////////////
|
||||
{
|
||||
incident_map-> Reset();
|
||||
incident_x_hist-> Reset();
|
||||
dose_map-> Reset();
|
||||
dose_hist-> Reset();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
void Analysis::Save(const G4String& fname)
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
TFile* file = new TFile(fname.c_str(),
|
||||
"RECREATE", "Geant4 ROOT analysis");
|
||||
incident_map-> Write();
|
||||
incident_x_hist-> Write();
|
||||
dose_map-> Write();
|
||||
dose_hist-> Write();
|
||||
|
||||
file-> Close();
|
||||
|
||||
delete file;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
void Analysis::FillIncident(const G4ThreeVector& p)
|
||||
///////////////////////////////////////////////////
|
||||
{
|
||||
if(! incidentFlag) {
|
||||
incident_map-> Fill(p.x()/cm, p.y()/cm);
|
||||
incident_x_hist-> Fill(p.x()/cm);
|
||||
|
||||
incidentFlag= true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
void Analysis::FillDose(const G4ThreeVector& p, G4double dedx)
|
||||
//////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4double Z0= 25.*cm;
|
||||
const G4double dxy= 10.*mm;
|
||||
|
||||
if(std::abs(p.y()) < dxy ) {
|
||||
dose_map-> Fill((p.z()+Z0)/cm, p.x()/cm, dedx/GeV);
|
||||
|
||||
if(std::abs(p.x()) < dxy) {
|
||||
dose_hist-> Fill((p.z()+Z0)/cm, dedx/GeV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "VoxelParam.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "VoxelSD.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
typedef G4LogicalVolume G4LV;
|
||||
typedef G4PVPlacement G4PVP;
|
||||
typedef G4VisAttributes G4VA;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////////////
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
////////////////////////////////////////////////////
|
||||
{
|
||||
G4NistManager* nistManager= G4NistManager::Instance();
|
||||
G4VisAttributes* va;
|
||||
|
||||
// ==============================================================
|
||||
// world volume
|
||||
// ==============================================================
|
||||
const G4double DXYZ_WORLD= 200.*cm;
|
||||
G4Box* sld_world= new G4Box("world",
|
||||
DXYZ_WORLD/2., DXYZ_WORLD/2., DXYZ_WORLD/2.);
|
||||
|
||||
G4Material* vacuum= nistManager-> FindOrBuildMaterial("G4_Galactic");
|
||||
G4LV* lv_world= new G4LogicalVolume(sld_world, vacuum, "world");
|
||||
G4PVP* world= new G4PVPlacement(0, G4ThreeVector(), "AREA",
|
||||
lv_world, 0, false, 0);
|
||||
// vis. attributes
|
||||
va= new G4VA(G4Color(1.,1.,1.));
|
||||
va-> SetVisibility(false);
|
||||
lv_world-> SetVisAttributes(va);
|
||||
|
||||
// ==============================================================
|
||||
// water phantom
|
||||
// ==============================================================
|
||||
const G4double DXY_PHANTOM= 20.*cm;
|
||||
const G4double DZ_PHANTOM= 50.*cm;
|
||||
|
||||
G4Box* sld_phantom= new G4Box("phantom",
|
||||
DXY_PHANTOM/2., DXY_PHANTOM/2., DZ_PHANTOM/2.);
|
||||
|
||||
G4Material* water= nistManager-> FindOrBuildMaterial("G4_WATER");
|
||||
G4LV* lv_phantom= new G4LogicalVolume(sld_phantom,
|
||||
water, "phantom");
|
||||
|
||||
va= new G4VA(G4Color(0.,1.,1.));
|
||||
lv_phantom-> SetVisAttributes(va);
|
||||
|
||||
new G4PVP(0, G4ThreeVector(), lv_phantom, "phantom", lv_world, false, 0);
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// voxel planes
|
||||
const G4double DXY_VXP= 20.*cm;
|
||||
const G4double DZ_VXP= 1.*mm;
|
||||
|
||||
G4Box* sld_vxp= new G4Box("vxplane", DXY_VXP/2., DXY_VXP/2., DZ_VXP/2.);
|
||||
G4LV* lv_vxp= new G4LV(sld_vxp, water, "vxplane");
|
||||
|
||||
va= new G4VA(G4Color(1.,0.,0.));
|
||||
va-> SetVisibility(false);
|
||||
lv_vxp-> SetVisAttributes(va);
|
||||
|
||||
for (G4int iz=0; iz<500; iz++) {
|
||||
G4double z0= -DZ_PHANTOM/2. + (iz+0.5)*DZ_VXP;
|
||||
new G4PVP(0, G4ThreeVector(0.,0.,z0),
|
||||
lv_vxp, "vxplane", lv_phantom,
|
||||
false, 1000+iz);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// voxel parameterized
|
||||
|
||||
G4Box* sld_voxel= new G4Box("voxel",1.,1.,1.); // dummy
|
||||
G4LV* lv_voxel= new G4LV(sld_voxel, water, "voxel");
|
||||
lv_voxel-> SetSensitiveDetector(new VoxelSD("voxel"));
|
||||
|
||||
va= new G4VA(G4Color(0.,1.,1.));
|
||||
va-> SetVisibility(false);
|
||||
lv_voxel-> SetVisAttributes(va);
|
||||
|
||||
const G4int nvoxels= 100*100;
|
||||
new G4PVParameterised("voxle", lv_voxel, lv_vxp,
|
||||
kUndefined, nvoxels, new VoxelParam());
|
||||
|
||||
|
||||
return world;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.2 2007/12/10 16:28:52 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// EventAction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "EventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////
|
||||
EventAction::EventAction()
|
||||
//////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
EventAction::~EventAction()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
void EventAction::BeginOfEventAction(const G4Event*)
|
||||
////////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> ClearIncidentFlag();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: MedicalBeam.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// MedicalBeam.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "MedicalBeam.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
///////////////////////////////////
|
||||
MedicalBeam::MedicalBeam()
|
||||
: particle(0),
|
||||
kineticE(1.*MeV),
|
||||
sourcePosition(G4ThreeVector()),
|
||||
SSD(1.*m),
|
||||
fieldShape(MedicalBeam::SQUARE),
|
||||
fieldR(10.*cm)
|
||||
///////////////////////////////////
|
||||
{
|
||||
|
||||
G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
|
||||
particle= particleTable-> FindParticle("proton");
|
||||
|
||||
kineticE= 200.*MeV;
|
||||
sourcePosition= G4ThreeVector(0.,0.,-125.*cm);
|
||||
SSD= 100.*cm;
|
||||
fieldXY[0]= fieldXY[1]= 5.*cm;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
MedicalBeam::~MedicalBeam()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
G4ThreeVector MedicalBeam::GenerateBeamDirection() const
|
||||
////////////////////////////////////////////////////////
|
||||
{
|
||||
// uniform distribution in a limitted solid angle
|
||||
G4double dr;
|
||||
if(fieldShape == MedicalBeam::SQUARE) {
|
||||
dr= std::sqrt(sqr(fieldXY[0]/2.)+sqr(fieldXY[1]/2.));
|
||||
} else {
|
||||
dr= fieldR;
|
||||
}
|
||||
|
||||
G4double sin0= dr/SSD;
|
||||
G4double cos0= std::sqrt(1.-sqr(sin0));
|
||||
|
||||
G4double dcos=0.;
|
||||
G4double dsin, dphi, z;
|
||||
|
||||
G4double x= DBL_MAX;
|
||||
G4double y= DBL_MAX;
|
||||
|
||||
G4double xmax, ymax;
|
||||
if(fieldShape == MedicalBeam::SQUARE) {
|
||||
xmax= fieldXY[0]/2./SSD;
|
||||
ymax= fieldXY[1]/2./SSD;
|
||||
} else {
|
||||
xmax= ymax= DBL_MAX-1.;
|
||||
}
|
||||
|
||||
while(! (std::abs(x)< xmax && std::abs(y)< ymax) ) {
|
||||
dcos= RandFlat::shoot(cos0, 1.);
|
||||
dsin= std::sqrt(1.-sqr(dcos));
|
||||
dphi= RandFlat::shoot(0., twopi);
|
||||
|
||||
x= std::cos(dphi)*dsin*dcos;
|
||||
y= std::sin(dphi)*dsin*dcos;
|
||||
}
|
||||
z= dcos;
|
||||
|
||||
return G4ThreeVector(x,y,z);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
void MedicalBeam::GeneratePrimaries(G4Event* anEvent)
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
if(particle==0) return;
|
||||
|
||||
// create a new vertex
|
||||
G4PrimaryVertex* vertex= new G4PrimaryVertex(sourcePosition, 0.*ns);
|
||||
|
||||
// momentum
|
||||
G4double mass= particle-> GetPDGMass();
|
||||
G4double p= std::sqrt(sqr(mass+kineticE)-sqr(mass));
|
||||
G4ThreeVector pmon= p*GenerateBeamDirection();
|
||||
G4PrimaryParticle* primary= new G4PrimaryParticle(particle,
|
||||
pmon.x(),
|
||||
pmon.y(),
|
||||
pmon.z());
|
||||
// set primary to vertex
|
||||
vertex-> SetPrimary(primary);
|
||||
|
||||
// set vertex to event
|
||||
anEvent-> AddPrimaryVertex(vertex);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.2 2007/12/10 16:28:54 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// RunAction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "RunAction.hh"
|
||||
#include "Analysis.hh"
|
||||
#include "G4MPImanager.hh"
|
||||
#include <stdio.h>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////
|
||||
RunAction::RunAction()
|
||||
//////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
RunAction::~RunAction()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
void RunAction::BeginOfRunAction(const G4Run*)
|
||||
//////////////////////////////////////////////
|
||||
{
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> Clear();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void RunAction::EndOfRunAction(const G4Run*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
G4int rank= G4MPImanager::GetManager()-> GetRank();
|
||||
|
||||
char str[64];
|
||||
sprintf(str, "dose-%03d.root", rank);
|
||||
G4String fname(str);
|
||||
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> Save(fname);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelParam.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelParam.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "VoxelParam.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////
|
||||
VoxelParam::VoxelParam()
|
||||
////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
VoxelParam::~VoxelParam()
|
||||
/////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void VoxelParam::ComputeTransformation(const G4int id,
|
||||
G4VPhysicalVolume* vol) const
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4int NX= 100;
|
||||
|
||||
G4int iy= id / NX;
|
||||
G4int ix= id % NX;
|
||||
|
||||
const G4double dxyz= 1.*mm;
|
||||
const G4double DXY= 10.*cm;
|
||||
|
||||
G4double x0= -DXY/2. + ix*dxyz;
|
||||
G4double y0= -DXY/2. + iy*dxyz;
|
||||
|
||||
vol-> SetTranslation(G4ThreeVector(x0,y0,0.));
|
||||
vol-> SetRotation(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
void VoxelParam::ComputeDimensions(G4Box& box, const G4int,
|
||||
const G4VPhysicalVolume*) const
|
||||
//////////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4double dxyz= 0.5*mm;
|
||||
|
||||
box.SetXHalfLength(dxyz);
|
||||
box.SetYHalfLength(dxyz);
|
||||
box.SetZHalfLength(dxyz);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelSD.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelSD.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "VoxelSD.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4MPImanager.hh"
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////
|
||||
VoxelSD::VoxelSD(const G4String& name)
|
||||
: G4VSensitiveDetector(name)
|
||||
//////////////////////////////////////
|
||||
{
|
||||
G4SDManager::GetSDMpointer()-> AddNewDetector(this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////
|
||||
VoxelSD::~VoxelSD()
|
||||
///////////////////
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
G4bool VoxelSD::ProcessHits(G4Step* astep, G4TouchableHistory*)
|
||||
///////////////////////////////////////////////////////////////
|
||||
{
|
||||
G4ThreeVector x0= astep-> GetPreStepPoint()-> GetPosition();
|
||||
G4ThreeVector x1= astep-> GetPostStepPoint()-> GetPosition();
|
||||
|
||||
G4int tid= astep-> GetTrack()-> GetTrackID();
|
||||
G4int iz= astep-> GetPreStepPoint()-> GetTouchable()-> GetReplicaNumber(1);
|
||||
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
|
||||
// incident position
|
||||
if (tid==1 && iz==1000) { // scored @ first layer
|
||||
myana-> FillIncident(x0);
|
||||
}
|
||||
|
||||
// energy deposit
|
||||
G4ThreeVector p= G4UniformRand()*(x1-x0) + x0; // position sampling
|
||||
G4double edep= astep-> GetTotalEnergyDeposit();
|
||||
myana-> FillDose(p, edep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void VoxelSD::Initialize(G4HCofThisEvent*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void VoxelSD::EndOfEvent(G4HCofThisEvent*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/vis/verbose 0
|
||||
|
||||
/vis/open OGLIX
|
||||
|
||||
/vis/scene/create
|
||||
/vis/scene/add/volume
|
||||
|
||||
/vis/sceneHandler/attach
|
||||
|
||||
/vis/viewer/set/viewpointThetaPhi 90. 270.
|
||||
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#/vis/scene/endOfEventAction refresh
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# $Id: G4MPI-lam.gmk,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4MPI (LAM)
|
||||
# ===========================================================
|
||||
|
||||
ifndef G4MPIROOT
|
||||
G4MPIROOT = /opt/lam
|
||||
endif
|
||||
|
||||
# additional flags
|
||||
CXX := mpic++
|
||||
CPPFLAGS += -I$(G4MPIROOT)/include
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# $Id: G4MPI-mpich2.gmk,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4MPI (MPICH2)
|
||||
# ===========================================================
|
||||
|
||||
ifndef G4MPIROOT
|
||||
G4MPIROOT = /opt/mpich2
|
||||
endif
|
||||
|
||||
# additional flags
|
||||
CXX := mpicxx
|
||||
CPPFLAGS += -I$(G4MPIROOT)/include -DMPICH_IGNORE_CXX_SEEK
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# $Id: G4MPI-openmpi.gmk,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4MPI (LAM)
|
||||
# ===========================================================
|
||||
|
||||
ifndef G4MPIROOT
|
||||
G4MPIROOT = /opt/ompi
|
||||
endif
|
||||
|
||||
# additional flags
|
||||
CXX := mpic++
|
||||
CPPFLAGS += -I$(G4MPIROOT)/include -I$(G4MPIROOT)/include/openmpi
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# $Id: G4MPI.gmk,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4MPI (LAM)
|
||||
# ===========================================================
|
||||
|
||||
ifndef G4MPIROOT
|
||||
G4MPIROOT = /opt/lam
|
||||
endif
|
||||
|
||||
# additional flags
|
||||
CXX := mpic++
|
||||
CPPFLAGS += -I$(G4MPIROOT)/include
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# $Id: GNUmakefile,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building MPI interface
|
||||
# ===========================================================
|
||||
name := G4UImpi
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
include G4MPI.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/run/include \
|
||||
-I$(G4BASE)/event/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/processes/transportation/include \
|
||||
-I$(G4BASE)/processes/decay/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
-I$(G4BASE)/geometry/magneticfield/include \
|
||||
-I$(G4BASE)/geometry/biasing/include \
|
||||
-I$(G4BASE)/digits_hits/detector/include \
|
||||
-I$(G4BASE)/digits_hits/hits/include \
|
||||
-I$(G4BASE)/digits_hits/digits/include \
|
||||
-I$(G4BASE)/interfaces/common/include \
|
||||
-I$(G4BASE)/interfaces/basic/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/graphics_reps/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
$Id: History,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
G4MPI History file
|
||||
------------------
|
||||
|
||||
16 Nov. 2007 K.Murakami
|
||||
- commited to G4 CVS.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
$Id: README,v 1.1 2007/11/16 13:32:56 kmura Exp $
|
||||
==========================================================================
|
||||
Geant4 MPI Interface
|
||||
|
||||
Author:
|
||||
Koichi Murakami (KEK) / Koichi.Murakami@kek.jp
|
||||
==========================================================================
|
||||
|
||||
How to build
|
||||
============
|
||||
|
||||
1. Check "G4MPI.gmk" for yor MPI configuration:
|
||||
|
||||
* Set "G4MPIROOT", which is the root path to your MPI library.
|
||||
* Redifine CXX as (wrapped) MPI C++ compiler.
|
||||
* Specify additional include paths and compiler flags to "CPPFLAGS".
|
||||
|
||||
Sample makefiles for (LAM, MPICH2, OpenMPI) are also presented.
|
||||
An example of "G4MPI.gmk":
|
||||
|
||||
# ===========================================================
|
||||
# Makefile for building G4MPI (LAM)
|
||||
# ===========================================================
|
||||
|
||||
ifndef G4MPIROOT
|
||||
G4MPIROOT = /opt/lam
|
||||
endif
|
||||
|
||||
# additional flags
|
||||
CXX := mpic++
|
||||
CPPFLAGS += -I$(G4MPIROOT)/include
|
||||
|
||||
|
||||
2. Build the library
|
||||
|
||||
# make
|
||||
# make includes
|
||||
|
||||
The library (libG4UImpi) will be created in $G4LIB,
|
||||
and header files will be installed into $G4INCLUDE.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPIbatch.hh,v 1.1 2007/11/16 14:05:39 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPIbatch.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_BATCH_H
|
||||
#define G4MPI_BATCH_H
|
||||
|
||||
#include "G4VMPIsession.hh"
|
||||
#include <fstream>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class G4MPIbatch : public G4VMPIsession {
|
||||
protected:
|
||||
std::ifstream batchStream;
|
||||
G4bool isOpened;
|
||||
G4bool isBatchMode;
|
||||
|
||||
// get command from a batch script file
|
||||
G4String ReadCommand();
|
||||
|
||||
public:
|
||||
G4MPIbatch(const G4String& fname="", G4bool qbatch=false);
|
||||
~G4MPIbatch();
|
||||
|
||||
// concrete implementations
|
||||
virtual G4UIsession* SessionStart();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,243 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPImanager.hh,v 1.1 2007/11/16 14:05:40 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPImanager.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_MANAGER_H
|
||||
#define G4MPI_MANAGER_H
|
||||
|
||||
#include "mpi.h"
|
||||
#include "globals.hh"
|
||||
#include <pthread.h>
|
||||
#include <fstream>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class G4MPImessenger;
|
||||
class G4MPIsession;
|
||||
class G4MPIstatus;
|
||||
class G4VMPIseedGenerator;
|
||||
|
||||
class G4MPImanager {
|
||||
private:
|
||||
static G4MPImanager* theManager;
|
||||
G4MPImessenger* messenger;
|
||||
G4MPIsession* session;
|
||||
|
||||
G4int verbose;
|
||||
G4MPIstatus* status; // status for each node
|
||||
|
||||
// MPI rank
|
||||
G4bool isMaster;
|
||||
G4bool isSlave;
|
||||
G4int rank;
|
||||
G4int size;
|
||||
|
||||
// MPI communicator
|
||||
MPI::Intracomm COMM_G4COMMAND;
|
||||
|
||||
// cout/cerr control
|
||||
G4bool qfcout;
|
||||
std::ofstream fscout;
|
||||
|
||||
// init/macro file
|
||||
G4bool qinitmacro;
|
||||
G4String initFileName;
|
||||
G4bool qbatchmode;
|
||||
G4String macroFileName;
|
||||
|
||||
// internal use
|
||||
void Initialize();
|
||||
void ParseArguments(G4int argc, char** argv);
|
||||
void Wait(G4int ausec) const;
|
||||
void UpdateStatus();
|
||||
|
||||
// for beamOn
|
||||
pthread_t threadID;
|
||||
|
||||
// seed generator
|
||||
G4VMPIseedGenerator* seedGenerator;
|
||||
|
||||
// parallel parameters
|
||||
G4double masterWeight;
|
||||
|
||||
public:
|
||||
|
||||
enum { // MPI master rank
|
||||
RANK_MASTER= 0
|
||||
};
|
||||
|
||||
enum { // MPI tag
|
||||
TAG_G4COMMAND= 100,
|
||||
TAG_G4STATUS= 200,
|
||||
TAG_G4SEED= 300,
|
||||
TAG_DATA= 1000
|
||||
};
|
||||
|
||||
G4MPImanager();
|
||||
G4MPImanager(int argc, char** argv);
|
||||
~G4MPImanager();
|
||||
|
||||
static G4MPImanager* GetManager();
|
||||
|
||||
// set/get methods
|
||||
G4MPIsession* GetMPIsession() const;
|
||||
|
||||
G4int GetVerbose() const;
|
||||
void SetVerbose(G4int iverbose);
|
||||
|
||||
G4int GetSize() const;
|
||||
G4int GetRank() const;
|
||||
|
||||
G4bool IsMaster() const;
|
||||
G4bool IsSlave() const;
|
||||
|
||||
G4bool IsInitMacro() const;
|
||||
const G4String& GetInitFileName() const;
|
||||
|
||||
G4bool IsBatchMode() const;
|
||||
const G4String& GetMacroFileName() const;
|
||||
|
||||
void SetMasterWeight(G4double aweight);
|
||||
G4double GetMasterWeight() const;
|
||||
|
||||
G4VMPIseedGenerator* GetSeedGenerator() const;
|
||||
|
||||
// MPI methods
|
||||
G4String BcastCommand(const G4String& command);
|
||||
void ShowStatus();
|
||||
void ShowSeeds();
|
||||
void SetSeed(G4int inode, G4long seed);
|
||||
|
||||
// methods for MPI environment
|
||||
void DistributeSeeds();
|
||||
void ExecuteMacroFile(const G4String& fname, G4bool qbatch=false);
|
||||
G4bool CheckThreadStatus();
|
||||
void ExecuteThreadCommand(const G4String& command);
|
||||
void ExecuteBeamOnThread(const G4String& command);
|
||||
void JoinBeamOnThread();
|
||||
|
||||
void BeamOn(G4int nevent, G4bool qdivide=true);
|
||||
void Print(const G4String& message);
|
||||
|
||||
// misc
|
||||
void ShowHelp() const;
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
|
||||
inline G4MPIsession* G4MPImanager::GetMPIsession() const
|
||||
{
|
||||
return session;
|
||||
}
|
||||
|
||||
inline G4int G4MPImanager::GetVerbose() const
|
||||
{
|
||||
return verbose;
|
||||
}
|
||||
|
||||
inline void G4MPImanager::SetVerbose(G4int iverbose)
|
||||
{
|
||||
G4int lv=iverbose;
|
||||
if(iverbose>1) lv=1;
|
||||
if(iverbose<0) lv=0;
|
||||
|
||||
verbose= lv;
|
||||
return;
|
||||
}
|
||||
|
||||
inline G4int G4MPImanager::GetRank() const
|
||||
{
|
||||
return rank;
|
||||
}
|
||||
|
||||
inline G4int G4MPImanager::GetSize() const
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
inline G4bool G4MPImanager::IsMaster() const
|
||||
{
|
||||
return isMaster;
|
||||
}
|
||||
|
||||
inline G4bool G4MPImanager::IsSlave() const
|
||||
{
|
||||
return isSlave;
|
||||
}
|
||||
|
||||
inline G4bool G4MPImanager::IsInitMacro() const
|
||||
{
|
||||
return qinitmacro;
|
||||
|
||||
}
|
||||
|
||||
inline const G4String& G4MPImanager::GetInitFileName() const
|
||||
{
|
||||
return initFileName;
|
||||
|
||||
}
|
||||
|
||||
inline G4bool G4MPImanager::IsBatchMode() const
|
||||
{
|
||||
return qbatchmode;
|
||||
}
|
||||
|
||||
inline const G4String& G4MPImanager::GetMacroFileName() const
|
||||
{
|
||||
return macroFileName;
|
||||
}
|
||||
|
||||
inline void G4MPImanager::SetMasterWeight(G4double aweight)
|
||||
{
|
||||
masterWeight= aweight;
|
||||
|
||||
if(aweight<0.) masterWeight= 0.;
|
||||
if(aweight>1.) masterWeight= 1.;
|
||||
}
|
||||
|
||||
inline G4double G4MPImanager::GetMasterWeight() const
|
||||
{
|
||||
return masterWeight;
|
||||
}
|
||||
|
||||
inline G4VMPIseedGenerator* G4MPImanager::GetSeedGenerator() const
|
||||
{
|
||||
return seedGenerator;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPImessenger.hh,v 1.1 2007/11/16 14:05:40 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPImessenger.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_MESSENGER_H
|
||||
#define G4MPI_MESSENGER_H
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class G4MPImanager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithADouble;
|
||||
class G4UIcommand;
|
||||
|
||||
class G4MPImessenger : public G4UImessenger {
|
||||
private:
|
||||
G4MPImanager* g4MPI;
|
||||
|
||||
// /mpi
|
||||
G4UIdirectory* dir;
|
||||
|
||||
G4UIcmdWithAnInteger* verbose;
|
||||
G4UIcmdWithoutParameter* status;
|
||||
|
||||
G4UIcmdWithAString* execute;
|
||||
|
||||
G4UIcommand* beamOn;
|
||||
G4UIcmdWithAnInteger* dotbeamOn;
|
||||
G4UIcmdWithADouble* masterWeight;
|
||||
|
||||
G4UIcmdWithoutParameter* showSeeds;
|
||||
G4UIcmdWithAnInteger* setMasterSeed;
|
||||
G4UIcommand* setSeed;
|
||||
|
||||
public:
|
||||
G4MPImessenger(G4MPImanager* manager);
|
||||
~G4MPImessenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
virtual G4String GetCurrentValue(G4UIcommand* command);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPIrandomSeedGenerator.hh,v 1.1 2007/11/16 14:05:40 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPIrandomSeedGenerator.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_RANDOM_SEED_GENERATOR_H
|
||||
#define G4MPI_RANDOM_SEED_GENERATOR_H
|
||||
|
||||
#include "G4VMPIseedGenerator.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class G4MPIrandomSeedGenerator : public G4VMPIseedGenerator {
|
||||
protected:
|
||||
G4bool CheckDoubleCount();
|
||||
virtual void GenerateSeeds();
|
||||
|
||||
public:
|
||||
G4MPIrandomSeedGenerator();
|
||||
~G4MPIrandomSeedGenerator();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPIsession.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPIsession.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_SESSION_H
|
||||
#define G4MPI_SESSION_H
|
||||
|
||||
#include "G4VMPIsession.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class G4MPIsession : public G4VMPIsession {
|
||||
protected:
|
||||
G4VUIshell* shell;
|
||||
|
||||
// get command from user prompt of the master node
|
||||
G4String GetCommand(const char* msg=0);
|
||||
|
||||
// misc
|
||||
G4bool TryForcedTerminate();
|
||||
|
||||
public:
|
||||
G4MPIsession(G4VUIshell* ashell=0);
|
||||
~G4MPIsession();
|
||||
|
||||
void SetPrompt(const G4String& prompt);
|
||||
void SetShell(G4VUIshell* ashell);
|
||||
|
||||
// concrete implementations
|
||||
virtual G4UIsession* SessionStart();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPIstatus.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPIstatus.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4MPI_STATUS_H
|
||||
#define G4MPI_STATUS_H
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4Timer.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class G4Timer;
|
||||
|
||||
class G4MPIstatus {
|
||||
private:
|
||||
G4int rank;
|
||||
G4int runID;
|
||||
G4int nEventToBeProcessed;
|
||||
G4int eventID;
|
||||
G4double cputime;
|
||||
G4ApplicationState g4state;
|
||||
G4Timer* timer;
|
||||
|
||||
G4String GetStateString(G4ApplicationState astate) const;
|
||||
|
||||
public:
|
||||
enum { NSIZE=10 };
|
||||
|
||||
G4MPIstatus();
|
||||
~G4MPIstatus();
|
||||
|
||||
// set/get functions
|
||||
void SetStatus(G4int arank, G4int runid, G4int noe, G4int evtid,
|
||||
G4ApplicationState state);
|
||||
|
||||
G4int GetRank() const;
|
||||
G4int GetRunID() const;
|
||||
G4int GetNEventToBeProcessed() const;
|
||||
G4int GetEventID() const;
|
||||
G4double GetCPUTime() const;
|
||||
G4ApplicationState GetG4State() const;
|
||||
|
||||
// for pickling
|
||||
G4int SizeOf() const;
|
||||
void Pack(G4int* data) const;
|
||||
void UnPack(G4int* data);
|
||||
|
||||
// for timer
|
||||
void StartTimer();
|
||||
void StopTimer();
|
||||
|
||||
void Print() const;
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
inline G4int G4MPIstatus::SizeOf() const
|
||||
{
|
||||
return NSIZE;
|
||||
}
|
||||
|
||||
inline G4int G4MPIstatus::GetRank() const
|
||||
{
|
||||
return rank;
|
||||
}
|
||||
|
||||
inline G4int G4MPIstatus::GetRunID() const
|
||||
{
|
||||
return runID;
|
||||
}
|
||||
|
||||
inline G4int G4MPIstatus::GetNEventToBeProcessed() const
|
||||
{
|
||||
return nEventToBeProcessed;
|
||||
}
|
||||
|
||||
inline G4int G4MPIstatus::GetEventID() const
|
||||
{
|
||||
return eventID;
|
||||
}
|
||||
|
||||
inline G4double G4MPIstatus::GetCPUTime() const
|
||||
{
|
||||
return cputime;
|
||||
}
|
||||
|
||||
inline G4ApplicationState G4MPIstatus::GetG4State() const
|
||||
{
|
||||
return g4state;
|
||||
}
|
||||
|
||||
inline void G4MPIstatus::StartTimer()
|
||||
{
|
||||
timer-> Start();
|
||||
}
|
||||
|
||||
inline void G4MPIstatus::StopTimer()
|
||||
{
|
||||
timer-> Stop();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UImpish.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4UImpish.hh
|
||||
//
|
||||
// shell for MPI slaves
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4UI_MPI_SH_H
|
||||
#define G4UI_MPI_SH_H
|
||||
|
||||
#include "G4VUIshell.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class G4UImpish : public G4VUIshell {
|
||||
|
||||
public:
|
||||
G4UImpish();
|
||||
~G4UImpish();
|
||||
|
||||
virtual G4String GetCommandLine(const char* msg=0);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VMPIseedGenerator.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4VMPIseedGenerator.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4VMPI_SEED_GENERATOR_H
|
||||
#define G4VMPI_SEED_GENERATOR_H
|
||||
|
||||
#include "globals.hh"
|
||||
#include <vector>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class G4VMPIseedGenerator {
|
||||
protected:
|
||||
G4long masterSeed;
|
||||
std::vector<G4long> seedList;
|
||||
|
||||
// generate seeds for MPI nodes
|
||||
virtual void GenerateSeeds()=0;
|
||||
|
||||
public:
|
||||
G4VMPIseedGenerator();
|
||||
virtual ~G4VMPIseedGenerator();
|
||||
|
||||
// set/get methods
|
||||
void SetMasterSeed(G4long aseed); // trigger GenerateSeeds()
|
||||
G4long GetMasterSeed() const;
|
||||
|
||||
const std::vector<G4long>& GetSeedList() const;
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
inline G4long G4VMPIseedGenerator::GetMasterSeed() const
|
||||
{
|
||||
return masterSeed;
|
||||
}
|
||||
|
||||
inline const std::vector<G4long>& G4VMPIseedGenerator::GetSeedList() const
|
||||
{
|
||||
return seedList;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VMPIsession.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4VMPIsession.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef G4VMPI_SESSION_H
|
||||
#define G4VMPI_SESSION_H
|
||||
|
||||
#include "G4VBasicShell.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
typedef void* (*Func_t)(void *); // for thead function
|
||||
|
||||
class G4MPImanager;
|
||||
class G4VUIshell;
|
||||
|
||||
class G4VMPIsession : public G4VBasicShell {
|
||||
protected:
|
||||
// MPI handling
|
||||
G4MPImanager* g4MPI;
|
||||
|
||||
// MPI node info (cache)
|
||||
G4bool isMaster;
|
||||
G4bool isSlave;
|
||||
G4int rank;
|
||||
|
||||
G4int ExecCommand(G4String aCommand);
|
||||
G4String TruncateCommand(const G4String& command) const;
|
||||
G4String BypassCommand(const G4String& command) const;
|
||||
|
||||
// for help operation
|
||||
virtual G4bool GetHelpChoice(G4int& aval);
|
||||
virtual void ExitHelp();
|
||||
|
||||
public:
|
||||
G4VMPIsession();
|
||||
~G4VMPIsession();
|
||||
|
||||
// concrete implementations
|
||||
virtual void PauseSessionStart(G4String msg);
|
||||
|
||||
virtual G4int ReceiveG4cout(G4String coutString);
|
||||
virtual G4int ReceiveG4cerr(G4String cerrString);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MPIbatch.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4MPIsession.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "G4MPIbatch.hh"
|
||||
#include "G4MPImanager.hh"
|
||||
#include "G4UIcommandStatus.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
G4MPIbatch::G4MPIbatch(const G4String& fname, G4bool qbatch)
|
||||
: G4VMPIsession(),
|
||||
isOpened(false), isBatchMode(qbatch)
|
||||
////////////////////////////////////////////////////////////
|
||||
{
|
||||
if(isMaster) {
|
||||
batchStream.open(fname, std::ios::in);
|
||||
if(batchStream.fail()) {
|
||||
G4cerr << "cannot open a macro file(" << fname << ")."
|
||||
<< G4endl;
|
||||
} else {
|
||||
isOpened= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
G4MPIbatch::~G4MPIbatch()
|
||||
/////////////////////////////
|
||||
{
|
||||
if(isOpened) batchStream.close();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
G4String G4MPIbatch::ReadCommand()
|
||||
//////////////////////////////////
|
||||
{
|
||||
enum { BUFSIZE= 256 };
|
||||
char linebuf[BUFSIZE];
|
||||
|
||||
while(batchStream.good()) {
|
||||
batchStream.getline(linebuf, BUFSIZE);
|
||||
|
||||
G4String cmdline(linebuf);
|
||||
cmdline= cmdline.strip(G4String::both);
|
||||
cmdline= cmdline.strip(G4String::both, '\011'); // remove TAB
|
||||
cmdline= TruncateCommand(cmdline);
|
||||
|
||||
str_size ic= cmdline.find_first_of('#');
|
||||
if(ic != G4String::npos) {
|
||||
cmdline= cmdline(0, ic);
|
||||
}
|
||||
|
||||
if(batchStream.eof()) {
|
||||
if(cmdline.size()==0) {
|
||||
return "exit";
|
||||
} else {
|
||||
return cmdline;
|
||||
}
|
||||
}
|
||||
|
||||
if(cmdline.size()==0) continue; // skip null line
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
return "exit"; // dummy
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
G4UIsession* G4MPIbatch::SessionStart()
|
||||
///////////////////////////////////////
|
||||
{
|
||||
G4String newCommand="", scommand; // newCommand is always "" in slaves
|
||||
|
||||
if(isMaster) newCommand= ReadCommand();
|
||||
// broadcast a new G4 command
|
||||
scommand= g4MPI-> BcastCommand(newCommand);
|
||||
if(scommand == "exit" ) return 0;
|
||||
|
||||
while(1){
|
||||
G4int rc= ExecCommand(scommand);
|
||||
if(rc != fCommandSucceeded) break;
|
||||
|
||||
if(isMaster) newCommand= ReadCommand();
|
||||
scommand= g4MPI-> BcastCommand(newCommand);
|
||||
if(scommand == "exit" ) {
|
||||
if(isBatchMode) {
|
||||
if(g4MPI-> CheckThreadStatus()) {
|
||||
g4MPI-> JoinBeamOnThread();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user