diff --git a/OCL/CMakeLists.txt b/OCL/CMakeLists.txt index 2814475..f13d3bf 100644 --- a/OCL/CMakeLists.txt +++ b/OCL/CMakeLists.txt @@ -43,19 +43,6 @@ target_link_libraries(OCL ${Geant4_LIBRARIES}) # build Scint. This is so that we can run the executable directly because it # relies on these scripts being in the current working directory. # -set(OCLSCRIPTS - PrintSimMacs.cpp - manyruns.sh - ) - -foreach(_script ${OCLSCRIPTS}) - configure_file( - ${PROJECT_SOURCE_DIR}/${_script} - ${PROJECT_BINARY_DIR}/${_script} - COPYONLY - ) -endforeach() - file(GLOB MACROS "${PROJECT_SOURCE_DIR}/*.mac") file(COPY ${MACROS} DESTINATION ${PROJECT_BINARY_DIR}) @@ -64,12 +51,12 @@ file(COPY ${MACROS} DESTINATION ${PROJECT_BINARY_DIR}) #-------------------------------------------------------------------------- # # Checks whether a "data" directory exists at the place GEANT4 wants to save -# the root files. +# the root files. # If it does not exist, this will lead to errors when you run the simulation # IF(EXISTS "../data") message("-- Data directory exists (needed for the root outputs)") -else() +else() message(SEND_ERROR " \n WARNING \n \"../data\" directory DOES NOT exists (needed for the root outputs)") endif() diff --git a/OCL/PrintSimMacs.cpp b/OCL/PrintSimMacs.cpp deleted file mode 100644 index 8c9264e..0000000 --- a/OCL/PrintSimMacs.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include - -using namespace std; - -/***************** Written by Gry in december 2015 ******************* -****************** changes made in january 2016 -This file generates a macros for runnin GEANT4 simulations with -N gamma rays of a given gamma ray energy Egamma isotropically distributed -between the theta angles thetamin and thetamax. - -To generate a set of macros run the bash script generatemacros.sh like this -source generatemacros.sh - -To run all the simulations use the script called manyruns.sh like this -source manyruns.sh -******************/ -int PrintSimMacs(){ -Int_t N = 1e6; //Number of gammas to be simulated -// Double_t mintheta = 160.; //smallest theta angle to be used for the gamma distribution [deg] -// Double_t maxtheta = 180.; //largest theta angle -Double_t Egammalow = 400.; //Lowest gamma energy to be simulated -Double_t Egammastep = 200.; //Steps of gamma energy -int nSteps = 50; // Number of Steps to simulate -// Double_t Egammahigh = 3000.; //Highest gamma energy to be simulated -Double_t Egamma = 0.; -ofstream macfile; -string fout; // basename - -for(int k=0;k -#include -#include - -using namespace std; - -/***************** Written by Gry in december 2015 ******************* -****************** changes made in january 2016 -This file generates a macros for runnin GEANT4 simulations with -N gamma rays of a given gamma ray energy Egamma isotropically distributed -between the theta angles thetamin and thetamax. - -To generate a set of macros run the bash script generatemacros.sh like this -source generatemacros.sh - -To run all the simulations use the script called manyruns.sh like this -source manyruns.sh -******************/ -int PrintSimMacs(){ -Int_t N = 1e6; //Number of gammas to be simulated -// Double_t mintheta = 160.; //smallest theta angle to be used for the gamma distribution [deg] -// Double_t maxtheta = 180.; //largest theta angle -Double_t Egammalow = 400.; //Lowest gamma energy to be simulated -Double_t Egammastep = 200.; //Steps of gamma energy -int nSteps = 50; // Number of Steps to simulate -// Double_t Egammahigh = 3000.; //Highest gamma energy to be simulated -Double_t Egamma = 0.; -ofstream macfile; -string fout; // basename - -for(int k=0;k List[str]: + string = [ + self._base_geometry_cmd, + "/run/initialize", + ""] + return string + + def run(self) -> List[str]: + assert np.issubdtype(type(self.nevent), np.integer) + + outname_base = Path(self.outdir) + fnout = Path(f"{self.outname_base}{self.energy}keV_n{self.nevent}") + fnout = outname_base / fnout.with_suffix(".root") + + def basestring(energykeV, fnout, nevent): + res = ["# Particle type, position, energy...", + "/gps/particle gamma", + "/gps/number 1", + "", + "# Particle source distribution", + "/gps/pos/type Plane", + "/gps/pos/shape Ellipse", + "/gps/pos/centre 0. 0. 0. mm", + "/gps/pos/halfx 0.75 mm", + "/gps/pos/halfy 1.25 mm", + "/gps/ang/type iso", + "", + f"/gps/energy {energykeV} keV", + f"/OCL/setOutName {fnout}", + "", + "# Number of events to run", + f"/run/beamOn {nevent}", + ] + return res + + string = basestring(self.energy, fnout, self.nevent) + # flat_list = [item for sublist in string for item in sublist] + return string + + +if __name__ == "__main__": + energy_grid = np.arange(50, 1e4, 10, dtype=int) + nevents = np.linspace(6e5, 3e6, len(energy_grid), dtype=np.int) + + energy_grid = np.append(energy_grid, [int(1.2e4), int(1.5e4), int(2e4)]) + nevents = np.append(nevents, [int(3e6), int(3e6), int(3e6)]) + + fnbase = Path("response_grid_macs") + fnbase.mkdir(exist_ok=True) + for i, (energy, nevent) in enumerate(zip(energy_grid, nevents)): + # print(f"Simulating gridpoint {i}") + macgen = MacroGenResponse(energy=energy, nevent=nevent) + macro = macgen.save(fnbase / f"grid_{i}.mac") + + # create summary file with commands to run + # sorted by decreasing computation time (highest energies first) + indices = np.arange(len(energy_grid)) + # np.random.shuffle(indices) + + cmds = [f"./OCL {fnbase}/grid_{i}.mac > $LOGDIR/out.o$LAUNCHER_JID" + for i in indices[::-1]] + cmd_string = "\n".join(*[cmds]) + fn_sum = Path("response_grid_cmds.txt") + fn_sum.write_text(cmd_string) diff --git a/OscarBuild/grid_simulations.py b/OscarBuild/grid_simulations.py new file mode 100644 index 0000000..8797d3e --- /dev/null +++ b/OscarBuild/grid_simulations.py @@ -0,0 +1,123 @@ +""" Run geant4 simulations on a grid for differernt geometry settings """ +import numpy as np +from typing import Dict, List, Optional +from pathlib import Path + + +class MacroGen: + def __init__(self): + self.detsList = np.arange(30) + 1 + self.dgeometry = None + + self.run_macs = ["run_152Eu.mac", "run_60Co.mac", "run_133Ba.mac", + "run_137Cs.mac"] + self.outdir = "../data/" + self.outname_base = "" # optionally: add eg sim_001_ + + self._base_geometry_cmd = "/control/execute setup_rad_source.mac" + pass + + def compose(self): + return '\n'.join(*[self.geometry() + self.run()]) + + def save(self, fname): + fn = Path(fname) + fn.write_text(self.compose()) + + def geometry(self, dgeometry: Optional[Dict] = None, + unit: str = "cm") -> List[str]: + d = self.dgeometry if dgeometry is None else dgeometry + string = [ + self._base_geometry_cmd, + f"/OCL/det/oscar/setCoatThickFront {d['front']:.4f} {unit}", + f"/OCL/det/oscar/setCoatThickRad {d['radial']:.4f} {unit}", + f"/OCL/det/oscar/setLaBrRefThick {d['reflector']:.4f} {unit}", + f"/OCL/det/oscar/setLaBrLidHalfThick {d['lidhalf']:.4f} {unit}", + "", + # note: default unit here is cm! + *[f"/OCL/det/oscar/setLaBrDist {N} {d['det']:.4f}" + for N in self.detsList], + "", + "/run/initialize", + ""] + return string + + def run(self) -> List[str]: + outname_base = Path(self.outdir) + fnrun = [Path(run) for run in self.run_macs] + fnout = [Path(self.outname_base + run) for run in self.run_macs] + fnout = [outname_base / fn.with_suffix(".root") for fn in fnout] + + def basestring(fnrun, fnout): + res = [f"/OCL/setOutName {fnout}", + f"/control/execute {fnrun}"] + return res + + string = [basestring(fnrun_, fnout_) + for fnrun_, fnout_ in zip(fnrun, fnout)] + flat_list = [item for sublist in string for item in sublist] + return flat_list + + +def meshgrid_1array(*args): + """ Make one grid of points from n different 1d grids. + + Example: + [x1, x2] ,  [y1, y2, y3] + -> [[x1, y1], + [x2, y1], + [x1, y2], + [x2, y2], + [x1, y3], + [x2, y3]] + """ + return np.array(np.meshgrid(*args)).T.reshape(-1, len(args)) + + +if __name__ == "__main__": + np.random.seed(65432) + macgen = MacroGen() + # print(macgen.run()) + + # nominal thicknesses in cm + dnominal = {'front': 0.2, 'radial': 0.1, 'reflector': 0.1, + 'lidhalf': 0.1, 'det': 16} + dvar = {} + for key, value in dnominal.items(): + dvar[key] = np.linspace(value*0.9, value*1.1, num=5) + + grid = meshgrid_1array(*dvar.values()) + print("Items to calculate: ", grid.shape) + + fnbase = Path("grid_macs") + fnbase.mkdir(exist_ok=True) + for i, pars in enumerate(grid): + # print(f"Simulating gridpoint {i}") + dtmp = {} + for idict, key in enumerate(dnominal.keys()): + dtmp[key] = pars[idict] + + macgen.outname_base = f"grid_{i}_" + macgen.dgeometry = dtmp + macro = macgen.save(fnbase / f"grid_{i}.mac") + + # create summary file with commands to run + # due to concerns on calculation time we may not calculate all values, + # but start with a random selection + indices = np.arange(len(grid)) + np.random.shuffle(indices) + + cmds = [f"./OCL grid_macs/grid_{i}.mac" for i in indices] + cmd_string = "\n".join(*[cmds]) + fn_sum = Path("grid_cmd_all.txt") + fn_sum.write_text(cmd_string) + + + + + # radial = np.linspace(1, 4, num=3) + # z = np.linspace(10, 40, num=4) + # xv = meshgrid_1array(x, y, z) + # print(xv) + # print(yv) + diff --git a/OscarBuild/manyruns.sh b/OscarBuild/manyruns.sh deleted file mode 100755 index 3cb3acd..0000000 --- a/OscarBuild/manyruns.sh +++ /dev/null @@ -1,5 +0,0 @@ -for macrofile in sim*.mac; -do ./OCL $macrofile; -cp $macrofile ../data/${macrofile} -cp ../data/Edep.root ../data/${macrofile}.root; -done diff --git a/OscarBuild/runsims.sh b/OscarBuild/runsims.sh deleted file mode 100755 index dc55ec0..0000000 --- a/OscarBuild/runsims.sh +++ /dev/null @@ -1,2 +0,0 @@ -root -b -q "PrintSimMacs.cpp"; -source manyruns.sh diff --git a/OscarBuild/submitt_scripts/commands b/OscarBuild/submitt_scripts/commands new file mode 120000 index 0000000..cbbbf4d --- /dev/null +++ b/OscarBuild/submitt_scripts/commands @@ -0,0 +1 @@ +../response_grid_cmds.txt \ No newline at end of file diff --git a/OscarBuild/submitt_scripts/commands_cp b/OscarBuild/submitt_scripts/commands_cp new file mode 100644 index 0000000..9838521 --- /dev/null +++ b/OscarBuild/submitt_scripts/commands_cp @@ -0,0 +1,5 @@ +./OCL grid/1.mac > $LOGDIR/out.o$LAUNCHER_JID +./OCL grid/2.mac > $LOGDIR/out.o$LAUNCHER_JID +./OCL grid/3.mac > $LOGDIR/out.o$LAUNCHER_JID +./OCL grid/4.mac > $LOGDIR/out.o$LAUNCHER_JID +./OCL grid/5.mac > $LOGDIR/out.o$LAUNCHER_JID diff --git a/OscarBuild/submitt_scripts/commands_grid0 b/OscarBuild/submitt_scripts/commands_grid0 new file mode 100644 index 0000000..34ed020 --- /dev/null +++ b/OscarBuild/submitt_scripts/commands_grid0 @@ -0,0 +1 @@ +./OCL response_grid_macs/grid_997.mac > $LOGDIR/out.o$LAUNCHER_JID diff --git a/OscarBuild/submitt_scripts/commands_postproc b/OscarBuild/submitt_scripts/commands_postproc new file mode 100644 index 0000000..56d57f8 --- /dev/null +++ b/OscarBuild/submitt_scripts/commands_postproc @@ -0,0 +1 @@ +root -l export_hist_short.C diff --git a/OscarBuild/submitt_scripts/launcher.slurm b/OscarBuild/submitt_scripts/launcher.slurm new file mode 100755 index 0000000..12ad414 --- /dev/null +++ b/OscarBuild/submitt_scripts/launcher.slurm @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J oscar_response +#SBATCH --nodes=8 +#SBATCH --ntasks-per-node=32 --cpus-per-task=1 +##SBATCH --qos=devel +#SBATCH -o grid.%j.out +#SBATCH -e grid.%j.err +#SBATCH -t 5-00:00:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +workdir=$USERWORK/$SLURM_JOB_ID +mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +export LAUNCHER_RMI=SLURM +export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LOGDIR=$workdir/logs +mkdir -p $LOGDIR + +export LAUNCHER_JOB_FILE=`pwd`/commands + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +$LAUNCHER_DIR/paramrun + diff --git a/OscarBuild/submitt_scripts/launcher.slurm_devel b/OscarBuild/submitt_scripts/launcher.slurm_devel new file mode 100755 index 0000000..5d316e2 --- /dev/null +++ b/OscarBuild/submitt_scripts/launcher.slurm_devel @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J geant4_test +#SBATCH --nodes=2 +#SBATCH --ntasks-per-node=32 --cpus-per-task=1 +#SBATCH --qos=devel +#SBATCH -o grid.%j.out +#SBATCH -e grid.%j.err +#SBATCH -t 00:20:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +workdir=$USERWORK/$SLURM_JOB_ID +mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +export LAUNCHER_RMI=SLURM +export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LOGDIR=$workdir/logs +mkdir -p $LOGDIR + +export LAUNCHER_JOB_FILE=`pwd`/commands + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +$LAUNCHER_DIR/paramrun + diff --git a/OscarBuild/submitt_scripts/launcher.slurm_grid0 b/OscarBuild/submitt_scripts/launcher.slurm_grid0 new file mode 100755 index 0000000..03662a1 --- /dev/null +++ b/OscarBuild/submitt_scripts/launcher.slurm_grid0 @@ -0,0 +1,66 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J oscar_response +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --partition=bigmem +#SBATCH --mem-per-cpu=1GB +#SBATCH -o grid.%j.out +#SBATCH -e grid.%j.err +#SBATCH -t 5-00:00:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +workdir=$USERWORK/$SLURM_JOB_ID +mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +export LAUNCHER_RMI=SLURM +export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LOGDIR=$workdir/logs +mkdir -p $LOGDIR + +export LAUNCHER_JOB_FILE=`pwd`/commands_grid0 + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +$LAUNCHER_DIR/paramrun + diff --git a/OscarBuild/submitt_scripts/postproc.sh b/OscarBuild/submitt_scripts/postproc.sh new file mode 100755 index 0000000..9c38c67 --- /dev/null +++ b/OscarBuild/submitt_scripts/postproc.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J resp_postproc +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --partition=bigmem +#SBATCH --mem-per-cpu=1GB +#SBATCH -o postproc.%j.out +#SBATCH -e postproc.%j.err +#SBATCH -t 01:30:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +workdir=$USERWORK/$SLURM_JOB_ID +mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +export LAUNCHER_RMI=SLURM +export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +#export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LAUNCHER_WORKDIR=/cluster/projects/nn9464k/fabio/OSCAR_response_results/641159/data +export LOGDIR=$workdir/logs_postproc +mkdir -p $LOGDIR + +export LAUNCHER_JOB_FILE=`pwd`/commands_postproc + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +$LAUNCHER_DIR/paramrun + diff --git a/OscarBuild/submitt_scripts/postproc_devel.sh b/OscarBuild/submitt_scripts/postproc_devel.sh new file mode 100644 index 0000000..ac09c78 --- /dev/null +++ b/OscarBuild/submitt_scripts/postproc_devel.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J resp_postproc +#SBATCH --nodes=1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --qos=devel +##SBATCH --mem-per-cpu=1GB +#SBATCH -o postproc.%j.out +#SBATCH -e postproc.%j.err +#SBATCH -t 00:30:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +workdir=$USERWORK/$SLURM_JOB_ID +mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +export LAUNCHER_RMI=SLURM +export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +#export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LAUNCHER_WORKDIR=/cluster/projects/nn9464k/fabio/OSCAR_response_results/641159/data +export LOGDIR=$workdir/logs_postproc +mkdir -p $LOGDIR + +export LAUNCHER_JOB_FILE=`pwd`/commands_postproc + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +$LAUNCHER_DIR/paramrun + diff --git a/OscarBuild/submitt_scripts/postproc_simple.sh b/OscarBuild/submitt_scripts/postproc_simple.sh new file mode 100644 index 0000000..7e00ee3 --- /dev/null +++ b/OscarBuild/submitt_scripts/postproc_simple.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Laucher batch script file for TACC systems (like Frontera, Stampede2, etc.) +# Si Liu +# July 13, 2020 +# +# Simple SLURM script for submitting multiple serial +# jobs (e.g. parametric studies) using a script wrapper +# to launch the jobs. +# +# To use, build the launcher executable and your +# serial application(s) and place them in your WORKDIR +# directory. Then, edit the LAUNCHER_JOB_FILE to specify +# each executable per process. +#------------------------------------------------------- +# +# <------ Setup Parameters ------> +# +#SBATCH -J resp_postproc +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --partition=bigmem +#SBATCH --mem-per-cpu=1GB +#SBATCH -o postproc.%j.out +#SBATCH -e postproc.%j.err +#SBATCH -t 01:30:00 +#SBATCH -A nn9464k +#SBATCH --mail-type=ALL +#SBATCH --mail-user=fabio.zeiser@fys.uio.no + +#------------------------------------------------------ + +set -o errexit # Exit the script on any error +set -o nounset # Treat any unset variables as an error + +module --quiet purge # Reset the modules to the system default + +# setup working dir (remember to copy back later) +#workdir=$USERWORK/$SLURM_JOB_ID +#mkdir -p $workdir +#cp -r $SUBMITDIR/* $workdir +#cp -r /cluster/home/fabiobz/OCL_GEANT4/* $workdir + +#module load launcher +#export LAUNCHER_DIR=/cluster/home/fabiobz/launcher + +# USING SLURM; plugins defines SLURM env. vars. +#export LAUNCHER_RMI=SLURM +#export LAUNCHER_PLUGIN_DIR=$LAUNCHER_DIR/plugins + +#export LAUNCHER_WORKDIR=$workdir/OscarBuild/ +export LAUNCHER_WORKDIR=/cluster/projects/nn9464k/fabio/OSCAR_response_results/641159/data +#export LOGDIR=$workdir/logs_postproc +#mkdir -p $LOGDIR + +#export LAUNCHER_JOB_FILE=`pwd`/commands_postproc + +#export LAUNCHER_SCHED=block + +module load Python/3.8.2-GCCcore-9.3.0 ROOT/6.12.06-intel-2018a-Python-2.7.14 icc/2019.1.144-GCC-8.2.0-2.31.1 CMake/3.13.3-GCCcore-8.2.0 +export LD_LIBRARY_PATH=/cluster/home/fabiobz/progs/xerces-c-3.2.3/install/lib:$LD_LIBRARY_PATH +source /cluster/home/fabiobz/progs/geant4.10.06.p02-install/bin/geant4.sh + +module list + +#$LAUNCHER_DIR/paramrun +cd $LAUNCHER_WORKDIR +root -l export_hist_short.C diff --git a/data/AnalyseSims.C b/data/AnalyseSims.C index 0b64edc..0016b43 100644 --- a/data/AnalyseSims.C +++ b/data/AnalyseSims.C @@ -46,6 +46,7 @@ void AnalyseSims::Loop() TH2D *h1_all = new TH2D("h1_all","Simulated electron energy deposition per detector",4200,0,21,30,1,31); TH1D *h2 = new TH1D("h2","Simulated and folded energy deposition",4200,0,21); + // this is the old FWHM parametrization -- see python scripts for updates Double_t cSmooth[] = {2.03936976e-04, 6.82322078e-23, 3.76053110e-05}; // make sure cal is in same units (MeVor keV) // generate a random number