Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -0,0 +1,149 @@
//$Id$
///\file "hadronic/NeutronSource/.README.txt"
///\brief Example NeutronSource README page
/*! \page ExampleNeutronSource Example NeutronSource
NeutronSource is an example of neutrons production. It illustrates the cooperative work
of nuclear reactions and radioactive decay processes.
It survey energy deposition and particle's flux.
It uses PhysicsConstructor objects.
\section NeutronSource_s1 MATERIALS AND GEOMETRY DEFINITION
The geometry is a cylinder (absorber) of an homogenous material (default : Beryllium oxide).
This absorber is within a container (default : stainless-steel).
Five parameters define the geometry :
- the material of the absorber
- the radius and length of the absorber
- the material of the container
- the thickness of the container
The default geometry is built in DetectorConstruction, but the above
parameters can be changed interactively via commands defined in DetectorMessenger.
The container is surrounded by a World volume (air)
A function, and its associated UI command, allows to build a material
directly from a single isotope.
To be identified by the ThermalScattering module, the elements composing a
material must have a specific name (see G4ParticleHPThermalScatteringNames.cc)
Examples of such materials are build in DetectorConstruction of Hadr04,06,07.
\section NeutronSource_s2 PHYSICS LIST
"Full" set of physics processes are registered, but via PhysicsConstructor
objects rather than complete pre-defined G4 physics lists. This alternative
way gives more freedom to register physics.
PhysicsConstructors are either predefined G4 PhysicsConstructors or 'local'.
They include : HadronElastic (including neutronHP), HadronInelastic,
IonsInelastic, GammaNuclear physics, RadioactiveDecay and Electromagnetic physics.
(see geant4/source/physics_lists/constructors)
ElectromagneticPhysics is a variante of EmStandard. No step constraint is imposed for
energy loss mechanism (ionisation and brems). This is enough when spatial distribution
of deposited energy do not need to be accurate.
(see param->SetStepFunction(1., 1*mm))
Several hadronic physics options are controlled by environment variables.
To trigger them, an envHadronic.csh has been added in this example.
One must select the options wished, and do
\verbatim
source envHadronic.[c]sh
\endverbatim
\section NeutronSource_s3 AN EVENT : THE PRIMARY GENERATOR
The primary kinematic is a single particle uniformly shooted within the absorber.
The type of the particle and its energy are set in PrimaryGeneratorAction (Am241, at rest),
and can be changed via the G4 build-in commands of ParticleGun class
(see the macros provided with this example).
\section NeutronSource_s4 PHYSICS
The program computes and plots energy deposited in the interaction volume
(absorber + container) and the flux of particles leaving this volume.
Processes invoked and particles generated during hadronic cascade are listed.
\section NeutronSource_s5 HISTOGRAMS
The test contains 13 built-in 1D histograms, which are managed by
G4AnalysisManager and its Messenger. The histos can be individually
activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, etc..)
(see the macros xxxx.mac).
1 "total energy deposit"
2 "dummy"
3 "total kinetic energy flow"
4 "gamma flux (dN/dE) at exit"
5 "e+- flux (dN/dE) at exit"
6 "neutrons flux (dN/dE) at exit"
7 "protons flux (dN/dE) at exit"
8 "deuterons flux (dN/dE) at exit"
9 "alphas flux (dN/dE) at exit"
10 "all others ions flux (dN/dE) at exit"
11 "all others baryons flux (dN/dE) at exit"
12 "all others mesons flux (dN/dE) at exit"
13 "all others leptons flux (dN/dE) at exit"
The histograms are managed by the HistoManager class and its Messenger.
The histos can be individually activated with the command :
\verbatim
/analysis/h1/set id nbBins valMin valMax unit
\endverbatim
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
One can control the name of the histograms file with the command:
\verbatim
/analysis/setFileName name (default NeutronSource)
\endverbatim
It is possible to choose the format of the histogram file : root (default),
xml, csv, by using namespace in HistoManager.hh
It is also possible to print selected histograms on an ascii file:
\verbatim
/analysis/h1/setAscii id
\endverbatim
All selected histos will be written on a file name.ascii (default NeutronSource)
\section NeutronSource_s6 VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualisation:
\verbatim
> /control/execute vis.mac
\endverbatim
The tracks are drawn at the end of event, and erased at the end of run.
gamma green
neutron yellow
negative particles (e-, ...) red
positive particles (e+, ions, ...) blue
\section NeutronSource_s7 HOW TO START ?
Execute NeutronSource in 'batch' mode from macro files :
\verbatim
% NeutronSource run1.mac
\endverbatim
Execute NeutronSource in 'interactive mode' with visualization :
\verbatim
% NeutronSource
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
\endverbatim
*/
@@ -0,0 +1,64 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(NeutronSource)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(NeutronSource NeutronSource.cc ${sources} ${headers})
target_link_libraries(NeutronSource ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build NeutronSource. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(NeutronSource_SCRIPTS
debug.mac
envHadronic.csh
envHadronic.sh
neutronSource.in
plotHisto.C
run1.mac
vis.mac
)
foreach(_script ${NeutronSource_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS NeutronSource DESTINATION bin)
@@ -0,0 +1,19 @@
# $Id: GNUmakefile 67909 2013-03-12 18:51:09Z vnivanch $
# ----------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98
# ----------------------------------------------------------
name := NeutronSource
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,31 @@
$Id: History 71654 2013-06-19 18:20:04Z maire $
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
NeutronSourcd History file
--------------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14-10-16 G.Folger (NeutronSource-V10-02-01)
- remove direct use of aParticleIterator, use GetParticleTableIterator().
fix required by clang39 on Linux and MAC
26-09-16 mma (NeutronSource-V10-02-00)
- change name : AmBe --> NeutronSource
22-09-16 mma (AmBe-V10-02-02)
- update GNUmakefile
18-09-16 mma (AmBe-V10-02-01)
- decrease statistic
01-07-16 Michel Maire (AmBe-V10-02-00)
- created from Hadr06
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/NeutronSource/NeutronSource.cc
/// \brief Main program of the hadronic/NeutronSource example
//
//
// $Id: TestEm1.cc,v 1.16 2010-04-06 11:11:24 maire Exp $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "SteppingVerbose.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
G4int nThreads = G4Threading::G4GetNumberOfCores();
if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
runManager->SetNumberOfThreads(nThreads);
#else
//my Verbose output class
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
G4RunManager* runManager = new G4RunManager;
#endif
// set mandatory initialization classes
DetectorConstruction* det= new DetectorConstruction;
runManager->SetUserInitialization(det);
PhysicsList* phys = new PhysicsList;
runManager->SetUserInitialization(phys);
runManager->SetUserInitialization(new ActionInitialization(det));
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (argc!=1) // batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
else //define visualization and UI terminal for interactive mode
{
#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
#ifdef G4UI_USE
G4UIExecutive * ui = new G4UIExecutive(argc,argv);
ui->SessionStart();
delete ui;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
}
// job termination
//
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,135 @@
$Id: README 69174 2013-04-21 20:38:15Z maire $
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
NeutronSource
-------------
NeutronSource is an example of neutrons production. It illustrates the cooperative work
of nuclear reactions and radioactive decay processes.
It survey energy deposition and particle's flux.
It uses PhysicsConstructor objects.
1- MATERIALS AND GEOMETRY DEFINITION
The geometry is a cylinder (absorber) of an homogenous material (default : Beryllium oxide).
This absorber is within a container (default : stainless-steel).
Five parameters define the geometry :
- the material of the absorber
- the radius and length of the absorber
- the material of the container
- the thickness of the container
The default geometry is built in DetectorConstruction, but the above
parameters can be changed interactively via commands defined in DetectorMessenger.
The container is surrounded by a World volume (air)
A function, and its associated UI command, allows to build a material
directly from a single isotope.
To be identified by the ThermalScattering module, the elements composing a
material must have a specific name (see G4ParticleHPThermalScatteringNames.cc)
Examples of such materials are build in DetectorConstruction of Hadr04,06,07.
2- PHYSICS LIST
"Full" set of physics processes are registered, but via PhysicsConstructor
objects rather than complete pre-defined G4 physics lists. This alternative
way gives more freedom to register physics.
PhysicsConstructors are either predefined G4 PhysicsConstructors or 'local'.
They include : HadronElastic (including neutronHP), HadronInelastic,
IonsInelastic, GammaNuclear physics, RadioactiveDecay and Electromagnetic physics.
(see geant4/source/physics_lists/constructors)
ElectromagneticPhysics is a variante of EmStandard. No step constraint is imposed for
energy loss mechanism (ionisation and brems). This is enough when spatial distribution
of deposited energy do not need to be accurate.
(see param->SetStepFunction(1., 1*mm))
Several hadronic physics options are controlled by environment variables.
To trigger them, an envHadronic.csh has been added in this example.
One must select the options wished, and do
source envHadronic.csh (or sh)
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic is a single particle uniformly shooted within the absorber.
The type of the particle and its energy are set in PrimaryGeneratorAction (Am241, at rest),
and can be changed via the G4 build-in commands of ParticleGun class
(see the macros provided with this example).
4- PHYSICS
The program computes and plots energy deposited in the interaction volume
(absorber + container) and the flux of particles leaving this volume.
Processes invoked and particles generated during hadronic cascade are listed.
5- HISTOGRAMS
The test contains 13 built-in 1D histograms, which are managed by
G4AnalysisManager and its Messenger. The histos can be individually
activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, etc..)
(see the macros xxxx.mac).
1 "total energy deposit"
2 "dummy"
3 "total kinetic energy flow"
4 "gamma flux (dN/dE) at exit"
5 "e+- flux (dN/dE) at exit"
6 "neutrons flux (dN/dE) at exit"
7 "protons flux (dN/dE) at exit"
8 "deuterons flux (dN/dE) at exit"
9 "alphas flux (dN/dE) at exit"
10 "all others ions flux (dN/dE) at exit"
11 "all others baryons flux (dN/dE) at exit"
12 "all others mesons flux (dN/dE) at exit"
13 "all others leptons flux (dN/dE) at exit"
The histograms are managed by the HistoManager class and its Messenger.
The histos can be individually activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
One can control the name of the histograms file with the command:
/analysis/setFileName name (default NeutronSource)
It is possible to choose the format of the histogram file : root (default),
xml, csv, by using namespace in HistoManager.hh
It is also possible to print selected histograms on an ascii file:
/analysis/h1/setAscii id
All selected histos will be written on a file name.ascii (default NeutronSource)
6- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualisation:
> /control/execute vis.mac
The tracks are drawn at the end of event, and erased at the end of run.
gamma green
neutron yellow
negative particles (e-, ...) red
positive particles (e+, ions, ...) blue
7- HOW TO START ?
Execute NeutronSource in 'batch' mode from macro files :
% NeutronSource run1.mac
Execute NeutronSource in 'interactive mode' with visualization :
% NeutronSource
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
@@ -0,0 +1,17 @@
/control/verbose 2
/run/verbose 2
/tracking/verbose 2
#
/run/initialize
#
/process/list
###/process/inactivate hadElastic
#
/gun/particle ion
/gun/ion 95 241
/gun/energy 0. eV
#
/control/execute vis.mac
#
/run/beamOn 1
+22
View File
@@ -0,0 +1,22 @@
#
# for neutronHP
#
unsetenv G4NEUTRONHP_SKIP_MISSING_ISOTOPES
unsetenv G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE
unsetenv G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
unsetenv G4NEUTRONHP_NELECT_DOPPLER
unsetenv G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS
#### setenv G4NEUTRONHP_SKIP_MISSING_ISOTOPES 1
#### setenv G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE 1
#### setenv G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION 1
#### setenv G4NEUTRONHP_NELECT_DOPPLER 1
#### setenv G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS 1
#
# for Bertini cascade
#
unsetenv G4CASCADE_USE_PRECOMPOUND
#### setenv G4CASCADE_USE_PRECOMPOUND 1
env |grep G4NEUTRONHP
env |grep G4CASCADE
+32
View File
@@ -0,0 +1,32 @@
#
# for neutronHP
#
unset G4NEUTRONHP_SKIP_MISSING_ISOTOPES
unset G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE
unset G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
unset G4NEUTRONHP_NELECT_DOPPLER
unset G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS
#### G4NEUTRONHP_SKIP_MISSING_ISOTOPES=1
#### export G4NEUTRONHP_SKIP_MISSING_ISOTOPES
#### G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE=1
#### export G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE
#### G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION=1
#### export G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
#### G4NEUTRONHP_NELECT_DOPPLER=1
#### export G4NEUTRONHP_NELECT_DOPPLER
#### G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS=1
#### export G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS
#
# for Bertini cascade
#
unset G4CASCADE_USE_PRECOMPOUND
#### G4CASCADE_USE_PRECOMPOUND=1
#### export G4CASCADE_USE_PRECOMPOUND
env |grep G4NEUTRONHP
env |grep G4CASCADE
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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: ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class DetectorConstruction;
class G4VSteppingVerbose;
/// Action initialization class.
///
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization(DetectorConstruction* detector);
virtual ~ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
virtual G4VSteppingVerbose* InitializeSteppingVerbose() const;
private:
DetectorConstruction* fDetector;
};
#endif
@@ -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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
// $Id: DetectorConstruction.hh 66586 2012-12-21 10:48:39Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4Material;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
G4Material*
MaterialWithSingleIsotope(G4String, G4String, G4double, G4int, G4int);
void SetAbsorRadius (G4double);
void SetAbsorLength (G4double);
void SetAbsorMaterial (G4String);
void SetContainThickness (G4double);
void SetContainMaterial (G4String);
public:
G4double GetAbsorRadius() {return fAbsorRadius;};
G4double GetAbsorLength() {return fAbsorLength;};
G4Material* GetAbsorMaterial() {return fAbsorMaterial;};
G4double GetContainThickness() {return fContainThickness;};
G4Material* GetContainMaterial() {return fContainMaterial;};
void PrintParameters();
private:
G4double fAbsorRadius, fAbsorLength;
G4Material* fAbsorMaterial;
G4LogicalVolume* fLAbsor;
G4double fContainThickness;
G4Material* fContainMaterial;
G4LogicalVolume* fLContain;
G4Material* fWorldMaterial;
G4VPhysicalVolume* fPWorld;
DetectorMessenger* fDetectorMessenger;
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/DetectorMessenger.hh
/// \brief Definition of the DetectorMessenger class
//
// $Id: DetectorMessenger.hh 67103 2013-01-31 18:18:03Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* fDetector;
G4UIdirectory* fTesthadrDir;
G4UIdirectory* fDetDir;
G4UIcmdWithAString* fMaterCmd1;
G4UIcmdWithAString* fMaterCmd2;
G4UIcmdWithADoubleAndUnit* fSizeCmd1;
G4UIcmdWithADoubleAndUnit* fSizeCmd2;
G4UIcmdWithADoubleAndUnit* fSizeCmd3;
G4UIcommand* fIsotopeCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm1/include/ElectromagneticPhysics.hh
/// \brief Definition of the ElectromagneticPhysics class
//
// $Id: ElectromagneticPhysics.hh 66586 2012-12-21 10:48:39Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ElectromagneticPhysics_h
#define ElectromagneticPhysics_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ElectromagneticPhysics : public G4VPhysicsConstructor
{
public:
ElectromagneticPhysics(const G4String& name = "standard");
~ElectromagneticPhysics();
public:
// This method is dummy for physics
virtual void ConstructParticle() {};
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm1/include/EventAction.hh
/// \brief Definition of the EventAction class
//
// $Id: EventAction.hh 76293 2013-11-08 13:11:23Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void AddEdep (G4double Edep);
void AddEflow(G4double Eflow);
private:
G4double fTotalEnergyDeposit;
G4double fTotalEnergyFlow;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/GammaNuclearPhysics.hh
/// \brief Definition of the GammaNuclearPhysics class
//
// $Id: GammaNuclearPhysics.hh 66587 2012-12-21 11:06:44Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef GammaNuclearPhysics_h
#define GammaNuclearPhysics_h 1
#include "globals.hh"
#include "G4VPhysicsConstructor.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class GammaNuclearPhysics : public G4VPhysicsConstructor
{
public:
GammaNuclearPhysics(const G4String& name="gamma");
~GammaNuclearPhysics();
public:
virtual void ConstructParticle() { };
virtual void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr06/include/HadronElasticPhysicsHP.hh
/// \brief Definition of the HadronElasticPhysicsHP class
//
// $Id: HadronElasticPhysicsHP.hh 71037 2013-06-10 09:20:54Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HadronElasticPhysicsHP_h
#define HadronElasticPhysicsHP_h 1
#include "globals.hh"
#include "G4HadronElasticPhysics.hh"
class NeutronHPMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HadronElasticPhysicsHP : public G4HadronElasticPhysics
{
public:
HadronElasticPhysicsHP(G4int ver = 1);
~HadronElasticPhysicsHP();
public:
virtual void ConstructProcess();
public:
void SetThermalPhysics(G4bool flag) {fThermal = flag;};
private:
G4bool fThermal;
NeutronHPMessenger* fNeutronMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/HistoManager.hh
/// \brief Definition of the HistoManager class
//
// $Id: HistoManager.hh 66586 2012-12-21 10:48:39Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoManager_h
#define HistoManager_h 1
#include "globals.hh"
#include "g4root.hh"
//#include "g4xml.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager
{
public:
HistoManager();
~HistoManager();
private:
void Book();
G4String fFileName;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm12/include/NeutronHPMessenger.hh
/// \brief Definition of the NeutronHPMessenger class
//
// $Id: NeutronHPMessenger.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef NeutronHPMessenger_h
#define NeutronHPMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class HadronElasticPhysicsHP;
class G4UIdirectory;
class G4UIcmdWithABool;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class NeutronHPMessenger: public G4UImessenger
{
public:
NeutronHPMessenger(HadronElasticPhysicsHP*);
~NeutronHPMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
HadronElasticPhysicsHP* fNeutronPhysics;
G4UIdirectory* fPhysDir;
G4UIcmdWithABool* fThermalCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/PhysicsList.hh
/// \brief Definition of the PhysicsList class
//
// $Id: PhysicsList.hh 66587 2012-12-21 11:06:44Z ihrivnac $
//
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList();
~PhysicsList();
public:
virtual void SetCuts();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm4/include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
// $Id: PrimaryGeneratorAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4Event;
class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
public:
virtual void GeneratePrimaries(G4Event*);
G4ParticleGun* GetParticleGun() {return fParticleGun;};
private:
G4ParticleGun* fParticleGun;
DetectorConstruction* fDetector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm11/include/Run.hh
/// \brief Definition of the Run class
//
// $Id: Run.hh 71375 2013-06-14 07:39:33Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef Run_h
#define Run_h 1
#include "G4Run.hh"
#include "G4VProcess.hh"
#include "globals.hh"
#include <map>
class DetectorConstruction;
class G4ParticleDefinition;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class Run : public G4Run
{
public:
Run(DetectorConstruction*);
~Run();
public:
void SetPrimary(G4ParticleDefinition* particle, G4double energy);
void CountProcesses(const G4VProcess* process);
void ParticleCount(G4String, G4double);
void AddEdep (G4double edep);
void AddEflow (G4double eflow);
void ParticleFlux(G4String, G4double);
virtual void Merge(const G4Run*);
void EndOfRun();
private:
struct ParticleData {
ParticleData()
: fCount(0), fEmean(0.), fEmin(0.), fEmax(0.) {}
ParticleData(G4int count, G4double ekin, G4double emin, G4double emax)
: fCount(count), fEmean(ekin), fEmin(emin), fEmax(emax) {}
G4int fCount;
G4double fEmean;
G4double fEmin;
G4double fEmax;
};
private:
DetectorConstruction* fDetector;
G4ParticleDefinition* fParticle;
G4double fEkin;
G4double fEnergyDeposit, fEnergyDeposit2;
G4double fEnergyFlow, fEnergyFlow2;
std::map<G4String,G4int> fProcCounter;
std::map<G4String,ParticleData> fParticleDataMap1;
std::map<G4String,ParticleData> fParticleDataMap2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/RunAction.hh
/// \brief Definition of the RunAction class
//
// $Id: RunAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction;
class Run;
class PrimaryGeneratorAction;
class HistoManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*, PrimaryGeneratorAction*);
~RunAction();
public:
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
private:
DetectorConstruction* fDetector;
PrimaryGeneratorAction* fPrimary;
Run* fRun;
HistoManager* fHistoManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/include/SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
// $Id: SteppingAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class EventAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(EventAction*);
~SteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
EventAction* fEventAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#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. *
// ********************************************************************
//
/// \file radioactivedecay/rdecay01/include/SteppingVerbose.hh
/// \brief Definition of the SteppingVerbose class
//
//
// $Id: SteppingVerbose.hh 70268 2013-05-28 14:17:50Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingVerbose_h
#define SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingVerbose : public G4SteppingVerbose {
public:
SteppingVerbose();
~SteppingVerbose();
virtual void TrackingStarted();
virtual void StepInfo();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm12/include/TrackingAction.hh
/// \brief Definition of the TrackingAction class
//
// $Id: TrackingAction.hh 69099 2013-04-18 12:25:19Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef TrackingAction_h
#define TrackingAction_h 1
#include "G4UserTrackingAction.hh"
#include "globals.hh"
class EventAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class TrackingAction : public G4UserTrackingAction {
public:
TrackingAction(EventAction*);
~TrackingAction() {};
virtual void PreUserTrackingAction(const G4Track*);
virtual void PostUserTrackingAction(const G4Track*);
private:
EventAction* fEventAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,28 @@
# $Id$
#
# Macro file for "NeutronSource.cc"
#
/control/verbose 2
/run/verbose 1
#
##/testhadr/det/setAbsorMat BeO
##/testhadr/det/setContMat Stainless-Steel
##/testhadr/det/setAbsorRadius 15 mm
##/testhadr/det/setAbsorLength 60 mm
##/testhadr/det/setContThick 2.4 mm
#
/run/initialize
#
/process/list
/process/inactivate hadElastic
#
/gun/particle ion
/gun/ion 95 241
/gun/energy 0. eV
#
##/analysis/setFileName NeutronSource
##/analysis/h1/set 6 60 0. 12. MeV #neutrons
#
/run/printProgress 1000
#
/run/beamOn 10000
@@ -0,0 +1,14 @@
{
gROOT->Reset();
// Draw histos filled by Geant4 simulation
//
TFile f("NeutronSource.root");
TCanvas* c1 = new TCanvas("c1", " ");
///TH1D* hist4 = (TH1D*)f.Get("4");
///hist4->Draw("HIST");
TH1D* hist6 = (TH1D*)f.Get("6");
hist6->Draw("HIST");
}
@@ -0,0 +1,28 @@
# $Id$
#
# Macro file for "AmBe.cc"
#
/control/verbose 2
/run/verbose 1
#
##/testhadr/det/setAbsorMat BeO
##/testhadr/det/setContMat Stainless-Steel
##/testhadr/det/setAbsorRadius 15 mm
##/testhadr/det/setAbsorLength 60 mm
##/testhadr/det/setContThick 2.4 mm
#
/run/initialize
#
/process/list
#
/gun/particle ion
/gun/ion 95 241
/gun/energy 0. eV
#
/analysis/setFileName NeutronSource
/analysis/h1/set 4 100 0. 10. MeV #gammas
/analysis/h1/set 6 60 0. 12. MeV #neutrons
#
/run/printProgress 10000
#
/run/beamOn 100000
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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: ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
: G4VUserActionInitialization(),
fDetector(detector)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
RunAction* runAction = new RunAction(fDetector, 0);
SetUserAction(runAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(fDetector);
SetUserAction(primary);
RunAction* runAction = new RunAction(fDetector, primary );
SetUserAction(runAction);
EventAction* event = new EventAction();
SetUserAction(event);
TrackingAction* trackingAction = new TrackingAction(event);
SetUserAction(trackingAction);
SteppingAction* steppingAction = new SteppingAction(event);
SetUserAction(steppingAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSteppingVerbose* ActionInitialization::InitializeSteppingVerbose() const
{
return new SteppingVerbose();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,292 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
// $Id: DetectorConstruction.cc 70755 2013-06-05 12:17:48Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction(),
fAbsorMaterial(0), fLAbsor(0), fContainMaterial(0), fLContain(0),
fWorldMaterial(0), fPWorld(0), fDetectorMessenger(0)
{
fAbsorRadius = 15*mm;
fAbsorLength = 60*mm;
fContainThickness = 2.4*mm;
DefineMaterials();
SetAbsorMaterial ("BeO");
SetContainMaterial("Stainless-Steel");
fDetectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete fDetectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
G4int ncomponents, natoms;
G4Element* Be = new G4Element("Beryllium","Be" , 4., 9.01*g/mole);
G4Element* N = new G4Element("Nitrogen" ,"N" , 7., 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" ,"O" , 8., 16.00*g/mole);
G4Element* Cr = new G4Element("Chromium" ,"Cr" , 24., 51.99*g/mole);
G4Element* Fe = new G4Element("Iron" ,"Fe" , 26., 55.84*g/mole);
G4Element* Ni = new G4Element("Nickel" ,"Ni" , 28., 58.69*g/mole);
G4Material* BeO =
new G4Material("BeO", 3.05*g/cm3, ncomponents=2);
BeO->AddElement(Be, natoms=1);
BeO->AddElement( O, natoms=1);
G4Material* inox =
new G4Material("Stainless-Steel", 8*g/cm3, ncomponents=3);
inox->AddElement(Fe, 74*perCent);
inox->AddElement(Cr, 18*perCent);
inox->AddElement(Ni, 8*perCent);
G4Material* Air =
new G4Material("Air", 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, 70.*perCent);
Air->AddElement(O, 30.*perCent);
fWorldMaterial = Air;
///G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material* DetectorConstruction::MaterialWithSingleIsotope( G4String name,
G4String symbol, G4double density, G4int Z, G4int A)
{
// define a material from an isotope
//
G4int ncomponents;
G4double abundance, massfraction;
G4Isotope* isotope = new G4Isotope(symbol, Z, A);
G4Element* element = new G4Element(name, symbol, ncomponents=1);
element->AddIsotope(isotope, abundance= 100.*perCent);
G4Material* material = new G4Material(name, density, ncomponents=1);
material->AddElement(element, massfraction=100.*perCent);
return material;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
{
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// compute dimensions
G4double ContainRadius = fAbsorRadius + fContainThickness;
G4double ContainLength = fAbsorLength + 2*fContainThickness;
G4double WorldSizeXY = 2.4*ContainRadius;
G4double WorldSizeZ = 1.2*ContainLength;
// World
//
G4Box*
sWorld = new G4Box("World", //name
0.5*WorldSizeXY,0.5*WorldSizeXY,0.5*WorldSizeZ); //dimensions
G4LogicalVolume*
lWorld = new G4LogicalVolume(sWorld, //shape
fWorldMaterial, //material
"World"); //name
fPWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lWorld, //logical volume
"World", //name
0, //mother volume
false, //no boolean operation
0); //copy number
// Container
//
G4Tubs*
sContain = new G4Tubs("Container", //name
0., ContainRadius, 0.5*ContainLength, 0., twopi); //dimensions
fLContain = new G4LogicalVolume(sContain, //shape
fContainMaterial, //material
fContainMaterial->GetName()); //name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLContain, //logical volume
fContainMaterial->GetName(), //name
lWorld, //mother volume
false, //no boolean operation
0); //copy number
// Absorber
//
G4Tubs*
sAbsor = new G4Tubs("Absorber", //name
0., fAbsorRadius, 0.5*fAbsorLength, 0., twopi); //dimensions
fLAbsor = new G4LogicalVolume(sAbsor, //shape
fAbsorMaterial, //material
fAbsorMaterial->GetName()); //name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLAbsor, //logical volume
fAbsorMaterial->GetName(), //name
fLContain, //mother volume
false, //no boolean operation
0); //copy number
PrintParameters();
//always return the root volume
//
return fPWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintParameters()
{
G4cout << "\n The Absorber is a cylinder of " << fAbsorMaterial->GetName()
<< " radius = " << G4BestUnit(fAbsorRadius,"Length")
<< " length = " << G4BestUnit(fAbsorLength,"Length") << G4endl;
G4cout << " The Container is a cylinder of " << fContainMaterial->GetName()
<< " thickness = " << G4BestUnit(fContainThickness,"Length") << G4endl;
G4cout << "\n" << fAbsorMaterial << G4endl;
G4cout << "\n" << fContainMaterial << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial) {
fAbsorMaterial = pttoMaterial;
if(fLAbsor) { fLAbsor->SetMaterial(fAbsorMaterial); }
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
} else {
G4cout << "\n--> warning from DetectorConstruction::SetAbsorMaterial : "
<< materialChoice << " not found" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetContainMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial) {
fContainMaterial = pttoMaterial;
if(fLContain) { fLContain->SetMaterial(fContainMaterial); }
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
} else {
G4cout << "\n--> warning from DetectorConstruction::SetContainMaterial : "
<< materialChoice << " not found" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorRadius(G4double value)
{
fAbsorRadius = value;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorLength(G4double value)
{
fAbsorLength = value;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetContainThickness(G4double value)
{
fContainThickness = value;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,166 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
// $Id: DetectorMessenger.cc 70755 2013-06-05 12:17:48Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:G4UImessenger(),
fDetector(Det), fTesthadrDir(0), fDetDir(0), fMaterCmd1(0), fMaterCmd2(0),
fSizeCmd1(0), fSizeCmd2(0), fSizeCmd3(0),
fIsotopeCmd(0)
{
fTesthadrDir = new G4UIdirectory("/testhadr/");
fTesthadrDir->SetGuidance("commands specific to this example");
G4bool broadcast = false;
fDetDir = new G4UIdirectory("/testhadr/det/",broadcast);
fDetDir->SetGuidance("detector construction commands");
fMaterCmd1 = new G4UIcmdWithAString("/testhadr/det/setAbsorMat",this);
fMaterCmd1->SetGuidance("Select absorber material");
fMaterCmd1->SetParameterName("choice",false);
fMaterCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
fMaterCmd2 = new G4UIcmdWithAString("/testhadr/det/setContMat",this);
fMaterCmd2->SetGuidance("Select container material");
fMaterCmd2->SetParameterName("choice",false);
fMaterCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeCmd1 = new G4UIcmdWithADoubleAndUnit("/testhadr/det/setAbsorRadius",this);
fSizeCmd1->SetGuidance("Set absorber radius");
fSizeCmd1->SetParameterName("Radius",false);
fSizeCmd1->SetRange("Radius>0.");
fSizeCmd1->SetUnitCategory("Length");
fSizeCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeCmd2 = new G4UIcmdWithADoubleAndUnit("/testhadr/det/setAbsorLength",this);
fSizeCmd2->SetGuidance("Set absorber length");
fSizeCmd2->SetParameterName("Length",false);
fSizeCmd2->SetRange("Length>0.");
fSizeCmd2->SetUnitCategory("Length");
fSizeCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeCmd3 = new G4UIcmdWithADoubleAndUnit("/testhadr/det/setContThick",this);
fSizeCmd3->SetGuidance("Set container thickness");
fSizeCmd3->SetParameterName("Thick",false);
fSizeCmd3->SetRange("Thick>0.");
fSizeCmd3->SetUnitCategory("Length");
fSizeCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
fIsotopeCmd = new G4UIcommand("/testhadr/det/setIsotopeMat",this);
fIsotopeCmd->SetGuidance("Build and select a material with single isotope");
fIsotopeCmd->SetGuidance(" symbol of isotope, Z, A, density of material");
//
G4UIparameter* symbPrm = new G4UIparameter("isotope",'s',false);
symbPrm->SetGuidance("isotope symbol");
fIsotopeCmd->SetParameter(symbPrm);
//
G4UIparameter* ZPrm = new G4UIparameter("Z",'i',false);
ZPrm->SetGuidance("Z");
ZPrm->SetParameterRange("Z>0");
fIsotopeCmd->SetParameter(ZPrm);
//
G4UIparameter* APrm = new G4UIparameter("A",'i',false);
APrm->SetGuidance("A");
APrm->SetParameterRange("A>0");
fIsotopeCmd->SetParameter(APrm);
//
G4UIparameter* densityPrm = new G4UIparameter("density",'d',false);
densityPrm->SetGuidance("density of material");
densityPrm->SetParameterRange("density>0.");
fIsotopeCmd->SetParameter(densityPrm);
//
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',false);
unitPrm->SetGuidance("unit of density");
G4String unitList = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("g/cm3"));
unitPrm->SetParameterCandidates(unitList);
fIsotopeCmd->SetParameter(unitPrm);
//
fIsotopeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete fMaterCmd1;
delete fMaterCmd2;
delete fSizeCmd1;
delete fSizeCmd2;
delete fSizeCmd3;
delete fIsotopeCmd;
delete fDetDir;
delete fTesthadrDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fMaterCmd1 )
{ fDetector->SetAbsorMaterial(newValue);}
if( command == fMaterCmd2 )
{ fDetector->SetContainMaterial(newValue);}
if( command == fSizeCmd1 )
{ fDetector->SetAbsorRadius(fSizeCmd1->GetNewDoubleValue(newValue));}
if( command == fSizeCmd2 )
{ fDetector->SetAbsorLength(fSizeCmd2->GetNewDoubleValue(newValue));}
if( command == fSizeCmd3 )
{ fDetector->SetContainThickness(fSizeCmd3->GetNewDoubleValue(newValue));}
if (command == fIsotopeCmd)
{
G4int Z; G4int A; G4double dens;
G4String name, unt;
std::istringstream is(newValue);
is >> name >> Z >> A >> dens >> unt;
dens *= G4UIcommand::ValueOf(unt);
fDetector->MaterialWithSingleIsotope (name,name,dens,Z,A);
fDetector->SetAbsorMaterial(name);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,160 @@
//
// ********************************************************************
// * 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: ElectromagneticPhysics.cc 71570 2013-06-18 10:14:44Z gcosmo $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ElectromagneticPhysics.hh"
#include "G4BuilderType.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4PhysicsListHelper.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4KleinNishinaModel.hh"
#include "G4eMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuMultipleScattering.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4ionIonisation.hh"
#include "G4IonParametrisedLossModel.hh"
#include "G4NuclearStopping.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ElectromagneticPhysics::ElectromagneticPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
SetPhysicsType(bElectromagnetic);
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(0);
param->SetStepFunction(1., 1*mm); //default= 0.1, 100*um
param->SetStepFunctionMuHad(1., 1*mm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ElectromagneticPhysics::~ElectromagneticPhysics()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ElectromagneticPhysics::ConstructProcess()
{
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// Add standard EM Processes
//
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while( (*particleIterator)() ){
G4ParticleDefinition* particle = particleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
ph->RegisterProcess(new G4PhotoElectricEffect, particle);
ph->RegisterProcess(new G4ComptonScattering, particle);
ph->RegisterProcess(new G4GammaConversion, particle);
} else if (particleName == "e-") {
ph->RegisterProcess(new G4eMultipleScattering(), particle);
ph->RegisterProcess(new G4eIonisation, particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
} else if (particleName == "e+") {
ph->RegisterProcess(new G4eMultipleScattering(), particle);
ph->RegisterProcess(new G4eIonisation, particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
} else if (particleName == "mu+" ||
particleName == "mu-" ) {
ph->RegisterProcess(new G4MuMultipleScattering(), particle);
ph->RegisterProcess(new G4MuIonisation, particle);
ph->RegisterProcess(new G4MuBremsstrahlung(), particle);
ph->RegisterProcess(new G4MuPairProduction(), particle);
} else if( particleName == "proton" ||
particleName == "pi-" ||
particleName == "pi+" ) {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4hIonisation, particle);
} else if( particleName == "alpha" ||
particleName == "He3" ) {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation, particle);
ph->RegisterProcess(new G4NuclearStopping(), particle);
} else if( particleName == "GenericIon" ) {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
G4ionIonisation* ionIoni = new G4ionIonisation();
ionIoni->SetEmModel(new G4IonParametrisedLossModel());
ph->RegisterProcess(ionIoni, particle);
ph->RegisterProcess(new G4NuclearStopping(), particle);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm1/src/EventAction.cc
/// \brief Implementation of the EventAction class
//
// $Id: EventAction.cc 76293 2013-11-08 13:11:23Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "Run.hh"
#include "HistoManager.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction()
:G4UserEventAction(),
fTotalEnergyDeposit(0.), fTotalEnergyFlow(0.)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::~EventAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event*)
{
fTotalEnergyDeposit = 0.;
fTotalEnergyFlow = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::AddEdep(G4double Edep)
{
fTotalEnergyDeposit += Edep;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::AddEflow(G4double Eflow)
{
fTotalEnergyFlow += Eflow;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event*)
{
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddEdep (fTotalEnergyDeposit);
run->AddEflow(fTotalEnergyFlow);
G4AnalysisManager::Instance()->FillH1(1,fTotalEnergyDeposit);
G4AnalysisManager::Instance()->FillH1(3,fTotalEnergyFlow);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/GammaNuclearPhysics.cc
/// \brief Implementation of the GammaNuclearPhysics class
//
// $Id: GammaNuclearPhysics.cc 66587 2012-12-21 11:06:44Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "GammaNuclearPhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// Processes
#include "G4PhotoNuclearProcess.hh"
#include "G4CascadeInterface.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GammaNuclearPhysics::GammaNuclearPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GammaNuclearPhysics::~GammaNuclearPhysics()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void GammaNuclearPhysics::ConstructProcess()
{
G4ProcessManager* pManager = G4Gamma::Gamma()->GetProcessManager();
//
G4PhotoNuclearProcess* process = new G4PhotoNuclearProcess();
//
G4CascadeInterface* bertini = new G4CascadeInterface();
bertini->SetMaxEnergy(10*GeV);
process->RegisterMe(bertini);
//
pManager->AddDiscreteProcess(process);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -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. *
// ********************************************************************
//
/// \file hadronic/Hadr06/include/HadronElasticPhysicsHP.hh
/// \brief Definition of the HadronElasticPhysicsHP class
//
// $Id:HadronElasticPhysicsHP.cc 71037 2013-06-10 09:20:54Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// HP models for neutron < 20 MeV
#include "HadronElasticPhysicsHP.hh"
#include "NeutronHPMessenger.hh"
#include "G4HadronicProcess.hh"
#include "G4ParticleHPElastic.hh"
#include "G4ParticleHPElasticData.hh"
#include "G4ParticleHPThermalScattering.hh"
#include "G4ParticleHPThermalScatteringData.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HadronElasticPhysicsHP::HadronElasticPhysicsHP(G4int ver)
: G4HadronElasticPhysics(ver),
fThermal(false), fNeutronMessenger(0)
{
fNeutronMessenger = new NeutronHPMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HadronElasticPhysicsHP::~HadronElasticPhysicsHP()
{
delete fNeutronMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HadronElasticPhysicsHP::ConstructProcess()
{
G4HadronElasticPhysics::ConstructProcess();
GetNeutronModel()->SetMinEnergy(19.5*MeV);
G4HadronicProcess* process = GetNeutronProcess();
G4ParticleHPElastic* model1 = new G4ParticleHPElastic();
process->RegisterMe(model1);
process->AddDataSet(new G4ParticleHPElasticData());
if (fThermal) {
G4ParticleHPThermalScattering* model2 = new G4ParticleHPThermalScattering();
process->RegisterMe(model2);
process->AddDataSet(new G4ParticleHPThermalScatteringData());
model1->SetMinEnergy(4*eV);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/HistoManager.cc
/// \brief Implementation of the HistoManager class
//
// $Id: HistoManager.cc 67909 2013-03-12 18:51:09Z vnivanch $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
: fFileName("NeutronSource")
{
Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
delete G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::Book()
{
// Create or get analysis manager
// The choice of analysis technology is done via selection of a namespace
// in HistoManager.hh
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName(fFileName);
analysisManager->SetVerboseLevel(1);
analysisManager->SetActivation(true); //enable inactivation of histograms
// Define histograms start values
const G4int kMaxHisto = 14;
const G4String id[] = {"0","1","2","3","4","5","6","7","8","9",
"10","11","12","13"};
const G4String title[] =
{ "dummy", //0
"total energy deposit", //1
"dummy", //2
"total kinetic energy flow", //3
"gamma flux (dN/dE) at exit", //4
"e+- flux (dN/dE) at exit", //5
"neutrons flux (dN/dE) at exit", //6
"protons flux (dN/dE) at exit", //7
"deuterons flux (dN/dE) at exit", //8
"alphas flux (dN/dE) at exit", //9
"all others ions flux (dN/dE) at exit", //10
"all others baryons flux (dN/dE) at exit", //11
"all others mesons flux (dN/dE) at exit", //12
"all others leptons flux (dN/dE) at exit" //13
};
// Default values (to be reset via /analysis/h1/set command)
G4int nbins = 100;
G4double vmin = 0.;
G4double vmax = 100.;
// Create all histograms as inactivated
// as we have not yet set nbins, vmin, vmax
for (G4int k=0; k<kMaxHisto; k++) {
G4int ih = analysisManager->CreateH1(id[k], title[k], nbins, vmin, vmax);
analysisManager->SetH1Activation(ih, false);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm12/src/NeutronHPMessenger.cc
/// \brief Implementation of the NeutronHPMessenger class
//
// $Id: NeutronHPMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "NeutronHPMessenger.hh"
#include "HadronElasticPhysicsHP.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NeutronHPMessenger::NeutronHPMessenger(HadronElasticPhysicsHP* phys)
:G4UImessenger(),fNeutronPhysics(phys),
fPhysDir(0), fThermalCmd(0)
{
fPhysDir = new G4UIdirectory("/testhadr/phys/");
fPhysDir->SetGuidance("physics list commands");
fThermalCmd = new G4UIcmdWithABool("/testhadr/phys/thermalScattering",this);
fThermalCmd->SetGuidance("set thermal scattering model");
fThermalCmd->SetParameterName("thermal",false);
fThermalCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NeutronHPMessenger::~NeutronHPMessenger()
{
delete fThermalCmd;
delete fPhysDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void NeutronHPMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == fThermalCmd)
{fNeutronPhysics->SetThermalPhysics(fThermalCmd->GetNewBoolValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id: PhysicsList.cc 70268 2013-05-28 14:17:50Z maire $
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsList.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "HadronElasticPhysicsHP.hh"
#include "G4HadronPhysicsFTFP_BERT_HP.hh"
#include "G4HadronPhysicsQGSP_BIC_HP.hh"
#include "G4HadronInelasticQBBC.hh"
#include "G4HadronPhysicsINCLXX.hh"
#include "G4IonPhysics.hh"
#include "G4IonINCLXXPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "GammaNuclearPhysics.hh"
#include "ElectromagneticPhysics.hh"
#include "G4DecayPhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList()
:G4VModularPhysicsList()
{
G4int verb = 0;
SetVerboseLevel(verb);
//add new units
//
new G4UnitDefinition( "millielectronVolt", "meV", "Energy", 1.e-3*eV);
new G4UnitDefinition( "mm2/g", "mm2/g", "Surface/Mass", mm2/g);
new G4UnitDefinition( "um2/mg", "um2/mg","Surface/Mass", um*um/mg);
// Hadron Elastic scattering
RegisterPhysics( new HadronElasticPhysicsHP(verb));
// Hadron Inelastic Physics
////RegisterPhysics( new G4HadronPhysicsFTFP_BERT_HP(verb));
RegisterPhysics( new G4HadronPhysicsQGSP_BIC_HP(verb));
////RegisterPhysics( new G4HadronInelasticQBBC(verb));
////RegisterPhysics( new G4HadronPhysicsINCLXX(verb));
// Ion Physics
RegisterPhysics( new G4IonPhysics(verb));
////RegisterPhysics( new G4IonINCLXXPhysics(verb));
// stopping Particles
///RegisterPhysics( new G4StoppingPhysics(verb));
// Gamma-Nuclear Physics
RegisterPhysics( new GammaNuclearPhysics("gamma"));
// EM physics
RegisterPhysics(new ElectromagneticPhysics());
// Decay
RegisterPhysics(new G4DecayPhysics());
// Radioactive decay
RegisterPhysics(new G4RadioactiveDecayPhysics());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCuts()
{
SetCutValue(0*mm, "proton");
SetCutValue(10*km, "e-");
SetCutValue(10*km, "e+");
SetCutValue(10*km, "gamma");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm4/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//
// $Id: PrimaryGeneratorAction.cc 67268 2013-02-13 11:38:40Z ihrivnac $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4Geantino.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det)
: G4VUserPrimaryGeneratorAction(), fParticleGun(0), fDetector(det)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun->SetParticleEnergy(0*eV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//particle type
if (fParticleGun->GetParticleDefinition() == G4Geantino::Geantino()) {
G4int Z = 95, A = 241;
G4double ionCharge = 0.*eplus;
G4double excitEnergy = 0.*keV;
G4ParticleDefinition* ion
= G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
fParticleGun->SetParticleDefinition(ion);
fParticleGun->SetParticleCharge(ionCharge);
}
//vertex position uniform within the absorber
//
G4double Rmax = fDetector->GetAbsorRadius();
G4double Rmax2 = Rmax*Rmax;
G4double R2 = G4UniformRand()*Rmax2;
G4double R = std::sqrt(R2);
G4double phi = twopi*G4UniformRand();
G4double ux = R*std::cos(phi),
uy = R*std::sin(phi);
G4double uz = (fDetector->GetAbsorLength())*(G4UniformRand() - 0.5);
fParticleGun->SetParticlePosition(G4ThreeVector(ux,uy,uz));
//distribution uniform in solid angle
//
G4double cosTheta = 2*G4UniformRand() - 1.;
G4double sinTheta = std::sqrt(1. - cosTheta*cosTheta);
phi = twopi*G4UniformRand();
G4double vx = sinTheta*std::cos(phi),
vy = sinTheta*std::sin(phi),
vz = cosTheta;
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(vx,vy,vz));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,336 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm11/src/Run.cc
/// \brief Implementation of the Run class
//
// $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "Run.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Run::Run(DetectorConstruction* det)
: G4Run(),
fDetector(det), fParticle(0), fEkin(0.)
{
fEnergyDeposit = fEnergyDeposit2 = 0.;
fEnergyFlow = fEnergyFlow2 = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Run::~Run()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
{
fParticle = particle;
fEkin = energy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::CountProcesses(const G4VProcess* process)
{
G4String procName = process->GetProcessName();
std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
if ( it == fProcCounter.end()) {
fProcCounter[procName] = 1;
}
else {
fProcCounter[procName]++;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::ParticleCount(G4String name, G4double Ekin)
{
std::map<G4String, ParticleData>::iterator it = fParticleDataMap1.find(name);
if ( it == fParticleDataMap1.end()) {
fParticleDataMap1[name] = ParticleData(1, Ekin, Ekin, Ekin);
}
else {
ParticleData& data = it->second;
data.fCount++;
data.fEmean += Ekin;
//update min max
G4double emin = data.fEmin;
if (Ekin < emin) data.fEmin = Ekin;
G4double emax = data.fEmax;
if (Ekin > emax) data.fEmax = Ekin;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::AddEdep(G4double edep)
{
fEnergyDeposit += edep;
fEnergyDeposit2 += edep*edep;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::AddEflow(G4double eflow)
{
fEnergyFlow += eflow;
fEnergyFlow2 += eflow*eflow;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::ParticleFlux(G4String name, G4double Ekin)
{
std::map<G4String, ParticleData>::iterator it = fParticleDataMap2.find(name);
if ( it == fParticleDataMap2.end()) {
fParticleDataMap2[name] = ParticleData(1, Ekin, Ekin, Ekin);
}
else {
ParticleData& data = it->second;
data.fCount++;
data.fEmean += Ekin;
//update min max
G4double emin = data.fEmin;
if (Ekin < emin) data.fEmin = Ekin;
G4double emax = data.fEmax;
if (Ekin > emax) data.fEmax = Ekin;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::Merge(const G4Run* run)
{
const Run* localRun = static_cast<const Run*>(run);
//primary particle info
//
fParticle = localRun->fParticle;
fEkin = localRun->fEkin;
// accumulate sums
//
fEnergyDeposit += localRun->fEnergyDeposit;
fEnergyDeposit2 += localRun->fEnergyDeposit2;
fEnergyFlow += localRun->fEnergyFlow;
fEnergyFlow2 += localRun->fEnergyFlow2;
//map: processes count
std::map<G4String,G4int>::const_iterator itp;
for ( itp = localRun->fProcCounter.begin();
itp != localRun->fProcCounter.end(); ++itp ) {
G4String procName = itp->first;
G4int localCount = itp->second;
if ( fProcCounter.find(procName) == fProcCounter.end()) {
fProcCounter[procName] = localCount;
}
else {
fProcCounter[procName] += localCount;
}
}
//map: created particles count
std::map<G4String,ParticleData>::const_iterator itc;
for (itc = localRun->fParticleDataMap1.begin();
itc != localRun->fParticleDataMap1.end(); ++itc) {
G4String name = itc->first;
const ParticleData& localData = itc->second;
if ( fParticleDataMap1.find(name) == fParticleDataMap1.end()) {
fParticleDataMap1[name]
= ParticleData(localData.fCount,
localData.fEmean,
localData.fEmin,
localData.fEmax);
}
else {
ParticleData& data = fParticleDataMap1[name];
data.fCount += localData.fCount;
data.fEmean += localData.fEmean;
G4double emin = localData.fEmin;
if (emin < data.fEmin) data.fEmin = emin;
G4double emax = localData.fEmax;
if (emax > data.fEmax) data.fEmax = emax;
}
}
//map: particles flux count
std::map<G4String,ParticleData>::const_iterator itn;
for (itn = localRun->fParticleDataMap2.begin();
itn != localRun->fParticleDataMap2.end(); ++itn) {
G4String name = itn->first;
const ParticleData& localData = itn->second;
if ( fParticleDataMap2.find(name) == fParticleDataMap2.end()) {
fParticleDataMap2[name]
= ParticleData(localData.fCount,
localData.fEmean,
localData.fEmin,
localData.fEmax);
}
else {
ParticleData& data = fParticleDataMap2[name];
data.fCount += localData.fCount;
data.fEmean += localData.fEmean;
G4double emin = localData.fEmin;
if (emin < data.fEmin) data.fEmin = emin;
G4double emax = localData.fEmax;
if (emax > data.fEmax) data.fEmax = emax;
}
}
G4Run::Merge(run);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::EndOfRun()
{
G4int prec = 5, wid = prec + 2;
G4int dfprec = G4cout.precision(prec);
//run condition
//
G4Material* material = fDetector->GetAbsorMaterial();
G4String Particle = fParticle->GetParticleName();
G4cout << "\n The run is " << numberOfEvent << " "<< Particle << " of "
<< G4BestUnit(fEkin,"Energy") << " within "
<< material->GetName() << " (D = "
<< G4BestUnit(2*(fDetector->GetAbsorRadius()),"Length") << " L = "
<< G4BestUnit(fDetector->GetAbsorLength(),"Length") << ")" << G4endl;
if (numberOfEvent == 0) { G4cout.precision(dfprec); return;}
//frequency of processes
//
G4cout << "\n Process calls frequency :" << G4endl;
G4int index = 0;
std::map<G4String,G4int>::iterator it;
for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
G4String procName = it->first;
G4int count = it->second;
G4String space = " "; if (++index%3 == 0) space = "\n";
G4cout << " " << std::setw(20) << procName << "="<< std::setw(7) << count
<< space;
}
G4cout << G4endl;
//particles count
//
G4cout << "\n List of generated particles:" << G4endl;
std::map<G4String,ParticleData>::iterator itc;
for (itc = fParticleDataMap1.begin(); itc != fParticleDataMap1.end(); itc++) {
G4String name = itc->first;
ParticleData data = itc->second;
G4int count = data.fCount;
G4double eMean = data.fEmean/count;
G4double eMin = data.fEmin;
G4double eMax = data.fEmax;
G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy")
<< ")" << G4endl;
}
// compute mean Energy deposited and rms
//
G4int TotNbofEvents = numberOfEvent;
fEnergyDeposit /= TotNbofEvents; fEnergyDeposit2 /= TotNbofEvents;
G4double rmsEdep = fEnergyDeposit2 - fEnergyDeposit*fEnergyDeposit;
if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep);
else rmsEdep = 0.;
G4cout << "\n Mean energy deposit per event = "
<< G4BestUnit(fEnergyDeposit,"Energy") << "; rms = "
<< G4BestUnit(rmsEdep, "Energy")
<< G4endl;
// compute mean Energy flow and rms
//
fEnergyFlow /= TotNbofEvents; fEnergyFlow2 /= TotNbofEvents;
G4double rmsEflow = fEnergyFlow2 - fEnergyFlow*fEnergyFlow;
if (rmsEflow>0.) rmsEflow = std::sqrt(rmsEflow);
else rmsEflow = 0.;
G4cout << " Mean energy flow per event = "
<< G4BestUnit(fEnergyFlow,"Energy") << "; rms = "
<< G4BestUnit(rmsEflow, "Energy")
<< G4endl;
//particles flux
//
G4cout << "\n List of particles emerging from the container :" << G4endl;
std::map<G4String,ParticleData>::iterator itn;
for (itn = fParticleDataMap2.begin(); itn != fParticleDataMap2.end(); itn++) {
G4String name = itn->first;
ParticleData data = itn->second;
G4int count = data.fCount;
G4double eMean = data.fEmean/count;
G4double eMin = data.fEmin;
G4double eMax = data.fEmax;
G4double Eflow = data.fEmean/TotNbofEvents;
G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy")
<< ") \tEflow/event = " << G4BestUnit(Eflow, "Energy") << G4endl;
}
//normalize histograms
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
for (G4int ih=1; ih<14; ih++) {
G4double binWidth = analysisManager->GetH1Width(ih);
G4double unit = analysisManager->GetH1Unit(ih);
G4double fac = unit/binWidth;
analysisManager->ScaleH1(ih,fac);
}
//remove all contents in fProcCounter, fCount
fProcCounter.clear();
fParticleDataMap2.clear();
//restore default format
G4cout.precision(dfprec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 70756 2013-06-05 12:20:06Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "Run.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "HistoManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim)
: G4UserRunAction(),
fDetector(det), fPrimary(prim), fRun(0), fHistoManager(0)
{
// Book predefined histograms
fHistoManager = new HistoManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{
delete fHistoManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* RunAction::GenerateRun()
{
fRun = new Run(fDetector);
return fRun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run*)
{
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
if (isMaster) G4Random::showEngineStatus();
// keep run condition
if (fPrimary) {
G4ParticleDefinition* particle
= fPrimary->GetParticleGun()->GetParticleDefinition();
G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
fRun->SetPrimary(particle, energy);
}
//histograms
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->IsActive() ) {
analysisManager->OpenFile();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run*)
{
if (isMaster) fRun->EndOfRun();
//save histograms
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->IsActive() ) {
analysisManager->Write();
analysisManager->CloseFile();
}
// show Rndm status
if (isMaster) G4Random::showEngineStatus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id: SteppingAction.cc 71404 2013-06-14 16:56:38Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "Run.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(EventAction* event)
: G4UserSteppingAction(), fEventAction(event)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// count processes
//
const G4StepPoint* endPoint = aStep->GetPostStepPoint();
const G4VProcess* process = endPoint->GetProcessDefinedStep();
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->CountProcesses(process);
// energy deposit
//
G4double edepStep = aStep->GetTotalEnergyDeposit();
if (edepStep <= 0.) return;
fEventAction->AddEdep(edepStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,158 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file radioactivedecay/rdecay01/src/SteppingVerbose.cc
/// \brief Implementation of the SteppingVerbose class
//
//
// $Id: SteppingVerbose.cc 71654 2013-06-19 18:20:04Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4ParticleTypes.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::SteppingVerbose()
: G4SteppingVerbose()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::~SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
//Step zero
//
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName()
<< " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName();
const G4VProcess* process
= fStep->GetPostStepPoint()->GetProcessDefinedStep();
G4String procName = " UserLimit";
if (process) procName = process->GetProcessName();
if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
G4cout << " " << std::setw(10) << procName;
G4cout << G4endl;
if (verboseLevel == 2) {
const std::vector<const G4Track*>* secondary
= fStep->GetSecondaryInCurrentStep();
size_t nbtrk = (*secondary).size();
if (nbtrk) {
G4cout << "\n :----- List of secondaries ----------------" << G4endl;
G4cout.precision(4);
for (size_t lp=0; lp<(*secondary).size(); lp++) {
G4cout << " "
<< std::setw(13)
<< (*secondary)[lp]->GetDefinition()->GetParticleName()
<< ": energy ="
<< std::setw(6)
<< G4BestUnit((*secondary)[lp]->GetKineticEnergy(),"Energy")
<< " time ="
<< std::setw(6)
<< G4BestUnit((*secondary)[lp]->GetGlobalTime(),"Time");
G4cout << G4endl;
}
G4cout << " :------------------------------------------\n" << G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm12/src/TrackingAction.cc
/// \brief Implementation of the TrackingAction class
//
// $Id: TrackingAction.cc 69099 2013-04-18 12:25:19Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "TrackingAction.hh"
#include "Run.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "G4RunManager.hh"
#include "G4Track.hh"
#include "G4StepStatus.hh"
#include "G4ParticleTypes.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction(EventAction* event)
:G4UserTrackingAction(), fEventAction(event)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingAction::PreUserTrackingAction(const G4Track* track)
{
//count secondary particles
if (track->GetTrackID() == 1) return;
G4String name = track->GetDefinition()->GetParticleName();
G4double energy = track->GetKineticEnergy();
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->ParticleCount(name,energy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingAction::PostUserTrackingAction(const G4Track* track)
{
// keep only outgoing particle
G4StepStatus status = track->GetStep()->GetPostStepPoint()->GetStepStatus();
if (status != fWorldBoundary) return;
const G4ParticleDefinition* particle = track->GetParticleDefinition();
G4String name = particle->GetParticleName();
G4double energy = track->GetKineticEnergy();
fEventAction->AddEflow(energy);
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->ParticleFlux(name,energy);
// histograms: enery flow
//
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
G4int ih = 0;
G4String type = particle->GetParticleType();
G4double charge = particle->GetPDGCharge();
if (charge > 3.) ih = 10;
else if (particle == G4Gamma::Gamma()) ih = 4;
else if (particle == G4Electron::Electron()) ih = 5;
else if (particle == G4Positron::Positron()) ih = 5;
else if (particle == G4Neutron::Neutron()) ih = 6;
else if (particle == G4Proton::Proton()) ih = 7;
else if (particle == G4Deuteron::Deuteron()) ih = 8;
else if (particle == G4Alpha::Alpha()) ih = 9;
else if (type == "nucleus") ih = 10;
else if (type == "baryon") ih = 11;
else if (type == "meson") ih = 12;
else if (type == "lepton") ih = 13;
if (ih > 0) analysis->FillH1(ih,energy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,85 @@
#
# Macro file for the initialization phase of "NeutronSource.cc"
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/run/verbose 2
#
/run/initialize
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
#/vis/viewer/set/viewpointThetaPhi 90. 0.
#
# Specify zoom value:
/vis/viewer/zoom 1.4
#
# Specify style (surface or wireframe):
/vis/viewer/set/style wireframe
# To get nice view
/vis/geometry/set/visibility World 0 true
#
# Draw coordinate axes:
#/vis/scene/add/axes 0 0 0 1 m
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts false
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 1
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
#
# Draw hits at end of event:
#/vis/scene/add/hits
#
# To draw only gammas:
#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma
#
# To invert the above, drawing all particles except gammas,
# keep the above two lines but also add:
#/vis/filtering/trajectories/particleFilter-0/invert true
#
# Many other options are available with /vis/modeling and /vis/filtering.
# For example, to select colour by particle ID:
/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/drawByParticleID-0/set e- red
/vis/modeling/trajectories/drawByParticleID-0/set gamma green
/vis/modeling/trajectories/drawByParticleID-0/set neutron yellow
/vis/modeling/trajectories/drawByParticleID-0/set alpha blue
/vis/modeling/trajectories/drawByParticleID-0/set GenericIon blue
#
# To superimpose all of the events from a given run:
/vis/scene/endOfEventAction accumulate
#
# Re-establish auto refreshing and verbosity:
/vis/viewer/set/autoRefresh true
/vis/verbose warnings
#
# For file-based drivers, use this to create an empty detector view:
#/vis/viewer/flush