Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -4,21 +4,30 @@
|
||||
|
||||
/*! \page Examples_common Category "common"
|
||||
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
This example includes a set of classes independent on each other which
|
||||
can be reused in "feature" examples demonstrating just a particular feature
|
||||
or users applications.
|
||||
|
||||
It provides the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
|
||||
- Physics list classes
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
These classes can be tested with the following programs:
|
||||
- testCommon.cc - only instantiates all classes
|
||||
- exampleCommonNoVis.cc - Geant4 application without visualization, that can be run
|
||||
both interactively or in batch (with the run.mac macro)
|
||||
- exampleCommonNoVis.cc - Geant4 application with visualization, that can be run
|
||||
both interactively or in batch (with the run.mac macro)
|
||||
|
||||
Building examples programs can be disabled with the CMake option: -DEXAMPLES_COMMON=OFF.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,9 +4,21 @@ cmake_minimum_required(VERSION 3.16...3.21)
|
||||
project(${common_prefix}common)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, no UI and Vis drivers activated
|
||||
# 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
|
||||
#
|
||||
find_package(Geant4 REQUIRED)
|
||||
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()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Option to build examples in addition to test
|
||||
#
|
||||
option(COMMON_EXAMPLES "Activate building example executables" ON)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
@@ -16,7 +28,7 @@ include(${Geant4_USE_FILE})
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
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)
|
||||
@@ -28,26 +40,36 @@ add_library(${common_prefix}common ${sources} ${headers})
|
||||
target_link_libraries(${common_prefix}common ${Geant4_LIBRARIES} )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries and common library
|
||||
# Add the test executable, and link it to the Geant4 libraries and common library
|
||||
#
|
||||
add_executable(${common_prefix}testCommon testCommon.cc )
|
||||
target_link_libraries(${common_prefix}testCommon ${common_prefix}common ${Geant4_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Optionally, add the example executables, and link it to the Geant4 libraries and common library
|
||||
#
|
||||
if(COMMON_EXAMPLES)
|
||||
add_executable(exampleCommon exampleCommon.cc )
|
||||
target_link_libraries(exampleCommon ${common_prefix}common ${Geant4_LIBRARIES})
|
||||
add_executable(exampleCommonNoVis exampleCommonNoVis.cc )
|
||||
target_link_libraries(exampleCommonNoVis ${common_prefix}common ${Geant4_LIBRARIES})
|
||||
endif(COMMON_EXAMPLES)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build detectorConstruction. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(detectorConstruction_SCRIPTS
|
||||
|
||||
)
|
||||
init.mac init_vis.mac run.mac vis.mac
|
||||
)
|
||||
|
||||
foreach(_script ${detectorConstruction_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
@@ -55,4 +77,8 @@ endforeach()
|
||||
# and the library to 'lib' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS ${common_prefix}testCommon DESTINATION bin)
|
||||
if (COMMON_EXAMPLES)
|
||||
install(TARGETS exampleCommon DESTINATION bin)
|
||||
install(TARGETS exampleCommonNoVis DESTINATION bin)
|
||||
endif(COMMON_EXAMPLES)
|
||||
install(TARGETS ${common_prefix}common DESTINATION lib)
|
||||
|
||||
@@ -5,6 +5,18 @@ which **must** added in reverse chronological order (newest at the top). It must
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
|
||||
## 2022-11-09 I. Hrivnacova (excommon-V11-00-02)
|
||||
- Fixed file descriptions in the top directory
|
||||
|
||||
## 2022-11-07 I. Hrivnacova (excommon-V11-00-01)
|
||||
New coding guidelines, added tests:
|
||||
- Added exampleCommon.cc and exampleCommonNoVis.cc
|
||||
- Added namespace Common
|
||||
- Override keywords
|
||||
- Data members initialization in .hh
|
||||
- Updated README files
|
||||
- Removed trailing whitespaces
|
||||
|
||||
## 2021-12-10 Ben Morgan (excommon-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
|
||||
@@ -7,20 +7,28 @@
|
||||
Common Classes for Extended Examples
|
||||
-------------------------------------
|
||||
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
This example includes a set of classes independent on each other which
|
||||
can be reused in "feature" examples demonstrating just a particular feature
|
||||
or users applications.
|
||||
|
||||
It provides the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
|
||||
- Physics list classes
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
These classes can be tested with the following programs:
|
||||
- testCommon.cc - only instantiates all classes
|
||||
- exampleCommonNoVis.cc - Geant4 application without visualization, that can be run
|
||||
both interactively or in batch (with the run.mac macro)
|
||||
- exampleCommonNoVis.cc - Geant4 application with visualization, that can be run
|
||||
both interactively or in batch (with the run.mac macro)
|
||||
|
||||
Building examples programs can be disabled with the CMake option: -DEXAMPLES_COMMON=OFF.
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
############################################
|
||||
!!! WARNING - FPE detection is activated !!!
|
||||
############################################
|
||||
|
||||
|
||||
################################
|
||||
!!! G4Backtrace is activated !!!
|
||||
################################
|
||||
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-11-01-ref-00 (9-December-2022)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
: NIM A 835 (2016), 186-225
|
||||
WWW : http://geant4.org/
|
||||
**************************************************************
|
||||
|
||||
Visualization Manager instantiating with verbosity "warnings (3)"...
|
||||
Visualization Manager initialising...
|
||||
Registering graphics systems...
|
||||
|
||||
You have successfully registered the following graphics systems.
|
||||
Registered graphics systems are:
|
||||
ASCIITree (ATree)
|
||||
DAWNFILE (DAWNFILE)
|
||||
G4HepRepFile (HepRepFile)
|
||||
RayTracer (RayTracer)
|
||||
VRML2FILE (VRML2FILE)
|
||||
gMocrenFile (gMocrenFile)
|
||||
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
|
||||
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
|
||||
OpenGLImmediateQt (OGLIQt, OGLI)
|
||||
OpenGLStoredQt (OGLSQt, OGL, OGLS)
|
||||
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
|
||||
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
|
||||
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
|
||||
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
|
||||
RayTracerX (RayTracerX)
|
||||
Qt3D (Qt3D)
|
||||
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
|
||||
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
|
||||
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
|
||||
|
||||
Registering model factories...
|
||||
|
||||
You have successfully registered the following model factories.
|
||||
Registered model factories:
|
||||
generic
|
||||
drawByAttribute
|
||||
drawByCharge
|
||||
drawByOriginVolume
|
||||
drawByParticleID
|
||||
drawByEncounteredVolume
|
||||
|
||||
Registered models:
|
||||
None
|
||||
|
||||
Registered filter factories:
|
||||
attributeFilter
|
||||
chargeFilter
|
||||
originVolumeFilter
|
||||
particleFilter
|
||||
encounteredVolumeFilter
|
||||
|
||||
Registered filters:
|
||||
None
|
||||
|
||||
You have successfully registered the following user vis actions.
|
||||
Run Duration User Vis Actions: none
|
||||
End of Event User Vis Actions: none
|
||||
End of Run User Vis Actions: none
|
||||
|
||||
Some /vis commands (optionally) take a string to specify colour.
|
||||
"/vis/list" to see available colours.
|
||||
/run/verbose 2
|
||||
#
|
||||
/run/beamOn 10
|
||||
|
||||
Region <DefaultRegionForTheWorld> -- -- appears in <World> world volume
|
||||
This region is in the mass world.
|
||||
Root logical volume(s) : World
|
||||
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
|
||||
Materials : G4_AIR
|
||||
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
|
||||
|
||||
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
|
||||
Root logical volume(s) :
|
||||
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
|
||||
Materials :
|
||||
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
|
||||
|
||||
========= Table of registered couples ============================
|
||||
|
||||
Index : 0 used in the geometry : Yes
|
||||
Material : G4_AIR
|
||||
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
|
||||
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
|
||||
Region(s) which use this couple :
|
||||
DefaultRegionForTheWorld
|
||||
|
||||
==================================================================
|
||||
|
||||
Start closing geometry.
|
||||
G4GeometryManager::ReportVoxelStats -- Voxel Statistics
|
||||
|
||||
Total memory consumed for geometry optimisation: 0 kByte
|
||||
Total CPU time elapsed for geometry optimisation: 0 seconds
|
||||
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
|
||||
See commands in /vis/modeling/trajectories/ for other options.
|
||||
### Run 0 starts.
|
||||
Run terminated.
|
||||
Run Summary
|
||||
Number of events processed : 10
|
||||
User=0.000000s Real=0.000275s Sys=0.000000s
|
||||
Graphics systems deleted.
|
||||
Visualization Manager deleting...
|
||||
G4 kernel has come to Quit state.
|
||||
UserDetectorConstruction deleted.
|
||||
UserPhysicsList deleted.
|
||||
UserActionInitialization deleted.
|
||||
UserWorkerInitialization deleted.
|
||||
UserWorkerThreadInitialization deleted.
|
||||
UserRunAction deleted.
|
||||
UserPrimaryGenerator deleted.
|
||||
RunManager is deleting RunManagerKernel.
|
||||
G4SDManager deleted.
|
||||
EventManager deleted.
|
||||
Units table cleared.
|
||||
TransportationManager deleted.
|
||||
Total navigation history collections cleaned: 6
|
||||
G4RNGHelper object is deleted.
|
||||
================== Deleting memory pools ===================
|
||||
Pool ID '20G4NavigationLevelRep', size : 0.00769 MB
|
||||
Pool ID '24G4ReferenceCountedHandleIvE', size : 0.000961 MB
|
||||
Pool ID '7G4Event', size : 0.000961 MB
|
||||
Pool ID '15G4PrimaryVertex', size : 0.000961 MB
|
||||
Pool ID '17G4PrimaryParticle', size : 0.000961 MB
|
||||
Pool ID '17G4DynamicParticle', size : 0.000961 MB
|
||||
Pool ID '7G4Track', size : 0.000961 MB
|
||||
Pool ID '18G4TouchableHistory', size : 0.000961 MB
|
||||
Pool ID '15G4CountedObjectIvE', size : 0.000961 MB
|
||||
Number of memory pools allocated: 9 of which, static: 0
|
||||
Dynamic pools deleted: 9 / Total memory freed: 0.015 MB
|
||||
============================================================
|
||||
G4Allocator objects are deleted.
|
||||
UImanager deleted.
|
||||
StateManager deleted.
|
||||
RunManagerKernel is deleted. Good bye :)
|
||||
RunManager is deleted.
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 common/exampleCommon.cc
|
||||
/// \brief Main program of the Common example
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "GeantinoPhysicsList.hh"
|
||||
#include "GpsPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
|
||||
using namespace Common;
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
|
||||
|
||||
// Construct the default run manager
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
|
||||
// Set mandatory initialization classes
|
||||
runManager->SetUserInitialization(new DetectorConstruction);
|
||||
runManager->SetUserInitialization(new GeantinoPhysicsList);
|
||||
|
||||
// Set mandatory user action class
|
||||
runManager->SetUserAction(new GpsPrimaryGeneratorAction);
|
||||
|
||||
// Initialize visualization
|
||||
//
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
visManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
// Process macro or start UI session
|
||||
//
|
||||
if ( ! ui ) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
else {
|
||||
// interactive mode
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// in the main() program !
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file common/exampleCommonNoVis.cc
|
||||
/// \brief Main program of the Common example without visualization
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "GeantinoPhysicsList.hh"
|
||||
#include "GpsPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
|
||||
using namespace Common;
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
|
||||
|
||||
// Construct the default run manager
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
|
||||
// Set mandatory initialization classes
|
||||
runManager->SetUserInitialization(new DetectorConstruction);
|
||||
runManager->SetUserInitialization(new GeantinoPhysicsList);
|
||||
|
||||
// Set mandatory user action class
|
||||
runManager->SetUserAction(new GpsPrimaryGeneratorAction);
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
// Process macro or start UI session
|
||||
//
|
||||
if ( ! ui ) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
else {
|
||||
// interactive mode
|
||||
UImanager->ApplyCommand("/control/execute init.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// in the main() program !
|
||||
delete runManager;
|
||||
}
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
//
|
||||
/// \file common/include/DetectorConstruction.hh
|
||||
/// \brief Definition of the Common::DetectorConstruction class
|
||||
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
@@ -40,40 +40,45 @@ class G4GenericMessenger;
|
||||
|
||||
/// Simple detector construction with a box volume placed in a world
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction(
|
||||
const G4String& boxMaterialName = "G4_AIR",
|
||||
G4double boxHx = 40*CLHEP::cm,
|
||||
G4double boxHy = 40*CLHEP::cm,
|
||||
G4double boxHx = 40*CLHEP::cm,
|
||||
G4double boxHy = 40*CLHEP::cm,
|
||||
G4double boxHz = 40*CLHEP::cm,
|
||||
const G4String& worldMaterialName = "G4_AIR",
|
||||
G4double worldSizeFactor = 1.25);
|
||||
~DetectorConstruction();
|
||||
~DetectorConstruction() override;
|
||||
|
||||
public:
|
||||
// methods from base class
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
// methods from base class
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
|
||||
// set methods
|
||||
void SetBoxMaterial(const G4String& materialName);
|
||||
void SetWorldMaterial(const G4String& materialName);
|
||||
void SetBoxDimensions(G4ThreeVector dimensions);
|
||||
void SetWorldSizeFactor(G4double factor);
|
||||
|
||||
|
||||
private:
|
||||
void DefineCommands();
|
||||
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4GenericMessenger* fMessenger = nullptr;
|
||||
G4String fBoxMaterialName;
|
||||
G4String fWorldMaterialName;
|
||||
G4ThreeVector fBoxDimensions;
|
||||
G4double fWorldSizeFactor;
|
||||
G4LogicalVolume* fBoxVolume;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
G4double fWorldSizeFactor = 0.;
|
||||
G4LogicalVolume* fBoxVolume = nullptr;
|
||||
G4LogicalVolume* fWorldVolume = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction0.hh
|
||||
/// \brief Definition of the DetectorConstruction0 class
|
||||
//
|
||||
/// \file common/include/DetectorConstruction0.hh
|
||||
/// \brief Definition of the Common::DetectorConstruction0 class
|
||||
|
||||
#ifndef DetectorConstruction0_h
|
||||
#define DetectorConstruction0_h 1
|
||||
@@ -40,33 +40,38 @@ class G4GenericMessenger;
|
||||
|
||||
/// Simple detector construction with only a world volume
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class DetectorConstruction0 : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction0(
|
||||
const G4String& materialName = "G4_AIR",
|
||||
G4double hx = 50*CLHEP::cm,
|
||||
G4double hy = 50*CLHEP::cm,
|
||||
G4double hx = 50*CLHEP::cm,
|
||||
G4double hy = 50*CLHEP::cm,
|
||||
G4double hz = 50*CLHEP::cm);
|
||||
~DetectorConstruction0();
|
||||
~DetectorConstruction0() override;
|
||||
|
||||
public:
|
||||
// methods from base class
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
// methods from base class
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
|
||||
// set methods
|
||||
void SetMaterial(const G4String& materialName);
|
||||
void SetDimensions(G4ThreeVector dimensions);
|
||||
|
||||
|
||||
private:
|
||||
void DefineCommands();
|
||||
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4GenericMessenger* fMessenger = nullptr;
|
||||
G4String fMaterialName;
|
||||
G4ThreeVector fDimensions;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
G4LogicalVolume* fWorldVolume = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GeantinoPhysicsList.hh
|
||||
/// \brief Definition of the GeantinoPhysicsList class
|
||||
//
|
||||
/// \file common/include/GeantinoPhysicsList.hh
|
||||
/// \brief Definition of the Common::GeantinoPhysicsList class
|
||||
|
||||
#ifndef GeantinoPhysicsList_h
|
||||
#define GeantinoPhysicsList_h 1
|
||||
@@ -34,17 +34,22 @@
|
||||
|
||||
/// Physics list with geantino and charged geantino only
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class GeantinoPhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
GeantinoPhysicsList();
|
||||
~GeantinoPhysicsList();
|
||||
~GeantinoPhysicsList() override;
|
||||
|
||||
protected:
|
||||
// Construct particle and physics process
|
||||
void ConstructParticle();
|
||||
void ConstructProcess();
|
||||
void ConstructParticle() override;
|
||||
void ConstructProcess() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GpsPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the GpsPrimaryGeneratorActionclass
|
||||
/// \file common/include/GpsPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the Common::GpsPrimaryGeneratorAction class
|
||||
//
|
||||
|
||||
#ifndef GpsPrimaryGeneratorAction_h
|
||||
@@ -42,23 +42,24 @@ class G4Event;
|
||||
///
|
||||
/// \author I. Hrivnacova; IPN Orsay
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class GpsPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
GpsPrimaryGeneratorAction();
|
||||
~GpsPrimaryGeneratorAction();
|
||||
GpsPrimaryGeneratorAction();
|
||||
~GpsPrimaryGeneratorAction() override;
|
||||
|
||||
// methods
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
void GeneratePrimaries(G4Event*) override;
|
||||
|
||||
private:
|
||||
// static data members
|
||||
static const G4String fgkDefaultParticleName;
|
||||
static const G4double fgkDefaultEnergy;
|
||||
|
||||
// data members
|
||||
G4GeneralParticleSource* fGeneralParticleSource;
|
||||
G4GeneralParticleSource* fGeneralParticleSource = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GunPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the GunPrimaryGeneratorAction class
|
||||
/// \file common/include/GunPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the Common::GunPrimaryGeneratorAction class
|
||||
|
||||
#ifndef GunPrimaryGeneratorAction_h
|
||||
#define GunPrimaryGeneratorAction_h 1
|
||||
@@ -44,6 +44,9 @@ class G4Event;
|
||||
///
|
||||
/// \author I. Hrivnacova; IPN Orsay
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
@@ -51,15 +54,17 @@ class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
const G4String& particleName = "geantino",
|
||||
G4double energy = 1.*CLHEP::MeV,
|
||||
G4ThreeVector position= G4ThreeVector(0,0,0),
|
||||
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));
|
||||
~GunPrimaryGeneratorAction();
|
||||
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));
|
||||
~GunPrimaryGeneratorAction() override;
|
||||
|
||||
// methods
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
void GeneratePrimaries(G4Event*) override;
|
||||
|
||||
private:
|
||||
// data members
|
||||
G4ParticleGun* fParticleGun;
|
||||
G4ParticleGun* fParticleGun = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Macro file for the initialization of example B1
|
||||
# in interactive session
|
||||
#
|
||||
# Set some default verbose
|
||||
/control/verbose 2
|
||||
/control/saveHistory
|
||||
/run/verbose 2
|
||||
#
|
||||
# Change the default number of threads (in multi-threaded mode)
|
||||
#/run/numberOfThreads 4
|
||||
#
|
||||
# Initialize kernel
|
||||
/run/initialize
|
||||
@@ -0,0 +1,16 @@
|
||||
# Macro file for the initialization of example B1
|
||||
# in interactive session
|
||||
#
|
||||
# Set some default verbose
|
||||
/control/verbose 2
|
||||
/control/saveHistory
|
||||
/run/verbose 2
|
||||
#
|
||||
# Change the default number of threads (in multi-threaded mode)
|
||||
#/run/numberOfThreads 4
|
||||
#
|
||||
# Initialize kernel
|
||||
/run/initialize
|
||||
#
|
||||
# Visualization setting
|
||||
/control/execute vis.mac
|
||||
@@ -0,0 +1,12 @@
|
||||
# Macro file for example common
|
||||
#
|
||||
# To be run preferably in batch
|
||||
# % ./exampleCommon[NoVis] run.mac
|
||||
#
|
||||
#/run/numberOfThreads 4
|
||||
/run/initialize
|
||||
#
|
||||
/control/verbose 2
|
||||
/run/verbose 2
|
||||
#
|
||||
/run/beamOn 10
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
/// \file common/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the Common::DetectorConstruction class
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction(
|
||||
@@ -43,14 +46,10 @@ DetectorConstruction::DetectorConstruction(
|
||||
G4double boxHx, G4double boxHy, G4double boxHz,
|
||||
const G4String& worldMaterialName,
|
||||
G4double worldSizeFactor)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(nullptr),
|
||||
fBoxMaterialName(boxMaterialName),
|
||||
: fBoxMaterialName(boxMaterialName),
|
||||
fWorldMaterialName(worldMaterialName),
|
||||
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
|
||||
fWorldSizeFactor(worldSizeFactor),
|
||||
fBoxVolume(nullptr),
|
||||
fWorldVolume(nullptr)
|
||||
fWorldSizeFactor(worldSizeFactor)
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
@@ -72,25 +71,25 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
auto worldMaterial = nistManager->FindOrBuildMaterial(fWorldMaterialName);
|
||||
auto boxMaterial = nistManager->FindOrBuildMaterial(fBoxMaterialName);
|
||||
|
||||
|
||||
// Geometry parameters
|
||||
//
|
||||
G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
|
||||
|
||||
|
||||
// World
|
||||
//
|
||||
auto sWorld
|
||||
auto sWorld
|
||||
= new G4Box("World", //name
|
||||
worldDimensions.x(), //dimensions (half-lentghs)
|
||||
worldDimensions.y(),
|
||||
worldDimensions.y(),
|
||||
worldDimensions.z());
|
||||
|
||||
fWorldVolume
|
||||
fWorldVolume
|
||||
= new G4LogicalVolume(sWorld, //shape
|
||||
worldMaterial, //material
|
||||
"World"); //name
|
||||
|
||||
auto pWorld
|
||||
auto pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
@@ -98,23 +97,23 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
0, //mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
|
||||
// Box
|
||||
//
|
||||
auto sBox
|
||||
//
|
||||
auto sBox
|
||||
= new G4Box("Box", //its name
|
||||
fBoxDimensions.x(), //dimensions (half-lengths)
|
||||
fBoxDimensions.y(),
|
||||
fBoxDimensions.y(),
|
||||
fBoxDimensions.z());
|
||||
|
||||
fBoxVolume
|
||||
|
||||
fBoxVolume
|
||||
= new G4LogicalVolume(sBox, //its shape
|
||||
boxMaterial, //its material
|
||||
"Box"); //its name
|
||||
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fBoxVolume, //its logical volume
|
||||
fBoxVolume, //its logical volume
|
||||
"Box", //its name
|
||||
fWorldVolume, //its mother volume
|
||||
false, //no boolean operation
|
||||
@@ -126,7 +125,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
|
||||
{
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -136,14 +135,14 @@ void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( fBoxVolume ) fBoxVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
|
||||
{
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -153,45 +152,45 @@ void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
|
||||
|
||||
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
|
||||
{
|
||||
/// Set box dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fBoxDimensions = dimensions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
|
||||
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
|
||||
{
|
||||
/// Set the multiplication factor from box dimensions to world dimensions.
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fWorldSizeFactor = factor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
"Detector control");
|
||||
|
||||
// setBoxMaterial command
|
||||
auto& setBoxMaterialCmd
|
||||
= fMessenger->DeclareMethod("setBoxMaterial",
|
||||
&DetectorConstruction::SetBoxMaterial,
|
||||
&DetectorConstruction::SetBoxMaterial,
|
||||
"Set box material name.");
|
||||
setBoxMaterialCmd.SetParameterName("boxMaterialName", false);
|
||||
setBoxMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
@@ -199,7 +198,7 @@ void DetectorConstruction::DefineCommands()
|
||||
// setWorldMaterial command
|
||||
auto& setWorldMaterialCmd
|
||||
= fMessenger->DeclareMethod("setWorldMaterial",
|
||||
&DetectorConstruction::SetWorldMaterial,
|
||||
&DetectorConstruction::SetWorldMaterial,
|
||||
"Set world material name.");
|
||||
setWorldMaterialCmd.SetParameterName("worldMaterialName", false);
|
||||
setWorldMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
@@ -207,19 +206,21 @@ void DetectorConstruction::DefineCommands()
|
||||
// setBoxDimensions command
|
||||
auto& setBoxDimensionsCmd
|
||||
= fMessenger->DeclareMethodWithUnit("setBoxDimensions", "mm",
|
||||
&DetectorConstruction::SetBoxDimensions,
|
||||
&DetectorConstruction::SetBoxDimensions,
|
||||
"Set box dimensions (in half lentgh).");
|
||||
setBoxDimensionsCmd.SetParameterName("boxDimensions", false);
|
||||
setBoxDimensionsCmd.SetStates(G4State_PreInit);
|
||||
|
||||
// setWorldSizeFactor command
|
||||
auto& setWorldSizeFactorCmd
|
||||
auto& setWorldSizeFactorCmd
|
||||
= fMessenger->DeclareMethod("setWorldSizeFactor",
|
||||
&DetectorConstruction::SetWorldSizeFactor,
|
||||
&DetectorConstruction::SetWorldSizeFactor,
|
||||
"Set the multiplication factor from box dimensions to world dimensions.");
|
||||
setWorldSizeFactorCmd.SetParameterName("worldSizeFactor", false);
|
||||
setWorldSizeFactorCmd.SetRange("WorldSizeFactor >= 1");
|
||||
setWorldSizeFactorCmd.SetStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction0.cc
|
||||
/// \brief Implementation of the DetectorConstruction0 class
|
||||
/// \file common/src/DetectorConstruction0.cc
|
||||
/// \brief Implementation of the Common::DetectorConstruction0 class
|
||||
|
||||
#include "DetectorConstruction0.hh"
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction0::DetectorConstruction0(
|
||||
const G4String& materialName,
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(nullptr),
|
||||
fMaterialName(materialName),
|
||||
fDimensions(hx, hy, hz),
|
||||
fWorldVolume(nullptr)
|
||||
: fMaterialName(materialName),
|
||||
fDimensions(hx, hy, hz)
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
@@ -66,21 +66,21 @@ G4VPhysicalVolume* DetectorConstruction0::Construct()
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
|
||||
|
||||
|
||||
// World
|
||||
//
|
||||
auto sWorld
|
||||
auto sWorld
|
||||
= new G4Box("World", //name
|
||||
fDimensions.x(), //dimensions (half-lentghs)
|
||||
fDimensions.y(),
|
||||
fDimensions.y(),
|
||||
fDimensions.z());
|
||||
|
||||
fWorldVolume
|
||||
fWorldVolume
|
||||
= new G4LogicalVolume(sWorld, //shape
|
||||
material, //material
|
||||
"World"); //name
|
||||
|
||||
auto pWorld
|
||||
auto pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
@@ -95,7 +95,7 @@ G4VPhysicalVolume* DetectorConstruction0::Construct()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction0::SetMaterial(const G4String& materialName)
|
||||
{
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -105,35 +105,35 @@ void DetectorConstruction0::SetMaterial(const G4String& materialName)
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
|
||||
{
|
||||
/// Set world dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fDimensions = dimensions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction0::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
"Detector control");
|
||||
|
||||
// setMaterial command
|
||||
auto& setMaterialCmd
|
||||
= fMessenger->DeclareMethod("setMaterial",
|
||||
&DetectorConstruction0::SetMaterial,
|
||||
&DetectorConstruction0::SetMaterial,
|
||||
"Set world material name.");
|
||||
setMaterialCmd.SetParameterName("materialName", false);
|
||||
setMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
@@ -142,10 +142,12 @@ void DetectorConstruction0::DefineCommands()
|
||||
// setDimensions command
|
||||
auto& setDimensionsCmd
|
||||
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
|
||||
&DetectorConstruction0::SetDimensions,
|
||||
&DetectorConstruction0::SetDimensions,
|
||||
"Set world dimensions (in half lentgh).");
|
||||
setDimensionsCmd.SetParameterName("dimensions", false);
|
||||
setDimensionsCmd.SetStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
@@ -24,23 +24,23 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GeantinoPhysicsList.cc
|
||||
/// \brief Implementation of the GeantinoPhysicsList class
|
||||
/// \file common/src/GeantinoPhysicsList.cc
|
||||
/// \brief Implementation of the Common::GeantinoPhysicsList class
|
||||
|
||||
#include "GeantinoPhysicsList.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
GeantinoPhysicsList::GeantinoPhysicsList()
|
||||
: G4VUserPhysicsList()
|
||||
{}
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
GeantinoPhysicsList::~GeantinoPhysicsList()
|
||||
{}
|
||||
GeantinoPhysicsList::GeantinoPhysicsList() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
GeantinoPhysicsList::~GeantinoPhysicsList() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -49,7 +49,7 @@ void GeantinoPhysicsList::ConstructParticle()
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
// created in the program.
|
||||
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
@@ -65,3 +65,5 @@ void GeantinoPhysicsList::ConstructProcess()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GpsPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the GpsPrimaryGeneratorActionclass
|
||||
/// \file common/src/GpsPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the Common::GpsPrimaryGeneratorActionclass
|
||||
|
||||
#include "GpsPrimaryGeneratorAction.hh"
|
||||
|
||||
@@ -33,14 +33,12 @@
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
const G4String GpsPrimaryGeneratorAction::fgkDefaultParticleName = "e-";
|
||||
const G4double GpsPrimaryGeneratorAction::fgkDefaultEnergy = 1.*MeV;
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fGeneralParticleSource(nullptr)
|
||||
{
|
||||
fGeneralParticleSource = new G4GeneralParticleSource();
|
||||
}
|
||||
@@ -61,3 +59,7 @@ void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
fGeneralParticleSource->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file GunPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the GunPrimaryGeneratorAction class
|
||||
/// \file common/src/GunPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the Common::GunPrimaryGeneratorAction class
|
||||
|
||||
#include "GunPrimaryGeneratorAction.hh"
|
||||
|
||||
@@ -34,15 +34,16 @@
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
|
||||
const G4String& particleName,
|
||||
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
|
||||
const G4String& particleName,
|
||||
G4double energy,
|
||||
G4ThreeVector position,
|
||||
G4ThreeVector position,
|
||||
G4ThreeVector momentumDirection)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(nullptr)
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
@@ -73,3 +74,7 @@ void GunPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file testCommon.cc
|
||||
/// \file common/testCommon.cc
|
||||
/// \brief Test program for the common classes
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "G4RunManager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
|
||||
using namespace Common;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Test program which only instantiates classes defined in
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
# Macro file for the visualization setting in the initialization phase
|
||||
# of the B1 example when running in interactive mode
|
||||
#
|
||||
|
||||
# Use these open statements to open selected visualization
|
||||
#
|
||||
# Use this open statement to create an OpenGL view:
|
||||
/vis/open OGL 600x600-0+0
|
||||
#
|
||||
# Use this open statement to create an OpenInventor view:
|
||||
#/vis/open OI
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Use this open statement to create an offscreen file with TSG:
|
||||
#/vis/open TSG_OFFSCREEN 1200x1200
|
||||
# See the tsg_offscreen.mac file for more commands to change
|
||||
# the file format, file name, picture size, etc.
|
||||
#
|
||||
# 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/viewpointVector -1 0 0
|
||||
/vis/viewer/set/lightsVector -1 0 0
|
||||
#
|
||||
# Specify style (surface, wireframe, auxiliary edges,...)
|
||||
/vis/viewer/set/style wireframe
|
||||
/vis/viewer/set/auxiliaryEdge true
|
||||
/vis/viewer/set/lineSegmentsPerCircle 100
|
||||
#
|
||||
# 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 true
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
|
||||
# (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/default/setDrawStepPts true
|
||||
# To select or override default colours (note: e+ is blue by default):
|
||||
#/vis/modeling/trajectories/list
|
||||
#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
|
||||
#
|
||||
# To superimpose all of the events from a given run:
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#
|
||||
# Decorations
|
||||
# Name
|
||||
/vis/set/textColour green
|
||||
/vis/set/textLayout right
|
||||
/vis/scene/add/text2D 0.9 -.9 24 ! ! exampleB1
|
||||
# or, if your system does not support right-adjustment
|
||||
#/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1
|
||||
/vis/set/textLayout # Revert to normal (left adjusted) layout
|
||||
/vis/set/textColour # Revert to default text colour (blue)
|
||||
#
|
||||
# Axes, scale, etc.
|
||||
/vis/scene/add/scale # Simple scale line
|
||||
/vis/scene/add/axes # Simple axes: x=red, y=green, z=blue.
|
||||
/vis/scene/add/eventID # Drawn at end of event
|
||||
/vis/scene/add/date # Date stamp
|
||||
/vis/scene/add/logo2D # Simple logo
|
||||
/vis/scene/add/logo # 3D logo
|
||||
#
|
||||
# Frame
|
||||
/vis/set/colour red
|
||||
/vis/set/lineWidth 2
|
||||
/vis/scene/add/frame # Simple frame around the view
|
||||
/vis/set/colour # Revert to default colour (white)
|
||||
/vis/set/lineWidth # Revert to default line width (1.)
|
||||
#
|
||||
# Attach text to one edge of Shape1, with a small, fixed offset
|
||||
/vis/scene/add/text 0 6 -4 cm 18 4 4 Shape1
|
||||
# Attach text to one corner of Shape2, with a small, fixed offset
|
||||
/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2
|
||||
#
|
||||
# To get nice view
|
||||
# Make the "World" box invisible
|
||||
/vis/geometry/set/visibility World 0 false
|
||||
# "Envelope" is transparent blue to represent water
|
||||
#/vis/geometry/set/colour Envelope 0 0 0 1 .3
|
||||
/vis/viewer/set/style surface
|
||||
/vis/viewer/set/hiddenMarker true
|
||||
/vis/viewer/set/viewpointThetaPhi 120 150
|
||||
#
|
||||
# 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
|
||||
Reference in New Issue
Block a user