Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
+38
View File
@@ -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
+39
View File
@@ -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()
+52
View File
@@ -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