Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -1,5 +1,5 @@
|
||||
#---Adding all advanced examples subdirectories explicitly
|
||||
cmake_minimum_required(VERSION 3.12...3.20)
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# some examples require Geant4 build with optional packages
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
set(name CaTS)
|
||||
project(${name} VERSION 0.1.0)
|
||||
|
||||
option(WITH_ROOT "Build example with ROOT" ON)
|
||||
option(WITH_G4OPTICKS "Build example with OPTICKS" OFF)
|
||||
option(G4ANALYSIS_USE "Build example with Analysis" ON)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# 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})
|
||||
#----------------------------------------------------------------------------
|
||||
# CaTS requires shared libraries
|
||||
#
|
||||
if(NOT Geant4_shared_FOUND)
|
||||
message(FATAL_ERROR "CaTS must use shared libraries")
|
||||
endif()
|
||||
|
||||
if(WITH_G4OPTICKS)
|
||||
message(STATUS "WITH_G4OPTICKS is set")
|
||||
include(OpticksBuildOptions)
|
||||
find_package( G4OK CONFIG REQUIRED )
|
||||
else()
|
||||
message(STATUS "WITH_G4OPTICKS is not set")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
|
||||
include(CaTSCXXFlags)
|
||||
endif()
|
||||
|
||||
if(WITH_ROOT)
|
||||
find_package(ROOT REQUIRED)
|
||||
# ROOT version 6 required
|
||||
if(ROOT_FOUND)
|
||||
STRING(REGEX MATCH "6.*" VERSION6MATCH ${ROOT_VERSION})
|
||||
if(NOT VERSION6MATCH)
|
||||
message(FATAL_ERROR "${name} requires ROOT 6")
|
||||
endif()
|
||||
endif()
|
||||
# Include ROOT's CMake functions for dictionary generation
|
||||
# since root6.20, the file is renamed and included by default, so include
|
||||
# only when we find the *old* name
|
||||
if(EXISTS "${ROOT_DIR}/modules/RootNewMacros.cmake")
|
||||
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
|
||||
endif()
|
||||
endif()
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
if(WITH_ROOT)
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR}
|
||||
${ROOT_INCLUDE_DIRS})
|
||||
#----------------------------------------------------------------------------
|
||||
# Generate dictionaries, add ROOT libraries properties
|
||||
#
|
||||
REFLEX_GENERATE_DICTIONARY(CaTSClasses include/CaTSClasses.hh SELECTION xml/selection.xml)
|
||||
add_library(CaTSClassesDict SHARED ${sources} CaTSClasses.cxx)
|
||||
set(libsuffix .so)
|
||||
set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} SUFFIX ${libsuffix})
|
||||
set_target_properties(CaTSClassesDict PROPERTIES ${ROOT_LIBRARY_PROPERTIES})
|
||||
target_link_libraries(CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
|
||||
else()
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
file(GLOB detectors ${PROJECT_SOURCE_DIR}/gdml/*.gdml)
|
||||
file(GLOB schemas ${PROJECT_SOURCE_DIR}/gdml/*.xsd)
|
||||
file(GLOB scripts ${PROJECT_SOURCE_DIR}/scripts/*)
|
||||
file(GLOB macros ${PROJECT_SOURCE_DIR}/macros/*.mac)
|
||||
file(GLOB runscripts ${PROJECT_SOURCE_DIR}/scripts/run.sh ${PROJECT_SOURCE_DIR}/scripts/check.sh)
|
||||
|
||||
if(WITH_G4OPTICKS)
|
||||
add_executable(${name} ${name}.cc ${sources} ${headers})
|
||||
target_compile_definitions( ${name} PRIVATE WITH_G4OPTICKS WITH_ROOT)
|
||||
target_link_libraries(${name} CaTSClassesDict Opticks::G4OK ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
else()
|
||||
add_executable(${name} ${name}.cc ${sources} ${headers})
|
||||
target_compile_definitions( ${name} PRIVATE WITH_ROOT)
|
||||
target_link_libraries(${name} CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
endif()
|
||||
if(WITH_ROOT)
|
||||
add_executable(readPhotonHits readPhotonHits.cc ${sources} ${headers})
|
||||
target_link_libraries(readPhotonHits CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
add_executable(readCalorimeterHits readCalorimeterHits.cc ${sources} ${headers})
|
||||
target_link_libraries(readCalorimeterHits CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
add_executable(readMscHits readMscHits.cc ${sources} ${headers})
|
||||
target_link_libraries(readMscHits CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
add_executable(readDRCalorimeterHits readDRCalorimeterHits.cc ${sources} ${headers})
|
||||
target_link_libraries(readDRCalorimeterHits CaTSClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} )
|
||||
link_directories( ${ROOT_LIBRARY_DIR} )
|
||||
endif()
|
||||
|
||||
install(TARGETS ${name} DESTINATION bin)
|
||||
install(FILES ${detectors} ${schemas} ${scripts} ${macros} DESTINATION bin)
|
||||
install(FILES ${detectors} DESTINATION bin/gdml)
|
||||
install(FILES ${macros} DESTINATION bin/macros)
|
||||
install(PROGRAMS ${runscripts} DESTINATION bin)
|
||||
if(WITH_ROOT)
|
||||
install(TARGETS CaTSClassesDict DESTINATION bin)
|
||||
install(TARGETS readPhotonHits DESTINATION bin)
|
||||
install(TARGETS readCalorimeterHits DESTINATION bin)
|
||||
install(TARGETS readDRCalorimeterHits DESTINATION bin)
|
||||
install(TARGETS readMscHits DESTINATION bin)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/CaTSClasses_rdict.pcm DESTINATION bin)
|
||||
endif()
|
||||
|
||||
message(STATUS "G4ANALYSIS_USE: ${G4ANALYSIS_USE}")
|
||||
message(STATUS "WITH_G4OPTICKS: ${G4OPTICKS}")
|
||||
message(STATUS "WITH_ROOT: ${ROOT}")
|
||||
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//* |\___/| *
|
||||
//* ) ( *
|
||||
//* =\ /= *
|
||||
//* )===( *
|
||||
//* / \ CaTS: Calorimeter and Tracker Simulation *
|
||||
//* | | is a flexible and extend-able framework *
|
||||
//* / \ for the simulation of various detector *
|
||||
//* \ / systems *
|
||||
//* \__ _/ https://github.com/hanswenzel/CaTS *
|
||||
//* ( ( *
|
||||
//* ) ) *
|
||||
//* (_( *
|
||||
//* CaTS also serves as an example that demonstrates how to use *
|
||||
//* opticks from within Geant4 for the creation and propagation of *
|
||||
//* optical photons. *
|
||||
//* see https://bitbucket.org/simoncblyth/opticks.git). *
|
||||
//* Ascii Art by Joan Stark: https://www.asciiworld.com/-Cats-2-.html *
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CaTS.cc
|
||||
/// \brief main driver of CaTS
|
||||
//
|
||||
// project headers:
|
||||
#include "ActionInitialization.hh"
|
||||
#include "CaTSVersion.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsConfigurator.hh"
|
||||
// Geant4 headers:
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include <G4Threading.hh>
|
||||
#ifdef WITH_G4OPTICKS
|
||||
# include "OPTICKS_LOG.hh"
|
||||
#endif
|
||||
#include "TROOT.h"
|
||||
#include <thread>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int nThreads = 0;
|
||||
#endif
|
||||
G4bool interactive = false;
|
||||
G4String physicsconf = "";
|
||||
G4String gdmlfile = "";
|
||||
G4String macrofile = "";
|
||||
G4UIExecutive* ui = nullptr;
|
||||
for(G4int i = 1; i < argc; i = i + 2)
|
||||
{
|
||||
if(G4String(argv[i]) == "-g")
|
||||
{
|
||||
gdmlfile = argv[i + 1];
|
||||
}
|
||||
else if(G4String(argv[i]) == "-pl")
|
||||
{
|
||||
physicsconf = G4String(argv[i + 1]);
|
||||
}
|
||||
else if(G4String(argv[i]) == "-m")
|
||||
{
|
||||
macrofile = G4String(argv[i + 1]);
|
||||
}
|
||||
#ifdef G4MULTITHREADED
|
||||
else if(G4String(argv[i]) == "-t")
|
||||
{
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(gdmlfile == "")
|
||||
{
|
||||
G4cout << "Error! Mandatory input file is not specified!" << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << "Usage: CaTS -g input_gdml_file:mandatory" << G4endl;
|
||||
G4cout << G4endl;
|
||||
return -1;
|
||||
}
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "---------------------------------------------------------------------"
|
||||
<< G4endl
|
||||
<< "* |\\___/| "
|
||||
"*"
|
||||
<< G4endl
|
||||
<< "* ) ( *"
|
||||
<< G4endl
|
||||
<< "* =\\ /= "
|
||||
"*"
|
||||
<< G4endl
|
||||
<< "* )===( Welcome to: *"
|
||||
<< G4endl
|
||||
<< "* / \\ CaTS: Calorimeter and Tracker Simulation "
|
||||
"*"
|
||||
<< G4endl
|
||||
<< "* | | a flexible and extend-able framework *"
|
||||
<< G4endl
|
||||
<< "* / \\ for the simulation of various detector "
|
||||
"*"
|
||||
<< G4endl
|
||||
<< "* \\ / systems *"
|
||||
<< G4endl
|
||||
<< "* \\__ _/ https://github.com/hanswenzel/CaTS "
|
||||
"*"
|
||||
<< G4endl
|
||||
<< "* ( ( *"
|
||||
<< G4endl << "* ) ) Version: " << CaTSVersion
|
||||
<< " *" << G4endl
|
||||
<< "* (_( Date: " << CaTSDate << " *"
|
||||
<< G4endl
|
||||
<< "---------------------------------------------------------------------"
|
||||
<< G4endl << G4endl;
|
||||
if(physicsconf == "")
|
||||
{
|
||||
G4cout << "Warning! no physics configuration specified!" << G4endl;
|
||||
G4cout << "Using default FTFP_BERT+OPTICAL+STEPLIMIT" << G4endl;
|
||||
physicsconf = "FTFP_BERT+OPTICAL+STEPLIMIT";
|
||||
G4cout << "Usage: CaTS -pl physicsconfiguration" << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
if(macrofile == "")
|
||||
{
|
||||
G4cout << "Warning! no macro specified!" << G4endl;
|
||||
G4cout << "assume interactive mode" << G4endl;
|
||||
interactive = true;
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
G4cout << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << "Usage: CaTS -m macrofile" << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
G4Timer* eventTimer = new G4Timer;
|
||||
eventTimer->Start();
|
||||
#ifdef WITH_G4OPTICKS
|
||||
OPTICKS_LOG(argc, argv);
|
||||
#endif
|
||||
G4VModularPhysicsList* phys =
|
||||
PhysicsConfigurator::getInstance()->Construct(physicsconf);
|
||||
G4String DumpFilename = gdmlfile + "_G4";
|
||||
ConfigurationManager::getInstance()->setGDMLFileName(DumpFilename);
|
||||
DetectorConstruction* dc = new DetectorConstruction(gdmlfile);
|
||||
// Run manager
|
||||
auto* rm = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
|
||||
// G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
|
||||
#ifdef G4MULTITHREADED
|
||||
// number of threads not set so use number of cores
|
||||
if(nThreads == 0)
|
||||
{
|
||||
nThreads = G4Threading::G4GetNumberOfCores();
|
||||
}
|
||||
if(nThreads > 0)
|
||||
{
|
||||
rm->SetNumberOfThreads(nThreads);
|
||||
}
|
||||
#endif
|
||||
rm->SetUserInitialization(dc);
|
||||
rm->SetUserInitialization(phys);
|
||||
ActionInitialization* actionInitialization = new ActionInitialization();
|
||||
rm->SetUserInitialization(actionInitialization);
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
if(interactive)
|
||||
{
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
delete visManager;
|
||||
}
|
||||
else
|
||||
{
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command + macrofile);
|
||||
|
||||
delete ui;
|
||||
}
|
||||
eventTimer->Stop();
|
||||
double totalCPUTime =
|
||||
eventTimer->GetUserElapsed() + eventTimer->GetSystemElapsed();
|
||||
G4int precision_t = G4cout.precision(3);
|
||||
std::ios::fmtflags flags_t = G4cout.flags();
|
||||
G4cout.setf(std::ios::fixed, std::ios::floatfield);
|
||||
G4cout << "TimeTotal> " << eventTimer->GetRealElapsed() << " " << totalCPUTime
|
||||
<< G4endl;
|
||||
G4cout.setf(flags_t);
|
||||
G4cout.precision(precision_t);
|
||||
delete eventTimer;
|
||||
delete rm;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# Examples
|
||||
Here we provide examples for running CaTS (without Opticks). The examples consist of a gdml file to define the detector configuration.
|
||||
|
||||
## homogeneous Crystal Calorimeter
|
||||
Here we just read out the energy deposited in a huge Crystal.
|
||||
|
||||
time ./CaTS -g homogeneous_pbwo_crystalcal.gdml -pl 'FTFP_BERT' -m pip_IO_Calo.mac
|
||||
time ./readCalorimeterHits CaloHits_Run0.root CaloHistos.root CalorimeterVolume
|
||||
|
||||
The created histogram can then be looked at using ROOT
|
||||
|
||||

|
||||
|
||||
## Dual Read out Crystal Calorimeter
|
||||
|
||||
Here in addtion to the deposited energy in the calorimeter cell we readout the number of Cerenkov photons that have been produced.
|
||||
|
||||
./CaTS -g crystalcal_pbwo.gdml -pl 'FTFP_BERT+OPTICAL' -m pip_IO_DR.mac
|
||||
./readDRCalorimeterHits DRCaloHits_Run0.root DRCaloHhstos.root CalorimeterVolume
|
||||
|
||||
## multiple scattering at a thin Diamond layer
|
||||
|
||||
In this example we register the momentum of a particle as it undergaos multiple scatering in a thin Diamond layer.
|
||||
|
||||
./CaTS -g DiamondTarget.gdml -pl 'FTFP_BERT' -m msc.mac
|
||||
./readMscHits Msc_Run0.root ms_histos.root 'volTarget'
|
||||
|
||||
|
||||
The created histogram can then be looked at using ROOT
|
||||
|
||||

|
||||
@@ -0,0 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - CaTS example
|
||||
=========================================================
|
||||
|
||||
Package History file
|
||||
|
||||
19 Novemebr 2021 - tag CaTS-V10-07-01 - I. Hrivnacova
|
||||
- Fixed PrimaryGeneratorAction destructor
|
||||
|
||||
22 October 2021 - tag CaTS-V10-07-00 - H. Wenzel
|
||||
- first version of CaTS example committed
|
||||
@@ -0,0 +1,301 @@
|
||||
# Prerequisites
|
||||
Opticks requires Geant4 (10.7.p02), nvidia cuda (11.3) and nvidia Optix (6.5) among other libraries. CaTS in addition will require ROOT. If all these libraries and development headers are available on your machine skip directly to (**Building opticks vs. existing libraries**). On a 'blank' computing system it makes sense to build CLHEP, then Geant4 and finally ROOT assuring that all the necessary development libraries and headers are installed.
|
||||
|
||||
# Building CLHEP
|
||||
The current version of Geant4 10.07.p02 is build on clhep 2.4.4.0.
|
||||
CLHEP can be found at:
|
||||
https://proj-clhep.web.cern.ch/proj-clhep/clhep23.html
|
||||
|
||||
to build it from scratch using cmake (used cmake version 3.20.5)
|
||||
|
||||
cd to the directory where you want to build clhep
|
||||
wget https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.4.0.tgz
|
||||
tar xzvf clhep-2.4.4.0.tgz
|
||||
cd 2.4.4.0/
|
||||
mkdir CLHEP-build
|
||||
cd CLHEP-build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=../CLHEP-install DCLHEP_BUILD_CXXSTD=-std=c++11 ../CLHEP
|
||||
make -j 8
|
||||
make install
|
||||
|
||||
**Note** the default install directory is /usr/local but one needs root privileges to install it there:
|
||||
|
||||
cd to the directory where you want to build clhep
|
||||
wget https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.4.0.tgz
|
||||
tar xzvf clhep-2.4.4.0.tgz
|
||||
cd 2.4.4.0/
|
||||
mkdir CLHEP-build
|
||||
cd CLHEP-build
|
||||
cmake -DCLHEP_BUILD_CXXSTD=-std=c++11 ../CLHEP
|
||||
make -j 8
|
||||
sudo make install
|
||||
|
||||
# Building Geant4
|
||||
|
||||
Geant4 versions are available at:
|
||||
https://geant4.web.cern.ch/support/download
|
||||
|
||||
|
||||
cd to the directory where you want to install Geant4
|
||||
wget https://geant4-data.web.cern.ch/releases/geant4.10.07.p02.tar.gz
|
||||
mkdir geant4.10.07.p02-build
|
||||
cd geant4.10.07.p02-build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=../geant4.10.07.p02-install -DGEANT4_BUILD_VERBOSE_CODE=OFF -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_SYSTEM_CLHEP=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_SYSTEM_EXPAT=ON -DGEANT4_USE_SYSTEM_ZLIB=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_OPENGL_X11=ON ../geant4.10.07.p02
|
||||
make -j 8
|
||||
make install
|
||||
. ../geant4.10.07.p02-install/bin/geant4.sh
|
||||
|
||||
|
||||
check the output for any error, install any development packages that might be necessary.
|
||||
|
||||
|
||||
|
||||
|
||||
# Building ROOT
|
||||
Instructions how to build ROOT from ssource can be found at:
|
||||
https://root.cern/install/build_from_source/
|
||||
|
||||
# cd to the diretory where you want to install root
|
||||
git clone --branch latest-stable https://github.com/root-project/root.git root_src
|
||||
mkdir root-build
|
||||
cd root-build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=../root-install ../root
|
||||
# speed up the make process
|
||||
new=" -j$(($(grep -c ^processor /proc/cpuinfo) - 1))"
|
||||
case ":${MAKEFLAGS:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) MAKEFLAGS="$MAKEFLAGS:$new" ;;
|
||||
esac
|
||||
cmake -DCMAKE_INSTALL_PREFIX=../root-install ../root_src/
|
||||
cmake --build . --target install
|
||||
|
||||
check the output for any error, install any development packages that might be necessary.
|
||||
|
||||
|
||||
. ../root-install/bin/thisroot.sh
|
||||
root
|
||||
|
||||
|
||||
# Installing CUDA
|
||||
|
||||
cuda (11.3) is available at the NVIDIA web site just follow the instruction depending on the system you are using.
|
||||
|
||||
https://developer.nvidia.com/cuda-downloads
|
||||
|
||||
**Note** this will also install the corresponding NVIDIA graphics driver you might have to reboot.
|
||||
|
||||
Another way to obtain cuda is to install the NVIDIA hpc-sdk kit. Which can be found here.
|
||||
https://developer.nvidia.com/nvidia-hpc-sdk-downloads
|
||||
|
||||
The NVIDIA hpc-sdk kit provides an interesting set of tools e.g. nvc++ which allows offloading of parallel algorithms to NVIDIA GPUs.
|
||||
|
||||
A good way to check that things are working properly is to build the cuda samples and execute them
|
||||
|
||||
# cd to the directory where you want to build the cuda samples. E.g. the commands deviceQueryDrv and deviceQuery provide useful information.
|
||||
mkdir cuda-test
|
||||
cd cuda-test
|
||||
cp -r /usr/local/cuda-11.3/samples .
|
||||
cd samples/
|
||||
which nvcc
|
||||
make
|
||||
bin/x86_64/linux/release/deviceQuery
|
||||
bin/x86_64/linux/release/deviceQueryDrv
|
||||
|
||||
2 Tools For Monitoring Nvidia GPUs On Linux can be found here:
|
||||
https://www.linuxuprising.com/2019/06/2-tools-for-monitoring-nvidia-gpus-on.html
|
||||
|
||||
# Installing Optix (6.5)
|
||||
|
||||
https://developer.nvidia.com/designworks/optix/download
|
||||
|
||||
Optix comes with precompiled samples and one might want to try them:
|
||||
|
||||
# cd to the Optix installation directory
|
||||
cd SDK-precompiled-samples
|
||||
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
# execute e.g.:
|
||||
./optixMDLSphere
|
||||
./optixSphere
|
||||
./optixTutorial
|
||||
# etc.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Building opticks vs. existing libraries
|
||||
|
||||
This are instructions how to build opticks making use of preinstalled libraries available on the system. These libraries include CLHEP, xerces-c, boost and Geant4.
|
||||
For geant 4 we use the current version at the time of writing which is Geant4.10.7.p2. We make use of the fact that the om-cmake function of om.bash is sensitive
|
||||
to CMAKE_PREFIX_PATH envvar so that we can point to the directories where the libraries are installed and void having to rebuild them. In principle just cut and paste the following line to a file change the envars of the different directories to match your system and source the resulting script.
|
||||
|
||||
cd to the directory where you want to install Opticks (the WORK_DIR environmental variable will point to this directory).
|
||||
|
||||
|
||||
Here we are using a tagged snapshot of Opticks which can be found in github:
|
||||
|
||||
git clone https://github.com/simoncblyth/opticks.git
|
||||
cd opticks
|
||||
git checkout tags/v0.1.6 -b v0.1.6-branch
|
||||
git status
|
||||
|
||||
The development version (a. k. a. the latest and greatest) can be found in the following repository
|
||||
|
||||
git clone https://bitbucket.org/simoncblyth/opticks.git
|
||||
|
||||
|
||||
|
||||
change opticks/optickscore/OpticksSwitches.h
|
||||
|
||||
so that:
|
||||
|
||||
#define WITH_SKIPAHEAD 1
|
||||
|
||||
is set.
|
||||
|
||||
cat > setup_opticks.sh << +EOF
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# --- you need to modify the following environmental variables so that point to the specific directories on your system
|
||||
# ---
|
||||
export WORK_DIR=/data2/wenzel/gputest_10.7.p02
|
||||
export OptiX_INSTALL_DIR=/home/wenzel/NVIDIA-OptiX-SDK-6.5.0-linux64
|
||||
export OPTICKS_COMPUTE_CAPABILITY=75
|
||||
export CUDA_INSTALL_DIR=/usr/local/cuda-11.3
|
||||
export CUDA_SAMPLES=${CUDA_INSTALL_DIR}/samples
|
||||
export G4INSTALL=/data2/wenzel/Geant4.10.07.p02_install
|
||||
. ${G4INSTALL}/bin/Geant4.sh
|
||||
export ROOTSYS=/data2/wenzel/root_install
|
||||
. ${ROOTSYS}/bin/thisroot.sh
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
export LOCAL_BASE=${WORK_DIR}/local
|
||||
export CMAKE_PREFIX_PATH=${G4INSTALL}:${LOCAL_BASE}/opticks/externals:${OptiX_INSTALL_DIR}:${WORK_DIR}/opticks/cmake/Modules/:${WORK_DIR}/local/opticks:${WORK_DIR}/local/opticks:${WORK_DIR}/local/opticks/externals/
|
||||
export PYTHONPATH=$WORK_DIR
|
||||
export OPTICKS_HOME=${WORK_DIR}/opticks
|
||||
export PATH=${LOCAL_BASE}/bin:${PATH}
|
||||
export OPTICKS_PREFIX=${WORK_DIR}/local/opticks
|
||||
export OPTICKS_INSTALL_PREFIX=$LOCAL_BASE/opticks
|
||||
export OPTICKS_OPTIX_PREFIX=${OptiX_INSTALL_DIR}
|
||||
export OPTICKS_CUDA_PREFIX=${CUDA_INSTALL_DIR}
|
||||
export OPTICKS_EMBEDDED_COMMANDLINE_EXTRA="--rngmax 10 --rtx 1 --skipaheadstep 10000"
|
||||
opticks-(){ . ${OPTICKS_HOME}/opticks.bash && opticks-env $* ; }
|
||||
op(){ op.sh $* ; }
|
||||
o(){ cd $(opticks-home) ; hg st ; }
|
||||
# make sure to add the compiler options
|
||||
new=" -fPIC"
|
||||
case ":${CXXFLAGS:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) CXXFLAGS="$CXXFLAGS:$new" ;;
|
||||
esac
|
||||
new=" -fPIC"
|
||||
case ":${CFLAGS:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) CFLAGS="$CFLAGS:$new" ;;
|
||||
esac
|
||||
# speed up the make process
|
||||
new=" -j$(($(grep -c ^processor /proc/cpuinfo) - 1))"
|
||||
case ":${MAKEFLAGS:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) MAKEFLAGS="$MAKEFLAGS:$new" ;;
|
||||
esac
|
||||
# deal with the $LD_LIBRARYPATH
|
||||
new=${OptiX_INSTALL_DIR}/lib64/
|
||||
case ":${LD_LIBRARY_PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH" ;;
|
||||
esac
|
||||
new=${OPTICKS_HOME}/externals/lib
|
||||
case ":${LD_LIBRARY_PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH" ;;
|
||||
esac
|
||||
new=${CUDA_INSTALL_DIR}/lib64/
|
||||
case ":${LD_LIBRARY_PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH" ;;
|
||||
esac
|
||||
new=${LOCAL_BASE}/opticks/lib/
|
||||
case ":${LD_LIBRARY_PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) LD_LIBRARY_PATH="$new:$LD_LIBRARY_PATH" ;;
|
||||
esac
|
||||
opticks-
|
||||
new=${CUDA_INSTALL_DIR}/bin
|
||||
case ":${PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) PATH="$new:$PATH" ;;
|
||||
esac
|
||||
new=${OPTICKS_HOME}/bin/
|
||||
case ":${PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) PATH="$new:$PATH" ;;
|
||||
esac
|
||||
new=${OPTICKS_HOME}/ana/
|
||||
case ":${PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) PATH="$new:$PATH" ;;
|
||||
esac
|
||||
new=${LOCAL_BASE}/opticks/lib/
|
||||
case ":${PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) PATH="$new:$PATH" ;;
|
||||
esac
|
||||
new=${CUDA_SAMPLES}/bin/x86_64/linux/release/
|
||||
case ":${PATH:=$new}:" in
|
||||
*:"$new":*) ;;
|
||||
*) PATH="$new:$PATH" ;;
|
||||
esac
|
||||
oinfo-(){
|
||||
echo 'LD_LIBRARY_PATH:';
|
||||
echo '================';
|
||||
echo ${LD_LIBRARY_PATH}| tr : \\n;
|
||||
echo;
|
||||
echo 'PATH:';
|
||||
echo '=====';
|
||||
echo ${PATH}| tr : \\n;
|
||||
echo;
|
||||
echo 'CMAKE_PREFIX_PATH:';
|
||||
echo '==================';
|
||||
echo ${CMAKE_PREFIX_PATH}| tr : \\n;
|
||||
}
|
||||
dinfo-(){
|
||||
nvidia-smi;
|
||||
${CUDA_SAMPLES}/bin/x86_64/linux/release/deviceQuery
|
||||
}
|
||||
+EOF
|
||||
|
||||
source setup_opticks.sh
|
||||
oinfo-
|
||||
dinfo-
|
||||
mkdir -p ${WORK_DIR}/local/opticks/externals/
|
||||
cd ${WORK_DIR}/local/opticks/externals/
|
||||
ln -s ${OptiX_INSTALL_DIR} OptiX
|
||||
cd ${WORK_DIR}
|
||||
opticks-externals-install >& install_ext.log &
|
||||
|
||||
scan the log file or any errors and correct them.
|
||||
|
||||
cd ${WORK_DIR}
|
||||
opticks-full >& install_full.log &
|
||||
|
||||
scan the log file or any errors and correct them. Before you run opticks-t you want to to create the geocache using e.g. one of the gdml files provided by CaTS
|
||||
(https://github.com/hanswenzel/CaTS)
|
||||
|
||||
geocache-
|
||||
geocache-create- --gdmlpath ${WORK_DIR}/local/opticks/opticksdata/export/juno1808/g4_00.gdml
|
||||
export OPTICKS_KEY=`output from above command"
|
||||
opticks-t
|
||||
|
||||
if the geocache-create- command doesn't work:
|
||||
|
||||
|
||||
${WORK_DIR}/local/opticks/lib/OKX4Test --okx4test --g4codegen --deletegeocache --gdmlpath ${WORK_DIR}/CaTS/gdml/simpleLArTPC.gdml
|
||||
export OPTICKS_KEY=`output from above command"
|
||||
opticks-t
|
||||
|
||||
|
||||
|
||||
# Building CaTS
|
||||
|
||||
Instructions for building and running CaTS can be found here:
|
||||
|
||||
https://github.com/hanswenzel/CaTS/blob/master/README.md
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gdml_simple_extension xmlns:gdml_simple_extension="http://www.example.org"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xs:noNamespaceSchemaLocation="SimpleExtension.xsd">
|
||||
<extension>
|
||||
<color name="magenta" R="0.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="green" R="0.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="red" R="1.0" G="0.0" B="0.0" A="1.0" />
|
||||
<color name="blue" R="0.0" G="0.0" B="1.0" A="1.0" />
|
||||
<color name="yellow" R="1.0" G="1.0" B="0.0" A="1.0" />
|
||||
</extension>
|
||||
<materials>
|
||||
<material name="Diamond" >
|
||||
<D value="3.515" unit="g/cm3"/>
|
||||
<fraction n="1.0" ref="G4_C"/>
|
||||
</material>
|
||||
</materials>
|
||||
<solids>
|
||||
<box name="WorldBox" lunit="cm" x="100" y="100" z="410"/>
|
||||
<tube name="Target" lunit="cm" z="0.000170697" rmax="30" deltaphi="2.*pi" aunit="rad" />
|
||||
</solids>
|
||||
<structure>
|
||||
<volume name="volTarget">
|
||||
<materialref ref="Diamond"/>
|
||||
<auxiliary auxtype="SensDet" auxvalue="Msc"/>
|
||||
<solidref ref="Target"/>
|
||||
<colorref ref="green"/>
|
||||
</volume>
|
||||
<volume name="TOP">
|
||||
<materialref ref="G4_Galactic"/>
|
||||
<solidref ref="WorldBox"/>
|
||||
<physvol name="physTargetVolume" copynumber="0">
|
||||
<volumeref ref="volTarget"/>
|
||||
<position name="Targetpos" x="0" y="0" z="0"/>
|
||||
</physvol>
|
||||
</volume>
|
||||
</structure>
|
||||
<setup version="1.0" name="Default">
|
||||
<world ref="TOP"/>
|
||||
</setup>
|
||||
</gdml_simple_extension>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xs:schema >
|
||||
<xs:schema attributeFormDefault="unqualified"
|
||||
elementFormDefault="unqualified"
|
||||
version="1.0"
|
||||
xmlns:gdml_simple_extension="http://www.example.org/"
|
||||
xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<xs:redefine schemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
|
||||
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Extend the volume element using the redefine tag.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:complexType name="VolumeType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Extend the VolumeType defined by GDML.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexContent>
|
||||
<xs:extension base="VolumeType">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="colorref" type="ReferenceType"/>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:redefine>
|
||||
|
||||
<xs:complexType name="extensionType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Contains color elements.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:sequence>
|
||||
<xs:element name="color" minOccurs="0" maxOccurs="unbounded" type="ColorType" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ColorType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
A complex type defining RGBA values for geometric data display.
|
||||
These values will be loaded into a G4VisAttributes object assigned
|
||||
to the G4LogicalVolume.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:attribute name="name" type="xs:ID" use="required" />
|
||||
<xs:attribute name="R" type="xs:double" default="1.0"/>
|
||||
<xs:attribute name="G" type="xs:double" default="1.0"/>
|
||||
<xs:attribute name="B" type="xs:double" default="1.0"/>
|
||||
<xs:attribute name="A" type="xs:double" default="1.0" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="extension" type="extensionType"/>
|
||||
|
||||
<xs:element name="gdml_simple_extension">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Top-level element including the gdml element
|
||||
plus a container extension element for e.g.
|
||||
fields, SDs, regions and components.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="extension" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element ref="gdml" minOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,619 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<gdml_simple_extension xmlns:gdml_simple_extension="http://www.example.org"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xs:noNamespaceSchemaLocation="SimpleExtension.xsd">
|
||||
<extension>
|
||||
<color name="test_color" R="0.1" G="0.2" B="0.3" A="1.0" />
|
||||
<color name="magenta" R="1.0" G="0.0" B="1.0" A="1.0" />
|
||||
<color name="green" R="0.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="red" R="1.0" G="0.0" B="0.0" A="1.0" />
|
||||
<color name="blue" R="0.0" G="0.0" B="1.0" A="1.0" />
|
||||
<color name="yellow" R="1.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="purple" R="0.5" G="0.0" B="0.5" A="1.0" />
|
||||
</extension>
|
||||
<!--
|
||||
calculated using sellmeier coefficients from
|
||||
Rémi Chipaux,
|
||||
Numerical formulae for the refractive index of lead tungstate
|
||||
CMS TN / 95-184. December 1995.
|
||||
-->
|
||||
|
||||
<define>
|
||||
<variable name="i" value="0"/>
|
||||
<variable name="j" value="0"/>
|
||||
<variable name="k" value="0"/>
|
||||
<constant name="num" value="1"/>
|
||||
<constant name="cellsize" value="5000"/>
|
||||
<matrix name="RINDEX" coldim="2" values="1.45864*eV 2.20849
|
||||
1.46036*eV 2.20857
|
||||
1.46208*eV 2.20865
|
||||
1.4638*eV 2.20874
|
||||
1.46553*eV 2.20882
|
||||
1.46727*eV 2.2089
|
||||
1.46901*eV 2.20899
|
||||
1.47075*eV 2.20907
|
||||
1.4725*eV 2.20916
|
||||
1.47425*eV 2.20924
|
||||
1.476*eV 2.20933
|
||||
1.47776*eV 2.20941
|
||||
1.47952*eV 2.2095
|
||||
1.48129*eV 2.20958
|
||||
1.48306*eV 2.20967
|
||||
1.48484*eV 2.20976
|
||||
1.48662*eV 2.20984
|
||||
1.48841*eV 2.20993
|
||||
1.49019*eV 2.21002
|
||||
1.49199*eV 2.21011
|
||||
1.49379*eV 2.2102
|
||||
1.49559*eV 2.21028
|
||||
1.49739*eV 2.21037
|
||||
1.4992*eV 2.21046
|
||||
1.50102*eV 2.21055
|
||||
1.50284*eV 2.21064
|
||||
1.50466*eV 2.21073
|
||||
1.50649*eV 2.21083
|
||||
1.50832*eV 2.21092
|
||||
1.51016*eV 2.21101
|
||||
1.512*eV 2.2111
|
||||
1.51385*eV 2.21119
|
||||
1.5157*eV 2.21129
|
||||
1.51755*eV 2.21138
|
||||
1.51941*eV 2.21148
|
||||
1.52128*eV 2.21157
|
||||
1.52315*eV 2.21166
|
||||
1.52502*eV 2.21176
|
||||
1.5269*eV 2.21186
|
||||
1.52878*eV 2.21195
|
||||
1.53067*eV 2.21205
|
||||
1.53256*eV 2.21214
|
||||
1.53446*eV 2.21224
|
||||
1.53636*eV 2.21234
|
||||
1.53827*eV 2.21244
|
||||
1.54018*eV 2.21254
|
||||
1.54209*eV 2.21264
|
||||
1.54401*eV 2.21273
|
||||
1.54594*eV 2.21283
|
||||
1.54787*eV 2.21293
|
||||
1.5498*eV 2.21303
|
||||
1.55174*eV 2.21314
|
||||
1.55369*eV 2.21324
|
||||
1.55564*eV 2.21334
|
||||
1.55759*eV 2.21344
|
||||
1.55955*eV 2.21354
|
||||
1.56151*eV 2.21365
|
||||
1.56348*eV 2.21375
|
||||
1.56546*eV 2.21386
|
||||
1.56744*eV 2.21396
|
||||
1.56942*eV 2.21407
|
||||
1.57141*eV 2.21417
|
||||
1.5734*eV 2.21428
|
||||
1.5754*eV 2.21438
|
||||
1.57741*eV 2.21449
|
||||
1.57942*eV 2.2146
|
||||
1.58143*eV 2.21471
|
||||
1.58345*eV 2.21482
|
||||
1.58548*eV 2.21492
|
||||
1.58751*eV 2.21503
|
||||
1.58954*eV 2.21514
|
||||
1.59158*eV 2.21525
|
||||
1.59363*eV 2.21536
|
||||
1.59568*eV 2.21548
|
||||
1.59773*eV 2.21559
|
||||
1.5998*eV 2.2157
|
||||
1.60186*eV 2.21581
|
||||
1.60394*eV 2.21593
|
||||
1.60601*eV 2.21604
|
||||
1.61018*eV 2.21627
|
||||
1.61228*eV 2.21639
|
||||
1.61438*eV 2.2165
|
||||
1.61648*eV 2.21662
|
||||
1.61859*eV 2.21674
|
||||
1.62071*eV 2.21685
|
||||
1.62283*eV 2.21697
|
||||
1.62496*eV 2.21709
|
||||
1.62709*eV 2.21721
|
||||
1.62923*eV 2.21733
|
||||
1.63137*eV 2.21745
|
||||
1.63352*eV 2.21757
|
||||
1.63568*eV 2.21769
|
||||
1.63784*eV 2.21782
|
||||
1.64*eV 2.21794
|
||||
1.64217*eV 2.21806
|
||||
1.64435*eV 2.21819
|
||||
1.64654*eV 2.21831
|
||||
1.64873*eV 2.21844
|
||||
1.65092*eV 2.21856
|
||||
1.65312*eV 2.21869
|
||||
1.65533*eV 2.21881
|
||||
1.65754*eV 2.21894
|
||||
1.65976*eV 2.21907
|
||||
1.66199*eV 2.2192
|
||||
1.66422*eV 2.21933
|
||||
1.66645*eV 2.21946
|
||||
1.6687*eV 2.21959
|
||||
1.67095*eV 2.21972
|
||||
1.6732*eV 2.21985
|
||||
1.67546*eV 2.21998
|
||||
1.67773*eV 2.22012
|
||||
1.68*eV 2.22025
|
||||
1.68228*eV 2.22038
|
||||
1.68457*eV 2.22052
|
||||
1.68686*eV 2.22066
|
||||
1.68916*eV 2.22079
|
||||
1.69146*eV 2.22093
|
||||
1.69377*eV 2.22107
|
||||
1.69609*eV 2.2212
|
||||
1.69841*eV 2.22134
|
||||
1.70074*eV 2.22148
|
||||
1.70308*eV 2.22162
|
||||
1.70542*eV 2.22177
|
||||
1.70777*eV 2.22191
|
||||
1.71013*eV 2.22205
|
||||
1.71249*eV 2.22219
|
||||
1.71486*eV 2.22234
|
||||
1.71723*eV 2.22248
|
||||
1.71961*eV 2.22263
|
||||
1.722*eV 2.22277
|
||||
1.7244*eV 2.22292
|
||||
1.7268*eV 2.22307
|
||||
1.72921*eV 2.22322
|
||||
1.73162*eV 2.22336
|
||||
1.73404*eV 2.22351
|
||||
1.73647*eV 2.22367
|
||||
1.73891*eV 2.22382
|
||||
1.74135*eV 2.22397
|
||||
1.7438*eV 2.22412
|
||||
1.74626*eV 2.22428
|
||||
1.74872*eV 2.22443
|
||||
1.75119*eV 2.22459
|
||||
1.75367*eV 2.22474
|
||||
1.75615*eV 2.2249
|
||||
1.75864*eV 2.22506
|
||||
1.76114*eV 2.22521
|
||||
1.76364*eV 2.22537
|
||||
1.76616*eV 2.22553
|
||||
1.76868*eV 2.2257
|
||||
1.7712*eV 2.22586
|
||||
1.77374*eV 2.22602
|
||||
1.77628*eV 2.22618
|
||||
1.77883*eV 2.22635
|
||||
1.78138*eV 2.22651
|
||||
1.78395*eV 2.22668
|
||||
1.78652*eV 2.22685
|
||||
1.78909*eV 2.22701
|
||||
1.79168*eV 2.22718
|
||||
1.79427*eV 2.22735
|
||||
1.79687*eV 2.22752
|
||||
1.79948*eV 2.22769
|
||||
1.8021*eV 2.22787
|
||||
1.80472*eV 2.22804
|
||||
1.80735*eV 2.22821
|
||||
1.80999*eV 2.22839
|
||||
1.81263*eV 2.22857
|
||||
1.81529*eV 2.22874
|
||||
1.81795*eV 2.22892
|
||||
1.82062*eV 2.2291
|
||||
1.8233*eV 2.22928
|
||||
1.82598*eV 2.22946
|
||||
1.82868*eV 2.22964
|
||||
1.83138*eV 2.22983
|
||||
1.83409*eV 2.23001
|
||||
1.8368*eV 2.2302
|
||||
1.83953*eV 2.23038
|
||||
1.84226*eV 2.23057
|
||||
1.845*eV 2.23076
|
||||
1.84775*eV 2.23095
|
||||
1.85051*eV 2.23114
|
||||
1.85328*eV 2.23133
|
||||
1.85605*eV 2.23152
|
||||
1.85883*eV 2.23171
|
||||
1.86162*eV 2.23191
|
||||
1.86442*eV 2.2321
|
||||
1.86723*eV 2.2323
|
||||
1.87005*eV 2.2325
|
||||
1.87287*eV 2.2327
|
||||
1.87571*eV 2.2329
|
||||
1.87855*eV 2.2331
|
||||
1.8814*eV 2.2333
|
||||
1.88426*eV 2.2335
|
||||
1.88713*eV 2.23371
|
||||
1.89*eV 2.23391
|
||||
1.89289*eV 2.23412
|
||||
1.89578*eV 2.23433
|
||||
1.89869*eV 2.23454
|
||||
1.9016*eV 2.23475
|
||||
1.90452*eV 2.23496
|
||||
1.90745*eV 2.23517
|
||||
1.91039*eV 2.23539
|
||||
1.91334*eV 2.2356
|
||||
1.91629*eV 2.23582
|
||||
1.91926*eV 2.23604
|
||||
1.92224*eV 2.23626
|
||||
1.92522*eV 2.23648
|
||||
1.92821*eV 2.2367
|
||||
1.93122*eV 2.23692
|
||||
1.93423*eV 2.23715
|
||||
1.93725*eV 2.23737
|
||||
1.94028*eV 2.2376
|
||||
1.94333*eV 2.23783
|
||||
1.94638*eV 2.23806
|
||||
1.94944*eV 2.23829
|
||||
1.95251*eV 2.23852
|
||||
1.95559*eV 2.23876
|
||||
1.95868*eV 2.23899
|
||||
1.96178*eV 2.23923
|
||||
1.96488*eV 2.23947
|
||||
1.968*eV 2.23971
|
||||
1.97113*eV 2.23995
|
||||
1.97427*eV 2.24019
|
||||
1.97742*eV 2.24044
|
||||
1.98058*eV 2.24068
|
||||
1.98375*eV 2.24093
|
||||
1.98693*eV 2.24118
|
||||
1.99012*eV 2.24143
|
||||
1.99331*eV 2.24168
|
||||
1.99652*eV 2.24194
|
||||
1.99975*eV 2.24219
|
||||
2.00298*eV 2.24245
|
||||
2.00622*eV 2.24271
|
||||
2.00947*eV 2.24297
|
||||
2.01273*eV 2.24323
|
||||
2.016*eV 2.24349
|
||||
2.01929*eV 2.24376
|
||||
2.02258*eV 2.24402
|
||||
2.02589*eV 2.24429
|
||||
2.0292*eV 2.24456
|
||||
2.03253*eV 2.24483
|
||||
2.03587*eV 2.24511
|
||||
2.03921*eV 2.24538
|
||||
2.04257*eV 2.24566
|
||||
2.04594*eV 2.24594
|
||||
2.04933*eV 2.24622
|
||||
2.05272*eV 2.2465
|
||||
2.05612*eV 2.24679
|
||||
2.05954*eV 2.24707
|
||||
2.06296*eV 2.24736
|
||||
2.0664*eV 2.24765
|
||||
2.06985*eV 2.24794
|
||||
2.07331*eV 2.24824
|
||||
2.07679*eV 2.24853
|
||||
2.08027*eV 2.24883
|
||||
2.08377*eV 2.24913
|
||||
2.08728*eV 2.24943
|
||||
2.0908*eV 2.24973
|
||||
2.09433*eV 2.25004
|
||||
2.09787*eV 2.25035
|
||||
2.10143*eV 2.25066
|
||||
2.10499*eV 2.25097
|
||||
2.10857*eV 2.25128
|
||||
2.11217*eV 2.2516
|
||||
2.11577*eV 2.25192
|
||||
2.11939*eV 2.25224
|
||||
2.12302*eV 2.25256
|
||||
2.12666*eV 2.25289
|
||||
2.13031*eV 2.25321
|
||||
2.13398*eV 2.25354
|
||||
2.13766*eV 2.25388
|
||||
2.14135*eV 2.25421
|
||||
2.14506*eV 2.25455
|
||||
2.14877*eV 2.25489
|
||||
2.1525*eV 2.25523
|
||||
2.15625*eV 2.25557
|
||||
2.16*eV 2.25592
|
||||
2.16377*eV 2.25627
|
||||
2.16756*eV 2.25662
|
||||
2.17135*eV 2.25697
|
||||
2.17516*eV 2.25733
|
||||
2.17898*eV 2.25768
|
||||
2.18282*eV 2.25805
|
||||
2.18667*eV 2.25841
|
||||
2.19053*eV 2.25878
|
||||
2.19441*eV 2.25914
|
||||
2.1983*eV 2.25952
|
||||
2.20221*eV 2.25989
|
||||
2.20612*eV 2.26027
|
||||
2.21006*eV 2.26065
|
||||
2.214*eV 2.26103
|
||||
2.21796*eV 2.26142
|
||||
2.22194*eV 2.26181
|
||||
2.22593*eV 2.2622
|
||||
2.22993*eV 2.26259
|
||||
2.23395*eV 2.26299
|
||||
2.23798*eV 2.26339
|
||||
2.24203*eV 2.26379
|
||||
2.24609*eV 2.2642
|
||||
2.25017*eV 2.26461
|
||||
2.25426*eV 2.26502
|
||||
2.25836*eV 2.26544
|
||||
2.26249*eV 2.26585
|
||||
2.26662*eV 2.26628
|
||||
2.27077*eV 2.2667
|
||||
2.27494*eV 2.26713
|
||||
2.27912*eV 2.26756
|
||||
2.28332*eV 2.268
|
||||
2.28753*eV 2.26844
|
||||
2.29176*eV 2.26888
|
||||
2.296*eV 2.26932
|
||||
2.30026*eV 2.26977
|
||||
2.30454*eV 2.27023
|
||||
2.30883*eV 2.27068
|
||||
2.31314*eV 2.27114
|
||||
2.31746*eV 2.2716
|
||||
2.3218*eV 2.27207
|
||||
2.32616*eV 2.27254
|
||||
2.33053*eV 2.27302
|
||||
2.33492*eV 2.2735
|
||||
2.33932*eV 2.27398
|
||||
2.34375*eV 2.27446
|
||||
2.34819*eV 2.27496
|
||||
2.35264*eV 2.27545
|
||||
2.35711*eV 2.27595
|
||||
2.3616*eV 2.27645
|
||||
2.36611*eV 2.27696
|
||||
2.37063*eV 2.27747
|
||||
2.37518*eV 2.27798
|
||||
2.37973*eV 2.2785
|
||||
2.38431*eV 2.27903
|
||||
2.38891*eV 2.27955
|
||||
2.39352*eV 2.28009
|
||||
2.39815*eV 2.28062
|
||||
2.40279*eV 2.28117
|
||||
2.40746*eV 2.28171
|
||||
2.41214*eV 2.28226
|
||||
2.41685*eV 2.28282
|
||||
2.42157*eV 2.28338
|
||||
2.42631*eV 2.28395
|
||||
2.43106*eV 2.28452
|
||||
2.43584*eV 2.28509
|
||||
2.44063*eV 2.28567
|
||||
2.44545*eV 2.28626
|
||||
2.45028*eV 2.28685
|
||||
2.45513*eV 2.28745
|
||||
2.46*eV 2.28805
|
||||
2.46489*eV 2.28865
|
||||
2.4698*eV 2.28927
|
||||
2.47473*eV 2.28988
|
||||
2.47968*eV 2.29051
|
||||
2.48465*eV 2.29114
|
||||
2.48964*eV 2.29177
|
||||
2.49465*eV 2.29241
|
||||
2.49968*eV 2.29306
|
||||
2.50473*eV 2.29371
|
||||
2.5098*eV 2.29437
|
||||
2.51489*eV 2.29503
|
||||
2.52*eV 2.2957
|
||||
2.52514*eV 2.29638
|
||||
2.53029*eV 2.29707
|
||||
2.53546*eV 2.29776
|
||||
2.54066*eV 2.29845
|
||||
2.54588*eV 2.29915
|
||||
2.55112*eV 2.29986
|
||||
2.55638*eV 2.30058
|
||||
2.56166*eV 2.3013
|
||||
2.56696*eV 2.30204
|
||||
2.57229*eV 2.30277
|
||||
2.57763*eV 2.30352
|
||||
2.583*eV 2.30427
|
||||
2.5884*eV 2.30503
|
||||
2.59381*eV 2.3058
|
||||
2.59925*eV 2.30657
|
||||
2.60471*eV 2.30735
|
||||
2.61019*eV 2.30814
|
||||
2.6157*eV 2.30894
|
||||
2.62123*eV 2.30975
|
||||
2.62678*eV 2.31056
|
||||
2.63236*eV 2.31139
|
||||
2.63796*eV 2.31222
|
||||
2.64359*eV 2.31306
|
||||
2.64923*eV 2.31391
|
||||
2.65491*eV 2.31476
|
||||
2.6606*eV 2.31563
|
||||
2.66633*eV 2.3165
|
||||
2.67207*eV 2.31739
|
||||
2.67784*eV 2.31828
|
||||
2.68364*eV 2.31919
|
||||
2.68946*eV 2.3201
|
||||
2.69531*eV 2.32102
|
||||
2.70118*eV 2.32196
|
||||
2.70708*eV 2.3229
|
||||
2.713*eV 2.32385
|
||||
2.71895*eV 2.32482
|
||||
2.72493*eV 2.32579
|
||||
2.73093*eV 2.32677
|
||||
2.73696*eV 2.32777
|
||||
2.74301*eV 2.32878
|
||||
2.7491*eV 2.3298
|
||||
2.7552*eV 2.33083
|
||||
2.76134*eV 2.33187
|
||||
2.7675*eV 2.33292
|
||||
2.7737*eV 2.33399
|
||||
2.77991*eV 2.33506
|
||||
2.78616*eV 2.33615
|
||||
2.79244*eV 2.33726
|
||||
2.79874*eV 2.33837
|
||||
2.80507*eV 2.3395
|
||||
2.81143*eV 2.34064
|
||||
2.81782*eV 2.3418
|
||||
2.82424*eV 2.34297
|
||||
2.83069*eV 2.34415
|
||||
2.83717*eV 2.34535
|
||||
2.84367*eV 2.34656
|
||||
2.85021*eV 2.34779
|
||||
2.85678*eV 2.34903
|
||||
2.86338*eV 2.35029
|
||||
2.87*eV 2.35156
|
||||
2.87666*eV 2.35285
|
||||
2.88335*eV 2.35415
|
||||
2.89007*eV 2.35547
|
||||
2.89683*eV 2.35681
|
||||
2.90361*eV 2.35817
|
||||
2.91043*eV 2.35954
|
||||
2.91728*eV 2.36093
|
||||
2.92416*eV 2.36234
|
||||
2.93107*eV 2.36376
|
||||
2.93801*eV 2.36521
|
||||
2.94499*eV 2.36667
|
||||
2.952*eV 2.36816
|
||||
2.95905*eV 2.36966
|
||||
2.96613*eV 2.37119
|
||||
2.97324*eV 2.37273
|
||||
2.98039*eV 2.3743
|
||||
2.98757*eV 2.37588
|
||||
2.99479*eV 2.37749
|
||||
3.00204*eV 2.37912
|
||||
3.00933*eV 2.38078
|
||||
3.01665*eV 2.38245
|
||||
3.024*eV 2.38415
|
||||
3.0314*eV 2.38588
|
||||
3.03883*eV 2.38763
|
||||
3.04629*eV 2.3894
|
||||
3.0538*eV 2.3912
|
||||
3.06134*eV 2.39303
|
||||
3.06892*eV 2.39489
|
||||
3.07653*eV 2.39677
|
||||
3.08418*eV 2.39868
|
||||
3.09188*eV 2.40061
|
||||
3.0996*eV 2.40258
|
||||
3.10737*eV 2.40458
|
||||
3.11518*eV 2.40661
|
||||
3.12303*eV 2.40867
|
||||
3.13091*eV 2.41076
|
||||
3.13884*eV 2.41288
|
||||
3.14681*eV 2.41504
|
||||
3.15481*eV 2.41723
|
||||
3.16286*eV 2.41946
|
||||
3.17095*eV 2.42172
|
||||
3.17908*eV 2.42402
|
||||
3.18725*eV 2.42636
|
||||
3.19547*eV 2.42874
|
||||
3.20373*eV 2.43115
|
||||
3.21203*eV 2.43361
|
||||
3.22037*eV 2.43611
|
||||
3.22875*eV 2.43865
|
||||
3.23719*eV 2.44123
|
||||
3.24566*eV 2.44386
|
||||
3.25418*eV 2.44653
|
||||
3.26274*eV 2.44926
|
||||
3.27135*eV 2.45203
|
||||
3.28001*eV 2.45485
|
||||
3.28871*eV 2.45772
|
||||
3.29745*eV 2.46064
|
||||
3.30625*eV 2.46362
|
||||
3.31509*eV 2.46665
|
||||
3.32397*eV 2.46974
|
||||
3.33291*eV 2.47289
|
||||
3.34189*eV 2.47609
|
||||
3.35092*eV 2.47936
|
||||
3.36001*eV 2.4827
|
||||
3.36914*eV 2.48609
|
||||
3.37832*eV 2.48956
|
||||
3.38755*eV 2.49309
|
||||
3.39683*eV 2.4967
|
||||
3.40616*eV 2.50038
|
||||
3.41554*eV 2.50413
|
||||
3.42498*eV 2.50796
|
||||
3.43447*eV 2.51187
|
||||
3.44401*eV 2.51587
|
||||
3.4536*eV 2.51995
|
||||
3.46325*eV 2.52412
|
||||
3.47295*eV 2.52838
|
||||
3.4827*eV 2.53273
|
||||
3.49251*eV 2.53718
|
||||
3.50238*eV 2.54173
|
||||
3.5123*eV 2.54639
|
||||
3.52228*eV 2.55115
|
||||
3.53231*eV 2.55603
|
||||
3.54241*eV 2.56102
|
||||
3.55256*eV 2.56612
|
||||
3.56276*eV 2.57135
|
||||
3.57303*eV 2.57671
|
||||
3.58336*eV 2.58221
|
||||
3.59374*eV 2.58784
|
||||
3.60419*eV 2.59361
|
||||
3.6147*eV 2.59953
|
||||
3.62527*eV 2.6056
|
||||
3.6359*eV 2.61184
|
||||
3.64659*eV 2.61824
|
||||
3.65735*eV 2.62481
|
||||
3.66817*eV 2.63157
|
||||
3.67906*eV 2.63851
|
||||
3.69001*eV 2.64564
|
||||
3.70102*eV 2.65299
|
||||
3.7121*eV 2.66054
|
||||
3.72325*eV 2.66832
|
||||
3.73446*eV 2.67633
|
||||
3.74575*eV 2.68458
|
||||
3.7571*eV 2.69308
|
||||
3.76852*eV 2.70185
|
||||
3.78001*eV 2.7109
|
||||
3.79157*eV 2.72025
|
||||
3.8032*eV 2.7299
|
||||
3.8149*eV 2.73987
|
||||
3.82667*eV 2.75017
|
||||
3.83852*eV 2.76084
|
||||
3.85044*eV 2.77188
|
||||
3.86244*eV 2.78331
|
||||
3.87451*eV 2.79516"/>
|
||||
</define>
|
||||
|
||||
<materials>
|
||||
<material Z="1.0" name="AIR">
|
||||
<D value="1e-24"/>
|
||||
<atom value="1.00794"/>
|
||||
</material>
|
||||
<element name="Oxygen" formula="O" Z="8."> <atom value="16.0"/> </element>
|
||||
<element name="Nitrogen" formula="N" Z="7."> <atom value="14.01"/> </element>
|
||||
<element name="Fluorine" formula="F" Z="9."> <atom value="18.9984032"/> </element>
|
||||
<element name="Lead" formula="Pb" Z="82."> <atom value="207.20"/> </element>
|
||||
<element name="Bismuth" formula="Bi" Z="83."> <atom value="208.98040"/> </element>
|
||||
<element name="Germanium" formula="Ge" Z="32."> <atom value="72.63"/> </element>
|
||||
<element name="Tungsten" formula="W" Z="74."> <atom value="183.84"/> </element>
|
||||
<material name="Air">
|
||||
<D value="1.290" unit="mg/cm3"/>
|
||||
<fraction n="0.7" ref="Nitrogen"/>
|
||||
<fraction n="0.3" ref="Oxygen"/>
|
||||
</material>
|
||||
|
||||
<material name="PbWO4">
|
||||
<property name="RINDEX" ref="RINDEX"/>
|
||||
<D value="8.28" unit="g/cm3"/>
|
||||
<composite n="1" ref="Lead"/>
|
||||
<composite n="1" ref="Tungsten"/>
|
||||
<composite n="4" ref="Oxygen"/>
|
||||
</material>
|
||||
</materials>
|
||||
<solids>
|
||||
<box name="WorldBox" lunit="mm" x="cellsize*num+100" y="cellsize*num+100" z="cellsize*num+100"/>
|
||||
<box name="CalorimeterCell" lunit="mm" x="cellsize" y="cellsize" z="cellsize"/>
|
||||
</solids>
|
||||
|
||||
<structure>
|
||||
<volume name="CalorimeterVolume">
|
||||
<materialref ref="PbWO4"/>
|
||||
<solidref ref="CalorimeterCell"/>
|
||||
<auxiliary auxtype="SensDet" auxvalue="DRCalorimeter"/>
|
||||
<colorref ref="green"/>
|
||||
</volume>
|
||||
|
||||
<volume name="TOP">
|
||||
<materialref ref="AIR"/>
|
||||
<solidref ref="WorldBox"/>
|
||||
<loop for="i" from="0" to="num-1" step="1">
|
||||
<loop for="j" from="0" to="num-1" step="1">
|
||||
<loop for="k" from="0" to="num-1" step="1">
|
||||
<physvol name="pvolCalorimeter" copynumber="i+j*num+k*num*num" >>
|
||||
<volumeref ref="CalorimeterVolume"/>
|
||||
<position name="posijk" x="cellsize*(0.5-num*0.5)+i*cellsize" y="cellsize*(0.5-num*0.5)+j*cellsize" z="cellsize*(0.5-num*0.5)+k*cellsize"/>
|
||||
</physvol>
|
||||
</loop>
|
||||
</loop>
|
||||
</loop>
|
||||
</volume>
|
||||
</structure>
|
||||
|
||||
<setup version="1.0" name="Default">
|
||||
<world ref="TOP"/>
|
||||
</setup>
|
||||
</gdml_simple_extension>
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<gdml_simple_extension xmlns:gdml_simple_extension="http://www.example.org"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xs:noNamespaceSchemaLocation="SimpleExtension.xsd">
|
||||
<extension>
|
||||
<color name="test_color" R="0.1" G="0.2" B="0.3" A="1.0" />
|
||||
<color name="magenta" R="1.0" G="0.0" B="1.0" A="1.0" />
|
||||
<color name="green" R="0.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="red" R="1.0" G="0.0" B="0.0" A="1.0" />
|
||||
<color name="blue" R="0.0" G="0.0" B="1.0" A="1.0" />
|
||||
<color name="yellow" R="1.0" G="1.0" B="0.0" A="1.0" />
|
||||
<color name="purple" R="0.5" G="0.0" B="0.5" A="1.0" />
|
||||
</extension>
|
||||
<define>
|
||||
<constant name="cellsize" value="5000"/>
|
||||
</define>
|
||||
<materials>
|
||||
<material Z="1.0" name="AIR">
|
||||
<D value="1e-24"/>
|
||||
<atom value="1.00794"/>
|
||||
</material>
|
||||
<element name="Oxygen" formula="O" Z="8.">
|
||||
<atom value="16.0"/>
|
||||
</element>
|
||||
<element name="Nitrogen" formula="N" Z="7.">
|
||||
<atom value="14.01"/>
|
||||
</element>
|
||||
<element name="Fluorine" formula="F" Z="9.">
|
||||
<atom value="18.9984032"/>
|
||||
</element>
|
||||
<element name="Lead" formula="Pb" Z="82.">
|
||||
<atom value="207.20"/>
|
||||
</element>
|
||||
<element name="Bismuth" formula="Bi" Z="83.">
|
||||
<atom value="208.98040"/>
|
||||
</element>
|
||||
<element name="Germanium" formula="Ge" Z="32.">
|
||||
<atom value="72.63"/>
|
||||
</element>
|
||||
<element name="Tungsten" formula="W" Z="74.">
|
||||
<atom value="183.84"/>
|
||||
</element>
|
||||
<material name="Air">
|
||||
<D value="1.290" unit="mg/cm3"/>
|
||||
<fraction n="0.7" ref="Nitrogen"/>
|
||||
<fraction n="0.3" ref="Oxygen"/>
|
||||
</material>
|
||||
|
||||
<material name="PbWO4">
|
||||
<D value="8.28" unit="g/cm3"/>
|
||||
<composite n="1" ref="Lead"/>
|
||||
<composite n="1" ref="Tungsten"/>
|
||||
<composite n="4" ref="Oxygen"/>
|
||||
</material>
|
||||
</materials>
|
||||
<solids>
|
||||
<box name="WorldBox" lunit="mm" x="cellsize+1000" y="cellsize+1000" z="cellsize+1000"/>
|
||||
<box name="CalorimeterCell" lunit="mm" x="cellsize" y="cellsize" z="cellsize"/>
|
||||
</solids>
|
||||
|
||||
<structure>
|
||||
<volume name="CalorimeterVolume">
|
||||
<materialref ref="PbWO4"/>
|
||||
<solidref ref="CalorimeterCell"/>
|
||||
<auxiliary auxtype="SensDet" auxvalue="Calorimeter"/>
|
||||
<colorref ref="green"/>
|
||||
</volume>
|
||||
|
||||
<volume name="TOP">
|
||||
<materialref ref="AIR"/>
|
||||
<solidref ref="WorldBox"/>
|
||||
<physvol name="pvolCalorimeter" copynumber="0" >>
|
||||
<volumeref ref="CalorimeterVolume"/>
|
||||
<position name="posijk" x="0" y="0" z="0"/>
|
||||
</physvol>
|
||||
</volume>
|
||||
</structure>
|
||||
|
||||
<setup version="1.0" name="Default">
|
||||
<world ref="TOP"/>
|
||||
</setup>
|
||||
</gdml_simple_extension>
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
+24
-17
@@ -23,26 +23,33 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// GEANT4 tag
|
||||
//
|
||||
// Author: Patricia Mendez (patricia.mendez@cern.ch)
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 12 Feb 2003 Patricia Mendez created
|
||||
// 11 Mar 2013 Luciano Pandola Migrated to g4tools (removed AIDA dependency)
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef FCALANALYSISMANAGER_HH
|
||||
#define FCALANALYSISMANAGER_HH
|
||||
|
||||
// comment g4root.hh and uncomment g4xml.hh for a XML-based output file
|
||||
|
||||
#include "g4root.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
#endif
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ActionInitialization.hh
|
||||
/// \brief Definition of the CaTS::ActionInitialization class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
ActionInitialization();
|
||||
virtual ~ActionInitialization() = default;
|
||||
void BuildForMaster() const final;
|
||||
void Build() const final;
|
||||
};
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CaTSClasses.hh
|
||||
/// \brief Declaration of the classes for generating dictionaries
|
||||
//
|
||||
#include "G4VHit.hh"
|
||||
#include "lArTPCHit.hh"
|
||||
#include "PhotonHit.hh"
|
||||
#include "InteractionHit.hh"
|
||||
#include "CalorimeterHit.hh"
|
||||
#include "DRCalorimeterHit.hh"
|
||||
#include "TrackerHit.hh"
|
||||
#include "MscHit.hh"
|
||||
#include "Event.hh"
|
||||
Event e;
|
||||
std::vector<PhotonHit*> p;
|
||||
std::vector<InteractionHit*> i;
|
||||
std::vector<lArTPCHit*> a;
|
||||
std::vector<CalorimeterHit*> c;
|
||||
std::vector<DRCalorimeterHit*> d;
|
||||
std::vector<TrackerHit*> t;
|
||||
std::vector<MscHit*> m;
|
||||
std::vector<G4VHit*> vh;
|
||||
std::map<G4String, std::vector<G4VHit*>> hm; // map of Hit Collections
|
||||
#undef __G4String
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CaTSVersion.hh
|
||||
/// \brief Definition of the CaTS::CaTSVersion class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
//=============================================
|
||||
// - The meaning of each digit is as follows;
|
||||
//
|
||||
// 71
|
||||
// |--> major version number
|
||||
// |--> minor version number
|
||||
//=============================================
|
||||
#ifndef CATSVERSION_NUMBER
|
||||
# define CATSVERSION_NUMBER 10
|
||||
#endif
|
||||
#ifndef CATSVERSION_TAG
|
||||
# define CATSVERSION_TAG "CaTS_1_0"
|
||||
#endif
|
||||
// as variables
|
||||
static const std::string CaTSVersion = "CaTS_1_0";
|
||||
static const std::string CaTSDate = "(14-October-2021)";
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CalorimeterHit.hh
|
||||
/// \brief Definition of the CaTS::CalorimeterHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class CalorimeterHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
CalorimeterHit();
|
||||
~CalorimeterHit() = default;
|
||||
CalorimeterHit(const CalorimeterHit&);
|
||||
const CalorimeterHit& operator=(const CalorimeterHit&);
|
||||
G4bool operator==(const CalorimeterHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "CalorimeterHit id: " << fid << " Edep: " << fEdep
|
||||
<< " em_Edep: " << fem_Edep << " time: " << ftime
|
||||
<< " X: " << fposition.getX() << " Y: " << fposition.getY()
|
||||
<< " Z: " << fposition.getZ() << G4endl;
|
||||
}
|
||||
CalorimeterHit(unsigned int i, G4double e, G4double em, G4double t,
|
||||
G4ThreeVector p);
|
||||
inline void SetPosition(G4ThreeVector position) { fposition = position; };
|
||||
inline G4ThreeVector GetPosition() const { return fposition; };
|
||||
inline void SetTime(G4double time) { ftime = time; };
|
||||
inline G4double GetTime() const { return ftime; };
|
||||
inline void SetId(unsigned int id) { fid = id; };
|
||||
inline unsigned int GetId() const { return fid; };
|
||||
inline void SetEdep(G4double Edep) { fEdep = Edep; };
|
||||
inline G4double GetEdep() const { return fEdep; };
|
||||
inline void Setem_Edep(G4double em_Edep) { fem_Edep = em_Edep; };
|
||||
inline G4double Getem_Edep() const { return fem_Edep; };
|
||||
|
||||
private:
|
||||
unsigned int fid{ 0 };
|
||||
G4double fEdep{ 0 };
|
||||
G4double fem_Edep{ 0 };
|
||||
G4double ftime{ 0 };
|
||||
G4ThreeVector fposition{ 0, 0, 0 };
|
||||
};
|
||||
|
||||
using CalorimeterHitsCollection = G4THitsCollection<CalorimeterHit>;
|
||||
extern G4ThreadLocal G4Allocator<CalorimeterHit>* CalorimeterHitAllocator;
|
||||
|
||||
inline void* CalorimeterHit::operator new(size_t)
|
||||
{
|
||||
if(!CalorimeterHitAllocator)
|
||||
{
|
||||
CalorimeterHitAllocator = new G4Allocator<CalorimeterHit>;
|
||||
}
|
||||
return (void*) CalorimeterHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void CalorimeterHit::operator delete(void* aHit)
|
||||
{
|
||||
CalorimeterHitAllocator->FreeSingle((CalorimeterHit*) aHit);
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CalorimeterSD.hh
|
||||
/// \brief Definition of the CaTS::CalorimeterSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "CalorimeterHit.hh"
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
|
||||
class CalorimeterSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
CalorimeterSD(G4String);
|
||||
~CalorimeterSD() = default;
|
||||
void Initialize(G4HCofThisEvent*) final;
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
CalorimeterHitsCollection* fCalorimeterHitsCollection{ nullptr };
|
||||
G4int fHCID{ 0 };
|
||||
G4bool verbose{ false };
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ColorReader.hh
|
||||
/// \brief Definition of the CaTS::ColorReader class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "G4GDMLReadStructure.hh"
|
||||
#include <G4String.hh>
|
||||
namespace xercesc_3_2
|
||||
{
|
||||
class DOMElement;
|
||||
}
|
||||
class G4VisAttributes;
|
||||
|
||||
class ColorReader : public G4GDMLReadStructure
|
||||
{
|
||||
public:
|
||||
ColorReader();
|
||||
~ColorReader();
|
||||
void ExtensionRead(const xercesc::DOMElement* const element);
|
||||
void ColorRead(const xercesc::DOMElement* const element);
|
||||
G4VisAttributes* GetVisAttribute(const G4String& ref);
|
||||
|
||||
protected:
|
||||
virtual void VolumeRead(const xercesc::DOMElement* const);
|
||||
|
||||
private:
|
||||
std::map<G4String, G4VisAttributes*> fAttribs;
|
||||
};
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ConfigurationManager.hh
|
||||
/// \brief Definition of the CaTS::ConfigurationManager class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include "G4String.hh"
|
||||
class G4GenericMessenger;
|
||||
|
||||
class ConfigurationManager
|
||||
{
|
||||
private:
|
||||
static ConfigurationManager* fginstance;
|
||||
static std::once_flag fginitInstanceFlag;
|
||||
#ifdef WITH_ROOT
|
||||
G4bool fdoAnalysis{ false }; // variable determines if we are doing analysis
|
||||
G4String fHistoFileName{
|
||||
"histograms.root"
|
||||
}; // File name for histos and ntuples
|
||||
G4bool fwriteHits{
|
||||
false
|
||||
}; // variable determines if hits are written out into Root File
|
||||
G4String fname{ "Hits" }; // full File name for root io
|
||||
#endif
|
||||
G4bool fenable_opticks{ true }; // use opticks if available
|
||||
unsigned int fMaxPhotons{ 1000000 };
|
||||
G4bool fenable_verbose{ false }; // switch on/off diagnostic printouts
|
||||
G4bool fdumpgdml{ false }; // write out Detector to gdml file
|
||||
G4String fGDMLFileName{ "dump.gdml_G4" };
|
||||
ConfigurationManager();
|
||||
|
||||
public:
|
||||
~ConfigurationManager();
|
||||
/// Define UI commands: choice of primary generators
|
||||
void DefineCommands();
|
||||
/// Pointer to the messenger for UI commands
|
||||
G4GenericMessenger* fMessenger = nullptr;
|
||||
static ConfigurationManager* getInstance()
|
||||
{
|
||||
std::call_once(fginitInstanceFlag,
|
||||
ConfigurationManager::initConfigurationManager);
|
||||
return fginstance;
|
||||
}
|
||||
static void initConfigurationManager()
|
||||
{
|
||||
fginstance = new ConfigurationManager();
|
||||
}
|
||||
#ifdef WITH_ROOT
|
||||
inline G4String getHistoFileName() const { return fHistoFileName; }
|
||||
inline G4bool isWriteHits() const { return fwriteHits; }
|
||||
inline G4bool isdoAnalysis() const { return fdoAnalysis; }
|
||||
inline void setfname(G4String name) { fname = name; }
|
||||
inline G4String getfname() const { return fname; }
|
||||
#endif
|
||||
inline G4bool isEnable_opticks() const { return fenable_opticks; };
|
||||
inline unsigned int getMaxPhotons() const { return fMaxPhotons; }
|
||||
inline G4bool isEnable_verbose() const { return fenable_verbose; };
|
||||
inline G4String getGDMLFileName() const { return fGDMLFileName; }
|
||||
inline void setGDMLFileName(G4String GDMLFileName)
|
||||
{
|
||||
fGDMLFileName = GDMLFileName;
|
||||
}
|
||||
inline G4bool isDumpgdml() const { return fdumpgdml; }
|
||||
void Print();
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DRCalorimeterHit.hh
|
||||
/// \brief Definition of the CaTS::DRCalorimeterHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class DRCalorimeterHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
DRCalorimeterHit();
|
||||
~DRCalorimeterHit() = default;
|
||||
DRCalorimeterHit(const DRCalorimeterHit&);
|
||||
const DRCalorimeterHit& operator=(const DRCalorimeterHit&);
|
||||
G4bool operator==(const DRCalorimeterHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "DRCalorimeterHit id: " << fid << " Edep: " << fEdep
|
||||
<< " em_Edep: " << fem_Edep << " NCeren: " << fNceren
|
||||
<< " X: " << fposition.getX() << " Y: " << fposition.getY()
|
||||
<< " Z: " << fposition.getZ() << G4endl;
|
||||
}
|
||||
|
||||
DRCalorimeterHit(unsigned int i, G4double e, G4double em, unsigned int nc,
|
||||
G4double t, G4ThreeVector p);
|
||||
inline void SetPosition(G4ThreeVector position) { fposition = position; };
|
||||
inline G4ThreeVector GetPosition() const { return fposition; };
|
||||
inline void SetTime(G4double time) { ftime = time; };
|
||||
inline G4double GetTime() const { return ftime; };
|
||||
inline void SetId(unsigned int id) { fid = id; };
|
||||
inline unsigned int GetId() const { return fid; };
|
||||
inline void SetEdep(G4double Edep) { fEdep = Edep; };
|
||||
inline G4double GetEdep() const { return fEdep; };
|
||||
inline void SetNceren(unsigned int Nceren) { fNceren = Nceren; };
|
||||
inline unsigned int GetNceren() const { return fNceren; };
|
||||
inline void SetEm_Edep(G4double em_Edep) { fem_Edep = em_Edep; };
|
||||
inline G4double GetEm_Edep() const { return fem_Edep; };
|
||||
|
||||
private:
|
||||
unsigned int fid{ 0 };
|
||||
G4double fEdep{ 0 };
|
||||
G4double fem_Edep{ 0 };
|
||||
unsigned int fNceren{ 0 };
|
||||
G4double ftime{ 0 };
|
||||
G4ThreeVector fposition{ 0, 0, 0 };
|
||||
};
|
||||
|
||||
using DRCalorimeterHitsCollection = G4THitsCollection<DRCalorimeterHit>;
|
||||
extern G4ThreadLocal G4Allocator<DRCalorimeterHit>* DRCalorimeterHitAllocator;
|
||||
|
||||
inline void* DRCalorimeterHit::operator new(size_t)
|
||||
{
|
||||
if(!DRCalorimeterHitAllocator)
|
||||
{
|
||||
DRCalorimeterHitAllocator = new G4Allocator<DRCalorimeterHit>;
|
||||
}
|
||||
return (void*) DRCalorimeterHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void DRCalorimeterHit::operator delete(void* aHit)
|
||||
{
|
||||
DRCalorimeterHitAllocator->FreeSingle((DRCalorimeterHit*) aHit);
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DRCalorimeterSD.hh
|
||||
/// \brief Definition of the CaTS::DRCalorimeterSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "DRCalorimeterHit.hh"
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
class DRCalorimeterSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
DRCalorimeterSD(G4String);
|
||||
~DRCalorimeterSD();
|
||||
void Initialize(G4HCofThisEvent*) final;
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
DRCalorimeterHitsCollection* fDRCalorimeterHitsCollection;
|
||||
G4int fHCID{ 0 };
|
||||
G4bool verbose{ false };
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the CaTS::DetectorConstruction class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include <G4String.hh>
|
||||
class G4VPhysicalVolume;
|
||||
class ColorReader;
|
||||
class G4GDMLParser;
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction(G4String fname);
|
||||
~DetectorConstruction() final;
|
||||
DetectorConstruction& operator=(const DetectorConstruction& right) = delete;
|
||||
DetectorConstruction(const DetectorConstruction&) = delete;
|
||||
void ReadGDML();
|
||||
G4VPhysicalVolume* Construct() final;
|
||||
void ConstructSDandField() final;
|
||||
void UpdateGeometry();
|
||||
|
||||
private:
|
||||
G4String gdmlFile;
|
||||
G4GDMLParser* parser{ nullptr };
|
||||
ColorReader* fReader{ nullptr };
|
||||
G4bool verbose{ false };
|
||||
};
|
||||
+31
-28
@@ -24,39 +24,42 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// This class is an derived class of G4VPhysicsConstructor
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
#ifndef GammaRayTelHadronPhysics_h
|
||||
#define GammaRayTelHadronPhysics_h 1
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file Event.hh
|
||||
/// \brief Definition of the CaTS::Event class
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#pragma once
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include <G4String.hh>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "G4Types.hh"
|
||||
class G4VHit;
|
||||
|
||||
|
||||
class GammaRayTelHadronPhysics : public G4VPhysicsConstructor
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
GammaRayTelHadronPhysics(const G4String& name ="hadron");
|
||||
virtual ~GammaRayTelHadronPhysics();
|
||||
|
||||
public:
|
||||
// This method will be invoked in the Construct() method.
|
||||
// each particle type will be instantiated
|
||||
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
|
||||
void ConstructProcess();
|
||||
public:
|
||||
Event() = default;
|
||||
virtual ~Event() = default;
|
||||
inline void SetEventNr(G4int i) { fEvtNum = i; }
|
||||
inline G4int GetEventNumber() const { return fEvtNum; }
|
||||
inline std::map<G4String, std::vector<G4VHit*>>* GetHCMap() { return &hcmap; }
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
G4int fEvtNum{ 0 };
|
||||
std::map<G4String, std::vector<G4VHit*>> hcmap; // map of Hit Collections
|
||||
};
|
||||
|
||||
|
||||
#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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file EventAction.hh
|
||||
/// \brief Definition of the CaTS::EventAction class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "G4UserEventAction.hh"
|
||||
class G4Event;
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
EventAction();
|
||||
~EventAction() = default;
|
||||
void BeginOfEventAction(const G4Event* anEvent) final;
|
||||
void EndOfEventAction(const G4Event* anEvent) final;
|
||||
|
||||
private:
|
||||
std::vector<std::string>& split(const std::string& s, char delim,
|
||||
std::vector<std::string>& elems);
|
||||
std::vector<std::string> split(const std::string& s, char delim);
|
||||
};
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file InteractionHit.hh
|
||||
/// \brief Definition of the CaTS::InteractionHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
|
||||
class InteractionHit : public G4VHit
|
||||
{
|
||||
private:
|
||||
G4String fpname{ "" }; // name of secondary particle
|
||||
G4double fpmom{ 0 }; // momentum of secondary particle
|
||||
G4double fEkin{ 0 }; // kinetic energy of secondary particle
|
||||
G4double ftheta{ 0 }; // theta of secondary particle
|
||||
public:
|
||||
InteractionHit();
|
||||
InteractionHit(G4String n, G4double m, G4double e, G4double t);
|
||||
~InteractionHit() = default;
|
||||
InteractionHit(const InteractionHit&);
|
||||
const InteractionHit& operator=(const InteractionHit&);
|
||||
G4int operator==(const InteractionHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "InteractionHit pname : " << fpname
|
||||
<< " momentum [GeV]: " << fpmom << " kinetic Energy [GeV]" << fEkin
|
||||
<< " theta: " << ftheta << G4endl;
|
||||
}
|
||||
inline void SetPname(G4String de) { fpname = de; };
|
||||
inline void SetPmom(G4double de) { fpmom = de; };
|
||||
inline void SetEkin(G4double de) { fEkin = de; };
|
||||
inline void SetTheta(G4double de) { ftheta = de; };
|
||||
inline G4String GetPname() { return fpname; };
|
||||
inline G4double GetPmom() { return fpmom; };
|
||||
inline G4double GetEkin() { return fEkin; };
|
||||
inline G4double GetTheta() { return ftheta; };
|
||||
};
|
||||
|
||||
using InteractionHitsCollection = G4THitsCollection<InteractionHit>;
|
||||
extern G4ThreadLocal G4Allocator<InteractionHit>* InteractionHitAllocator;
|
||||
|
||||
inline void* InteractionHit::operator new(size_t)
|
||||
{
|
||||
if(!InteractionHitAllocator)
|
||||
{
|
||||
InteractionHitAllocator = new G4Allocator<InteractionHit>;
|
||||
}
|
||||
return (void*) InteractionHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void InteractionHit::operator delete(void* aHit)
|
||||
{
|
||||
InteractionHitAllocator->FreeSingle((InteractionHit*) aHit);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file InteractionSD.hh
|
||||
/// \brief Definition of the CaTS::InteractionSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "InteractionHit.hh"
|
||||
class G4HCofThisEvent;
|
||||
class G4Step;
|
||||
class G4TouchableHistory;
|
||||
class ParticleChange;
|
||||
|
||||
class InteractionSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
InteractionSD(G4String);
|
||||
~InteractionSD();
|
||||
void Initialize(G4HCofThisEvent*);
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
|
||||
|
||||
private:
|
||||
G4int fHCID;
|
||||
ParticleChange* fFirstInter;
|
||||
ParticleChange* fOtherInter;
|
||||
InteractionHitsCollection* fInteractionHitsCollection;
|
||||
};
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file MscHit.hh
|
||||
/// \brief Definition of the CaTS::MscHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <G4Types.hh>
|
||||
#include <G4ios.hh>
|
||||
#include <ostream>
|
||||
#include <tls.hh>
|
||||
|
||||
class MscHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
MscHit();
|
||||
~MscHit() = default;
|
||||
MscHit(const MscHit&);
|
||||
const MscHit& operator=(const MscHit&);
|
||||
G4bool operator==(const MscHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "MscHit KinE: " << fkinE << " Px: " << fmomentum.getX()
|
||||
<< " Py: " << fmomentum.getY() << " Pz: " << fmomentum.getZ()
|
||||
<< G4endl;
|
||||
}
|
||||
MscHit(G4double kinE, G4ThreeVector momentum);
|
||||
inline void SetKinE(G4double kinE) { fkinE = kinE; };
|
||||
inline G4double GetKinE() const { return fkinE; };
|
||||
inline void SetMomentum(G4ThreeVector momentum) { fmomentum = momentum; };
|
||||
inline G4ThreeVector GetMomentum() const { return fmomentum; };
|
||||
|
||||
private:
|
||||
G4double fkinE{ 0 };
|
||||
G4ThreeVector fmomentum{ 0, 0, 0 };
|
||||
};
|
||||
|
||||
using MscHitsCollection = G4THitsCollection<MscHit>;
|
||||
extern G4ThreadLocal G4Allocator<MscHit>* MscHitAllocator;
|
||||
|
||||
inline void* MscHit::operator new(size_t)
|
||||
{
|
||||
if(!MscHitAllocator)
|
||||
{
|
||||
MscHitAllocator = new G4Allocator<MscHit>;
|
||||
}
|
||||
return (void*) MscHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void MscHit::operator delete(void* aHit)
|
||||
{
|
||||
MscHitAllocator->FreeSingle((MscHit*) aHit);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file MscSD.hh
|
||||
/// \brief Definition of the CaTS::MscSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "MscHit.hh"
|
||||
class G4HCofThisEvent;
|
||||
class G4Step;
|
||||
class G4TouchableHistory;
|
||||
|
||||
class MscSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
MscSD(G4String);
|
||||
~MscSD() = default;
|
||||
void Initialize(G4HCofThisEvent*) final;
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
MscHitsCollection* fMscHitsCollection{ nullptr };
|
||||
G4int fHCID{ 0 };
|
||||
G4bool verbose{ false };
|
||||
G4bool done{ false };
|
||||
};
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ParticleChange.hh
|
||||
/// \brief Definition of the CaTS::ParticleChange class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
class ParticleChange : public G4VParticleChange
|
||||
{
|
||||
public:
|
||||
ParticleChange()
|
||||
: fIsFirstInter(false)
|
||||
{}
|
||||
ParticleChange(G4bool isFirst)
|
||||
: fIsFirstInter(isFirst)
|
||||
{}
|
||||
virtual ~ParticleChange() {}
|
||||
|
||||
G4bool IsFisrtInteraction() const { return fIsFirstInter; }
|
||||
|
||||
private:
|
||||
G4bool fIsFirstInter;
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhotonHit.hh
|
||||
/// \brief Definition of the CaTS::PhotonHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class PhotonHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
PhotonHit();
|
||||
~PhotonHit() = default;
|
||||
PhotonHit(const PhotonHit&);
|
||||
const PhotonHit& operator=(const PhotonHit&);
|
||||
G4bool operator==(const PhotonHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "PhotonHit id: " << fid << " pid: " << fpid
|
||||
<< " wavelength: " << fwavelength << " time: " << ftime
|
||||
<< " position X: " << fposition.getX() << " Y: " << fposition.getY()
|
||||
<< " Z: " << fposition.getZ()
|
||||
<< " direction X: " << fdirection.getX()
|
||||
<< " Y: " << fdirection.getY() << " Z: " << fdirection.getZ()
|
||||
<< " polarization: X:" << fpolarization.getX()
|
||||
<< " Y: " << fpolarization.getY() << " Z: " << fpolarization.getZ()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
PhotonHit(unsigned id, unsigned pid, G4double wavelength, G4double time,
|
||||
G4ThreeVector position, G4ThreeVector direction,
|
||||
G4ThreeVector polarization);
|
||||
inline void SetWavelength(G4double wavelength) { fwavelength = wavelength; }
|
||||
inline G4double GetWavelength() { return fwavelength; }
|
||||
inline void SetPolarization(G4ThreeVector polarization)
|
||||
{
|
||||
fpolarization = polarization;
|
||||
}
|
||||
inline G4ThreeVector GetPolarization() const { return fpolarization; }
|
||||
inline void SetDirection(G4ThreeVector direction) { fdirection = direction; }
|
||||
inline G4ThreeVector GetDirection() const { return fdirection; }
|
||||
inline void SetPosition(G4ThreeVector position) { fposition = position; }
|
||||
inline G4ThreeVector GetPosition() const { return fposition; }
|
||||
inline void SetTime(G4double time) { ftime = time; }
|
||||
inline G4double GetTime() const { return ftime; }
|
||||
inline void SetPid(unsigned pid) { fpid = pid; }
|
||||
inline unsigned GetPid() const { return fpid; }
|
||||
inline void SetId(unsigned id) { fid = id; }
|
||||
inline unsigned GetId() const { return fid; }
|
||||
|
||||
private:
|
||||
unsigned int fid{ 0 };
|
||||
unsigned int fpid{ 0 };
|
||||
G4double fwavelength{ 0 };
|
||||
G4double ftime{ 0 };
|
||||
G4ThreeVector fposition{ 0, 0, 0 };
|
||||
G4ThreeVector fdirection{ 0, 0, 0 };
|
||||
G4ThreeVector fpolarization{ 0, 0, 0 };
|
||||
};
|
||||
|
||||
using PhotonHitsCollection = G4THitsCollection<PhotonHit>;
|
||||
extern G4ThreadLocal G4Allocator<PhotonHit>* PhotonHitAllocator;
|
||||
|
||||
inline void* PhotonHit::operator new(size_t)
|
||||
{
|
||||
if(!PhotonHitAllocator)
|
||||
{
|
||||
PhotonHitAllocator = new G4Allocator<PhotonHit>;
|
||||
}
|
||||
return (void*) PhotonHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void PhotonHit::operator delete(void* aHit)
|
||||
{
|
||||
PhotonHitAllocator->FreeSingle((PhotonHit*) aHit);
|
||||
}
|
||||
+46
-44
@@ -24,55 +24,57 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
// Class Description:
|
||||
// This class is an derived class of G4VPhysicsConstructor
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// -------------------------------------------
|
||||
// History
|
||||
// first version 12 Nov. 2000 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
#ifndef GammaRayTelGeneralPhysics_h
|
||||
#define GammaRayTelGeneralPhysics_h 1
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhotonSD.hh
|
||||
/// \brief Definition of the CaTS::PhotonSD class
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#pragma once
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "PhotonHit.hh"
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
class GammaRayTelGeneralPhysics : public G4VPhysicsConstructor
|
||||
class PhotonSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
GammaRayTelGeneralPhysics(const G4String& name = "general");
|
||||
virtual ~GammaRayTelGeneralPhysics();
|
||||
|
||||
public:
|
||||
// This method will be invoked in the Construct() method.
|
||||
// each particle type will be instantiated
|
||||
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();
|
||||
|
||||
protected:
|
||||
G4Decay fDecayProcess;
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
PhotonSD(G4String);
|
||||
~PhotonSD() = default;
|
||||
void Initialize(G4HCofThisEvent*) final;
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*) final;
|
||||
#ifdef WITH_G4OPTICKS
|
||||
void AddOpticksHits();
|
||||
#endif
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
PhotonHitsCollection* fPhotonHitsCollection{ 0 };
|
||||
G4int fHCID{ 0 };
|
||||
static constexpr G4double hc = (h_Planck * c_light) / (CLHEP::eV * CLHEP::nm);
|
||||
G4bool verbose{ false };
|
||||
inline G4double etolambda(G4double E)
|
||||
{
|
||||
// input photon energy in eV
|
||||
// return wavelength in nm:
|
||||
// lambda = h c/e
|
||||
//
|
||||
return hc / E;
|
||||
}
|
||||
};
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhysicsConfigurator.hh
|
||||
/// \brief Definition of the CaTS::PhysicsConfigurator class
|
||||
|
||||
#pragma once
|
||||
|
||||
class G4String;
|
||||
class G4VModularPhysicsList;
|
||||
|
||||
class PhysicsConfigurator
|
||||
{
|
||||
private:
|
||||
static PhysicsConfigurator* instance;
|
||||
|
||||
public:
|
||||
PhysicsConfigurator() = default;
|
||||
G4VModularPhysicsList* Construct(G4String physName);
|
||||
~PhysicsConfigurator() = default;
|
||||
static PhysicsConfigurator* getInstance();
|
||||
};
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the CaTS::PrimaryGeneratorAction class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include <G4String.hh>
|
||||
#include <G4ios.hh>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
class G4GenericMessenger;
|
||||
class G4VPrimaryGenerator;
|
||||
class G4Event;
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
virtual ~PrimaryGeneratorAction();
|
||||
void GeneratePrimaries(G4Event*) final;
|
||||
inline void SetGenerator(G4String genname)
|
||||
{
|
||||
std::map<G4String, G4VPrimaryGenerator*>::iterator pos =
|
||||
gentypeMap.find(genname);
|
||||
if(pos != gentypeMap.end())
|
||||
{
|
||||
fcurrentGenerator = pos->second;
|
||||
fcurrentGeneratorName = genname;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Primary Generator: " << genname << " is not a valid Option"
|
||||
<< G4endl;
|
||||
G4cout << "Valid Options are: ";
|
||||
#if(G4VERSION_NUMBER > 1072)
|
||||
for(auto [genType, generator] : gentypeMap)
|
||||
{
|
||||
G4cout << genType << " ";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
#else
|
||||
for(std::map<G4String, G4VPrimaryGenerator*>::iterator ii =
|
||||
gentypeMap.begin();
|
||||
ii != gentypeMap.end(); ++ii)
|
||||
{
|
||||
G4cout << (*ii).first << " ";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
inline G4VPrimaryGenerator* GetGenerator() const { return fcurrentGenerator; }
|
||||
inline G4String GetGeneratorName() const { return fcurrentGeneratorName; }
|
||||
inline void Print()
|
||||
{
|
||||
G4cout << "===================================================" << G4endl;
|
||||
G4cout << " Primary Generator: " << fcurrentGeneratorName << G4endl;
|
||||
G4cout << "===================================================" << G4endl;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Define UI commands: choice of primary generators
|
||||
void DefineCommands();
|
||||
G4VPrimaryGenerator* fcurrentGenerator = nullptr;
|
||||
G4String fcurrentGeneratorName{ "particleGun" };
|
||||
PrimaryGeneratorAction& operator=(const PrimaryGeneratorAction& right);
|
||||
PrimaryGeneratorAction(const PrimaryGeneratorAction&);
|
||||
std::map<G4String, G4VPrimaryGenerator*> gentypeMap;
|
||||
/// Pointer to the messenger for UI commands
|
||||
G4GenericMessenger* fMessenger = nullptr;
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RadiatorSD.hh
|
||||
/// \brief Definition of the CaTS::RadiatorSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4ScintillationTrackInformation.hh"
|
||||
#include <G4MaterialPropertyVector.hh>
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
class G4Step;
|
||||
class G4Material;
|
||||
class G4HCofThisEvent;
|
||||
class G4MaterialPropertiesTable;
|
||||
class G4PhysicsOrderedFreeVector;
|
||||
class G4PhysicsTable;
|
||||
class G4TouchableHistory;
|
||||
|
||||
class RadiatorSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
RadiatorSD(G4String name);
|
||||
virtual ~RadiatorSD() = default;
|
||||
// methods from base class
|
||||
void Initialize(G4HCofThisEvent* hitCollection) final;
|
||||
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
const G4Material* aMaterial;
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable;
|
||||
//
|
||||
// properties related to Scintillation
|
||||
//
|
||||
G4MaterialPropertyVector* Fast_Intensity;
|
||||
G4MaterialPropertyVector* Slow_Intensity;
|
||||
G4double YieldRatio; // slowerRatio,
|
||||
G4double FastTimeConstant; // TimeConstant,
|
||||
G4double SlowTimeConstant; // slowerTimeConstant,
|
||||
G4ScintillationType ScintillationType;
|
||||
//
|
||||
// properties related to Cerenkov
|
||||
//
|
||||
G4MaterialPropertyVector* Rindex;
|
||||
G4PhysicsOrderedFreeVector* CerenkovAngleIntegrals;
|
||||
const G4PhysicsTable* thePhysicsTable;
|
||||
G4double Pmin{ 0 };
|
||||
G4double Pmax{ 0 };
|
||||
G4double dp{ 0 };
|
||||
G4double nMax{ 0 };
|
||||
G4bool first{ true };
|
||||
G4bool verbose{ false };
|
||||
G4int tCphotons{ 0 };
|
||||
G4int tSphotons{ 0 };
|
||||
#ifdef WITH_G4OPTICKS
|
||||
//
|
||||
// info needed for generating Cerenkov photons on the GPU;
|
||||
//
|
||||
G4double maxCos{ 0.0 };
|
||||
G4double maxSin2{ 0.0 };
|
||||
G4double beta{ 0.0 };
|
||||
G4double beta1{ 0.0 };
|
||||
G4double beta2{ 0.0 };
|
||||
G4double BetaInverse{ 0.0 };
|
||||
G4double MeanNumberOfPhotons1{ 0.0 };
|
||||
G4double MeanNumberOfPhotons2{ 0.0 };
|
||||
G4int Sphotons{ 0 }; // number of scintillation photons this step
|
||||
G4int Cphotons{ 0 }; // number of Cerenkov photons this step
|
||||
const G4double ScintillationTime{ 0.0 };
|
||||
const G4int scntId{ 1 };
|
||||
#endif
|
||||
};
|
||||
+42
-33
@@ -24,44 +24,53 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
// Class Description:
|
||||
// This class is an derived class of G4VPhysicsConstructor
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// -------------------------------------------
|
||||
// History
|
||||
// first version 12 Nov. 2000 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
#ifndef GammaRayTelIonPhysics_h
|
||||
#define GammaRayTelIonPhysics_h 1
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RootIO.hh
|
||||
/// \brief Definition of the CaTS::RootIO class
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#ifdef WITH_ROOT
|
||||
#pragma once
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include "RtypesCore.h"
|
||||
#include <G4Types.hh>
|
||||
#include "G4ThreadLocalSingleton.hh"
|
||||
|
||||
class TFile;
|
||||
class TTree;
|
||||
class TBranch;
|
||||
class Event;
|
||||
|
||||
class GammaRayTelIonPhysics : public G4VPhysicsConstructor
|
||||
{
|
||||
public:
|
||||
GammaRayTelIonPhysics(const G4String& name="ion");
|
||||
virtual ~GammaRayTelIonPhysics();
|
||||
|
||||
public:
|
||||
// This method will be invoked in the Construct() method.
|
||||
// each particle type will be instantiated
|
||||
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();
|
||||
class RootIO {
|
||||
friend class G4ThreadLocalSingleton< RootIO >;
|
||||
public:
|
||||
virtual ~RootIO()= default;
|
||||
static RootIO* GetInstance();
|
||||
void Write(Event*);
|
||||
void Close();
|
||||
void Merge();
|
||||
protected:
|
||||
RootIO();
|
||||
|
||||
private:
|
||||
TFile* fFile{ nullptr };
|
||||
G4int fNevents{ 0 };
|
||||
TTree* ftree{ nullptr };
|
||||
TBranch* fevtbranch{ nullptr };
|
||||
Long64_t fnb{ 0 };
|
||||
G4bool fevtinitialized{ false };
|
||||
static G4ThreadLocal RootIO* fgInstance;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WITH_ROOT */
|
||||
+30
-18
@@ -24,23 +24,35 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - ULTRA experiment example
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
// Code developed by:
|
||||
// B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
|
||||
//
|
||||
// ****************************************************
|
||||
// * UltraAnalysisManager.hh
|
||||
// ****************************************************
|
||||
//
|
||||
// Class used for analysis procedures
|
||||
//
|
||||
#ifndef ULTRAANALYSISMANAGER_HH
|
||||
#define ULTRAANALYSISMANAGER_HH 1
|
||||
|
||||
#include "g4root.hh"
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RunAction.hh
|
||||
/// \brief Definition of the CaTS::RunAction class
|
||||
|
||||
#endif
|
||||
#pragma once
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
class G4Run;
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
private:
|
||||
G4bool geo_initialized{ false };
|
||||
|
||||
public:
|
||||
RunAction();
|
||||
void BeginOfRunAction(const G4Run* run) final;
|
||||
void EndOfRunAction(const G4Run* run) final;
|
||||
};
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file StackingAction.hh
|
||||
/// \brief Definition of the CaTS::StackingAction class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <G4ClassificationOfNewTrack.hh>
|
||||
#include <G4Types.hh>
|
||||
#include "G4UserStackingAction.hh"
|
||||
class G4Track;
|
||||
class G4GenericMessenger;
|
||||
|
||||
class StackingAction : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
StackingAction();
|
||||
~StackingAction();
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) final;
|
||||
void Print();
|
||||
|
||||
private:
|
||||
/// Define UI commands:
|
||||
void DefineCommands();
|
||||
G4bool fkillPi0{ false };
|
||||
G4bool fkilleta{ false };
|
||||
G4bool fkillGammafromnCapture{ false };
|
||||
/// Pointer to the messenger for UI commands
|
||||
G4GenericMessenger* fMessenger = nullptr;
|
||||
};
|
||||
+20
-15
@@ -23,28 +23,33 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRAnalysis.hh
|
||||
// Defining the file format of output histogram/n-tuple
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file TrackInfo.hh
|
||||
/// \brief Definition of the CaTS::TrackInfo class
|
||||
|
||||
#ifndef GRAnalysis_h
|
||||
#define GRAnalysis_h 1
|
||||
#pragma once
|
||||
|
||||
//#include "g4root.hh"
|
||||
#include "g4csv.hh"
|
||||
//#include "g4xml.hh"
|
||||
#include "G4VUserTrackInformation.hh"
|
||||
|
||||
#endif
|
||||
class TrackInfo : public G4VUserTrackInformation
|
||||
{
|
||||
public:
|
||||
TrackInfo(G4int photon_record_id_)
|
||||
: photon_record_id(photon_record_id_)
|
||||
{}
|
||||
G4int photon_record_id{ 0 };
|
||||
};
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file TrackerHit.hh
|
||||
/// \brief Definition of the CaTS::TrackerHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class TrackerHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
TrackerHit();
|
||||
~TrackerHit() = default;
|
||||
TrackerHit(const TrackerHit&);
|
||||
const TrackerHit& operator=(const TrackerHit&);
|
||||
G4bool operator==(const TrackerHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "TrackerHit id: " << fid << " Edep: " << fEdep
|
||||
<< " X: " << fposition.getX() << " Y: " << fposition.getY()
|
||||
<< " Z: " << fposition.getZ() << " time: " << ftime << G4endl;
|
||||
}
|
||||
|
||||
TrackerHit(G4double edep, G4ThreeVector position, G4double time);
|
||||
inline void SetEdep(G4double Edep) { fEdep = Edep; }
|
||||
inline G4double GetEdep() { return fEdep; }
|
||||
inline void SetTime(G4double time) { ftime = time; }
|
||||
inline G4double GetTime() const { return ftime; }
|
||||
inline void SetPosition(G4ThreeVector position) { fposition = position; }
|
||||
inline G4ThreeVector GetPosition() const { return fposition; }
|
||||
|
||||
private:
|
||||
G4int fid{ 0 };
|
||||
G4double fEdep{ 0 };
|
||||
G4ThreeVector fposition{ 0, 0, 0 };
|
||||
G4double ftime{ 0 };
|
||||
};
|
||||
|
||||
using TrackerHitsCollection = G4THitsCollection<TrackerHit>;
|
||||
extern G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator;
|
||||
|
||||
inline void* TrackerHit::operator new(size_t)
|
||||
{
|
||||
if(!TrackerHitAllocator)
|
||||
{
|
||||
TrackerHitAllocator = new G4Allocator<TrackerHit>;
|
||||
}
|
||||
return (void*) TrackerHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void TrackerHit::operator delete(void* aHit)
|
||||
{
|
||||
TrackerHitAllocator->FreeSingle((TrackerHit*) aHit);
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file TrackerSD.hh
|
||||
/// \brief Definition of the CaTS::TrackerSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "TrackerHit.hh"
|
||||
class G4HCofThisEvent;
|
||||
class G4Step;
|
||||
class G4TouchableHistory;
|
||||
|
||||
class TrackerSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
TrackerSD(G4String);
|
||||
~TrackerSD() = default;
|
||||
void Initialize(G4HCofThisEvent*) final;
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
TrackerHitsCollection* fTrackerHitsCollection{ nullptr };
|
||||
G4int fHCID{ 0 };
|
||||
G4bool verbose{ false };
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file lArTPCHit.hh
|
||||
/// \brief Definition of the CaTS::lArTPCHit class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
class lArTPCHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
lArTPCHit();
|
||||
~lArTPCHit() = default;
|
||||
lArTPCHit(G4double fe, G4double fx, G4double fy, G4double fz);
|
||||
lArTPCHit(const lArTPCHit&);
|
||||
const lArTPCHit& operator=(const lArTPCHit&);
|
||||
G4bool operator==(const lArTPCHit&) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
void Draw() final;
|
||||
inline void Print() final
|
||||
{
|
||||
G4cout << "lArTPCHit Nr. of electrons: " << fElectrons
|
||||
<< " x position [mm]: " << fPosX << " y position [mm]: " << fPosY
|
||||
<< " z position [mm]: " << fPosZ << G4endl;
|
||||
}
|
||||
|
||||
void SetElectrons(G4double de) { fElectrons = de; };
|
||||
void SetPosX(G4double x) { fPosX = x; };
|
||||
void SetPosY(G4double y) { fPosY = y; };
|
||||
void SetPosZ(G4double z) { fPosZ = z; };
|
||||
G4double GetEdep() { return fElectrons; };
|
||||
G4double GetPosX() { return fPosX; };
|
||||
G4double GetPosY() { return fPosY; };
|
||||
G4double GetPosZ() { return fPosZ; };
|
||||
|
||||
private:
|
||||
G4double fElectrons{ 0 };
|
||||
G4double fPosX{ 0 };
|
||||
G4double fPosY{ 0 };
|
||||
G4double fPosZ{ 0 };
|
||||
};
|
||||
|
||||
using lArTPCHitsCollection = G4THitsCollection<lArTPCHit>;
|
||||
extern G4ThreadLocal G4Allocator<lArTPCHit>* lArTPCHitAllocator;
|
||||
|
||||
inline void* lArTPCHit::operator new(size_t)
|
||||
{
|
||||
if(!lArTPCHitAllocator)
|
||||
{
|
||||
lArTPCHitAllocator = new G4Allocator<lArTPCHit>;
|
||||
}
|
||||
return (void*) lArTPCHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void lArTPCHit::operator delete(void* aHit)
|
||||
{
|
||||
lArTPCHitAllocator->FreeSingle((lArTPCHit*) aHit);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file lArTPCSD.hh
|
||||
/// \brief Definition of the CaTS::lArTPCSD class
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lArTPCHit.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4ScintillationTrackInformation.hh"
|
||||
#include <G4MaterialPropertyVector.hh>
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
class G4Material;
|
||||
class G4PhysicsTable;
|
||||
class G4TouchableHistory;
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4MaterialPropertiesTable;
|
||||
class G4PhysicsOrderedFreeVector;
|
||||
|
||||
class lArTPCSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
lArTPCSD(G4String name);
|
||||
virtual ~lArTPCSD() = default;
|
||||
void Initialize(G4HCofThisEvent* hitCollection) final;
|
||||
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history) final;
|
||||
void EndOfEvent(G4HCofThisEvent* hitCollection) final;
|
||||
|
||||
private:
|
||||
G4int materialIndex;
|
||||
const G4Material* aMaterial;
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable;
|
||||
//
|
||||
// properties related to Scintillation
|
||||
//
|
||||
G4MaterialPropertyVector* Fast_Intensity{ nullptr };
|
||||
G4MaterialPropertyVector* Slow_Intensity{ nullptr };
|
||||
G4double YieldRatio{ 0 }; // slowerRatio,
|
||||
G4double FastTimeConstant{ 0 }; // TimeConstant,
|
||||
G4double SlowTimeConstant{ 0 }; // slowerTimeConstant,
|
||||
G4ScintillationType ScintillationType;
|
||||
//
|
||||
// properties related to Cerenkov
|
||||
//
|
||||
G4MaterialPropertyVector* Rindex{ nullptr };
|
||||
G4PhysicsOrderedFreeVector* CerenkovAngleIntegrals{ nullptr };
|
||||
const G4PhysicsTable* thePhysicsTable{ 0 };
|
||||
G4double Pmin{ 0 };
|
||||
G4double Pmax{ 0 };
|
||||
G4double dp{ 0 };
|
||||
G4double nMax{ 0 };
|
||||
G4bool first{ false };
|
||||
G4bool verbose{ false };
|
||||
G4int tCphotons{ 0 };
|
||||
G4int tSphotons{ 0 };
|
||||
G4double NumElectrons(G4double e, G4double ds);
|
||||
lArTPCHitsCollection* flArTPCHitsCollection{ nullptr };
|
||||
G4int fHCID{ 0 };
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
# Macro file for initialization
|
||||
# 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 @@
|
||||
/CaTS/verbose false
|
||||
/CaTS/dumpgdml true
|
||||
/CaTS/writeHits true
|
||||
/CaTS/fname Msc
|
||||
/CaTS/enable_opticks false
|
||||
/run/initialize
|
||||
/CaTS/doAnalysis false
|
||||
/gun/particle proton
|
||||
/gun/energy 0.8 GeV
|
||||
/gun/position 0. 0. -1. cm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 100000
|
||||
@@ -0,0 +1,16 @@
|
||||
/CaTS/verbose false
|
||||
/process/had/verbose 0
|
||||
/run/initialize
|
||||
#
|
||||
/run/physicsModified
|
||||
#
|
||||
/run/initialize
|
||||
/random/setSeeds 7 38
|
||||
/CaTS/fname CaloHits
|
||||
/CaTS/writeHits true
|
||||
/CaTS/enable_opticks false
|
||||
/gun/particle pi+
|
||||
/gun/energy 10. GeV
|
||||
/gun/position 0. 0. -200. mm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 1000
|
||||
@@ -0,0 +1,23 @@
|
||||
/CaTS/verbose false
|
||||
/process/had/verbose 0
|
||||
/run/initialize
|
||||
#
|
||||
#
|
||||
#/process/optical/scintillation/setStackPhotons false
|
||||
#/process/optical/scintillation/verbose 0
|
||||
#
|
||||
# the Cerenkov process is needed even when we run on GPU (to get the number of photons to be produced) but we don't put optical photons on the stack
|
||||
#
|
||||
#
|
||||
/run/physicsModified
|
||||
#
|
||||
/run/initialize
|
||||
/random/setSeeds 7 38
|
||||
/CaTS/fname DRCaloHits
|
||||
/CaTS/writeHits true
|
||||
/CaTS/enable_opticks false
|
||||
/gun/particle pi+
|
||||
/gun/energy 10. GeV
|
||||
/gun/position 0. 0. -200. mm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 1000
|
||||
@@ -0,0 +1,18 @@
|
||||
/CaTS/verbose false
|
||||
/CaTS/dumpgdml false
|
||||
/CaTS/writeHits true
|
||||
/CaTS/fname Hits_G4_point
|
||||
/process/optical/scintillation/setStackPhotons true
|
||||
/process/optical/cerenkov/setStackPhotons true
|
||||
/process/optical/rayleigh/verbose 0
|
||||
/process/optical/absorption/verbose 0
|
||||
/process/optical/boundary/verbose 0
|
||||
/run/initialize
|
||||
/random/setSeeds 7 38
|
||||
/CaTS/enable_opticks false
|
||||
/CaTS/doAnalysis false
|
||||
/gun/particle e-
|
||||
/gun/energy 2 MeV
|
||||
/gun/position 0. 0. 0. cm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 100
|
||||
@@ -0,0 +1,25 @@
|
||||
/CaTS/verbose false
|
||||
/CaTS/dumpgdml true
|
||||
/CaTS/writeHits true
|
||||
/CaTS/fname NewHits_point
|
||||
/run/initialize
|
||||
#
|
||||
# the scintillation process is needed even when we run on GPU but we don't put optical photons on the stack
|
||||
#
|
||||
/process/optical/scintillation/setStackPhotons false
|
||||
#
|
||||
# the Cerenkov process is needed even when we run on GPU but we don't put optical photons on the stack
|
||||
#
|
||||
#/process/activate Cerenkov
|
||||
/process/optical/cerenkov/setStackPhotons false
|
||||
/process/optical/rayleigh/verbose 0
|
||||
/process/optical/absorption/verbose 0
|
||||
/process/optical/boundary/verbose 0
|
||||
/random/setSeeds 7 38
|
||||
/CaTS/enable_opticks true
|
||||
/CaTS/doAnalysis false
|
||||
/gun/particle e-
|
||||
/gun/energy 2 GeV
|
||||
/gun/position 0. 0. -105. cm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 100
|
||||
@@ -0,0 +1,19 @@
|
||||
/CaTS/verbose false
|
||||
/CaTS/dumpgdml true
|
||||
/CaTS/GDMLFileName dump.gdml
|
||||
/CaTS/writeHits true
|
||||
/CaTS/fname NewHits_G4_point
|
||||
/process/optical/scintillation/setStackPhotons true
|
||||
/process/optical/cerenkov/setStackPhotons true
|
||||
/process/optical/rayleigh/verbose 0
|
||||
/process/optical/absorption/verbose 0
|
||||
/process/optical/boundary/verbose 0
|
||||
/run/initialize
|
||||
/random/setSeeds 7 38
|
||||
/CaTS/enable_opticks false
|
||||
/CaTS/doAnalysis false
|
||||
/gun/particle e-
|
||||
/gun/energy 2 GeV
|
||||
/gun/position 0. 0. -105. cm
|
||||
/gun/direction 0. 0. 1.
|
||||
/run/beamOn 10
|
||||
@@ -0,0 +1,82 @@
|
||||
# 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 OIX
|
||||
#
|
||||
# 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. 180.
|
||||
#
|
||||
# Specify zoom value:
|
||||
#/vis/viewer/zoom 2.
|
||||
#
|
||||
# Specify style (surface, wireframe, auxiliary edges,...)
|
||||
#/vis/viewer/set/style wireframe
|
||||
/vis/viewer/set/auxiliaryEdge true
|
||||
#/vis/viewer/set/lineSegmentsPerCircle 100
|
||||
#
|
||||
# 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 true
|
||||
/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/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
|
||||
#
|
||||
# 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
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
# start from nothing, so repeated inclusion of this into CMake context doesnt repeat the flags
|
||||
set(CMAKE_CXX_FLAGS)
|
||||
|
||||
if(WIN32)
|
||||
|
||||
# need to detect compiler not os?
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W4") # overall warning level 4
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4996") # disable C4996: 'strdup': The POSIX name for this item is deprecated.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_ITERATOR_DEBUG_LEVEL=0")
|
||||
|
||||
|
||||
else(WIN32)
|
||||
|
||||
## c++11 forced by AsioZMQ : AsioZMQ not used here, but expect best to use same compiler options as far as possible
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") ## huh nvcc compilation fails with this ???
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -stdlib=libc++")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
else ()
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") #needed for numpyserver- on Linux ?
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
|
||||
endif ()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") ## avoid boostrap visibility warning at link
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-show-option")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
|
||||
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-comment")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow")
|
||||
endif()
|
||||
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
if(FLAGS_VERBOSE)
|
||||
# https://cmake.org/Wiki/CMake_Useful_Variables
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_FLAGS_RELWITHDEBINFO= ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD} " )
|
||||
message(STATUS "OpticksCompilationFlags.cmake : CMAKE_CXX_STANDARD_REQUIRED : ${CMAKE_CXX_STANDARD_REQUIRED} " )
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//* |\___/| *
|
||||
//* ) ( *
|
||||
//* =\ /= *
|
||||
//* )===( *
|
||||
//* / \ CaTS: Calorimeter and Tracker Simulation *
|
||||
//* | | is a flexible and extend-able framework *
|
||||
//* / \ for the simulation of various detector *
|
||||
//* \ / systems *
|
||||
//* \__ _/ https://github.com/hanswenzel/CaTS *
|
||||
//* ( ( *
|
||||
//* ) ) *
|
||||
//* (_( *
|
||||
//* CaTS also serves as an example that demonstrates how to use *
|
||||
//* opticks from within Geant4 for the creation and propagation of *
|
||||
//* optical photons. *
|
||||
//* see https://bitbucket.org/simoncblyth/opticks.git). *
|
||||
//* Ascii Art by Joan Stark: https://www.asciiworld.com/-Cats-2-.html *
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
/// \file readCalorimeterHits.cc
|
||||
/// \brief example how to read the CaTS::CalorimeterHits
|
||||
//
|
||||
// Root headers
|
||||
#include "TFile.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTree.h"
|
||||
#include "TH1.h"
|
||||
// project headers
|
||||
#include "Event.hh"
|
||||
#include "CalorimeterHit.hh"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libCaTSClassesDict");
|
||||
if(argc < 3)
|
||||
{
|
||||
G4cout
|
||||
<< "Program requires 2 arguments: name of input file, name of output file"
|
||||
<< G4endl;
|
||||
exit(1);
|
||||
}
|
||||
TFile* outfile = new TFile(argv[2], "RECREATE");
|
||||
TFile fo(argv[1]);
|
||||
fo.GetListOfKeys()->Print();
|
||||
Event* event = new Event();
|
||||
TTree* Tevt = (TTree*) fo.Get("Events");
|
||||
Tevt->SetBranchAddress("event.", &event);
|
||||
TBranch* fevtbranch = Tevt->GetBranch("event.");
|
||||
Int_t nevent = fevtbranch->GetEntries();
|
||||
std::cout << " Nr. of Events: " << nevent << std::endl;
|
||||
double max = 0.;
|
||||
double min = 1000000;
|
||||
std::string CollectionName = argv[3];
|
||||
CollectionName = CollectionName + "_Calorimeter_HC";
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
CalorimeterHit* drcaloHit =
|
||||
dynamic_cast<CalorimeterHit*>(hits.at(ii));
|
||||
const double ed = drcaloHit->GetEdep();
|
||||
if(ed > max)
|
||||
max = ed;
|
||||
if(ed < min)
|
||||
min = ed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile->cd();
|
||||
TH1F* hedep =
|
||||
new TH1F("energy", "edep", 100, min - 0.1 * min, max + 0.1 * max);
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
CalorimeterHit* drcaloHit =
|
||||
dynamic_cast<CalorimeterHit*>(hits.at(ii));
|
||||
hedep->Fill(drcaloHit->GetEdep());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// hedep->Fit("gaus");
|
||||
outfile->Write();
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//* |\___/| *
|
||||
//* ) ( *
|
||||
//* =\ /= *
|
||||
//* )===( *
|
||||
//* / \ CaTS: Calorimeter and Tracker Simulation *
|
||||
//* | | is a flexible and extend-able framework *
|
||||
//* / \ for the simulation of various detector *
|
||||
//* \ / systems *
|
||||
//* \__ _/ https://github.com/hanswenzel/CaTS *
|
||||
//* ( ( *
|
||||
//* ) ) *
|
||||
//* (_( *
|
||||
//* CaTS also serves as an example that demonstrates how to use *
|
||||
//* opticks from within Geant4 for the creation and propagation of *
|
||||
//* optical photons. *
|
||||
//* see https://bitbucket.org/simoncblyth/opticks.git). *
|
||||
//* Ascii Art by Joan Stark: https://www.asciiworld.com/-Cats-2-.html *
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
/// \file readDRCalorimeterHits.cc
|
||||
/// \brief example how to read the CaTS::DRCalorimeterHits
|
||||
//
|
||||
// Root headers
|
||||
#include "TFile.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTree.h"
|
||||
#include "TH1.h"
|
||||
// project headers
|
||||
#include "Event.hh"
|
||||
#include "DRCalorimeterHit.hh"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libCaTSClassesDict");
|
||||
if(argc < 4)
|
||||
{
|
||||
G4cout << "Program requires 3 arguments: name of input file, name of "
|
||||
"output file, Volume that sensitive detector is attached to"
|
||||
<< G4endl;
|
||||
exit(1);
|
||||
}
|
||||
TFile* outfile = new TFile(argv[2], "RECREATE");
|
||||
outfile->cd();
|
||||
TFile fo(argv[1]);
|
||||
fo.GetListOfKeys()->Print();
|
||||
Event* event = new Event();
|
||||
TTree* Tevt = (TTree*) fo.Get("Events");
|
||||
Tevt->SetBranchAddress("event.", &event);
|
||||
TBranch* fevtbranch = Tevt->GetBranch("event.");
|
||||
Int_t nevent = fevtbranch->GetEntries();
|
||||
G4cout << " Nr. of Events: " << nevent << G4endl;
|
||||
double max = 0.;
|
||||
double min = 1000000;
|
||||
double nmax = 0.;
|
||||
double nmin = 1000000000;
|
||||
std::string CollectionName = argv[3];
|
||||
CollectionName = CollectionName + "_DRCalorimeter_HC";
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
DRCalorimeterHit* drcaloHit =
|
||||
dynamic_cast<DRCalorimeterHit*>(hits.at(ii));
|
||||
const double ed = drcaloHit->GetEdep();
|
||||
if(ed > max)
|
||||
max = ed;
|
||||
if(ed < min)
|
||||
min = ed;
|
||||
const unsigned int nceren = drcaloHit->GetNceren();
|
||||
if(nceren > nmax)
|
||||
nmax = nceren;
|
||||
if(nceren < nmin)
|
||||
nmin = nceren;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile->cd();
|
||||
TH1F* hedep = new TH1F("energy", "edep", 100, min, max);
|
||||
TH1F* hnceren = new TH1F("nceren", "nceren", 100, nmin, nmax);
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
DRCalorimeterHit* drcaloHit =
|
||||
dynamic_cast<DRCalorimeterHit*>(hits.at(ii));
|
||||
hedep->Fill(drcaloHit->GetEdep());
|
||||
hnceren->Fill(drcaloHit->GetNceren());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// hedep->Fit("gaus");
|
||||
// hnceren->Fit("gaus");
|
||||
outfile->Write();
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//* |\___/| *
|
||||
//* ) ( *
|
||||
//* =\ /= *
|
||||
//* )===( *
|
||||
//* / \ CaTS: Calorimeter and Tracker Simulation *
|
||||
//* | | is a flexible and extend-able framework *
|
||||
//* / \ for the simulation of various detector *
|
||||
//* \ / systems *
|
||||
//* \__ _/ https://github.com/hanswenzel/CaTS *
|
||||
//* ( ( *
|
||||
//* ) ) *
|
||||
//* (_( *
|
||||
//* CaTS also serves as an example that demonstrates how to use *
|
||||
//* opticks from within Geant4 for the creation and propagation of *
|
||||
//* optical photons. *
|
||||
//* see https://bitbucket.org/simoncblyth/opticks.git). *
|
||||
//* Ascii Art by Joan Stark: https://www.asciiworld.com/-Cats-2-.html *
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
/// \file readMscHits.cc
|
||||
/// \brief example how to read the CaTS::MscHits
|
||||
//
|
||||
// Root headers
|
||||
#include "TFile.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTree.h"
|
||||
#include "TH1.h"
|
||||
#include <string>
|
||||
// project headers
|
||||
#include "Event.hh"
|
||||
#include "MscHit.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libCaTSClassesDict");
|
||||
if(argc < 4)
|
||||
{
|
||||
G4cout << "Program requires 3 arguments: name of input file, name of "
|
||||
"output file, Volume that sensitive detector is attached to"
|
||||
<< G4endl;
|
||||
exit(1);
|
||||
}
|
||||
TFile* outfile = new TFile(argv[2], "RECREATE");
|
||||
TFile fo(argv[1]);
|
||||
Event* event = new Event();
|
||||
TTree* Tevt = (TTree*) fo.Get("Events");
|
||||
Tevt->SetBranchAddress("event.", &event);
|
||||
TBranch* fevtbranch = Tevt->GetBranch("event.");
|
||||
Int_t nevent = fevtbranch->GetEntries();
|
||||
outfile->cd();
|
||||
TH1F* theta = new TH1F("angle", "angle", 100, 0.0, 0.15);
|
||||
std::string CollectionName = argv[3];
|
||||
CollectionName = CollectionName + "_Msc_HC";
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
MscHit* mscHit = dynamic_cast<MscHit*>(hits.at(ii));
|
||||
G4ThreeVector invec(0, 0, 1.);
|
||||
std::cout << std::setprecision(12) << mscHit->GetKinE() << " "
|
||||
<< std::setprecision(12) << mscHit->GetMomentum().getX()
|
||||
<< " " << std::setprecision(12)
|
||||
<< mscHit->GetMomentum().getY() << " "
|
||||
<< std::setprecision(12) << mscHit->GetMomentum().getZ()
|
||||
<< std::endl;
|
||||
theta->Fill(invec.angle(mscHit->GetMomentum()) * 57.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile->Write();
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//* |\___/| *
|
||||
//* ) ( *
|
||||
//* =\ /= *
|
||||
//* )===( *
|
||||
//* / \ CaTS: Calorimeter and Tracker Simulation *
|
||||
//* | | is a flexible and extend-able framework *
|
||||
//* / \ for the simulation of various detector *
|
||||
//* \ / systems *
|
||||
//* \__ _/ https://github.com/hanswenzel/CaTS *
|
||||
//* ( ( *
|
||||
//* ) ) *
|
||||
//* (_( *
|
||||
//* CaTS also serves as an example that demonstrates how to use *
|
||||
//* opticks from within Geant4 for the creation and propagation of *
|
||||
//* optical photons. *
|
||||
//* see https://bitbucket.org/simoncblyth/opticks.git). *
|
||||
//* Ascii Art by Joan Stark: https://www.asciiworld.com/-Cats-2-.html *
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
/// \file readPhotonHits.cc
|
||||
/// \brief example how to read the CaTS::PhotonHits
|
||||
//
|
||||
// Root headers
|
||||
#include "TFile.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTree.h"
|
||||
#include "TH1.h"
|
||||
#include "TH2.h"
|
||||
// Project headers
|
||||
#include "Event.hh"
|
||||
#include "lArTPCHit.hh"
|
||||
#include "PhotonHit.hh"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libCaTSClassesDict");
|
||||
if(argc < 4)
|
||||
{
|
||||
G4cout << "Program requires 3 arguments: name of input file, name of "
|
||||
"output file, Volume that sensitive detector is attached to"
|
||||
<< G4endl;
|
||||
exit(1);
|
||||
}
|
||||
TFile* outfile = new TFile(argv[2], "RECREATE");
|
||||
outfile->cd();
|
||||
TH2F* pos2 = new TH2F("position", "position of Photon Hits", 400, -1000.,
|
||||
1000., 400, -500, 500);
|
||||
TH1F* time = new TH1F("time", "timing of photon hits", 1000, 0., 250.);
|
||||
TH1F* time0 = new TH1F("time0", "timing of photon hits", 1000, 0., 250.);
|
||||
TH1F* time1 = new TH1F("time1", "timing of photon hits", 1000, 0., 250.);
|
||||
TH1F* time2 = new TH1F("time2", "timing of photon hits", 1000, 0., 250.);
|
||||
TH1F* wl = new TH1F("wl", "wavelength of detected photons", 1000, 0., 250.);
|
||||
TH1F* np = new TH1F("np", "number of detected photons", 100, 0., 50.);
|
||||
TFile fo(argv[1]);
|
||||
fo.GetListOfKeys()->Print();
|
||||
Event* event = new Event();
|
||||
TTree* Tevt = (TTree*) fo.Get("Events");
|
||||
Tevt->SetBranchAddress("event.", &event);
|
||||
TBranch* fevtbranch = Tevt->GetBranch("event.");
|
||||
Int_t nevent = fevtbranch->GetEntries();
|
||||
G4cout << "Nr. of Events: " << nevent << G4endl;
|
||||
std::string CollectionName = argv[3];
|
||||
CollectionName = CollectionName + "_Photondetector_HC";
|
||||
for(Int_t i = 0; i < nevent; i++)
|
||||
{
|
||||
fevtbranch->GetEntry(i);
|
||||
auto* hcmap = event->GetHCMap();
|
||||
for(const auto& ele : *hcmap)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
if(ele.first.compare(CollectionName) == 0)
|
||||
{
|
||||
auto hits = ele.second;
|
||||
G4int NbHits = hits.size();
|
||||
G4cout << "Event: " << i << " Number of Hits: " << NbHits << G4endl;
|
||||
np->Fill(NbHits);
|
||||
for(G4int ii = 0; ii < NbHits; ii++)
|
||||
{
|
||||
PhotonHit* photonHit = dynamic_cast<PhotonHit*>(hits.at(ii));
|
||||
time->Fill(photonHit->GetTime());
|
||||
wl->Fill(photonHit->GetWavelength());
|
||||
if(photonHit->GetPosition().getZ() < -100.)
|
||||
time0->Fill(photonHit->GetTime());
|
||||
if(photonHit->GetPosition().getZ() > -100. &&
|
||||
photonHit->GetPosition().getZ() < 100)
|
||||
time1->Fill(photonHit->GetTime());
|
||||
if(photonHit->GetPosition().getZ() < 100.)
|
||||
time2->Fill(photonHit->GetTime());
|
||||
pos2->Fill(photonHit->GetPosition().getZ(),
|
||||
photonHit->GetPosition().getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile->cd();
|
||||
outfile->Write();
|
||||
}
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash -l
|
||||
msg="=== $BASH_SOURCE :"
|
||||
|
||||
info(){ cat << EOI
|
||||
$msg checking the environment
|
||||
OPTICKS_HOME : $OPTICKS_HOME
|
||||
CMAKE_PREFIX_PATH :
|
||||
$(echo $CMAKE_PREFIX_PATH | tr ":" "\n")
|
||||
The CMAKE_PREFIX_PATH is expected to contain about seven prefix directories including::
|
||||
OPTICKS_PREFIX : $OPTICKS_PREFIX
|
||||
OPTICKS_PREFIX/externals : $OPTICKS_PREFIX/externals
|
||||
Note that environment setup must be done in login scripts : .bashrc .bash_profile .opticks_config etc..
|
||||
Doing environment setup just in the current session will not work as scripts often invoke login scripts.
|
||||
EOI
|
||||
}
|
||||
|
||||
rc=0
|
||||
if [ -z "$OPTICKS_HOME" -o -z "$OPTICKS_PREFIX" -o -z "$CMAKE_PREFIX_PATH" ]; then
|
||||
echo $msg missing required envvars : your need to source .opticks_config
|
||||
rc=1
|
||||
fi
|
||||
if [ "$CMAKE_PREFIX_PATH" == ${CMAKE_PREFIX_PATH/$OPTICKS_PREFIX:/} ]; then
|
||||
echo $msg CMAKE_PREFIX_PATH does not contain the expected prefix : $OPTICKS_PREFIX : you need to invoke opticks-setup from .opticks_config
|
||||
rc=2
|
||||
fi
|
||||
if [ "$CMAKE_PREFIX_PATH" == ${CMAKE_PREFIX_PATH/$OPTICKS_PREFIX\/externals\:/} ]; then
|
||||
echo $msg CMAKE_PREFIX_PATH does not contain the expected prefix : $OPTICKS_PREFIX/externals : you need to invoke opticks-setup from .opticks_config
|
||||
rc=3
|
||||
fi
|
||||
|
||||
if [ $rc -ne 0 ]; then
|
||||
info
|
||||
echo $msg environment check FAILED : rc $rc
|
||||
else
|
||||
[ -n "$VERBOSE" ] && info
|
||||
echo $msg environment check PASSED : rc $rc
|
||||
fi
|
||||
exit $rc
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
# Python program explaining
|
||||
# load() function
|
||||
|
||||
import numpy as geek
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
b = geek.load('hits.npy')
|
||||
|
||||
print("size of b is:",b.size)
|
||||
print("shape of b is:",b.shape)
|
||||
print("ndim of b is:",b.ndim)
|
||||
print(b)
|
||||
print(b[0,0,0])
|
||||
print(b[0,3,0])
|
||||
print("b is printed from hits.npy")
|
||||
x = b[:,0,0]
|
||||
y = b[:,0,1]
|
||||
z = b[:,0,2]
|
||||
lamb = b[:,2,3]
|
||||
print(x.shape)
|
||||
print(y.shape)
|
||||
print(lamb.shape)
|
||||
|
||||
#axs = plt.subplots(2, 2, figsize=(5, 5))
|
||||
plt.subplot(131)
|
||||
plt.ylabel('#Photons')
|
||||
plt.xlabel('x-position/mm')
|
||||
plt.hist(x,50,(-200,200.))
|
||||
plt.subplot(132)
|
||||
plt.xlabel('x-position/mm')
|
||||
plt.ylabel('y-position/mm')
|
||||
plt.scatter(x, y)
|
||||
plt.subplot(133)
|
||||
plt.xlabel('lambda/nm')
|
||||
plt.ylabel('#Photons')
|
||||
plt.hist(lamb,50,(50,800.))
|
||||
#plt.hist(z)
|
||||
plt.show()
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash -l
|
||||
msg="=== $BASH_SOURCE :"
|
||||
|
||||
./check.sh
|
||||
[ $? -ne 0 ] && echo $msg check failed && exit 1
|
||||
|
||||
extra_logging(){
|
||||
# switch on extra logging for these classes
|
||||
export G4Opticks=INFO
|
||||
export OpMgr=INFO
|
||||
export OpPropagator=INFO
|
||||
export OpEngine=INFO
|
||||
export OScene=INFO
|
||||
export OEvent=INFO
|
||||
export OSensorLib=INFO
|
||||
}
|
||||
#extra_logging
|
||||
|
||||
genstep_skips(){
|
||||
# from okc:OpticksGentep.h
|
||||
local OpticksGenstep_G4Cerenkov_1042=1
|
||||
local OpticksGenstep_G4Scintillation_1042=2
|
||||
local OpticksGenstep_DsG4Cerenkov_r3971=3
|
||||
local OpticksGenstep_DsG4Scintillation_r3971=4
|
||||
local OpticksGenstep_TORCH=5
|
||||
# uncomment one of the below to skip cerenkov OR scintillation gensteps at G4Opticks collection
|
||||
#export OPTICKS_SKIP_GENCODE=${OpticksGenstep_G4Cerenkov_1042},${OpticksGenstep_DsG4Cerenkov_r3971}
|
||||
#export OPTICKS_SKIP_GENCODE=${OpticksGenstep_G4Scintillation_1042},${OpticksGenstep_DsG4Scintillation_r3971}
|
||||
}
|
||||
genstep_skips
|
||||
|
||||
|
||||
# defines the embedded commandline picking between production and devlopment(with lots of .npy saves)
|
||||
#export OPTICKS_EMBEDDED_COMMANDLINE="dev"
|
||||
export OPTICKS_EMBEDDED_COMMANDLINE="pro"
|
||||
|
||||
# appends to the embedded commandline
|
||||
#export OPTICKS_EMBEDDED_COMMANDLINE_EXTRA="--rngmax 10 --trivial" # trivial changes the generate.cu kernel
|
||||
export OPTICKS_EMBEDDED_COMMANDLINE_EXTRA="--rngmax 100"
|
||||
|
||||
|
||||
#SY=50
|
||||
#SY=100
|
||||
SY=5000
|
||||
#SY=10000
|
||||
#SY=50000
|
||||
|
||||
cmd="CaTS $PWD/gdml/G4Opticks_$SY.gdml macros/muon_noIO.mac"
|
||||
#cmd="gdb -ex r --args $cmd" # uncomment to run under debugger
|
||||
|
||||
echo $cmd
|
||||
eval $cmd
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the CaTS::ActionInitialization class
|
||||
|
||||
// Geant4 headers
|
||||
#include <G4VUserActionInitialization.hh>
|
||||
// project headers
|
||||
#include "ActionInitialization.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "StackingAction.hh"
|
||||
|
||||
|
||||
ActionInitialization::ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new RunAction);
|
||||
}
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new PrimaryGeneratorAction());
|
||||
SetUserAction(new StackingAction());
|
||||
SetUserAction(new EventAction());
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CalorimeterHit.cc
|
||||
/// \brief Implementation of the CaTS::CalorimeterHit class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
// project headers
|
||||
#include "CalorimeterHit.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
G4ThreadLocal G4Allocator<CalorimeterHit>* CalorimeterHitAllocator = nullptr;
|
||||
|
||||
CalorimeterHit::CalorimeterHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
|
||||
CalorimeterHit::CalorimeterHit(unsigned i, G4double e, G4double em, G4double t,
|
||||
G4ThreeVector p)
|
||||
: G4VHit()
|
||||
{
|
||||
fid = i;
|
||||
fEdep = e;
|
||||
fem_Edep = em;
|
||||
ftime = t;
|
||||
fposition = p;
|
||||
}
|
||||
|
||||
CalorimeterHit::CalorimeterHit(const CalorimeterHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
// No need to call class member functions via this->
|
||||
fid = right.fid;
|
||||
fEdep = right.fEdep;
|
||||
fem_Edep = right.fem_Edep;
|
||||
ftime = right.ftime;
|
||||
fposition = right.fposition;
|
||||
}
|
||||
|
||||
const CalorimeterHit& CalorimeterHit::operator=(const CalorimeterHit& right)
|
||||
{
|
||||
// No need to call class member functions via this->
|
||||
fid = right.fid;
|
||||
fEdep = right.fEdep;
|
||||
fem_Edep = right.fem_Edep;
|
||||
ftime = right.ftime;
|
||||
fposition = right.fposition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool CalorimeterHit::operator==(const CalorimeterHit& right) const
|
||||
{
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
void CalorimeterHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(fposition);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file CalorimeterSD.cc
|
||||
/// \brief Implementation of the CaTS::CalorimeterSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
// project headers
|
||||
#include "CalorimeterSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
CalorimeterSD::CalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " CalorimeterSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
void CalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fCalorimeterHitsCollection =
|
||||
new CalorimeterHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, fCalorimeterHitsCollection);
|
||||
}
|
||||
|
||||
G4bool CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
// auto can be used for all results from retrieving functions
|
||||
auto edep = aStep->GetTotalEnergyDeposit() / CLHEP::MeV;
|
||||
if(edep == 0.)
|
||||
return false;
|
||||
auto time = aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::ns;
|
||||
auto touch = aStep->GetPreStepPoint()->GetTouchable();
|
||||
auto cellpos = touch->GetTranslation();
|
||||
unsigned int ID = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetCopyNo();
|
||||
auto theTrack = aStep->GetTrack();
|
||||
auto particleType = theTrack->GetDefinition()->GetParticleName();
|
||||
//
|
||||
// check if this cell has been hit before
|
||||
// fCalorimeterHitsCollection
|
||||
for(unsigned int j = 0; j < fCalorimeterHitsCollection->entries(); j++)
|
||||
{
|
||||
CalorimeterHit* aPreviousHit = (*fCalorimeterHitsCollection)[j];
|
||||
if(ID == aPreviousHit->GetId())
|
||||
{
|
||||
aPreviousHit->SetEdep(aStep->GetTotalEnergyDeposit() +
|
||||
aPreviousHit->GetEdep());
|
||||
if((particleType == "e+") || (particleType == "gamma") ||
|
||||
(particleType == "e-"))
|
||||
{
|
||||
aPreviousHit->Setem_Edep(edep + aPreviousHit->Getem_Edep());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//
|
||||
// otherwise create a new hit:
|
||||
//
|
||||
CalorimeterHit* newHit;
|
||||
if((particleType == "e+") || (particleType == "gamma") ||
|
||||
(particleType == "e-"))
|
||||
{
|
||||
newHit = new CalorimeterHit(ID, edep, edep, time, cellpos);
|
||||
}
|
||||
else
|
||||
{
|
||||
newHit = new CalorimeterHit(ID, edep, 0.0, time, cellpos);
|
||||
}
|
||||
fCalorimeterHitsCollection->insert(newHit);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalorimeterSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = fCalorimeterHitsCollection->entries();
|
||||
if(verbose)
|
||||
G4cout << " Number of CalorimeterHits: " << NbHits << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ColorReader.cc
|
||||
/// \brief extending gdml reader to deal with colors and visualization attributes
|
||||
//
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
// project headers
|
||||
#include "ColorReader.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
ColorReader::ColorReader()
|
||||
: G4GDMLReadStructure()
|
||||
{}
|
||||
|
||||
ColorReader::~ColorReader()
|
||||
{
|
||||
#if(G4VERSION_NUMBER > 1072)
|
||||
for(auto [name, attribute] : fAttribs)
|
||||
{
|
||||
delete attribute;
|
||||
}
|
||||
#else
|
||||
std::map<G4String, G4VisAttributes*>::iterator pos;
|
||||
for(pos = fAttribs.begin(); pos != fAttribs.end(); pos++)
|
||||
{
|
||||
delete pos->second;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ColorReader::ExtensionRead(const xercesc::DOMElement* const extElement)
|
||||
{
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "ColorReaderReading GDML extension..." << G4endl;
|
||||
G4cout << "ColorReader: Reading new GDML extension..." << G4endl;
|
||||
}
|
||||
for(xercesc::DOMNode* iter = extElement->getFirstChild(); iter != 0;
|
||||
iter = iter->getNextSibling())
|
||||
{
|
||||
if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const xercesc::DOMElement* const child =
|
||||
dynamic_cast<xercesc::DOMElement*>(iter);
|
||||
const G4String tag = Transcode(child->getTagName());
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML:" << tag << G4endl;
|
||||
}
|
||||
if(tag == "color")
|
||||
{
|
||||
ColorRead(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String error_msg = "Unknown tag in structure: " + tag;
|
||||
G4Exception("ColorReader::ExtensionRead()", "ReadError", FatalException,
|
||||
error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ColorReader::VolumeRead(const xercesc::DOMElement* const volumeElement)
|
||||
{
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML: VolumeRead" << G4endl;
|
||||
}
|
||||
G4VSolid* solidPtr = 0;
|
||||
G4Material* materialPtr = 0;
|
||||
G4VisAttributes* attrPtr = 0;
|
||||
G4GDMLAuxListType auxList;
|
||||
XMLCh* name_attr = xercesc::XMLString::transcode("name");
|
||||
const G4String name = Transcode(volumeElement->getAttribute(name_attr));
|
||||
xercesc::XMLString::release(&name_attr);
|
||||
for(xercesc::DOMNode* iter = volumeElement->getFirstChild(); iter != 0;
|
||||
iter = iter->getNextSibling())
|
||||
{
|
||||
if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const xercesc::DOMElement* const child =
|
||||
dynamic_cast<xercesc::DOMElement*>(iter);
|
||||
const G4String tag = Transcode(child->getTagName());
|
||||
if(tag == "auxiliary")
|
||||
{
|
||||
auxList.push_back(AuxiliaryRead(child));
|
||||
}
|
||||
else if(tag == "materialref")
|
||||
{
|
||||
materialPtr = GetMaterial(GenerateName(RefRead(child), true));
|
||||
}
|
||||
else if(tag == "solidref")
|
||||
{
|
||||
solidPtr = GetSolid(GenerateName(RefRead(child)));
|
||||
}
|
||||
else if(tag == "colorref")
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML: found visual attribute ..." << G4endl;
|
||||
}
|
||||
attrPtr = GetVisAttribute(GenerateName(RefRead(child)));
|
||||
}
|
||||
}
|
||||
pMotherLogical =
|
||||
new G4LogicalVolume(solidPtr, materialPtr, GenerateName(name), 0, 0, 0);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML: attaching visual attribute ..." << G4endl;
|
||||
}
|
||||
pMotherLogical->SetVisAttributes(attrPtr);
|
||||
if(!auxList.empty())
|
||||
{
|
||||
auxMap[pMotherLogical] = auxList;
|
||||
}
|
||||
Volume_contentRead(volumeElement);
|
||||
}
|
||||
|
||||
void ColorReader::ColorRead(const xercesc::DOMElement* const colorElement)
|
||||
{
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML: ColorRead" << G4endl;
|
||||
}
|
||||
G4String name;
|
||||
G4VisAttributes* color = 0;
|
||||
G4double r = 0., g = 0., b = 0., a = 0.;
|
||||
const xercesc::DOMNamedNodeMap* const attributes =
|
||||
colorElement->getAttributes();
|
||||
XMLSize_t attributeCount = attributes->getLength();
|
||||
for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
|
||||
attribute_index++)
|
||||
{
|
||||
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
||||
if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const xercesc::DOMAttr* const attribute =
|
||||
dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
if(attName == "name")
|
||||
{
|
||||
name = GenerateName(attValue);
|
||||
}
|
||||
else if(attName == "R")
|
||||
{
|
||||
r = eval.Evaluate(attValue);
|
||||
}
|
||||
else if(attName == "G")
|
||||
{
|
||||
g = eval.Evaluate(attValue);
|
||||
}
|
||||
else if(attName == "B")
|
||||
{
|
||||
b = eval.Evaluate(attValue);
|
||||
}
|
||||
else if(attName == "A")
|
||||
{
|
||||
a = eval.Evaluate(attValue);
|
||||
}
|
||||
}
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Color attribute (R,G,B,A) is: " << r << ", " << g << ", " << b
|
||||
<< ", " << a << " !" << G4endl;
|
||||
}
|
||||
color = new G4VisAttributes(G4Color(r, g, b, a));
|
||||
fAttribs.insert(std::make_pair(name, color));
|
||||
}
|
||||
|
||||
G4VisAttributes* ColorReader::GetVisAttribute(const G4String& ref)
|
||||
{
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "G4GDML: GetVisAttribute" << G4endl;
|
||||
}
|
||||
G4VisAttributes* col = 0;
|
||||
std::map<G4String, G4VisAttributes*>::iterator pos = fAttribs.find(ref);
|
||||
if(pos != fAttribs.end())
|
||||
{
|
||||
col = pos->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String err_mess = "Attribute: " + ref + " NOT found !";
|
||||
G4Exception("ColorReader::GetVisAttribute()", "ReadError", FatalException,
|
||||
err_mess);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file ConfigurationManager.cc
|
||||
/// \brief Implementation of the CaTS::ConfigurationManager class
|
||||
|
||||
// Geant4 headers
|
||||
#include <G4ios.hh>
|
||||
#include "G4GenericMessenger.hh"
|
||||
// project headers
|
||||
#include "ConfigurationManager.hh"
|
||||
// c++ headers
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
ConfigurationManager* ConfigurationManager::fginstance = nullptr;
|
||||
std::once_flag ConfigurationManager::fginitInstanceFlag;
|
||||
|
||||
ConfigurationManager::ConfigurationManager() { DefineCommands(); }
|
||||
|
||||
ConfigurationManager::~ConfigurationManager() { delete fMessenger; }
|
||||
|
||||
void ConfigurationManager::Print()
|
||||
{
|
||||
G4cout << "--------------------------------------------------" << G4endl;
|
||||
G4cout << "CaTS configuration: " << G4endl;
|
||||
G4cout << "====================" << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << "fenable_verbose: " << fenable_verbose << G4endl;
|
||||
G4cout << "fdumpgdml: " << fdumpgdml << G4endl;
|
||||
G4cout << "fGDMLFileName: " << fGDMLFileName << G4endl;
|
||||
#ifdef WITH_ROOT
|
||||
G4cout << "fdoAnalysis: " << fdoAnalysis << G4endl;
|
||||
G4cout << "fHistoFileName: " << fHistoFileName << G4endl;
|
||||
G4cout << "fwriteHits: " << fwriteHits << G4endl;
|
||||
G4cout << "fname: " << fname << G4endl;
|
||||
#endif
|
||||
G4cout << "fenable_opticks: " << fenable_opticks << G4endl;
|
||||
G4cout << "fMaxPhotons: " << fMaxPhotons << G4endl;
|
||||
G4cout << "--------------------------------------------------" << G4endl;
|
||||
}
|
||||
|
||||
void ConfigurationManager::DefineCommands()
|
||||
{
|
||||
fMessenger = new G4GenericMessenger(this, "/CaTS/", "Configuring CaTS");
|
||||
//
|
||||
// Commands defining RootIO
|
||||
#ifdef WITH_ROOT
|
||||
auto& HistoFileNameCmd =
|
||||
fMessenger->DeclareProperty("HistoFileName", fHistoFileName);
|
||||
HistoFileNameCmd.SetGuidance("Filename for Analysis Histograms");
|
||||
HistoFileNameCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
HistoFileNameCmd.SetDefaultValue("histograms.root");
|
||||
auto& writeHitsCmd = fMessenger->DeclareProperty("writeHits", fwriteHits);
|
||||
writeHitsCmd.SetGuidance("Write out Hits collection");
|
||||
writeHitsCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
writeHitsCmd.SetDefaultValue("false");
|
||||
auto& doAnalysisCmd = fMessenger->DeclareProperty("doAnalysis", fdoAnalysis);
|
||||
doAnalysisCmd.SetGuidance("Do Analysis");
|
||||
doAnalysisCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
doAnalysisCmd.SetDefaultValue("false");
|
||||
auto& fnameCmd = fMessenger->DeclareProperty("fname", fname);
|
||||
fnameCmd.SetGuidance("set fname");
|
||||
fnameCmd.SetStates(G4State_PreInit);
|
||||
fnameCmd.SetDefaultValue("Hits");
|
||||
#endif
|
||||
//
|
||||
// Commands enabling G4Opticks and frequency calling it:
|
||||
//
|
||||
auto& enable_opticksCmd =
|
||||
fMessenger->DeclareProperty("enable_opticks", fenable_opticks);
|
||||
enable_opticksCmd.SetGuidance(
|
||||
"use opticks for generating and tracing of optical photons");
|
||||
enable_opticksCmd.SetDefaultValue("false");
|
||||
enable_opticksCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
auto& MaxPhotonsCmd = fMessenger->DeclareProperty("MaxPhotons", fMaxPhotons);
|
||||
MaxPhotonsCmd.SetGuidance(
|
||||
"set number of photons to be collecetd befores invoking G4Opticks");
|
||||
MaxPhotonsCmd.SetDefaultValue("1000000");
|
||||
MaxPhotonsCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
//
|
||||
// general command to control verbosity and writing out geometry to a gdml
|
||||
// file:
|
||||
//
|
||||
fMessenger->DeclareMethod("list", &ConfigurationManager::Print)
|
||||
.SetGuidance("Print all configuration parameters")
|
||||
.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
auto& verboseCmd = fMessenger->DeclareProperty("verbose", fenable_verbose);
|
||||
verboseCmd.SetGuidance("Set flag for enabling verbose diagnostic printout");
|
||||
verboseCmd.SetDefaultValue("false");
|
||||
verboseCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
auto& GDMLFileNameCmd =
|
||||
fMessenger->DeclareProperty("GDMLFileName", fGDMLFileName);
|
||||
GDMLFileNameCmd.SetGuidance(
|
||||
"Set Filename to dump GDML representation of Geometry");
|
||||
GDMLFileNameCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
GDMLFileNameCmd.SetDefaultValue("dump.gdml_G4");
|
||||
auto& dumpgdmlCmd = fMessenger->DeclareProperty("dumpgdml", fdumpgdml);
|
||||
dumpgdmlCmd.SetGuidance(
|
||||
"Set flag for enabling dumping the Geometry to a gdml file");
|
||||
dumpgdmlCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
dumpgdmlCmd.SetDefaultValue("false");
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DRCalorimeterHit.cc
|
||||
/// \brief Implementation of the CaTS::DRCalorimeterHit class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
// project headers
|
||||
#include "DRCalorimeterHit.hh"
|
||||
G4ThreadLocal G4Allocator<DRCalorimeterHit>* DRCalorimeterHitAllocator =
|
||||
nullptr;
|
||||
|
||||
DRCalorimeterHit::DRCalorimeterHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
|
||||
DRCalorimeterHit::DRCalorimeterHit(unsigned int i, G4double e, G4double em,
|
||||
unsigned int nc, G4double t, G4ThreeVector p)
|
||||
: G4VHit()
|
||||
{
|
||||
fid = i;
|
||||
fEdep = e;
|
||||
fem_Edep = em;
|
||||
fNceren = nc;
|
||||
ftime = t;
|
||||
fposition = p;
|
||||
}
|
||||
|
||||
DRCalorimeterHit::DRCalorimeterHit(const DRCalorimeterHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
this->fid = right.fid;
|
||||
this->fEdep = right.fEdep;
|
||||
this->fem_Edep = right.fem_Edep;
|
||||
this->fNceren = right.fNceren;
|
||||
this->ftime = right.ftime;
|
||||
this->fposition = right.fposition;
|
||||
}
|
||||
|
||||
const DRCalorimeterHit& DRCalorimeterHit::operator=(
|
||||
const DRCalorimeterHit& right)
|
||||
{
|
||||
this->fid = right.fid;
|
||||
this->fEdep = right.fEdep;
|
||||
this->fem_Edep = right.fem_Edep;
|
||||
this->fNceren = right.fNceren;
|
||||
this->ftime = right.ftime;
|
||||
this->fposition = right.fposition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool DRCalorimeterHit::operator==(const DRCalorimeterHit& right) const
|
||||
{
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
void DRCalorimeterHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(fposition);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DRCalorimeterSD.cc
|
||||
/// \brief Implementation of the CaTS::DRCalorimeterSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4Cerenkov.hh"
|
||||
// project headers
|
||||
#include "DRCalorimeterSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
DRCalorimeterSD::DRCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
, fDRCalorimeterHitsCollection(0)
|
||||
, fHCID(0)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " DRCalorimeterSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
DRCalorimeterSD::~DRCalorimeterSD() {}
|
||||
|
||||
void DRCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fDRCalorimeterHitsCollection =
|
||||
new DRCalorimeterHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
G4cout << "DRCalorimeterSD::Initialize: " << SensitiveDetectorName
|
||||
<< " " << collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, fDRCalorimeterHitsCollection);
|
||||
}
|
||||
|
||||
G4bool DRCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit() / CLHEP::MeV;
|
||||
if(edep == 0.)
|
||||
return false;
|
||||
G4double time = aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::ns;
|
||||
const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
|
||||
G4ThreeVector cellpos = touch->GetTranslation();
|
||||
unsigned int ID = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetCopyNo();
|
||||
G4Track* theTrack = aStep->GetTrack();
|
||||
G4String particleType = theTrack->GetDefinition()->GetParticleName();
|
||||
unsigned int NCerenPhotons = 0;
|
||||
G4SteppingManager* fpSteppingManager = G4EventManager::GetEventManager()
|
||||
->GetTrackingManager()
|
||||
->GetSteppingManager();
|
||||
G4StepStatus stepStatus = fpSteppingManager->GetfStepStatus();
|
||||
if(stepStatus != fAtRestDoItProc)
|
||||
{
|
||||
G4ProcessVector* procPost = fpSteppingManager->GetfPostStepDoItVector();
|
||||
size_t MAXofPostStepLoops = fpSteppingManager->GetMAXofPostStepLoops();
|
||||
for(size_t i3 = 0; i3 < MAXofPostStepLoops; i3++)
|
||||
{
|
||||
if((*procPost)[i3]->GetProcessName() == "Cerenkov")
|
||||
{
|
||||
G4Cerenkov* proc = (G4Cerenkov*) (*procPost)[i3];
|
||||
NCerenPhotons += proc->GetNumPhotons();
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// check if this cell has been hit before
|
||||
// fDRCalorimeterHitsCollection
|
||||
for(unsigned int j = 0; j < fDRCalorimeterHitsCollection->entries(); j++)
|
||||
{
|
||||
DRCalorimeterHit* aPreviousHit = (*fDRCalorimeterHitsCollection)[j];
|
||||
if(ID == aPreviousHit->GetId())
|
||||
{
|
||||
aPreviousHit->SetEdep(aStep->GetTotalEnergyDeposit() +
|
||||
aPreviousHit->GetEdep());
|
||||
aPreviousHit->SetNceren(aPreviousHit->GetNceren() + NCerenPhotons);
|
||||
if((particleType == "e+") || (particleType == "gamma") ||
|
||||
(particleType == "e-"))
|
||||
{
|
||||
aPreviousHit->SetEm_Edep(edep + aPreviousHit->GetEm_Edep());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//
|
||||
// otherwise create a new hit:
|
||||
//
|
||||
DRCalorimeterHit* newHit;
|
||||
if((particleType == "e+") || (particleType == "gamma") ||
|
||||
(particleType == "e-"))
|
||||
{
|
||||
newHit = new DRCalorimeterHit(ID, edep, edep, NCerenPhotons, time, cellpos);
|
||||
}
|
||||
else
|
||||
{
|
||||
newHit = new DRCalorimeterHit(ID, edep, 0.0, time, NCerenPhotons, cellpos);
|
||||
}
|
||||
fDRCalorimeterHitsCollection->insert(newHit);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DRCalorimeterSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = fDRCalorimeterHitsCollection->entries();
|
||||
if(verbose)
|
||||
G4cout << " Number of DRCalorimeterHits: " << NbHits << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the CaTS::DetectorConstruction class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4GDMLParser.hh"
|
||||
// project headers
|
||||
#include "ConfigurationManager.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "TrackerSD.hh"
|
||||
#include "MscSD.hh"
|
||||
#include "lArTPCSD.hh"
|
||||
#include "CalorimeterSD.hh"
|
||||
#include "DRCalorimeterSD.hh"
|
||||
#include "RadiatorSD.hh"
|
||||
#include "PhotonSD.hh"
|
||||
#include "InteractionSD.hh"
|
||||
#include "ColorReader.hh"
|
||||
// c++ headers
|
||||
#include <iostream>
|
||||
|
||||
DetectorConstruction::DetectorConstruction(G4String fname)
|
||||
: G4VUserDetectorConstruction()
|
||||
, gdmlFile(fname)
|
||||
{}
|
||||
|
||||
DetectorConstruction::~DetectorConstruction() {}
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
ReadGDML();
|
||||
const G4GDMLAuxMapType* auxmap = parser->GetAuxMap();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found " << auxmap->size()
|
||||
<< " volume(s) with auxiliary information." << G4endl << G4endl;
|
||||
}
|
||||
for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin();
|
||||
iter != auxmap->end(); iter++)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Volume " << ((*iter).first)->GetName()
|
||||
<< " has the following list of auxiliary information: " << G4endl;
|
||||
}
|
||||
for(G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
|
||||
vit != (*iter).second.end(); vit++)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "--> Type: " << (*vit).type << " Value: " << (*vit).value
|
||||
<< G4endl;
|
||||
}
|
||||
if((*vit).type == "StepLimit")
|
||||
{
|
||||
G4UserLimits* fStepLimit = new G4UserLimits(atof((*vit).value));
|
||||
((*iter).first)->SetUserLimits(fStepLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
G4VPhysicalVolume* worldPhysVol = parser->GetWorldVolume();
|
||||
if(ConfigurationManager::getInstance()->isDumpgdml())
|
||||
{
|
||||
std::ifstream ifile;
|
||||
ifile.open(ConfigurationManager::getInstance()->getGDMLFileName());
|
||||
if(ifile)
|
||||
{
|
||||
G4cout << "****************************************************"
|
||||
<< G4endl;
|
||||
G4cout << ConfigurationManager::getInstance()->getGDMLFileName()
|
||||
<< " already exists!!!" << G4endl;
|
||||
G4cout << "No new gdml dump created!!!" << G4endl;
|
||||
G4cout << "****************************************************"
|
||||
<< G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Writing: "
|
||||
<< ConfigurationManager::getInstance()->getGDMLFileName()
|
||||
<< G4endl;
|
||||
parser->Write(ConfigurationManager::getInstance()->getGDMLFileName(),
|
||||
worldPhysVol);
|
||||
}
|
||||
}
|
||||
return worldPhysVol;
|
||||
}
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
const G4GDMLAuxMapType* auxmap = parser->GetAuxMap();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found " << auxmap->size()
|
||||
<< " volume(s) with auxiliary information." << G4endl << G4endl;
|
||||
}
|
||||
for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin();
|
||||
iter != auxmap->end(); iter++)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Volume " << ((*iter).first)->GetName()
|
||||
<< " has the following list of auxiliary information: " << G4endl;
|
||||
}
|
||||
for(G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
|
||||
vit != (*iter).second.end(); vit++)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "--> Type: " << (*vit).type << " Value: " << (*vit).value
|
||||
<< G4endl;
|
||||
}
|
||||
if((*vit).type == "SensDet")
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found sensitive Detector: " << (*vit).value << G4endl;
|
||||
}
|
||||
if((*vit).value == "PhotonDetector")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Photondetector";
|
||||
PhotonSD* aPhotonSD = new PhotonSD(name);
|
||||
SDman->AddNewDetector(aPhotonSD);
|
||||
((*iter).first)->SetSensitiveDetector(aPhotonSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "Target")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Target";
|
||||
InteractionSD* aInteractionSD = new InteractionSD(name);
|
||||
SDman->AddNewDetector(aInteractionSD);
|
||||
((*iter).first)->SetSensitiveDetector(aInteractionSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "Tracker")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Tracker";
|
||||
TrackerSD* aTrackerSD = new TrackerSD(name);
|
||||
SDman->AddNewDetector(aTrackerSD);
|
||||
((*iter).first)->SetSensitiveDetector(aTrackerSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "Msc")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Msc";
|
||||
MscSD* aMscSD = new MscSD(name);
|
||||
SDman->AddNewDetector(aMscSD);
|
||||
((*iter).first)->SetSensitiveDetector(aMscSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "lArTPC")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_lArTPC";
|
||||
lArTPCSD* alArTPCSD = new lArTPCSD(name);
|
||||
SDman->AddNewDetector(alArTPCSD);
|
||||
((*iter).first)->SetSensitiveDetector(alArTPCSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "Radiator")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Radiator";
|
||||
RadiatorSD* aRadiatorSD = new RadiatorSD(name);
|
||||
SDman->AddNewDetector(aRadiatorSD);
|
||||
((*iter).first)->SetSensitiveDetector(aRadiatorSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "Calorimeter")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_Calorimeter";
|
||||
CalorimeterSD* aCalorimeterSD = new CalorimeterSD(name);
|
||||
SDman->AddNewDetector(aCalorimeterSD);
|
||||
((*iter).first)->SetSensitiveDetector(aCalorimeterSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
else if((*vit).value == "DRCalorimeter")
|
||||
{
|
||||
G4String name = ((*iter).first)->GetName() + "_DRCalorimeter";
|
||||
DRCalorimeterSD* aDRCalorimeterSD = new DRCalorimeterSD(name);
|
||||
SDman->AddNewDetector(aDRCalorimeterSD);
|
||||
((*iter).first)->SetSensitiveDetector(aDRCalorimeterSD);
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Attaching sensitive Detector: " << (*vit).value
|
||||
<< " to Volume: " << ((*iter).first)->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((*vit).type == "Solid")
|
||||
{
|
||||
if((*vit).value == "True")
|
||||
{
|
||||
G4VisAttributes* visibility = new G4VisAttributes();
|
||||
visibility->SetForceSolid(true);
|
||||
G4VisAttributes* visatt = new G4VisAttributes(
|
||||
((*iter).first)->GetVisAttributes()->GetColour());
|
||||
visatt->SetVisibility(true);
|
||||
visatt->SetForceSolid(true);
|
||||
visatt->SetForceAuxEdgeVisible(true);
|
||||
((*iter).first)->SetVisAttributes(visatt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void DetectorConstruction::ReadGDML()
|
||||
{
|
||||
fReader = new ColorReader;
|
||||
parser = new G4GDMLParser(fReader);
|
||||
parser->Read(gdmlFile, false);
|
||||
G4VPhysicalVolume* World = parser->GetWorldVolume();
|
||||
//----- GDML parser makes world invisible, this is a hack to make it
|
||||
// visible again...
|
||||
G4LogicalVolume* pWorldLogical = World->GetLogicalVolume();
|
||||
pWorldLogical->SetVisAttributes(0);
|
||||
G4cout << World->GetTranslation() << G4endl << G4endl;
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found World: " << World->GetName() << G4endl;
|
||||
G4cout << "World LV: " << World->GetLogicalVolume()->GetName() << G4endl;
|
||||
}
|
||||
G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found " << pLVStore->size() << " logical volumes." << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
G4PhysicalVolumeStore* pPVStore = G4PhysicalVolumeStore::GetInstance();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Found " << pPVStore->size() << " physical volumes." << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
|
||||
}
|
||||
+29
-21
@@ -23,30 +23,38 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Code developed by:
|
||||
// S.Larsson
|
||||
// ********************************************************************
|
||||
//
|
||||
// ************************************
|
||||
// * *
|
||||
// * PurgMagAnalysisManager.hh *
|
||||
// * *
|
||||
// ************************************
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file Event.cc
|
||||
/// \brief Implementation of the CaTS::Event class
|
||||
|
||||
#ifndef G4PROCESSTESTANALYSIS_HH
|
||||
#define G4PROCESSTESTANALYSIS_HH
|
||||
|
||||
//!Uncomment #include to switch to ROOT or XML output file
|
||||
//#include "g4root.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
//! Default here is a CSV file
|
||||
#include "g4csv.hh"
|
||||
|
||||
#include "G4Version.hh"
|
||||
#include "Event.hh"
|
||||
#include <utility>
|
||||
|
||||
void Event::Reset()
|
||||
{
|
||||
#if(G4VERSION_NUMBER > 1072)
|
||||
for(auto [name, hitvector] : hcmap)
|
||||
{
|
||||
hitvector.clear();
|
||||
}
|
||||
#else
|
||||
std::map<G4String, std::vector<G4VHit*>>::iterator it;
|
||||
for(it = hcmap.begin(); it != hcmap.end(); it++)
|
||||
{
|
||||
(it->second).clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file EventAction.cc
|
||||
/// \brief Implementation of the CaTS::EventAction class
|
||||
|
||||
// Geant4 headers
|
||||
#include <G4UserEventAction.hh>
|
||||
#include <G4ios.hh>
|
||||
#include "G4Event.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include <G4String.hh>
|
||||
#include <G4Types.hh>
|
||||
#include <G4VHit.hh>
|
||||
#include <G4VHitsCollection.hh>
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
// project headers:
|
||||
#include "EventAction.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
#include "Event.hh"
|
||||
#include "PhotonSD.hh"
|
||||
#include "PhotonHit.hh"
|
||||
#include "InteractionHit.hh"
|
||||
#include "lArTPCHit.hh"
|
||||
#include "TrackerHit.hh"
|
||||
#include "MscHit.hh"
|
||||
#include "CalorimeterHit.hh"
|
||||
#include "DRCalorimeterHit.hh"
|
||||
#ifdef WITH_ROOT
|
||||
#include "RootIO.hh"
|
||||
#endif
|
||||
// stl headers
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <istream>
|
||||
#ifdef WITH_G4OPTICKS
|
||||
#include "OpticksFlags.hh"
|
||||
#include "G4Opticks.hh"
|
||||
#include "G4OpticksHit.hh"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
// Mutex to lock updating the global ion map
|
||||
G4Mutex ionIdMapMutex = G4MUTEX_INITIALIZER;
|
||||
} // namespace
|
||||
|
||||
EventAction::EventAction()
|
||||
: G4UserEventAction() {
|
||||
#ifdef WITH_ROOT
|
||||
RootIO::GetInstance();
|
||||
#endif
|
||||
}
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* anEvent) {
|
||||
}
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event* event) {
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if (verbose)
|
||||
G4cout << "EventAction::EndOfEventAction Event: " << event->GetEventID()
|
||||
<< G4endl;
|
||||
G4HCofThisEvent* HCE = event->GetHCofThisEvent();
|
||||
if (HCE == nullptr)
|
||||
return;
|
||||
#ifdef WITH_ROOT
|
||||
Event* CaTSEvt = new Event();
|
||||
CaTSEvt->SetEventNr(event->GetEventID());
|
||||
std::map<G4String, std::vector < G4VHit*>>*hcmap = CaTSEvt->GetHCMap();
|
||||
#endif // end WITH_ROOT
|
||||
#ifdef WITH_G4OPTICKS
|
||||
if (ConfigurationManager::getInstance()->isEnable_opticks()) {
|
||||
G4Opticks* g4ok = G4Opticks::Get();
|
||||
G4int eventid = event->GetEventID();
|
||||
g4ok->propagateOpticalPhotons(eventid);
|
||||
unsigned num_hits = g4ok->getNumHit();
|
||||
G4cout << "EndOfEventAction: num_hits: " << num_hits << G4endl;
|
||||
if (num_hits > 0) {
|
||||
G4HCtable* hctable = G4SDManager::GetSDMpointer()->GetHCtable();
|
||||
for (G4int i = 0; i < hctable->entries(); ++i) {
|
||||
std::string sdn = hctable->GetSDname(i);
|
||||
std::size_t found = sdn.find("Photondetector");
|
||||
if (found != std::string::npos) {
|
||||
PhotonSD* aSD =
|
||||
(PhotonSD*) G4SDManager::GetSDMpointer()->FindSensitiveDetector(
|
||||
sdn);
|
||||
aSD->AddOpticksHits();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
G4cout << "***********************************************************"
|
||||
"********************************************************"
|
||||
<< G4endl;
|
||||
G4cout << " EndOfEventAction: numphotons: " << g4ok->getNumPhotons()
|
||||
<< " Gensteps: " << g4ok->getNumGensteps()
|
||||
<< " Maxgensteps: " << g4ok->getMaxGensteps() << G4endl;
|
||||
G4cout << " EndOfEventAction: num_hits: " << g4ok->getNumHit() << G4endl;
|
||||
G4cout << g4ok->dbgdesc() << G4endl;
|
||||
}
|
||||
g4ok->reset();
|
||||
if (verbose) {
|
||||
G4cout << "========================== After reset: " << G4endl;
|
||||
G4cout << " EndOfEventAction: numphotons: " << g4ok->getNumPhotons()
|
||||
<< " Gensteps: " << g4ok->getNumGensteps()
|
||||
<< " Maxgensteps: " << g4ok->getMaxGensteps() << G4endl;
|
||||
G4cout << "EndOfEventAction: num_hits: " << g4ok->getNumHit() << G4endl;
|
||||
G4cout << g4ok->dbgdesc() << G4endl;
|
||||
G4cout << "***********************************************************"
|
||||
"********************************************************"
|
||||
<< G4endl;
|
||||
}
|
||||
} // end isEnable_opticks
|
||||
#endif // end WITH_G4OPTICKS
|
||||
//
|
||||
// Now we deal with the Geant4 Hit collections.
|
||||
//
|
||||
if (verbose)
|
||||
G4cout << "Number of collections: " << HCE->GetNumberOfCollections()
|
||||
<< G4endl;
|
||||
#ifdef WITH_ROOT
|
||||
if (ConfigurationManager::getInstance()->isWriteHits()) {
|
||||
for (int i = 0; i < HCE->GetNumberOfCollections(); i++) {
|
||||
G4VHitsCollection* hc = HCE->GetHC(i);
|
||||
G4String hcname = hc->GetName();
|
||||
std::vector<std::string> y = split(hcname, '_');
|
||||
std::string Classname = y[1];
|
||||
if (verbose)
|
||||
G4cout << "Classname: " << Classname << G4endl;
|
||||
if (Classname == "lArTPC") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
lArTPCHit* tpcHit = dynamic_cast<lArTPCHit*> (hit);
|
||||
hitsVector.push_back(tpcHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "Photondetector") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "Photondetector size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
PhotonHit* pHit = dynamic_cast<PhotonHit*> (hit);
|
||||
hitsVector.push_back(pHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "Target") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "Interaction size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
InteractionHit* iaHit = dynamic_cast<InteractionHit*> (hit);
|
||||
hitsVector.push_back(iaHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "Tracker") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "Tracker size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
TrackerHit* tHit = dynamic_cast<TrackerHit*> (hit);
|
||||
hitsVector.push_back(tHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "Msc") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "Msc size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
MscHit* mscHit = dynamic_cast<MscHit*> (hit);
|
||||
hitsVector.push_back(mscHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "Calorimeter") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "Calorimeter size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
CalorimeterHit* cHit = dynamic_cast<CalorimeterHit*> (hit);
|
||||
hitsVector.push_back(cHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else if (Classname == "DRCalorimeter") {
|
||||
std::vector<G4VHit*> hitsVector;
|
||||
G4int NbHits = hc->GetSize();
|
||||
if (verbose)
|
||||
G4cout << "DRCalorimeter size: " << hc->GetSize() << G4endl;
|
||||
for (G4int ii = 0; ii < NbHits; ii++) {
|
||||
G4VHit* hit = hc->GetHit(ii);
|
||||
DRCalorimeterHit* drHit = dynamic_cast<DRCalorimeterHit*> (hit);
|
||||
hitsVector.push_back(drHit);
|
||||
}
|
||||
hcmap->insert(std::make_pair(hcname, hitsVector));
|
||||
} else {
|
||||
G4cout << "SD type: " << Classname << " unknown" << G4endl;
|
||||
}
|
||||
}
|
||||
G4AutoLock lock(&ionIdMapMutex);
|
||||
RootIO::GetInstance()->Write(CaTSEvt);
|
||||
CaTSEvt->Reset();
|
||||
delete CaTSEvt;
|
||||
} // end enableio
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::string>& EventAction::split(const std::string& s, char delim,
|
||||
std::vector<std::string>& elems) {
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(item);
|
||||
}
|
||||
return elems;
|
||||
}
|
||||
|
||||
std::vector<std::string> EventAction::split(const std::string& s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
return split(s, delim, elems);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file InteractionHit.cc
|
||||
/// \brief Implementation of the CaTS::InteractionHit class
|
||||
|
||||
#include <G4VHit.hh>
|
||||
#include "InteractionHit.hh"
|
||||
template <class Type>
|
||||
class G4Allocator;
|
||||
G4ThreadLocal G4Allocator<InteractionHit>* InteractionHitAllocator = nullptr;
|
||||
|
||||
InteractionHit::InteractionHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
|
||||
InteractionHit::InteractionHit(G4String pn, G4double p, G4double e, G4double t)
|
||||
: G4VHit()
|
||||
{
|
||||
fpname = pn; // name of secondary particle
|
||||
fpmom = p; // momentum of secondary particle
|
||||
fEkin = e; // kinetic energy of secondary particle
|
||||
ftheta = t; // theta of secondary particle
|
||||
}
|
||||
|
||||
InteractionHit::InteractionHit(const InteractionHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
fpname = right.fpname;
|
||||
fpmom = right.fpmom;
|
||||
fEkin = right.fEkin;
|
||||
ftheta = right.ftheta;
|
||||
}
|
||||
|
||||
const InteractionHit& InteractionHit::operator=(const InteractionHit& right)
|
||||
{
|
||||
fpname = right.fpname;
|
||||
fpmom = right.fpmom;
|
||||
fEkin = right.fEkin;
|
||||
ftheta = right.ftheta;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int InteractionHit::operator==(const InteractionHit& right) const
|
||||
{
|
||||
return (this == &right) ? 1 : 0;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file InteractionSD.cc
|
||||
/// \brief Implementation of the CaTS::InteractionSD class
|
||||
|
||||
// Geant4 headers:
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
// project headers
|
||||
#include "InteractionSD.hh"
|
||||
#include "ParticleChange.hh"
|
||||
|
||||
InteractionSD::InteractionSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " InteractionSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
}
|
||||
|
||||
InteractionSD::~InteractionSD()
|
||||
{
|
||||
delete fFirstInter;
|
||||
delete fOtherInter;
|
||||
}
|
||||
|
||||
void InteractionSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
G4cout << "Hits Collection capacity: " << HCE->GetCapacity() << G4endl;
|
||||
fInteractionHitsCollection =
|
||||
new InteractionHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
G4cout << "InteractionSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
HCE->AddHitsCollection(fHCID, fInteractionHitsCollection);
|
||||
fFirstInter = new ParticleChange(true);
|
||||
fOtherInter = new ParticleChange();
|
||||
}
|
||||
|
||||
G4bool InteractionSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4int nsc = fFirstInter->GetNumberOfSecondaries();
|
||||
if(nsc > 0)
|
||||
{
|
||||
for(G4int i = 0; i < nsc; i++)
|
||||
{
|
||||
delete fFirstInter->GetSecondary(i);
|
||||
}
|
||||
fFirstInter->Clear();
|
||||
}
|
||||
nsc = fOtherInter->GetNumberOfSecondaries();
|
||||
if(nsc > 0)
|
||||
{
|
||||
for(G4int i = 0; i < nsc; i++)
|
||||
{
|
||||
delete fOtherInter->GetSecondary(i);
|
||||
}
|
||||
fOtherInter->Clear();
|
||||
}
|
||||
const std::vector<const G4Track*>* secs = aStep->GetSecondaryInCurrentStep();
|
||||
G4int nsec = secs->size();
|
||||
for(G4int i = 0; i < nsec; i++)
|
||||
{
|
||||
G4Track* tr = new G4Track(*((*secs)[i]));
|
||||
if(aStep->GetTrack()->GetTrackStatus() != fAlive) // track looses identity
|
||||
{
|
||||
if(aStep->GetTrack()->GetParentID() == 0) // primary track
|
||||
{
|
||||
fFirstInter->AddSecondary(tr);
|
||||
}
|
||||
else // secondary track, and it's also looses identity (re-interaction)
|
||||
{
|
||||
fOtherInter->AddSecondary(tr);
|
||||
}
|
||||
}
|
||||
} // end loop over secondaries
|
||||
G4int NSec = fFirstInter->GetNumberOfSecondaries();
|
||||
if(NSec > 0)
|
||||
{
|
||||
const G4DynamicParticle* sec = 0;
|
||||
for(G4int i = 0; i < NSec; i++)
|
||||
{
|
||||
sec = fFirstInter->GetSecondary(i)->GetDynamicParticle();
|
||||
const G4String& pname = sec->GetDefinition()->GetParticleName();
|
||||
G4double pmom = (sec->GetTotalMomentum()) / GeV;
|
||||
G4double Ekin = (sec->GetKineticEnergy()) / GeV;
|
||||
G4double theta = (sec->GetMomentum()).theta();
|
||||
InteractionHit* newHit = new InteractionHit(pname, pmom, Ekin, theta);
|
||||
fInteractionHitsCollection->insert(newHit);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file MscHit.cc
|
||||
/// \brief Implementation of the CaTS::MscHit class
|
||||
|
||||
// Geant4 headers
|
||||
#include <G4ThreeVector.hh>
|
||||
#include <G4VHit.hh>
|
||||
// project headers
|
||||
#include "MscHit.hh"
|
||||
|
||||
template <class Type>
|
||||
class G4Allocator;
|
||||
G4ThreadLocal G4Allocator<MscHit>* MscHitAllocator = nullptr;
|
||||
|
||||
MscHit::MscHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
MscHit::MscHit(G4double E, G4ThreeVector mom)
|
||||
: G4VHit()
|
||||
{
|
||||
this->fkinE = E;
|
||||
this->fmomentum = mom;
|
||||
}
|
||||
|
||||
MscHit::MscHit(const MscHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
fkinE = right.fkinE;
|
||||
fmomentum = right.fmomentum;
|
||||
}
|
||||
|
||||
const MscHit& MscHit::operator=(const MscHit& right)
|
||||
{
|
||||
fkinE = right.fkinE;
|
||||
fmomentum = right.fmomentum;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool MscHit::operator==(const MscHit& right) const
|
||||
{
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
void MscHit::Draw() {}
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file MscSD.cc
|
||||
/// \brief Implementation of the CaTS::MscSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
// project headers
|
||||
#include "MscSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
MscSD::MscSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " MscSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
void MscSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fMscHitsCollection =
|
||||
new MscHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
G4cout << "MscSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, fMscHitsCollection);
|
||||
done = false;
|
||||
}
|
||||
|
||||
G4bool MscSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
if(!done)
|
||||
{
|
||||
if(aStep->GetTrack()->GetParentID() ==
|
||||
0) // only care about the primary particle
|
||||
{
|
||||
const G4StepPoint* postStep = aStep->GetPostStepPoint();
|
||||
if(postStep->GetStepStatus() == fGeomBoundary)
|
||||
{
|
||||
MscHit* newHit =
|
||||
new MscHit(postStep->GetKineticEnergy(), postStep->GetMomentum());
|
||||
fMscHitsCollection->insert(newHit);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MscSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = fMscHitsCollection->entries();
|
||||
if(verbose)
|
||||
G4cout << " Number of MscHits: " << NbHits << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhotonHit.cc
|
||||
/// \brief Implementation of the CaTS::PhotonHit class
|
||||
|
||||
// Geant4 headers
|
||||
#include "PhotonHit.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include <G4Point3D.hh>
|
||||
#include <G4ThreeVector.hh>
|
||||
#include <G4VHit.hh>
|
||||
// project headers
|
||||
#include "PhotonHit.hh"
|
||||
|
||||
template <class Type>
|
||||
class G4Allocator;
|
||||
G4ThreadLocal G4Allocator<PhotonHit>* PhotonHitAllocator = nullptr;
|
||||
|
||||
PhotonHit::PhotonHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
|
||||
PhotonHit::PhotonHit(unsigned iid, unsigned ipid, G4double iwavelength,
|
||||
G4double itime, G4ThreeVector iposition,
|
||||
G4ThreeVector idirection, G4ThreeVector ipolarization)
|
||||
: G4VHit()
|
||||
{
|
||||
fid = iid;
|
||||
fpid = ipid;
|
||||
fwavelength = iwavelength;
|
||||
ftime = itime;
|
||||
fposition = iposition;
|
||||
fdirection = idirection;
|
||||
fpolarization = ipolarization;
|
||||
}
|
||||
|
||||
PhotonHit::PhotonHit(const PhotonHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
fid = right.fid;
|
||||
fpid = right.fpid;
|
||||
fwavelength = right.fwavelength;
|
||||
ftime = right.ftime;
|
||||
fposition = right.fposition;
|
||||
fdirection = right.fdirection;
|
||||
fpolarization = right.fpolarization;
|
||||
}
|
||||
|
||||
const PhotonHit& PhotonHit::operator=(const PhotonHit& right)
|
||||
{
|
||||
fid = right.fid;
|
||||
fpid = right.fpid;
|
||||
fwavelength = right.fwavelength;
|
||||
ftime = right.ftime;
|
||||
fposition = right.fposition;
|
||||
fdirection = right.fdirection;
|
||||
fpolarization = right.fpolarization;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool PhotonHit::operator==(const PhotonHit& right) const
|
||||
{
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
void PhotonHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(fposition);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhotonSD.cc
|
||||
/// \brief Implementation of the CaTS::PhotonSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
// project headers
|
||||
#include "PhotonSD.hh"
|
||||
#ifdef WITH_G4OPTICKS
|
||||
# include "G4Opticks.hh"
|
||||
# include "TrackInfo.hh"
|
||||
# include "OpticksGenstep.h"
|
||||
# include "OpticksFlags.hh"
|
||||
# include "G4OpticksHit.hh"
|
||||
#endif
|
||||
|
||||
PhotonSD::PhotonSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " PhotonSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
void PhotonSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fPhotonHitsCollection =
|
||||
new PhotonHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
G4cout << "PhotonSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, fPhotonHitsCollection);
|
||||
}
|
||||
|
||||
G4bool PhotonSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4Track* theTrack = aStep->GetTrack();
|
||||
// we only deal with optical Photons:
|
||||
if(theTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
G4double theEdep = theTrack->GetTotalEnergy() / CLHEP::eV;
|
||||
const G4VProcess* thisProcess = theTrack->GetCreatorProcess();
|
||||
G4String processname;
|
||||
if(thisProcess != NULL)
|
||||
processname = thisProcess->GetProcessName();
|
||||
else
|
||||
processname = "No Process";
|
||||
unsigned theCreationProcessid;
|
||||
if(processname == "Cerenkov")
|
||||
{
|
||||
theCreationProcessid = 0;
|
||||
}
|
||||
else if(processname == "Scintillation")
|
||||
{
|
||||
theCreationProcessid = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
theCreationProcessid = -1;
|
||||
}
|
||||
PhotonHit* newHit = new PhotonHit(
|
||||
0, theCreationProcessid, etolambda(theEdep), theTrack->GetGlobalTime(),
|
||||
aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPostStepPoint()->GetMomentumDirection(),
|
||||
aStep->GetPostStepPoint()->GetPolarization());
|
||||
fPhotonHitsCollection->insert(newHit);
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PhotonSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4int NbHits = fPhotonHitsCollection->entries();
|
||||
G4cout << " PhotonSD::EndOfEvent Number of PhotonHits: " << NbHits
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
#ifdef WITH_G4OPTICKS
|
||||
void PhotonSD::AddOpticksHits()
|
||||
{
|
||||
G4Opticks* g4ok = G4Opticks::Get();
|
||||
bool way_enabled = g4ok->isWayEnabled();
|
||||
unsigned num_hits = g4ok->getNumHit();
|
||||
if(verbose)
|
||||
G4cout << "PhotonSD::AddOpticksHits PhotonHits: " << num_hits << G4endl;
|
||||
G4OpticksHit hit;
|
||||
G4OpticksHitExtra hit_extra;
|
||||
G4OpticksHitExtra* hit_extra_ptr = way_enabled ? &hit_extra : NULL;
|
||||
for(unsigned i = 0; i < num_hits; i++)
|
||||
{
|
||||
g4ok->getHit(i, &hit, hit_extra_ptr);
|
||||
PhotonHit* newHit =
|
||||
new PhotonHit(i, 0, hit.wavelength, hit.time, hit.global_position,
|
||||
hit.global_direction, hit.global_polarization);
|
||||
fPhotonHitsCollection->insert(newHit);
|
||||
}
|
||||
if(verbose)
|
||||
G4cout << "AddOpticksHits size: " << fPhotonHitsCollection->entries()
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PhysicsConfigurator.cc
|
||||
/// \brief Implementation of the CaTS::PhysicsConfigurator class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4String.hh"
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "G4PhysListFactoryAlt.hh"
|
||||
#include "G4PhysicsConstructorRegistry.hh"
|
||||
#include "G4PhysListRegistry.hh"
|
||||
#include "G4OpticalParameters.hh"
|
||||
#include "G4NeutronTrackingCut.hh"
|
||||
#include "G4StepLimiter.hh"
|
||||
#include "G4StepLimiterPhysics.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
// project Headers
|
||||
#include "PhysicsConfigurator.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
// c++ headers
|
||||
#include <stdlib.h>
|
||||
PhysicsConfigurator* PhysicsConfigurator::instance = 0;
|
||||
|
||||
G4VModularPhysicsList* PhysicsConfigurator::Construct(G4String physName)
|
||||
{
|
||||
//
|
||||
// Access to registries and factories
|
||||
//
|
||||
G4PhysicsConstructorRegistry* g4pcr =
|
||||
G4PhysicsConstructorRegistry::Instance();
|
||||
G4PhysListRegistry* g4plr = G4PhysListRegistry::Instance();
|
||||
G4bool verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "Available Physics Constructors: "
|
||||
<< g4pcr->AvailablePhysicsConstructors().size() << G4endl;
|
||||
G4cout << "Available Physics Lists: "
|
||||
<< g4plr->AvailablePhysLists().size() << G4endl;
|
||||
G4cout << "Available Physics Extensions: "
|
||||
<< g4plr->AvailablePhysicsExtensions().size() << G4endl;
|
||||
G4cout << "Available Physics Lists Em: "
|
||||
<< g4plr->AvailablePhysListsEM().size() << G4endl;
|
||||
g4plr->SetVerbose(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g4plr->SetVerbose(0);
|
||||
}
|
||||
g4plr->AddPhysicsExtension("OPTICAL", "G4OpticalPhysics");
|
||||
g4plr->AddPhysicsExtension("STEPLIMIT", "G4StepLimiterPhysics");
|
||||
g4plr->AddPhysicsExtension("NEUTRONLIMIT", "G4NeutronTrackingCut");
|
||||
if(verbose)
|
||||
{
|
||||
g4pcr->PrintAvailablePhysicsConstructors();
|
||||
g4plr->PrintAvailablePhysLists();
|
||||
}
|
||||
g4alt::G4PhysListFactory factory;
|
||||
G4VModularPhysicsList* phys = nullptr;
|
||||
if(verbose)
|
||||
G4cout << "Physics configuration: " << physName << G4endl;
|
||||
//
|
||||
// currently using the Constructor names doesn't work otherwise it would be:
|
||||
// G4String physName = "FTFP_BERT+G4OpticalPhysics+G4StepLimiterPhysics";
|
||||
// using the name doesn't work either
|
||||
// G4String physName = "FTFP_BERT+Optical+stepLimiter";
|
||||
// reference PhysicsList via its name
|
||||
//
|
||||
if(factory.IsReferencePhysList(physName))
|
||||
{
|
||||
phys = factory.GetReferencePhysList(physName);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Not a reference physics list" << G4endl;
|
||||
g4plr->PrintAvailablePhysLists();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << phys->GetPhysicsTableDirectory() << G4endl;
|
||||
}
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("Cerenkov", true);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("Scintillation", true);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("OpAbsorption", true);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("OpRayleigh", true);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("OpMieHG", false);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("OpWLS", true);
|
||||
G4OpticalParameters::Instance()->SetProcessActivation("OpWLS2", false);
|
||||
|
||||
G4OpticalParameters::Instance()->SetCerenkovStackPhotons(false);
|
||||
G4OpticalParameters::Instance()->SetScintStackPhotons(false);
|
||||
G4OpticalParameters::Instance()->SetScintTrackSecondariesFirst(
|
||||
true); // only relevant if we actually stack and trace the optical photons
|
||||
G4OpticalParameters::Instance()->SetCerenkovTrackSecondariesFirst(
|
||||
true); // only relevant if we actually stack and trace the optical photons
|
||||
G4OpticalParameters::Instance()->SetCerenkovMaxPhotonsPerStep(100);
|
||||
G4OpticalParameters::Instance()->SetCerenkovMaxBetaChange(10.0);
|
||||
if(verbose)
|
||||
{
|
||||
phys->DumpList();
|
||||
}
|
||||
return phys;
|
||||
}
|
||||
|
||||
PhysicsConfigurator* PhysicsConfigurator::getInstance()
|
||||
{
|
||||
if(instance == 0)
|
||||
instance = new PhysicsConfigurator();
|
||||
return instance;
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the CaTS::PrimaryGeneratorAction class
|
||||
|
||||
// Geant4 headers:
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4HEPEvtInterface.hh"
|
||||
#include "G4Version.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
// project headers:
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
// c++ headers:
|
||||
#include <cstring>
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
DefineCommands();
|
||||
G4int n_particle = 1;
|
||||
G4ParticleGun* fParticleGun = new G4ParticleGun(n_particle);
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle =
|
||||
particleTable->FindParticle(particleName = "mu+");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
|
||||
fParticleGun->SetParticleEnergy(10. * CLHEP::GeV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., 0.));
|
||||
gentypeMap["particleGun"] = fParticleGun;
|
||||
gentypeMap["GPS"] = new G4GeneralParticleSource;
|
||||
fcurrentGenerator = gentypeMap["particleGun"];
|
||||
fcurrentGeneratorName = "particleGun";
|
||||
}
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fMessenger;
|
||||
for( auto& gentype : gentypeMap )
|
||||
{
|
||||
delete gentype.second;
|
||||
}
|
||||
}
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
fcurrentGenerator->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
void PrimaryGeneratorAction::DefineCommands()
|
||||
{
|
||||
fMessenger = new G4GenericMessenger(this, "/CaTS/primaryGenerator/",
|
||||
"select primary Generator");
|
||||
// command to select primary Generator
|
||||
fMessenger
|
||||
->DeclareMethod("setGenerator", &PrimaryGeneratorAction::SetGenerator)
|
||||
.SetGuidance("Select the primary Generator (Available generators : "
|
||||
"particleGun,GPS")
|
||||
.SetParameterName("generator", true)
|
||||
.SetDefaultValue("particleGun")
|
||||
.SetCandidates("particleGun GPS");
|
||||
fMessenger->DeclareMethod("Print", &PrimaryGeneratorAction::Print)
|
||||
.SetGuidance("Print name of primary generator")
|
||||
.SetStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RadiatorSD.cc
|
||||
/// \brief Implementation of the CaTS::RadiatorSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#ifdef WITH_G4OPTICKS
|
||||
# include "G4ThreeVector.hh"
|
||||
# include "G4ios.hh"
|
||||
# include "G4UnitsTable.hh"
|
||||
# include "G4SystemOfUnits.hh"
|
||||
# include "G4VProcess.hh"
|
||||
# include "G4VRestDiscreteProcess.hh"
|
||||
# include "G4SDManager.hh"
|
||||
# include "G4HCofThisEvent.hh"
|
||||
# include "G4Opticks.hh"
|
||||
# include "TrackInfo.hh"
|
||||
# include "OpticksGenstep.h"
|
||||
# include "OpticksFlags.hh"
|
||||
# include "G4OpticksHit.hh"
|
||||
# include "G4EventManager.hh"
|
||||
# include "G4Event.hh"
|
||||
# include "G4RunManager.hh"
|
||||
# include "G4Version.hh"
|
||||
# include "PhotonSD.hh"
|
||||
# include "G4Cerenkov.hh"
|
||||
# include "G4Scintillation.hh"
|
||||
# include <string>
|
||||
#endif
|
||||
// project headers
|
||||
#include "RadiatorSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
RadiatorSD::RadiatorSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
void RadiatorSD::Initialize(G4HCofThisEvent*) {}
|
||||
|
||||
G4bool RadiatorSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(edep == 0.)
|
||||
return false;
|
||||
// only deal with charged particles
|
||||
G4Track* aTrack = aStep->GetTrack();
|
||||
G4double charge = aTrack->GetDynamicParticle()->GetCharge();
|
||||
if(charge == 0)
|
||||
return false;
|
||||
#ifdef WITH_G4OPTICKS
|
||||
if(ConfigurationManager::getInstance()->isEnable_opticks())
|
||||
{
|
||||
G4int materialIndex = 0;
|
||||
if(first)
|
||||
{
|
||||
aMaterial = aTrack->GetMaterial();
|
||||
materialIndex = aMaterial->GetIndex();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "*******************************" << G4endl;
|
||||
G4cout << "RadiatorSD::ProcessHits initializing Material: "
|
||||
<< aMaterial->GetName() << " " << G4endl;
|
||||
G4cout << "RadiatorSD::ProcessHits: Name "
|
||||
<< aStep->GetPreStepPoint()
|
||||
->GetPhysicalVolume()
|
||||
->GetLogicalVolume()
|
||||
->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
aMaterialPropertiesTable = aMaterial->GetMaterialPropertiesTable();
|
||||
if(verbose)
|
||||
{
|
||||
aMaterialPropertiesTable->DumpTable();
|
||||
}
|
||||
//
|
||||
// properties related to Scintillation
|
||||
//
|
||||
# if(G4VERSION_NUMBER > 1072)
|
||||
YieldRatio =
|
||||
aMaterialPropertiesTable->GetConstProperty(kSCINTILLATIONYIELD1) /
|
||||
aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONYIELD2); // slowerRatio,
|
||||
FastTimeConstant = aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONTIMECONSTANT1); // TimeConstant,
|
||||
SlowTimeConstant = aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONTIMECONSTANT2); // slowerTimeConstant,
|
||||
# else
|
||||
Fast_Intensity = aMaterialPropertiesTable->GetProperty(kFASTCOMPONENT);
|
||||
Slow_Intensity = aMaterialPropertiesTable->GetProperty(kSLOWCOMPONENT);
|
||||
YieldRatio = aMaterialPropertiesTable->GetConstProperty(kYIELDRATIO);
|
||||
# endif
|
||||
ScintillationType = Slow;
|
||||
//
|
||||
// properties related to Cerenkov
|
||||
//
|
||||
Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
|
||||
# if(G4VERSION_NUMBER > 1072)
|
||||
Pmin = Rindex->GetMinEnergy();
|
||||
Pmax = Rindex->GetMaxEnergy();
|
||||
# else
|
||||
Pmin = Rindex->GetMinLowEdgeEnergy();
|
||||
Pmax = Rindex->GetMaxLowEdgeEnergy();
|
||||
# endif
|
||||
dp = Pmax - Pmin;
|
||||
nMax = Rindex->GetMaxValue();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "nMax: " << nMax << " Pmin: " << Pmin << " Pmax: " << Pmax
|
||||
<< " dp: " << dp << G4endl;
|
||||
Rindex->DumpValues();
|
||||
}
|
||||
//
|
||||
first = false;
|
||||
} // end if first
|
||||
G4int Sphotons = 0; // number of scintillation photons this step
|
||||
G4int Cphotons = 0; // number of Cerenkov photons this step
|
||||
//
|
||||
// info needed for generating Cerenkov photons on the GPU;
|
||||
//
|
||||
G4double maxCos = 0.0;
|
||||
G4double maxSin2 = 0.0;
|
||||
G4double beta = 0.0;
|
||||
G4double beta1 = 0.0;
|
||||
G4double beta2 = 0.0;
|
||||
G4double BetaInverse = 0.0;
|
||||
G4double MeanNumberOfPhotons1 = 0.0;
|
||||
G4double MeanNumberOfPhotons2 = 0.0;
|
||||
G4SteppingManager* fpSteppingManager = G4EventManager::GetEventManager()
|
||||
->GetTrackingManager()
|
||||
->GetSteppingManager();
|
||||
G4StepStatus stepStatus = fpSteppingManager->GetfStepStatus();
|
||||
if(stepStatus != fAtRestDoItProc)
|
||||
{
|
||||
G4ProcessVector* procPost = fpSteppingManager->GetfPostStepDoItVector();
|
||||
size_t MAXofPostStepLoops = fpSteppingManager->GetMAXofPostStepLoops();
|
||||
for(size_t i3 = 0; i3 < MAXofPostStepLoops; i3++)
|
||||
{
|
||||
if((*procPost)[i3]->GetProcessName() == "Cerenkov")
|
||||
{
|
||||
G4Cerenkov* proc = (G4Cerenkov*) (*procPost)[i3];
|
||||
thePhysicsTable = proc->GetPhysicsTable();
|
||||
CerenkovAngleIntegrals =
|
||||
(G4PhysicsOrderedFreeVector*) ((*thePhysicsTable)(materialIndex));
|
||||
Cphotons = proc->GetNumPhotons();
|
||||
if(Cphotons > 0)
|
||||
{
|
||||
beta1 = aStep->GetPreStepPoint()->GetBeta();
|
||||
beta2 = aStep->GetPostStepPoint()->GetBeta();
|
||||
beta = (beta1 + beta2) * 0.5;
|
||||
BetaInverse = 1. / beta;
|
||||
maxCos = BetaInverse / nMax;
|
||||
maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
|
||||
MeanNumberOfPhotons1 =
|
||||
proc->GetAverageNumberOfPhotons(charge, beta1, aMaterial, Rindex);
|
||||
MeanNumberOfPhotons2 =
|
||||
proc->GetAverageNumberOfPhotons(charge, beta2, aMaterial, Rindex);
|
||||
}
|
||||
}
|
||||
if((*procPost)[i3]->GetProcessName() == "Scintillation")
|
||||
{
|
||||
G4Scintillation* proc1 = (G4Scintillation*) (*procPost)[i3];
|
||||
Sphotons = proc1->GetNumPhotons();
|
||||
}
|
||||
}
|
||||
}
|
||||
tSphotons += Sphotons;
|
||||
tCphotons += Cphotons;
|
||||
G4ThreeVector deltaPosition = aStep->GetDeltaPosition();
|
||||
G4double ScintillationTime = 0. * ns;
|
||||
G4int scntId = 1;
|
||||
G4StepPoint* pPreStepPoint = aStep->GetPreStepPoint();
|
||||
G4ThreeVector x0 = pPreStepPoint->GetPosition();
|
||||
G4ThreeVector p0 = aStep->GetDeltaPosition().unit();
|
||||
//
|
||||
// harvest the Scintillation photon gensteps:
|
||||
//
|
||||
if(Sphotons > 0)
|
||||
{
|
||||
G4double ScintillationRiseTime = 0.0;
|
||||
G4Opticks::Get()->collectGenstep_G4Scintillation_1042(
|
||||
aTrack, aStep, Sphotons, scntId, ScintillationTime,
|
||||
ScintillationRiseTime);
|
||||
}
|
||||
//
|
||||
// harvest the Cerenkov photon gensteps:
|
||||
//
|
||||
if(Cphotons > 0)
|
||||
{
|
||||
G4Opticks::Get()->collectGenstep_G4Cerenkov_1042(
|
||||
aTrack, aStep, Cphotons, BetaInverse, Pmin, Pmax, maxCos, maxSin2,
|
||||
MeanNumberOfPhotons1, MeanNumberOfPhotons2);
|
||||
}
|
||||
G4Opticks* g4ok = G4Opticks::Get();
|
||||
G4RunManager* rm = G4RunManager::GetRunManager();
|
||||
const G4Event* event = rm->GetCurrentEvent();
|
||||
G4int eventid = event->GetEventID();
|
||||
G4OpticksHit hit;
|
||||
unsigned num_photons = g4ok->getNumPhotons();
|
||||
if(num_photons > ConfigurationManager::getInstance()->getMaxPhotons())
|
||||
{
|
||||
g4ok->propagateOpticalPhotons(eventid);
|
||||
G4HCtable* hctable = G4SDManager::GetSDMpointer()->GetHCtable();
|
||||
for(G4int i = 0; i < hctable->entries(); ++i)
|
||||
{
|
||||
std::string sdn = hctable->GetSDname(i);
|
||||
std::size_t found = sdn.find("Photondetector");
|
||||
if(found != std::string::npos)
|
||||
{
|
||||
PhotonSD* aSD =
|
||||
(PhotonSD*) G4SDManager::GetSDMpointer()->FindSensitiveDetector(
|
||||
sdn);
|
||||
aSD->AddOpticksHits();
|
||||
}
|
||||
}
|
||||
g4ok->reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void RadiatorSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
tSphotons = 0;
|
||||
tCphotons = 0;
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
// November 10th, 2021 : implement writing one file
|
||||
// per worker thread which are then merged
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RootIO.cc
|
||||
/// \brief Implementation of the CaTS::RootIO class
|
||||
|
||||
#ifdef WITH_ROOT
|
||||
// Project headers
|
||||
#include "RootIO.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
#include "Event.hh"
|
||||
// Geant4 headers
|
||||
#include <G4String.hh>
|
||||
#include <G4ios.hh>
|
||||
#include <G4Threading.hh>
|
||||
#include <G4RunManager.hh>
|
||||
// Root headers
|
||||
#include "TBranch.h"
|
||||
#include "TFile.h"
|
||||
#include "TObject.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTree.h"
|
||||
#include "TROOT.h"
|
||||
// c++ headers
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
||||
G4ThreadLocal RootIO* RootIO::fgInstance = nullptr;
|
||||
// mutex in a file scope
|
||||
namespace {
|
||||
// Mutex to lock RootIO constructor
|
||||
G4Mutex RootIOMutex = G4MUTEX_INITIALIZER;
|
||||
} // namespace
|
||||
|
||||
RootIO::RootIO() {
|
||||
G4AutoLock lock(&RootIOMutex);
|
||||
TSystem ts;
|
||||
gSystem->Load("libCaTSClassesDict");
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
if (G4Threading::IsWorkerThread()) {
|
||||
G4String fFilename = ConfigurationManager::getInstance()->getfname() +
|
||||
"_Thread_" +
|
||||
std::to_string(G4Threading::G4GetThreadId()) + ".root";
|
||||
G4cout << "RootIO:: Opening File: " << fFilename << G4endl;
|
||||
fFile = new TFile(fFilename.c_str(), "RECREATE");
|
||||
TTree::SetMaxTreeSize(1000 * Long64_t(2000000000));
|
||||
// Create a ROOT Tree and one superbranch
|
||||
ftree = new TTree("Events", "ROOT tree containing Hit collections");
|
||||
ftree->SetAutoSave(1000000000); // autosave when 1 Gbyte written
|
||||
Int_t branchStyle = 1;
|
||||
TTree::SetBranchStyle(branchStyle);
|
||||
}
|
||||
} else {
|
||||
G4String fFilename = ConfigurationManager::getInstance()->getfname() + ".root";
|
||||
G4cout << "RootIO:: Opening File: " << fFilename << G4endl;
|
||||
fFile = new TFile(fFilename.c_str(), "RECREATE");
|
||||
TTree::SetMaxTreeSize(1000 * Long64_t(2000000000));
|
||||
// Create a ROOT Tree and one superbranch
|
||||
ftree = new TTree("Events", "ROOT tree containing Hit collections");
|
||||
ftree->SetAutoSave(1000000000); // autosave when 1 Gbyte written
|
||||
Int_t branchStyle = 1;
|
||||
TTree::SetBranchStyle(branchStyle);
|
||||
}
|
||||
}
|
||||
|
||||
RootIO* RootIO::GetInstance() {
|
||||
if (fgInstance == nullptr) {
|
||||
static G4ThreadLocalSingleton<RootIO> inst;
|
||||
fgInstance = inst.Instance();
|
||||
}
|
||||
return fgInstance;
|
||||
}
|
||||
|
||||
void RootIO::Write(Event* fevent) {
|
||||
if (ConfigurationManager::getInstance()->isEnable_verbose())
|
||||
G4cout << "writing Event: " << fevent->GetEventNumber() << G4endl;
|
||||
if ((fevent->GetEventNumber()) % 1000 == 0)
|
||||
G4cout << "writing Event: " << fevent->GetEventNumber() << G4endl;
|
||||
if (!fevtinitialized) {
|
||||
Int_t bufsize = 64000;
|
||||
fevtbranch = ftree->Branch("event.", &fevent, bufsize, 0);
|
||||
fevtbranch->SetAutoDelete(kFALSE);
|
||||
fevtinitialized = true;
|
||||
}
|
||||
fFile = ftree->GetCurrentFile(); // just in case we switched to a new file
|
||||
fnb += ftree->Fill();
|
||||
fFile->Write("", TObject::kOverwrite);
|
||||
}
|
||||
|
||||
void RootIO::Close() {
|
||||
G4cout << " Closing File: " << G4endl;
|
||||
fFile = ftree->GetCurrentFile();
|
||||
fFile->Close();
|
||||
}
|
||||
|
||||
void RootIO::Merge() {
|
||||
if (G4Threading::IsMasterThread()) {
|
||||
unsigned int nthreads = G4RunManager::GetRunManager()->GetNumberOfThreads();
|
||||
G4cout << "RootIO::Merging: " << nthreads << " threads" << G4endl;
|
||||
G4String filename = ConfigurationManager::getInstance()->getfname();
|
||||
G4String tmpfn;
|
||||
std::vector<TFile*> filevec;
|
||||
std::vector<Event*> evtvec;
|
||||
std::vector<TTree*> treevec;
|
||||
std::vector<TBranch*> branchvec;
|
||||
TList* list = new TList;
|
||||
TTree* newtree;
|
||||
for (unsigned int i = 0; i < nthreads; i++) {
|
||||
tmpfn = filename + "_Thread_" + std::to_string(i) + ".root";
|
||||
filevec.push_back(new TFile(tmpfn.c_str()));
|
||||
treevec.push_back((TTree*) (filevec[i]->Get("Events")));
|
||||
list->Add(treevec[i]);
|
||||
if (i == nthreads - 1) {
|
||||
G4String tmpfn2 = filename + "_Merged.root";
|
||||
TFile* fm = new TFile(tmpfn2.c_str(), "RECREATE");
|
||||
newtree = TTree::MergeTrees(list);
|
||||
newtree->SetName("Events");
|
||||
Event* eventm = new Event();
|
||||
newtree->SetBranchAddress("event.", &eventm);
|
||||
TBranch* fevtbranchm = newtree->GetBranch("event.");
|
||||
int neventm = fevtbranchm->GetEntries();
|
||||
G4cout << "Nr. of Events: " << neventm << G4endl;
|
||||
newtree->Write();
|
||||
fm->Close();
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < nthreads; i++) {
|
||||
tmpfn = filename + "_Thread_" + std::to_string(i) + ".root";
|
||||
if (remove(tmpfn.c_str()) != 0) {
|
||||
G4cout << "Error deleting file: " << tmpfn << G4endl;
|
||||
} else {
|
||||
G4cout << "File: " << tmpfn << " successfully deleted" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RunAction.cc
|
||||
/// \brief Implementation of the CaTS::RunAction class
|
||||
|
||||
#include <G4UserRunAction.hh>
|
||||
#include "G4Run.hh"
|
||||
#ifdef WITH_G4OPTICKS
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4Opticks.hh"
|
||||
#endif
|
||||
#ifdef WITH_ROOT
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "RootIO.hh"
|
||||
#endif
|
||||
// project headers
|
||||
#include "RunAction.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
RunAction::RunAction()
|
||||
: G4UserRunAction() {
|
||||
}
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun) {
|
||||
#ifdef WITH_ROOT
|
||||
if (ConfigurationManager::getInstance()->isdoAnalysis()) {
|
||||
// Create the generic analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetDefaultFileType("root");
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
G4String HistoFileName =
|
||||
ConfigurationManager::getInstance()->getHistoFileName();
|
||||
G4cout << "Opening Analysis output File: " << HistoFileName << G4endl;
|
||||
analysisManager->SetFileName(HistoFileName);
|
||||
analysisManager->OpenFile();
|
||||
//
|
||||
// Book histograms, ntuple
|
||||
//
|
||||
// Creating 1D histograms
|
||||
analysisManager->CreateH1("ENeutron", "Energy of created Neutrons", 200, 0,
|
||||
100);
|
||||
analysisManager->CreateH1("EProton", "Energy of created Protons", 200, 0,
|
||||
100);
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_G4OPTICKS
|
||||
if (ConfigurationManager::getInstance()->isEnable_opticks()) {
|
||||
if (!geo_initialized) {
|
||||
G4cout << "\n\n###[ RunAction::BeginOfRunAction G4Opticks.setGeometry\n\n"
|
||||
<< G4endl;
|
||||
G4VPhysicalVolume* world =
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume();
|
||||
assert(world);
|
||||
bool standardize_geant4_materials = false; // required for alignment
|
||||
G4Opticks* g4ok = G4Opticks::Get();
|
||||
g4ok->setGeometry(world, standardize_geant4_materials);
|
||||
const std::vector<G4PVPlacement*>& sensor_placements =
|
||||
g4ok->getSensorPlacements();
|
||||
G4cout << "sensor_placements.size(): " << sensor_placements.size()
|
||||
<< G4endl;
|
||||
for (unsigned i = 0; i < sensor_placements.size(); i++) {
|
||||
float efficiency_1 = 0.5f;
|
||||
float efficiency_2 = 1.0f;
|
||||
int sensor_cat = -1; // -1:means no angular info
|
||||
int sensor_identifier =
|
||||
0xc0ffee + i; // mockup a detector specific identifier
|
||||
unsigned sensorIndex = 1 + i; // 1-based
|
||||
g4ok->setSensorData(sensorIndex, efficiency_1, efficiency_2, sensor_cat,
|
||||
sensor_identifier);
|
||||
}
|
||||
G4cout << "\n\n###] RunAction::BeginOfRunAction G4Opticks.setGeometry\n\n"
|
||||
<< G4endl;
|
||||
geo_initialized = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run*) {
|
||||
#ifdef WITH_G4OPTICKS
|
||||
if (ConfigurationManager::getInstance()->isEnable_opticks()) {
|
||||
if (ConfigurationManager::getInstance()->isEnable_verbose()) {
|
||||
G4cout << "\n\n###[ RunAction::EndOfRunAction G4Opticks.Finalize\n\n"
|
||||
<< G4endl;
|
||||
}
|
||||
G4Opticks::Finalize();
|
||||
if (ConfigurationManager::getInstance()->isEnable_verbose()) {
|
||||
G4cout << "\n\n###] RunAction::EndOfRunAction G4Opticks.Finalize\n\n"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_ROOT
|
||||
if (ConfigurationManager::getInstance()->isEnable_verbose()) {
|
||||
G4cout << "##############RunAction::EndOfRunAction" << G4endl;
|
||||
}
|
||||
if (ConfigurationManager::getInstance()->isWriteHits()) {
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
RootIO::GetInstance()->Merge();
|
||||
} else {
|
||||
RootIO::GetInstance()->Close();
|
||||
}
|
||||
}
|
||||
if (ConfigurationManager::getInstance()->isdoAnalysis()) {
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file StackingAction.cc
|
||||
/// \brief Implementation of the CaTS::StackingAction class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ClassificationOfNewTrack.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
// project headers
|
||||
#include "StackingAction.hh"
|
||||
|
||||
StackingAction::StackingAction()
|
||||
: G4UserStackingAction()
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
StackingAction::~StackingAction() { delete fMessenger; }
|
||||
G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(
|
||||
const G4Track* aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack classification = fWaiting;
|
||||
if(aTrack->GetParentID() == 0)
|
||||
return classification;
|
||||
if(aTrack->GetDefinition()->GetParticleName() == "pi0")
|
||||
{
|
||||
if(fkillPi0)
|
||||
{
|
||||
classification = fKill;
|
||||
}
|
||||
}
|
||||
if(aTrack->GetDefinition()->GetParticleName() == "eta")
|
||||
{
|
||||
if(fkilleta)
|
||||
{
|
||||
classification = fKill;
|
||||
}
|
||||
}
|
||||
if(aTrack->GetDefinition()->GetParticleName() == "gamma")
|
||||
{
|
||||
if(aTrack->GetCreatorProcess()->GetProcessName() == "nCapture")
|
||||
{
|
||||
if(fkillGammafromnCapture)
|
||||
{
|
||||
classification = fKill;
|
||||
}
|
||||
}
|
||||
}
|
||||
return classification;
|
||||
}
|
||||
|
||||
void StackingAction::Print()
|
||||
{
|
||||
G4cout << "===================================================" << G4endl;
|
||||
G4cout << " StackingAction configuration: " << G4endl;
|
||||
G4cout << " Kill Pi0s : " << fkillPi0 << G4endl;
|
||||
G4cout << " Kill etas : " << fkilleta << G4endl;
|
||||
G4cout << " Kill Gammas from neutron Capture: " << fkillGammafromnCapture
|
||||
<< G4endl;
|
||||
G4cout << "===================================================" << G4endl;
|
||||
}
|
||||
|
||||
void StackingAction::DefineCommands()
|
||||
{
|
||||
fMessenger = new G4GenericMessenger(this, "/CaTS/StackingAction/",
|
||||
"select particles to kill");
|
||||
auto& killPi0Cmd = fMessenger->DeclareProperty("killPi0", fkillPi0);
|
||||
killPi0Cmd.SetGuidance("kill Pi0 (true/false)");
|
||||
killPi0Cmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
killPi0Cmd.SetDefaultValue("false");
|
||||
auto& killetaCmd = fMessenger->DeclareProperty("killeta", fkilleta);
|
||||
killetaCmd.SetGuidance("kill eta (true/false)");
|
||||
killetaCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
|
||||
killetaCmd.SetDefaultValue("false");
|
||||
auto& killGammafromnCaptureCmd = fMessenger->DeclareProperty(
|
||||
"killGammafromnCapture", fkillGammafromnCapture);
|
||||
killGammafromnCaptureCmd.SetGuidance("kill GammafromnCapture (true/false)");
|
||||
killGammafromnCaptureCmd.SetStates(G4State_PreInit, G4State_Init,
|
||||
G4State_Idle);
|
||||
killGammafromnCaptureCmd.SetDefaultValue("false");
|
||||
fMessenger->DeclareMethod("Print", &StackingAction::Print)
|
||||
.SetGuidance("Print StackingAction configuration")
|
||||
.SetStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
+55
-61
@@ -23,80 +23,74 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file TrackerHit.cc
|
||||
/// \brief Implementation of the CaTS::TrackerHit class
|
||||
|
||||
#include "GammaRayTelEMstdPhysics.hh"
|
||||
// Geant4 headers
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
// project headers
|
||||
#include "TrackerHit.hh"
|
||||
G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator = nullptr;
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip>
|
||||
|
||||
// gamma
|
||||
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
|
||||
|
||||
// e-
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
|
||||
// e+
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
|
||||
GammaRayTelEMstdPhysics::GammaRayTelEMstdPhysics(const G4String& name)
|
||||
: G4VPhysicsConstructor(name)
|
||||
TrackerHit::TrackerHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
TrackerHit::TrackerHit(G4double iedep, G4ThreeVector iposition, G4double itime)
|
||||
: G4VHit()
|
||||
{
|
||||
fEdep = iedep;
|
||||
fposition = iposition;
|
||||
ftime = itime;
|
||||
}
|
||||
|
||||
GammaRayTelEMstdPhysics::~GammaRayTelEMstdPhysics()
|
||||
TrackerHit::TrackerHit(const TrackerHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fposition = right.fposition;
|
||||
ftime = right.ftime;
|
||||
}
|
||||
|
||||
void GammaRayTelEMstdPhysics::ConstructParticle()
|
||||
const TrackerHit& TrackerHit::operator=(const TrackerHit& right)
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fposition = right.fposition;
|
||||
ftime = right.ftime;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
|
||||
void GammaRayTelEMstdPhysics::ConstructProcess()
|
||||
G4bool TrackerHit::operator==(const TrackerHit& right) const
|
||||
{
|
||||
G4ProcessManager * pManager = 0;
|
||||
|
||||
// Gamma Physics
|
||||
pManager = G4Gamma::Gamma()->GetProcessManager();
|
||||
|
||||
pManager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pManager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pManager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
|
||||
// Electron Physics
|
||||
|
||||
pManager = G4Electron::Electron()->GetProcessManager();
|
||||
|
||||
pManager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
|
||||
pManager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pManager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
|
||||
// Positron Physics
|
||||
|
||||
pManager = G4Positron::Positron()->GetProcessManager();
|
||||
|
||||
pManager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
|
||||
pManager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pManager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
pManager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
|
||||
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
void TrackerHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(fposition);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file TrackerSD.cc
|
||||
/// \brief Implementation of the CaTS::TrackerSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
// project headers
|
||||
#include "TrackerSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
TrackerSD::TrackerSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " TrackerSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
}
|
||||
|
||||
void TrackerSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fTrackerHitsCollection =
|
||||
new TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
G4cout << "TrackerSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, fTrackerHitsCollection);
|
||||
}
|
||||
|
||||
G4bool TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(edep == 0. || aStep->GetTrack()->GetDynamicParticle()->GetCharge() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
TrackerHit* newHit =
|
||||
new TrackerHit(edep, aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPostStepPoint()->GetGlobalTime() / ns);
|
||||
fTrackerHitsCollection->insert(newHit);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = fTrackerHitsCollection->entries();
|
||||
if(verbose)
|
||||
G4cout << " Number of TrackerHits: " << NbHits << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file lArTPCHit.cc
|
||||
/// \brief Implementation of the CaTS::lArTPCHit class
|
||||
|
||||
#include <G4VHit.hh>
|
||||
#include "lArTPCHit.hh"
|
||||
template <class Type>
|
||||
class G4Allocator;
|
||||
G4ThreadLocal G4Allocator<lArTPCHit>* lArTPCHitAllocator = nullptr;
|
||||
|
||||
lArTPCHit::lArTPCHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
lArTPCHit::lArTPCHit(G4double fe, G4double fx, G4double fy, G4double fz)
|
||||
: G4VHit()
|
||||
{
|
||||
fElectrons = fe;
|
||||
fPosX = fx;
|
||||
fPosY = fy;
|
||||
fPosZ = fz;
|
||||
}
|
||||
|
||||
lArTPCHit::lArTPCHit(const lArTPCHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
fElectrons = right.fElectrons;
|
||||
fPosX = right.fPosX;
|
||||
fPosY = right.fPosY;
|
||||
fPosZ = right.fPosZ;
|
||||
}
|
||||
|
||||
const lArTPCHit& lArTPCHit::operator=(const lArTPCHit& right)
|
||||
{
|
||||
fElectrons = right.fElectrons;
|
||||
fPosX = right.fPosX;
|
||||
fPosY = right.fPosY;
|
||||
fPosZ = right.fPosZ;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4bool lArTPCHit::operator==(const lArTPCHit& right) const
|
||||
{
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
void lArTPCHit::Draw() {}
|
||||
@@ -0,0 +1,324 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// CaTS (Calorimetry and Tracking Simulation)
|
||||
//
|
||||
// Authors : Hans Wenzel
|
||||
// Soon Yung Jun
|
||||
// (Fermi National Accelerator Laboratory)
|
||||
//
|
||||
// History
|
||||
// October 18th, 2021 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file lArTPCSD.cc
|
||||
/// \brief Implementation of the CaTS::lArTPCSD class
|
||||
|
||||
// Geant4 headers
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Track.hh"
|
||||
#ifdef WITH_G4OPTICKS
|
||||
# include "G4Opticks.hh"
|
||||
# include "TrackInfo.hh"
|
||||
# include "OpticksGenstep.h"
|
||||
# include "OpticksFlags.hh"
|
||||
# include "G4OpticksHit.hh"
|
||||
# include "G4Cerenkov.hh"
|
||||
# include "G4Event.hh"
|
||||
# include "G4MaterialPropertiesTable.hh"
|
||||
# include "G4PhysicalConstants.hh"
|
||||
# include "G4RunManager.hh"
|
||||
# include "G4SteppingManager.hh"
|
||||
# include "G4SystemOfUnits.hh"
|
||||
# include "G4UnitsTable.hh"
|
||||
# include "G4VProcess.hh"
|
||||
# include "G4VRestDiscreteProcess.hh"
|
||||
# include "PhotonSD.hh"
|
||||
# include "G4Cerenkov.hh"
|
||||
# include "G4Scintillation.hh"
|
||||
# include "G4Version.hh"
|
||||
#endif
|
||||
// project headers
|
||||
#include "lArTPCSD.hh"
|
||||
#include "ConfigurationManager.hh"
|
||||
|
||||
lArTPCSD::lArTPCSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
verbose = ConfigurationManager::getInstance()->isEnable_verbose();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << collectionName.size() << " lArTPCSD name: " << name
|
||||
<< " collection Name: " << HCname << G4endl;
|
||||
}
|
||||
fHCID = -1;
|
||||
first = true;
|
||||
}
|
||||
|
||||
void lArTPCSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
flArTPCHitsCollection =
|
||||
new lArTPCHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHCID < 0)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "lArTPCSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
}
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
hce->AddHitsCollection(fHCID, flArTPCHitsCollection);
|
||||
}
|
||||
|
||||
G4bool lArTPCSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(edep == 0.)
|
||||
return false;
|
||||
// only deal with charged particles
|
||||
G4Track* aTrack = aStep->GetTrack();
|
||||
G4double charge = aTrack->GetDynamicParticle()->GetCharge();
|
||||
if(charge == 0)
|
||||
return false;
|
||||
G4double ds = aStep->GetStepLength();
|
||||
lArTPCHit* newHit = new lArTPCHit(
|
||||
NumElectrons(edep, ds), aStep->GetPostStepPoint()->GetPosition().getX(),
|
||||
aStep->GetPostStepPoint()->GetPosition().getY(),
|
||||
aStep->GetPostStepPoint()->GetPosition().getZ());
|
||||
flArTPCHitsCollection->insert(newHit);
|
||||
#ifdef WITH_G4OPTICKS
|
||||
if(ConfigurationManager::getInstance()->isEnable_opticks())
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
aMaterial = aTrack->GetMaterial();
|
||||
materialIndex = aMaterial->GetIndex();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "*******************************" << G4endl;
|
||||
G4cout << "RadiatorSD::ProcessHits initializing Material: "
|
||||
<< aMaterial->GetName() << " " << G4endl;
|
||||
G4cout << "RadiatorSD::ProcessHits: Name "
|
||||
<< aStep->GetPreStepPoint()
|
||||
->GetPhysicalVolume()
|
||||
->GetLogicalVolume()
|
||||
->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
aMaterialPropertiesTable = aMaterial->GetMaterialPropertiesTable();
|
||||
if(verbose)
|
||||
{
|
||||
aMaterialPropertiesTable->DumpTable();
|
||||
}
|
||||
//
|
||||
// properties related to Scintillation
|
||||
//
|
||||
# if(G4VERSION_NUMBER > 1072)
|
||||
YieldRatio =
|
||||
aMaterialPropertiesTable->GetConstProperty(kSCINTILLATIONYIELD1) /
|
||||
aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONYIELD2); // slowerRatio,
|
||||
FastTimeConstant = aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONTIMECONSTANT1); // TimeConstant,
|
||||
SlowTimeConstant = aMaterialPropertiesTable->GetConstProperty(
|
||||
kSCINTILLATIONTIMECONSTANT2); // slowerTimeConstant,
|
||||
# else
|
||||
Fast_Intensity = aMaterialPropertiesTable->GetProperty(kFASTCOMPONENT);
|
||||
Slow_Intensity = aMaterialPropertiesTable->GetProperty(kSLOWCOMPONENT);
|
||||
YieldRatio = aMaterialPropertiesTable->GetConstProperty(kYIELDRATIO);
|
||||
# endif
|
||||
ScintillationType = Slow;
|
||||
//
|
||||
// properties related to Cerenkov
|
||||
//
|
||||
Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
|
||||
# if(G4VERSION_NUMBER > 1072)
|
||||
Pmin = Rindex->GetMinEnergy();
|
||||
Pmax = Rindex->GetMaxEnergy();
|
||||
# else
|
||||
Pmin = Rindex->GetMinLowEdgeEnergy();
|
||||
Pmax = Rindex->GetMaxLowEdgeEnergy();
|
||||
# endif
|
||||
dp = Pmax - Pmin;
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << "nMax: " << nMax << "Pmin: " << Pmin << "Pmax: " << Pmax
|
||||
<< "dp: " << dp << G4endl;
|
||||
Rindex->DumpValues();
|
||||
}
|
||||
//
|
||||
first = false;
|
||||
}
|
||||
G4int Sphotons = 0; // number of scintillation photons this step
|
||||
G4int Cphotons = 0; // number of Cerenkov photons this step
|
||||
//
|
||||
// info needed for generating Cerenkov photons on the GPU;
|
||||
//
|
||||
G4double maxCos = 0.0;
|
||||
G4double maxSin2 = 0.0;
|
||||
G4double beta = 0.0;
|
||||
G4double beta1 = 0.0;
|
||||
G4double beta2 = 0.0;
|
||||
G4double BetaInverse = 0.0;
|
||||
G4double MeanNumberOfPhotons1 = 0.0;
|
||||
G4double MeanNumberOfPhotons2 = 0.0;
|
||||
G4SteppingManager* fpSteppingManager = G4EventManager::GetEventManager()
|
||||
->GetTrackingManager()
|
||||
->GetSteppingManager();
|
||||
G4StepStatus stepStatus = fpSteppingManager->GetfStepStatus();
|
||||
if(stepStatus != fAtRestDoItProc)
|
||||
{
|
||||
G4ProcessVector* procPost = fpSteppingManager->GetfPostStepDoItVector();
|
||||
size_t MAXofPostStepLoops = fpSteppingManager->GetMAXofPostStepLoops();
|
||||
for(size_t i3 = 0; i3 < MAXofPostStepLoops; i3++)
|
||||
{
|
||||
if((*procPost)[i3]->GetProcessName() == "Cerenkov")
|
||||
{
|
||||
G4Cerenkov* proc = (G4Cerenkov*) (*procPost)[i3];
|
||||
thePhysicsTable = proc->GetPhysicsTable();
|
||||
CerenkovAngleIntegrals =
|
||||
(G4PhysicsOrderedFreeVector*) ((*thePhysicsTable)(materialIndex));
|
||||
Cphotons = proc->GetNumPhotons();
|
||||
if(Cphotons > 0)
|
||||
{
|
||||
beta1 = aStep->GetPreStepPoint()->GetBeta();
|
||||
beta2 = aStep->GetPostStepPoint()->GetBeta();
|
||||
beta = (beta1 + beta2) * 0.5;
|
||||
BetaInverse = 1. / beta;
|
||||
maxCos = BetaInverse / nMax;
|
||||
maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
|
||||
MeanNumberOfPhotons1 =
|
||||
proc->GetAverageNumberOfPhotons(charge, beta1, aMaterial, Rindex);
|
||||
MeanNumberOfPhotons2 =
|
||||
proc->GetAverageNumberOfPhotons(charge, beta2, aMaterial, Rindex);
|
||||
}
|
||||
}
|
||||
if((*procPost)[i3]->GetProcessName() == "Scintillation")
|
||||
{
|
||||
G4Scintillation* proc1 = (G4Scintillation*) (*procPost)[i3];
|
||||
Sphotons = proc1->GetNumPhotons();
|
||||
}
|
||||
}
|
||||
}
|
||||
tSphotons += Sphotons;
|
||||
tCphotons += Cphotons;
|
||||
G4ThreeVector deltaPosition = aStep->GetDeltaPosition();
|
||||
G4double ScintillationTime = 0. * ns;
|
||||
G4int scntId = 1;
|
||||
G4StepPoint* pPreStepPoint = aStep->GetPreStepPoint();
|
||||
G4ThreeVector x0 = pPreStepPoint->GetPosition();
|
||||
G4ThreeVector p0 = aStep->GetDeltaPosition().unit();
|
||||
//
|
||||
// harvest the Scintillation photon gensteps:
|
||||
//
|
||||
if(Sphotons > 0)
|
||||
{
|
||||
G4double ScintillationRiseTime = 0.0;
|
||||
G4Opticks::Get()->collectGenstep_G4Scintillation_1042(
|
||||
aTrack, aStep, Sphotons, scntId, ScintillationTime,
|
||||
ScintillationRiseTime);
|
||||
}
|
||||
//
|
||||
// harvest the Cerenkov photon gensteps:
|
||||
//
|
||||
if(Cphotons > 0)
|
||||
{
|
||||
G4Opticks::Get()->collectGenstep_G4Cerenkov_1042(
|
||||
aTrack, aStep, Cphotons, BetaInverse, Pmin, Pmax, maxCos, maxSin2,
|
||||
MeanNumberOfPhotons1, MeanNumberOfPhotons2);
|
||||
}
|
||||
G4Opticks* g4ok = G4Opticks::Get();
|
||||
G4RunManager* rm = G4RunManager::GetRunManager();
|
||||
const G4Event* event = rm->GetCurrentEvent();
|
||||
G4int eventid = event->GetEventID();
|
||||
G4OpticksHit hit;
|
||||
unsigned num_photons = g4ok->getNumPhotons();
|
||||
if(num_photons > ConfigurationManager::getInstance()->getMaxPhotons())
|
||||
{
|
||||
g4ok->propagateOpticalPhotons(eventid);
|
||||
G4HCtable* hctable = G4SDManager::GetSDMpointer()->GetHCtable();
|
||||
for(G4int i = 0; i < hctable->entries(); ++i)
|
||||
{
|
||||
std::string sdn = hctable->GetSDname(i);
|
||||
std::size_t found = sdn.find("Photondetector");
|
||||
if(found != std::string::npos)
|
||||
{
|
||||
PhotonSD* aSD =
|
||||
(PhotonSD*) G4SDManager::GetSDMpointer()->FindSensitiveDetector(
|
||||
sdn);
|
||||
aSD->AddOpticksHits();
|
||||
}
|
||||
}
|
||||
g4ok->reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void lArTPCSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
tSphotons = 0;
|
||||
tCphotons = 0;
|
||||
G4int NbHits = flArTPCHitsCollection->entries();
|
||||
if(verbose)
|
||||
{
|
||||
G4cout << " Number of lArTPCHits: " << NbHits << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4double lArTPCSD::NumElectrons(G4double edep, G4double ds)
|
||||
{
|
||||
// Nucl.Instrum.Meth.A523:275-286,2004
|
||||
G4double fGeVToElectrons = 4.237e+07;
|
||||
G4double fModBoxA = 0.930;
|
||||
G4double fModBoxB = 0.212;
|
||||
G4double EFieldStep = 0.5;
|
||||
G4double recomb = 0.0;
|
||||
G4double dEdx = (ds <= 0.0) ? 0.0 : edep / ds;
|
||||
if(dEdx < 1.)
|
||||
dEdx = 1.;
|
||||
if(ds > 0)
|
||||
{
|
||||
G4double Xi = fModBoxB * dEdx / EFieldStep;
|
||||
recomb = std::log(fModBoxA + Xi) / Xi;
|
||||
}
|
||||
else
|
||||
{
|
||||
recomb = 0.0;
|
||||
}
|
||||
G4double fNumIonElectrons = fGeVToElectrons * 1.e-3 * edep * recomb;
|
||||
return fNumIonElectrons;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<lcgdict>
|
||||
<class name="std::basic_string<char>" />
|
||||
<class name="G4String"/>
|
||||
<class name="G4VHit"/>
|
||||
<class name="Event"/>
|
||||
<class name="lArTPCHit"/>
|
||||
<class name="std::vector<lArTPCHit*>"/>
|
||||
<class name="PhotonHit"/>
|
||||
<class name="std::vector<PhotonHit*>"/>
|
||||
<class name="InteractionHit"/>
|
||||
<class name="std::vector<InteractionHit*>"/>
|
||||
<class name="CalorimeterHit"/>
|
||||
<class name="std::vector<CalorimeterHit*>"/>
|
||||
<class name="DRCalorimeterHit"/>
|
||||
<class name="std::vector<DRCalorimeterHit*>"/>
|
||||
<class name="TrackerHit"/>
|
||||
<class name="std::vector<TrackerHit*>"/>
|
||||
<class name="MscHit"/>
|
||||
<class name="std::vector<MscHit*>"/>
|
||||
<class name="G4ThreeVector"/>
|
||||
<class name="CLHEP::Hep3Vector"/>
|
||||
<class name="std::map<G4String, std::vector<G4VHit*> >"/>
|
||||
</lcgdict>
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.12...3.20)
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
set(name ChargeExchangeMC)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,9 @@ cirrone@lns.infn.it
|
||||
History file of the ChargeExchangeMC application
|
||||
====================================================
|
||||
|
||||
25.10.2021 - B. Morgan (ChargeExchangeMC-V10-07-01)
|
||||
Use G4StrUtil functions replacing deprecated G4String member functions
|
||||
|
||||
24.05.2021 - B. Morgan (ChargeExchangeMC-V10-07-00)
|
||||
Bump required CMake version range to 3.12...3.20, matching core Geant4
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
|
||||
=====================================================================
|
||||
Geant4 - Cexmc advanced example
|
||||
=====================================================================
|
||||
|
||||
README
|
||||
-----------------------
|
||||
|
||||
Author: A. Radkov (alexey.radkov@gmail.com)
|
||||
|
||||
------> Introduction
|
||||
|
||||
Cexmc stands for Charge EXchange Monte Carlo. The program was used to simulate
|
||||
real experiments in Petersburg Nuclear Physics Institute (PNPI, Russia).
|
||||
Detailed User's Manual and explanatory images of the experimental setup can be
|
||||
found in directory doc/ of this example.
|
||||
|
||||
------> Compilation
|
||||
|
||||
Basic modules of Cexmc must compile with Geant4 version 9.4. Cexmc won't compile
|
||||
with older versions of Geant4. Cexmc contains several optional modules which can
|
||||
be enabled or disabled in the makefile by setting dedicated macros: most of them
|
||||
are listed in the beginning of the makefile and well commented. Modules may
|
||||
involve additional dependencies. In the following table the dependencies and
|
||||
related modules are shown.
|
||||
|
||||
Dependency Requirement Makefile Macro / Module Comment
|
||||
--------------------------------------------------------------------------------
|
||||
boost::serialize Optional CEXMC_USE_PERSISTENCY / used when
|
||||
Persistency (de)serialization of
|
||||
events and run data
|
||||
|
||||
boost::split Optional CEXMC_USE_PERSISTENCY / used when parsing
|
||||
Main command line
|
||||
arguments related to
|
||||
persistency module
|
||||
|
||||
boost::spirit Optional CEXMC_USE_CUSTOM_FILTER / used in custom
|
||||
Custom filter filter engine
|
||||
|
||||
cernlib Optional CEXMC_USE_GENBOD / Main user can choose
|
||||
native GENBOD() as
|
||||
phase space
|
||||
generator
|
||||
|
||||
CERN ROOT Optional CEXMC_USE_ROOT / used in histograming
|
||||
Histograming
|
||||
|
||||
CERN ROOT / Qt Optional CEXMC_USE_ROOTQT / used for live
|
||||
binding Histograming histograms in Qt
|
||||
sessions
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
The persistency module is compatible with a pretty old boost::serialize version
|
||||
(compilation was tested under Scientific Linux 4.8 with gcc 3.4.6 and boost
|
||||
version 1.32). Custom filter requires a newer boost as far as it uses modern
|
||||
boost::spirit library which requires boost version 1.37 and higher.
|
||||
Presence of CERN ROOT libraries is tested automatically in the makefile, but it
|
||||
is possible to disable or enable the histograming framework manually using flag
|
||||
CEXMC_USE_HISTOGRAMING in the makefile.
|
||||
Compilation of visualization modules and interactive sessions depends on whether
|
||||
standard Geant4 macros like G4VIS_USE, G4UI_USE, G4UI_USE_TCSH and G4UI_USE_QT
|
||||
have been set.
|
||||
If boost is installed in a special path in your system then you may need to
|
||||
properly set environment variables BOOST_INCLUDE_PATH and BOOST_LIBRARY_PATH
|
||||
which denote directories where boost include files and libraries are located.
|
||||
|
||||
------> Run modes
|
||||
|
||||
Run modes are set from command-line options. To see available command-line
|
||||
options type in terminal 'cexmc -h' or just 'cexmc'. Some run modes can be
|
||||
unavailable if certain modules were not compiled.
|
||||
|
||||
Here is list of run modes categorized by type of interaction with user:
|
||||
|
||||
1. Batch mode. The simplest mode without any interaction with user.
|
||||
No command line option is required.
|
||||
2. Interactive mode. The program provides an interactive shell.
|
||||
To run in the interactive mode command line option -i must be specified.
|
||||
3. Graphical Qt mode. This mode is specified by command line option -g.
|
||||
|
||||
List of run modes categorized by task:
|
||||
|
||||
1. Straight mode (or Monte Carlo mode). The program will read preinit and
|
||||
init macros, then calculate acceptances and (optionally) save data in
|
||||
project files. Project files are saved in a directory defined by
|
||||
environment variable CEXMC_PROJECTS_DIR (or in the current directory if it
|
||||
is not defined), name of the project is specified by option -w. Preinit
|
||||
and init macros are set by options -p and -m respectively. In the straight
|
||||
mode preinit macro must be specified explicitly, as far as desired
|
||||
production model can be instantiated only in preinit phase.
|
||||
2. Replay mode (or Read project mode). In this mode the program will not use
|
||||
common Geant4's event loop. Instead, it will sequentially read event data
|
||||
from an existing project and pass them into
|
||||
CexmcEventAction::EndOfEventAction(). The read project is specified by
|
||||
option -r. This mode is useful when user wants to recalculate data from an
|
||||
existing project with different conditions (for example with different
|
||||
reconstruction parameters) or apply a custom filter. The results of run
|
||||
can be written again into another project.
|
||||
3. Show results mode (or Output mode). The program will output various data
|
||||
from an existing project (specified by option -r). Type(s) of data are
|
||||
specified in option -o. For example, to show results of a run user can
|
||||
specify -orun in command line. To show events, geometry and run results
|
||||
user can specify -oevents,geom,run.
|
||||
Binary file not shown.
Binary file not shown.
@@ -457,13 +457,13 @@ void CexmcSetup::ReadRightDetectors( void )
|
||||
{
|
||||
if ( ( *k )->GetLogicalVolume() == vetoCounterVolume )
|
||||
{
|
||||
if ( ( *k )->GetName().contains( "Right" ) )
|
||||
if ( G4StrUtil::contains(( *k )->GetName(), "Right" ) )
|
||||
rightVetoCounter = *k;
|
||||
break;
|
||||
}
|
||||
if ( ( *k )->GetLogicalVolume() == calorimeterVolume )
|
||||
{
|
||||
if ( ( *k )->GetName().contains( "Right" ) )
|
||||
if ( G4StrUtil::contains(( *k )->GetName(), "Right" ) )
|
||||
rightCalorimeter = *k;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 3.12...3.20)
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
|
||||
project(HGCal_testbeam)
|
||||
|
||||
|
||||
@@ -14,6 +14,18 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
14-November-2021 G. Cosmo (exhgcaltb-V10-07-05)
|
||||
- Fixed compilation warning for unused private member in PrimaryGeneratorAction.
|
||||
|
||||
07-October-2021 I. Hrivnacova (exhgcaltb-V10-07-04)
|
||||
- Migration to new G4AnalysisManager.hh header;
|
||||
define the default output file type (root).
|
||||
|
||||
19-July-2021 I. Hrivnacova (exhgcaltb-V10-07-03)
|
||||
- Updated for changes in the analysis category:
|
||||
removed deleting of the analysis manager,
|
||||
as this is now done by the Geant4 kernel.
|
||||
|
||||
10-June-21 V. Ivanchenko (exhgcaltb-V10-07-02)
|
||||
- SiliconPixelHit, SiPMHit - fixed bug in handling of NIEL energy
|
||||
deposition
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user