From 53ea8d26ee63f103f12230028c64175ca076657d Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Mon, 10 Jul 2023 12:44:28 -0700 Subject: [PATCH 01/27] CHG: Print error message if the Assign-position of named detectors does not lead to a detector --- src/geomega/src/MDGeometry.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/geomega/src/MDGeometry.cxx b/src/geomega/src/MDGeometry.cxx index 77cb5f75..3aa595eb 100644 --- a/src/geomega/src/MDGeometry.cxx +++ b/src/geomega/src/MDGeometry.cxx @@ -3797,13 +3797,17 @@ bool MDGeometry::ScanSetupFile(MString FileName, bool CreateNodes, bool Virtuali } MDVolumeSequence* VS = new MDVolumeSequence(); - //cout<<"Assign pos: "<GetVolumeSequence(Pos, VS); + if (VS->GetDetector() == nullptr) { + MString VSout = VS->ToString(); + Typo("The position is not within a detector"); + cout<SetVolumeSequence(*VS); if (D->HasGuardRing() == true) { D->GetGuardRing()->SetVolumeSequence(*VS); } - //cout<<"VS: "<ToString()< Date: Mon, 10 Jul 2023 20:11:02 -0700 Subject: [PATCH 02/27] CHG: Improved font scaling --- resource/examples/benchmarks/Benchmark.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resource/examples/benchmarks/Benchmark.py b/resource/examples/benchmarks/Benchmark.py index 7eec7885..f25f0d19 100644 --- a/resource/examples/benchmarks/Benchmark.py +++ b/resource/examples/benchmarks/Benchmark.py @@ -241,8 +241,12 @@ FontScaler = 0.5 matplotlib.rcParams.update({'font.size': FontScaler*18}) -matplotlib.rcParams.update({'axes.titlesize': FontScaler*30}) -matplotlib.rcParams.update({'axes.labelsize': FontScaler*24}) +matplotlib.rcParams.update({'axes.titlesize': FontScaler*32}) +matplotlib.rcParams.update({'axes.labelsize': FontScaler*24}) +if len(Reference) <= 8: + matplotlib.rcParams.update({'xtick.labelsize': FontScaler*18}) +else: + matplotlib.rcParams.update({'xtick.labelsize': FontScaler*18*8/len(Reference)}) matplotlib.rcParams.update({'figure.figsize': [12.0, 6.0]}) x = np.arange(len(Labels)) # the label locations From 08b49f84e201ebaf3691011a9fceaec3c65daaa5 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Mon, 10 Jul 2023 20:13:17 -0700 Subject: [PATCH 03/27] CHG: Added io reference --- resource/examples/benchmarks/References/io.bm | 47 +++++++++++++++++++ resource/examples/benchmarks/oberon.bm | 47 ------------------- 2 files changed, 47 insertions(+), 47 deletions(-) create mode 100644 resource/examples/benchmarks/References/io.bm delete mode 100644 resource/examples/benchmarks/oberon.bm diff --git a/resource/examples/benchmarks/References/io.bm b/resource/examples/benchmarks/References/io.bm new file mode 100644 index 00000000..ee40edcb --- /dev/null +++ b/resource/examples/benchmarks/References/io.bm @@ -0,0 +1,47 @@ +# Benchmark summary file + +HostName: io.local + +OSFlavour: macOS +OSVersion: 13.4.1 +Kernel: 22.5.0 + +CPUModel: Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz +CPUName: i5-2415M +CPUSockets: 1 +CPUCoresPerSocket: 2 +CPUThreadsPerCore: 2 +Cores: 2 +Threads: 4 + +ROOTVersion: 6.28/04 +Geant4Version: 10.2.3 + +MEGAlibVersion: 3.99.02 +MEGAlibGitHash: ab0bd75a1f7945060fbe97ed19a6e7209a7efb7d 2023-07-10 +MEGAlibOptimization: -O -DNDEBUG + +# Cosima +DurationCosimaSingle: 68.194 +EventsPerSecondCosimaSingle: 1466.404 +DurationCosimaMultiple: 118.714 +EventsPerSecondCosimaMultiple: 3369.442 + +# Revan +DurationRevanSingle: 19.238 +EventsPerSecondRevanSingle: 5198.045 +DurationRevanMultiple: 18.737 +EventsPerSecondRevanMultiple: 21348.134 + +# ResponseCreator +DurationResponseCreatorSingle: 33.686 +EventsPerSecondResponseCreatorSingle: 2968.592 +DurationResponseCreatorMultiple: 65.550 +EventsPerSecondResponseCreatorMultiple: 6102.212 + +# MimrecImaging +DurationMimrecImagingSingle: 103.211 +EventsPerSecondMimrecImagingSingle: 968.888 +DurationMimrecImagingMultiple: 48.047 +EventsPerSecondMimrecImagingMultiple: 2081.295 + diff --git a/resource/examples/benchmarks/oberon.bm b/resource/examples/benchmarks/oberon.bm deleted file mode 100644 index 5d53c0bb..00000000 --- a/resource/examples/benchmarks/oberon.bm +++ /dev/null @@ -1,47 +0,0 @@ -# Benchmark summary file - -HostName: oberon.ssl.berkeley.edu - -OSFlavour: macOS -OSVersion: 13.4 -Kernel: 22.5.0 - -CPUModel: Apple M1 -CPUName: Apple M1 -CPUSockets: 1 -CPUCoresPerSocket: 8 -CPUThreadsPerCore: 1 -Cores: 8 -Threads: 8 - -ROOTVersion: 6.28/04 -Geant4Version: 10.2.3 - -MEGAlibVersion: 3.99.02 -MEGAlibGitHash: 94c9b31657138f7be60018c7b9f6e244d6db0e76 2023-06-06 -MEGAlibOptimization: -O -DNDEBUG - -# Cosima -DurationCosimaSingle: 17.065 -EventsPerSecondCosimaSingle: 5859.947 -DurationCosimaMultiple: 26.069 -EventsPerSecondCosimaMultiple: 30687.790 - -# Revan -DurationRevanSingle: 6.036 -EventsPerSecondRevanSingle: 16567.263 -DurationRevanMultiple: 5.648 -EventsPerSecondRevanMultiple: 141643.059 - -# ResponseCreator -DurationResponseCreatorSingle: 9.769 -EventsPerSecondResponseCreatorSingle: 10236.462 -DurationResponseCreatorMultiple: 16.382 -EventsPerSecondResponseCreatorMultiple: 48834.086 - -# MimrecImaging -DurationMimrecImagingSingle: 41.373 -EventsPerSecondMimrecImagingSingle: 2417.035 -DurationMimrecImagingMultiple: 10.915 -EventsPerSecondMimrecImagingMultiple: 9161.704 - From 558585688d6bbe7dfea82e972d48526309d6b673 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 13 Jul 2023 20:48:09 -0700 Subject: [PATCH 04/27] ADD: Callisto reference benchmark --- .../benchmarks/References/callisto.bm | 47 +++++++++++++++++++ resource/examples/benchmarks/References/io.bm | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 resource/examples/benchmarks/References/callisto.bm diff --git a/resource/examples/benchmarks/References/callisto.bm b/resource/examples/benchmarks/References/callisto.bm new file mode 100644 index 00000000..9283fbc3 --- /dev/null +++ b/resource/examples/benchmarks/References/callisto.bm @@ -0,0 +1,47 @@ +# Benchmark summary file + +HostName: callisto + +OSFlavour: ubuntu +OSVersion: 22.04 +Kernel: 5.19.0-46-generic + +CPUModel: Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz +CPUName: i7-4558U +CPUSockets: 1 +CPUCoresPerSocket: 2 +CPUThreadsPerCore: 2 +Cores: 2 +Threads: 4 + +ROOTVersion: 6.28/04 +Geant4Version: 10.2.3 + +MEGAlibVersion: 3.99.02 +MEGAlibGitHash: 08b49f84e201ebaf3691011a9fceaec3c65daaa5 2023-07-10 +MEGAlibOptimization: -O -DNDEBUG + +# Cosima +DurationCosimaSingle: 36.294 +EventsPerSecondCosimaSingle: 2755.276 +DurationCosimaMultiple: 63.256 +EventsPerSecondCosimaMultiple: 6323.510 + +# Revan +DurationRevanSingle: 8.409 +EventsPerSecondRevanSingle: 11892.020 +DurationRevanMultiple: 12.547 +EventsPerSecondRevanMultiple: 31880.130 + +# ResponseCreator +DurationResponseCreatorSingle: 18.994 +EventsPerSecondResponseCreatorSingle: 5264.820 +DurationResponseCreatorMultiple: 42.131 +EventsPerSecondResponseCreatorMultiple: 9494.196 + +# MimrecImaging +DurationMimrecImagingSingle: 70.112 +EventsPerSecondMimrecImagingSingle: 1426.289 +DurationMimrecImagingMultiple: 33.153 +EventsPerSecondMimrecImagingMultiple: 3016.318 + diff --git a/resource/examples/benchmarks/References/io.bm b/resource/examples/benchmarks/References/io.bm index ee40edcb..523e8a83 100644 --- a/resource/examples/benchmarks/References/io.bm +++ b/resource/examples/benchmarks/References/io.bm @@ -1,6 +1,6 @@ # Benchmark summary file -HostName: io.local +HostName: io OSFlavour: macOS OSVersion: 13.4.1 From dbd147f911d6baebf16e695b18f889a749c3e34e Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 3 Aug 2023 20:21:17 -0700 Subject: [PATCH 05/27] BUG: Fast event selector ignored unidentifiable events --- src/mimrec/src/MEventSelector.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mimrec/src/MEventSelector.cxx b/src/mimrec/src/MEventSelector.cxx index 3dcdf949..ecba07ff 100644 --- a/src/mimrec/src/MEventSelector.cxx +++ b/src/mimrec/src/MEventSelector.cxx @@ -1131,7 +1131,7 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) // ATTENTION: PUT ALL CHANGES HERE INTO BOTH (FAST & DETAILED) VERSION OF THIS FUNCTION - if (Event->IsGoodEvent() == false) { + if (Event->IsGoodEvent() == false && m_UseFlaggedAsBad == false) { return false; } @@ -1148,6 +1148,7 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) return false; } + // Compton events: if (Event->GetType() == MPhysicalEvent::c_Compton) { MComptonEvent *C = (MComptonEvent *) Event; @@ -1288,12 +1289,13 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) return false; } } else if (Event->GetType() == MPhysicalEvent::c_Unidentifiable) { - return false; + if (m_UseUnidentifiables == false) { + return false; + } } else { cout<<"Unknown event type: "<GetType()<GetTime()) == false) { @@ -1304,7 +1306,6 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) return false; } } - if (Event->GetTimeWalk() < m_TimeWalkMin || Event->GetTimeWalk() > m_TimeWalkMax) { @@ -1321,6 +1322,7 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) return false; } + // ATTENTION: PUT ALL CHANGES HERE INTO BOTH (FAST & DETAILED) VERSION OF THIS FUNCTION if (m_UseBeam == true) { @@ -1384,8 +1386,7 @@ bool MEventSelector::IsQualifiedEventFast(MPhysicalEvent* Event) return false; } } - - + // Only start in certain detectors - needs an active geometry if (m_Geometry != 0) { From ac3a54482ec9cc1c9cc9e8731eb809a58787fbbf Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 3 Aug 2023 20:24:52 -0700 Subject: [PATCH 06/27] CHG: Improved debug output --- src/fretalon/framework/src/MSupervisor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fretalon/framework/src/MSupervisor.cxx b/src/fretalon/framework/src/MSupervisor.cxx index 70a73223..21cfeaad 100644 --- a/src/fretalon/framework/src/MSupervisor.cxx +++ b/src/fretalon/framework/src/MSupervisor.cxx @@ -412,7 +412,7 @@ bool MSupervisor::Validate() if (Found == false) { // if it is a hard requirement than we have to quit if (m_Modules[m]->GetPreceedingModuleHardRequirement(t) == true) { - mout<<"Hard predecessor requirements for module "<GetName()<<" are not fullfilled"<GetName()<<"\" are not fullfilled (type: "<GetPreceedingModuleType(t)<<")"< Date: Thu, 3 Aug 2023 21:15:41 -0700 Subject: [PATCH 07/27] CHG: Try to detect if cosima started successfully --- bin/mcosima | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/bin/mcosima b/bin/mcosima index ae66df62..7afc06f9 100755 --- a/bin/mcosima +++ b/bin/mcosima @@ -392,6 +392,7 @@ echo "TAGS=( )" >> ${KillFileName} # Start the sims +FirstTag="" for (( i=1; i <= ${Threads}; i+=1 )); do # First check if we are ready to launch a new thread mwait -i=${Max} -p=cosima @@ -429,6 +430,10 @@ for (( i=1; i <= ${Threads}; i+=1 )); do sleep ${Delay} echo "TAGS+=( ${Tag} )" >> ${KillFileName} + + if [[ ${FirstTag} == "" ]]; then + FirstTag=${Tag} + fi done cat >> ${KillFileName} < Date: Fri, 4 Aug 2023 00:08:27 -0700 Subject: [PATCH 08/27] CHG: Store and read the MEGAlib configuration --- bin/megalib-config | 54 ++++++++++++++++++++++++++++++++++++++++++++++ configure | 10 +++++++++ 2 files changed, 64 insertions(+) create mode 100755 bin/megalib-config diff --git a/bin/megalib-config b/bin/megalib-config new file mode 100755 index 00000000..26d1ed91 --- /dev/null +++ b/bin/megalib-config @@ -0,0 +1,54 @@ +#!/bin/bash + +# Tool to check the configuration used to compile MEGAlib + +commandhelp() { + echo "" + echo "megalib-config"; + echo "Copyright by Andreas Zoglauer" + echo "" + echo "Shows MEGAlib configuration options" + echo "" + echo "Usage: megalib-config [options]"; + echo "" + echo "Options:" + echo " --compiler : Version of the compiler used during configuration" + echo " --python3 : Version of python3 used during configuration" + echo " --root : Version of ROOT used during configuration" + echo " --geant4 : Version of Geant4 used during configuration" + echo " --help : Show this help" + echo "" +} + + +# Store command line as array +CMD=( "$@" ) +MACHINESSTRING="" + +# Check for help +for C in "${CMD[@]}"; do + if [[ ${C} == --help ]]; then + echo "" + commandhelp + exit 0 + fi +done + + +for C in "${CMD[@]}"; do + if [[ ${C} == --compiler ]]; then + cat $MEGALIB/config/Configuration.txt | grep "COMPILER" | awk -F= '{print $2}' + elif [[ ${C} == --python3 ]]; then + cat $MEGALIB/config/Configuration.txt | grep "PYTHON3" | awk -F= '{print $2}' + elif [[ ${C} == --root ]]; then + cat $MEGALIB/config/Configuration.txt | grep "ROOT" | awk -F= '{print $2}' + elif [[ ${C} == --geant4 ]]; then + cat $MEGALIB/config/Configuration.txt | grep "GEANT4" | awk -F= '{print $2}' + elif [[ ${C} == *-h* ]]; then + echo "" + commandhelp + exit 0 + fi +done + +exit 0 diff --git a/configure b/configure index 96f544b5..f6d14196 100755 --- a/configure +++ b/configure @@ -623,6 +623,16 @@ echo "" echo "Removing old build..." make clean +# Store configuration +echo "" +echo "Storing configuration..." +rm -f config/Configuration.txt +echo "COMPILER=$(gcc --version | head -n 1)" >> config/Configuration.txt +echo "PYTHON3=$(python3 --version)" >> config/Configuration.txt +echo "ROOT=$(root-config --version)" >> config/Configuration.txt +echo "GEANT4=$(geant4-config --version)" >> config/Configuration.txt + + echo "" echo "" echo "Done! Now type 'make' to compile and link MEGAlib" From 99ef66604f185bd0bcf510e6f7397196cb70cc78 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Fri, 4 Aug 2023 18:41:39 -0700 Subject: [PATCH 09/27] CHG: Improved output --- src/sivan/src/MSimHT.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sivan/src/MSimHT.cxx b/src/sivan/src/MSimHT.cxx index a3c3c4b6..558d046b 100644 --- a/src/sivan/src/MSimHT.cxx +++ b/src/sivan/src/MSimHT.cxx @@ -262,9 +262,16 @@ MString MSimHT::ToString() const out<<"Hit in D"< 0) { + out<<"originating from IA"<<(m_Origins.size() == 1 ? " " : "s "); + for (unsigned int i = 0; i < m_Origins.size(); ++i) { + out< Date: Fri, 4 Aug 2023 18:42:46 -0700 Subject: [PATCH 10/27] CHG: Use address sanitizer in strong/hard debug mode --- configure | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index f6d14196..54d481b5 100755 --- a/configure +++ b/configure @@ -25,6 +25,7 @@ confhelp() { echo " " echo "--debug=[off/no, on/yes, strong/hard]" echo " Default is on." + echo " Strong enables the address sanitizer on Linux with gcc to detect memory access errors." echo " " echo "--compiler=[gcc, clang, icc]" echo " This currently only works on Linux. Default is gcc. On a Mac always the default compiler is used." @@ -483,9 +484,9 @@ if [[ ${DEBUG} == normal ]] || [[ ${DEBUG} == strong ]]; then OPTIONS+=" -g" if [[ ${DEBUG} == strong ]]; then OPTIONS+=" -DDEBUG1" - fi - if [[ ${COMP} == gcc ]] && [[ ${OS} == linux ]]; then - OPTIONS+=" -fstack-protector-all" + if [[ ${COMP} == gcc ]] && [[ ${OS} == linux ]]; then + OPTIONS+=" -fsanitize=address" + fi fi fi From 5dfe45d1855042e19b74ebef70be3810029ab50d Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Fri, 4 Aug 2023 18:43:21 -0700 Subject: [PATCH 11/27] CHG: Make sure it says C++-14 instead of C++-11 --- config/Makefile.linuxgcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Makefile.linuxgcc b/config/Makefile.linuxgcc index 3fd44ea7..db54c9d9 100644 --- a/config/Makefile.linuxgcc +++ b/config/Makefile.linuxgcc @@ -9,7 +9,7 @@ #---------------------------------------------------------------- -CMODE = "Linux with gcc and support for C++11" +CMODE = "Linux with gcc utilizing C++14" DLL = so # Basic flags generated by ROOT From a5251bc4c616cd1ab0fd1bc468680a148c9bbdcf Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Fri, 4 Aug 2023 23:28:23 -0700 Subject: [PATCH 12/27] CHG: Compatibility with NASA NAS --- resource/examples/benchmarks/Benchmark.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resource/examples/benchmarks/Benchmark.sh b/resource/examples/benchmarks/Benchmark.sh index 53016153..76fa9efe 100755 --- a/resource/examples/benchmarks/Benchmark.sh +++ b/resource/examples/benchmarks/Benchmark.sh @@ -20,7 +20,7 @@ checkload() { } -# For compatibility with macOS Catalina, compile a little C++ program to get the time in milliseconds +# For compatibility with macOS, compile a little C++ program to get the time in milliseconds TempEXE=$(mktemp) TimerC="${TempEXE}.cpp" @@ -49,9 +49,12 @@ if [[ $(uname -s) == Linux ]]; then CPUModel=$( lscpu | grep "Model name" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' ) CPUSockets=$( lscpu | grep "Socket" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' ) - if ! [[ ${CPUSockets} =~ ^?[0-9]+$ ]]; then + if ! [[ ${CPUSockets} =~ ^[0-9]+$ ]]; then CPUSockets=1 fi + if [[ ${CPUSockets} == "0" ]]; then + CPUSockets=1 + fi CPUCoresPerSocket=$( lscpu | grep "per socket" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' ) if [[ ${CPUCoresPerSocket} == "" ]]; then CPUCoresPerSocket=$( lscpu | grep "per cluster" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' ) From 2017b079055ede7dcb2bfce328961f7ceff52fff Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Mon, 7 Aug 2023 00:10:51 -0700 Subject: [PATCH 13/27] ADD: Option to store origin information --- bin/mrevan | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/mrevan b/bin/mrevan index 081a90b5..cf088869 100755 --- a/bin/mrevan +++ b/bin/mrevan @@ -13,6 +13,7 @@ help() { echo " -n : The nice level as an integer (default: 0)" echo " -c : Revan configuration file name (mandatory)" echo " -g : Overwrites the geometry in the configuration file (optional)" + echo " -o: Save origin information (for response creation)" echo " -f : Long list of sim/evta files - MUST BE LAST" echo ""; echo "Example:"; @@ -34,6 +35,7 @@ NICELEVEL=0 CFG="" FILES="" GEOMETRY="" +ORIGIN="FALSE" # Find the default number of threads if [[ ${OSTYPE} == darwin* ]]; then @@ -56,6 +58,9 @@ while [ $# -gt 0 ] ; do -h|--help) help; exit 0;; + -o) + ORIGIN="TRUE" + ;; -t) shift; if [ $# -eq 0 ]; then @@ -114,7 +119,7 @@ while [ $# -gt 0 ] ; do exit 0; fi while [ $# -ne 0 ]; do - FILES+=" "$1; + FILES+="$1 "; shift; done ;; @@ -165,9 +170,10 @@ echo " " echo "Number of threads to use: ${THREADS}" echo "Nice level: ${NICELEVEL}" if [[ ${GEOMETRY} != "" ]]; then - echo "Geometry: ${GEOMETRY}" + echo "Geometry: ${GEOMETRY}" fi echo "Revan configuration file: ${CFG}" +echo "Origin info: ${ORIGIN}" echo "Sim/evta files: ${FILES}" @@ -175,7 +181,11 @@ echo "Sim/evta files: ${FILES}" for SIMFILE in ${FILES}; do mwait -p=revan -i=${THREADS} echo "Launching revan for file ${SIMFILE}" - CMD="source ${MEGALIB}/bin/source-megalib.sh; revan -c ${CFG} -a -n -f ${SIMFILE}" + OPTIONS="-c ${CFG} -a -n " + if [[ ${ORIGIN} == "TRUE" ]]; then + OPTIONS+="--oi " + fi + CMD="source ${MEGALIB}/bin/source-megalib.sh; revan ${OPTIONS} -f ${SIMFILE}" if [[ ${GEOMETRY} != "" ]]; then CMD+=" -g ${GEOMETRY}" fi From de992ef60595e414f47be3199f380d690a7f3003 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Mon, 7 Aug 2023 00:11:38 -0700 Subject: [PATCH 14/27] CHG: Improved command line help --- src/response/src/MResponseCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/response/src/MResponseCreator.cxx b/src/response/src/MResponseCreator.cxx index 422800b7..f205a111 100644 --- a/src/response/src/MResponseCreator.cxx +++ b/src/response/src/MResponseCreator.cxx @@ -143,7 +143,7 @@ bool MResponseCreator::ParseCommandLine(int argc, char** argv) Usage<<" -b --mimrec-config file use this mimrec configuration file instead of defaults for the imaging response"<>> TEST RUN SUCCESSFUL <<<"\""< Date: Mon, 7 Aug 2023 00:22:39 -0700 Subject: [PATCH 15/27] BUG: Command line --- src/response/src/MResponseCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/response/src/MResponseCreator.cxx b/src/response/src/MResponseCreator.cxx index f205a111..1cf4325e 100644 --- a/src/response/src/MResponseCreator.cxx +++ b/src/response/src/MResponseCreator.cxx @@ -143,7 +143,7 @@ bool MResponseCreator::ParseCommandLine(int argc, char** argv) Usage<<" -b --mimrec-config file use this mimrec configuration file instead of defaults for the imaging response"<>> TEST RUN SUCCESSFUL <<<"\""<>> TEST RUN SUCCESSFUL <<<\""< Date: Mon, 14 Aug 2023 22:34:54 -0700 Subject: [PATCH 16/27] CHG: Add Galactic coordinate handling to azimuthal Compton scatter angle distribution --- src/mimrec/src/MInterfaceMimrec.cxx | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/mimrec/src/MInterfaceMimrec.cxx b/src/mimrec/src/MInterfaceMimrec.cxx index b27c38c5..a8251e42 100644 --- a/src/mimrec/src/MInterfaceMimrec.cxx +++ b/src/mimrec/src/MInterfaceMimrec.cxx @@ -5589,6 +5589,8 @@ void MInterfaceMimrec::AzimuthalComptonScatterAngle() // Initalize the image size (x-axis) int NBins = m_Settings->GetHistBinsARMGamma(); + double Disk = m_Settings->GetTPDistanceTrans(); + MVector TestPosition = GetTestPosition(); TH1D* Hist = new TH1D("AzimuthalComptonScatterAngle", "Azimuthal Compton Scatter Angle", NBins, -180, 180); Hist->SetBit(kCanDelete); @@ -5599,20 +5601,9 @@ void MInterfaceMimrec::AzimuthalComptonScatterAngle() Hist->SetMinimum(0.0); Hist->SetNdivisions(-508, "X"); - MPhysicalEvent* Event = nullptr; MComptonEvent* ComptonEvent = nullptr; - // Origin in spherical coordinates: - double Theta = m_Settings->GetTPTheta()*c_Rad; - double Phi = m_Settings->GetTPPhi()*c_Rad; - - // Origin in Cartesian Corrdinates: - MVector Origin; - Origin.SetMagThetaPhi(c_FarAway, Theta, Phi); - - double ArmCut = 180; - // Some statistics: int InsideArmCutSource = 0; int OutsideArmCutSource = 0; @@ -5624,16 +5615,14 @@ void MInterfaceMimrec::AzimuthalComptonScatterAngle() if (m_Selector->IsQualifiedEventFast(Event) == true) { if (Event->GetType() == MPhysicalEvent::c_Compton) { ComptonEvent = dynamic_cast(Event); - if (fabs(ComptonEvent->GetARMGamma(Origin, m_Settings->GetCoordinateSystem()))*c_Deg < ArmCut) { - MVector Plain = ComptonEvent->Dg(); - Plain.RotateZ(-Phi); - Plain.RotateY(-Theta); - - double Angle = Plain.Phi(); - Hist->Fill(Angle*c_Deg); + if (fabs(ComptonEvent->GetARMGamma(TestPosition, m_Settings->GetCoordinateSystem()))*c_Deg < Disk) { + + double Angle = ComptonEvent->GetAzimuthalScatterAngle(TestPosition, m_Settings->GetCoordinateSystem())*c_Deg; + + Hist->Fill(Angle); InsideArmCutSource++; - } else { + } else { OutsideArmCutSource++; } } @@ -5641,7 +5630,7 @@ void MInterfaceMimrec::AzimuthalComptonScatterAngle() delete Event; } - + // Close the event loader FinalizeEventLoader(); From 6d8666158e4aa17a9ae583e9eea1c528bfb38ac5 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 17 Aug 2023 12:05:29 -0700 Subject: [PATCH 17/27] ADD: Script to compile ll atmosphere code --- resource/examples/advanced/Atmosphere/make_all.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 resource/examples/advanced/Atmosphere/make_all.sh diff --git a/resource/examples/advanced/Atmosphere/make_all.sh b/resource/examples/advanced/Atmosphere/make_all.sh new file mode 100644 index 00000000..5a86fc4f --- /dev/null +++ b/resource/examples/advanced/Atmosphere/make_all.sh @@ -0,0 +1,6 @@ + + +for P in `ls *.cxx`; do + make -f ${MEGALIB}/resource/standalone/Makefile.standalone PRG=${P} +done + From df6f7534f1ed7983aed8e4760fd32d90bcb6bb37 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 24 Aug 2023 14:34:00 -0700 Subject: [PATCH 18/27] CHG: How events are written to file --- src/global/misc/inc/MComptonEvent.h | 7 +- src/global/misc/inc/MDecayEvent.h | 5 +- src/global/misc/inc/MMultiEvent.h | 4 +- src/global/misc/inc/MMuonEvent.h | 6 +- src/global/misc/inc/MPETEvent.h | 4 +- src/global/misc/inc/MPairEvent.h | 5 +- src/global/misc/inc/MPhotoEvent.h | 37 ++++-- src/global/misc/inc/MPhysicalEvent.h | 5 + src/global/misc/inc/MRotationInterface.h | 2 +- src/global/misc/inc/MUnidentifiableEvent.h | 7 +- src/global/misc/src/MComptonEvent.cxx | 91 +++++++-------- src/global/misc/src/MDecayEvent.cxx | 30 +++-- src/global/misc/src/MMultiEvent.cxx | 32 +++-- src/global/misc/src/MMuonEvent.cxx | 28 +++-- src/global/misc/src/MPETEvent.cxx | 35 +++--- src/global/misc/src/MPairEvent.cxx | 38 +++--- src/global/misc/src/MPhotoEvent.cxx | 28 +++-- src/global/misc/src/MPhysicalEvent.cxx | 117 ++++++++++--------- src/global/misc/src/MRotationInterface.cxx | 2 +- src/global/misc/src/MUnidentifiableEvent.cxx | 19 ++- 20 files changed, 276 insertions(+), 226 deletions(-) diff --git a/src/global/misc/inc/MComptonEvent.h b/src/global/misc/inc/MComptonEvent.h index 04fae5c4..cd9149d7 100644 --- a/src/global/misc/inc/MComptonEvent.h +++ b/src/global/misc/inc/MComptonEvent.h @@ -53,9 +53,9 @@ class MComptonEvent : public MPhysicalEvent //! Initialize from a text line bool Assimilate(char* LineBuffer); - //! Steam the content of this class into a file - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); - //! Parse a line + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line which is tra-file compatible virtual int ParseLine(const char* Line, bool Fast = false); //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); @@ -241,7 +241,6 @@ class MComptonEvent : public MPhysicalEvent // Miscellaneous: virtual void Reset(); virtual MString ToString() const; - MString ToBasicString() const; // To do: Implement all different possibilities... diff --git a/src/global/misc/inc/MDecayEvent.h b/src/global/misc/inc/MDecayEvent.h index 82becbf6..c7a0c416 100644 --- a/src/global/misc/inc/MDecayEvent.h +++ b/src/global/misc/inc/MDecayEvent.h @@ -43,7 +43,10 @@ class MDecayEvent : public MPhysicalEvent // Initilisations bool Assimilate(MDecayEvent* DecayEvent); bool Assimilate(MPhysicalEvent* Event); - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line which is tra-file compatible virtual int ParseLine(const char* Line, bool Fast = false); //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); diff --git a/src/global/misc/inc/MMultiEvent.h b/src/global/misc/inc/MMultiEvent.h index 82d95233..e22469ba 100644 --- a/src/global/misc/inc/MMultiEvent.h +++ b/src/global/misc/inc/MMultiEvent.h @@ -45,7 +45,9 @@ class MMultiEvent : public MPhysicalEvent //! Copy the data of the given event into this one bool Assimilate(MPhysicalEvent* Event); - //! Stream the data from a file + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Stream the content to the given file-stream virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); //! Parse a single line from the file virtual int ParseLine(const char* Line, bool Fast = false); diff --git a/src/global/misc/inc/MMuonEvent.h b/src/global/misc/inc/MMuonEvent.h index 0cda2753..ce23bb94 100644 --- a/src/global/misc/inc/MMuonEvent.h +++ b/src/global/misc/inc/MMuonEvent.h @@ -40,8 +40,12 @@ class MMuonEvent : public MPhysicalEvent bool Assimilate(MPhysicalEvent *Event); bool Assimilate(MVector Direction, MVector CenterOfGravity, double Energy); bool Assimilate(char *LineBuffer); - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line which is tra-file compatible virtual int ParseLine(const char* Line, bool Fast = false); + //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); diff --git a/src/global/misc/inc/MPETEvent.h b/src/global/misc/inc/MPETEvent.h index 48755175..d9200fb3 100644 --- a/src/global/misc/inc/MPETEvent.h +++ b/src/global/misc/inc/MPETEvent.h @@ -46,8 +46,8 @@ class MPETEvent : public MPhysicalEvent //! Copy the data of the given event into this one bool Assimilate(MPhysicalEvent* Event); - //! Stream the data from a file - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; //! Parse a single line from the file virtual int ParseLine(const char* Line, bool Fast = false); diff --git a/src/global/misc/inc/MPairEvent.h b/src/global/misc/inc/MPairEvent.h index 2b9b38da..cebb9d2e 100644 --- a/src/global/misc/inc/MPairEvent.h +++ b/src/global/misc/inc/MPairEvent.h @@ -43,7 +43,10 @@ class MPairEvent : public MPhysicalEvent bool Assimilate(MPairEvent* PairEvent); bool Assimilate(MPhysicalEvent* Event); bool Assimilate(char* LineBuffer); - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line which is tra-file compatible virtual int ParseLine(const char* Line, bool Fast = false); //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); diff --git a/src/global/misc/inc/MPhotoEvent.h b/src/global/misc/inc/MPhotoEvent.h index fc41fa18..f70ffd97 100644 --- a/src/global/misc/inc/MPhotoEvent.h +++ b/src/global/misc/inc/MPhotoEvent.h @@ -28,20 +28,32 @@ //////////////////////////////////////////////////////////////////////////////// +//! A photo-effect or single-site event class MPhotoEvent : public MPhysicalEvent { // Public Interface: public: + //! Standard consructor MPhotoEvent(); + //! Standrad destructor virtual ~MPhotoEvent(); - // Initilisations + // Initilizations + + //! Assimilate from a similar event bool Assimilate(MPhotoEvent* PhotoEvent); - bool Assimilate(MPhysicalEvent* Event); + //! Assimilate from a physical event + bool Assimilate(MPhysicalEvent* Event); + //! Assimilate from the basic data bool Assimilate(MVector Position, double Energy, double Weight = 1); + //! Assimilate from a single line of data bool Assimilate(char* LineBuffer); - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line which is tra-file compatible virtual int ParseLine(const char* Line, bool Fast = false); + //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); @@ -49,16 +61,23 @@ class MPhotoEvent : public MPhysicalEvent virtual bool Validate(); // Basic data: + + //! Set the total energy of the event void SetEnergy(const double Energy) { m_Energy = Energy; } + //! Get the total energy of the event virtual double GetEnergy() const { return m_Energy; } + //! Set the position of the event void SetPosition(const MVector& Position) { m_Position = Position; } - //! Get the position of the event - this is the location of the initial interaction! + //! Get the position of the event virtual MVector GetPosition() const { return m_Position; } + //! For some imaging tasks we need to weigh the event, set that weight void SetWeight(const double Weight) { m_Weight = Weight; } + //! For some imaging tasks we need to weigh the event, get that weight double GetWeight() const { return m_Weight; } + //! ToDo: Make osolencent MPhysicalEvent* Data(); @@ -79,10 +98,12 @@ class MPhotoEvent : public MPhysicalEvent // protected members: protected: - // basic data: - double m_Energy; // Deposited Energy - MVector m_Position; // Position - double m_Weight; // Weighting of this event + //! The deposited energy + double m_Energy; + //! The intercation position + MVector m_Position; + //! The weighting of the event (needed for some imaging tasks) + double m_Weight; // private members: private: diff --git a/src/global/misc/inc/MPhysicalEvent.h b/src/global/misc/inc/MPhysicalEvent.h index 6b126426..f9b941cb 100644 --- a/src/global/misc/inc/MPhysicalEvent.h +++ b/src/global/misc/inc/MPhysicalEvent.h @@ -53,6 +53,8 @@ class MPhysicalEvent : public MRotationInterface virtual MPhysicalEvent* Duplicate(); //! Stream the content to the given file-stream virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; //! Parse the content of the stream virtual int ParseLine(const char* Line, bool Fast = false); //! Parse the content of the stream @@ -111,6 +113,8 @@ class MPhysicalEvent : public MRotationInterface unsigned int GetNComments() const { return m_Comments.size(); } //! Get the specific comment -- throws MExceptionIndexOutOfBounds otherwise MString GetComment(unsigned int i) const; + //! Clear comments + void ClearComments() { m_Comments.clear(); } //! Add a hit void AddHit(const MPhysicalEventHit& Hit) { m_Hits.push_back(Hit); } @@ -130,6 +134,7 @@ class MPhysicalEvent : public MRotationInterface //! Get the OI energy information double GetOIEnergy() const { return m_OIEnergy; } + //! Convert content to a descriptive string of the event virtual MString ToString() const; static const int c_Unknown; diff --git a/src/global/misc/inc/MRotationInterface.h b/src/global/misc/inc/MRotationInterface.h index 4a05fffd..780add92 100644 --- a/src/global/misc/inc/MRotationInterface.h +++ b/src/global/misc/inc/MRotationInterface.h @@ -59,7 +59,7 @@ class MRotationInterface //! Stream to a file //! Reading has to be done in the derived class - void Stream(ostringstream& S); + void Stream(ostringstream& S) const; //! Retrieve the *key* content from binary bool ParseBinary(MBinaryStore& Out, const bool HasGalacticPointing, const bool HasDetectorRotation, const bool HasHorizonPointing, const int BinaryPrecision = 32, const int Version = 25); diff --git a/src/global/misc/inc/MUnidentifiableEvent.h b/src/global/misc/inc/MUnidentifiableEvent.h index b9c464a6..38fc29a8 100644 --- a/src/global/misc/inc/MUnidentifiableEvent.h +++ b/src/global/misc/inc/MUnidentifiableEvent.h @@ -41,8 +41,11 @@ class MUnidentifiableEvent : public MPhysicalEvent // Initilisations bool Assimilate(MUnidentifiableEvent* UnidentifiableEvent); - bool Assimilate(MPhysicalEvent *Event); - virtual bool Stream(MFile& File, int Version, bool Read, bool Fast = false, bool ReadDelayed = false); + bool Assimilate(MPhysicalEvent *Event); + + //! Stream the content into a tra-file compatible string + virtual MString ToTraString() const; + //! Parse a single line from the file virtual int ParseLine(const char* Line, bool Fast = false); //! Create a copy of this event virtual MPhysicalEvent* Duplicate(); diff --git a/src/global/misc/src/MComptonEvent.cxx b/src/global/misc/src/MComptonEvent.cxx index 829f79c6..5ce07188 100644 --- a/src/global/misc/src/MComptonEvent.cxx +++ b/src/global/misc/src/MComptonEvent.cxx @@ -1114,7 +1114,7 @@ MPhysicalEvent* MComptonEvent::Data() //////////////////////////////////////////////////////////////////////////////// - +/* MString MComptonEvent::ToBasicString() const { // Transform the data to one line of text @@ -1130,58 +1130,57 @@ MString MComptonEvent::ToBasicString() const return MString(LineBuffer); } - +*/ //////////////////////////////////////////////////////////////////////////////// -bool MComptonEvent::Stream(MFile& File, int Version, bool Read, bool Fast, bool ReadDelayed) +MString MComptonEvent::ToTraString() const { - // Hopefully a faster way to stream data from and to a file than ROOT... - // Rearely used options which are zero and default to zero are not streamed! - - bool Return = MPhysicalEvent::Stream(File, Version, Read, Fast, ReadDelayed); - - if (Read == false) { - // Write Compton specific infos: - - ostringstream S; - - if (m_ClusteringQualityFactor != 0) S<<"PQ "<ToTraString(); + T += "SF"; + } + + return T; +} + + +//////////////////////////////////////////////////////////////////////////////// + + bool MMultiEvent::Stream(MFile& File, int Version, bool Read, bool Fast, bool ReadDelayed) { - // Sstream data from and to a file than ROOT... + // Stream data from and to a file than ROOT... bool Return = true; @@ -269,14 +289,8 @@ bool MMultiEvent::Stream(MFile& File, int Version, bool Read, bool Fast, bool Re } else { // Write Multi specific infos: - Return = MPhysicalEvent::Stream(File, Version, Read, Fast, ReadDelayed); - - for (unsigned int i = 0; i < m_Events.size(); ++i) { - File.WriteLine("SI"); - m_Events[i]->Stream(File, Version, Read, Fast, ReadDelayed); - File.WriteLine("SF"); - } - + + File.Write(ToTraString()); File.Flush(); } diff --git a/src/global/misc/src/MMuonEvent.cxx b/src/global/misc/src/MMuonEvent.cxx index 4c7be8e8..5819a093 100644 --- a/src/global/misc/src/MMuonEvent.cxx +++ b/src/global/misc/src/MMuonEvent.cxx @@ -227,23 +227,21 @@ MPhysicalEvent* MMuonEvent::Data() //////////////////////////////////////////////////////////////////////////////// -bool MMuonEvent::Stream(MFile& File, int Version, bool Read, bool Fast, bool ReadDelayed) +MString MMuonEvent::ToTraString() const { - // Hopefully a faster way to stream data from and to a file than ROOT... - - bool Return = MPhysicalEvent::Stream(File, Version, Read, Fast, ReadDelayed); - - if (Read == false) { - // Write Muon specific infos: - ostringstream S; - S<<"ME "< Date: Thu, 24 Aug 2023 14:35:13 -0700 Subject: [PATCH 19/27] CHG: Parse whole event from string and make sure comments are only set once into MPhysicalEvent --- src/revan/inc/MRERawEvent.h | 8 +++++++- src/revan/src/MRERawEvent.cxx | 30 ++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/revan/inc/MRERawEvent.h b/src/revan/inc/MRERawEvent.h index 50d619a7..514a9875 100644 --- a/src/revan/inc/MRERawEvent.h +++ b/src/revan/inc/MRERawEvent.h @@ -53,6 +53,9 @@ class MRERawEvent : public MRESE, public MRotationInterface //! Duplicate this RESE MRERawEvent* Duplicate(); + //! Parse a whole event + int Parse(MString Event, int Version); + //! Parse the text Line which contains hit information from a sim or evta file int ParseLine(const char* Line, int Version); @@ -142,8 +145,11 @@ class MRERawEvent : public MRESE, public MRotationInterface bool GetExternalBadEventFlag() { return m_ExternalBadEventFlag; } MString GetExternalBadEventString() { return m_ExternalBadEventString; } - + //! Set the physical event + //! We create a local copy, thus Event will not be owned void SetPhysicalEvent(MPhysicalEvent* Event); + //! Get the physical event + //! This class owns the object, thus make your own ->Duplicate() MPhysicalEvent* GetPhysicalEvent(); diff --git a/src/revan/src/MRERawEvent.cxx b/src/revan/src/MRERawEvent.cxx index a4059bf2..468df196 100644 --- a/src/revan/src/MRERawEvent.cxx +++ b/src/revan/src/MRERawEvent.cxx @@ -1012,13 +1012,13 @@ MPhysicalEvent* MRERawEvent::GetPhysicalEvent() // This is only an experimental flag --- don't activate it unless you know what you are doing... bool UseCenterD2 = false; - if (m_Event != 0 && m_Event->GetType() != m_EventType) { + if (m_Event != nullptr && m_Event->GetType() != m_EventType) { // We had an upgrade... delete m_Event; - m_Event = 0; + m_Event = nullptr; } - if (m_Event == 0) { + if (m_Event == nullptr) { if (m_EventType == c_ComptonEvent) { MComptonEvent* CE = new MComptonEvent(); double ED1 = 0.0; @@ -1172,8 +1172,9 @@ MPhysicalEvent* MRERawEvent::GetPhysicalEvent() m_Event->SetOIInformation(Start->GetPosition(), Start->GetDirection(), Start->GetPolarization(), Start->GetEnergy()); } } + m_Event->ClearComments(); // Since this info might be added multiple times. for (unsigned int c = 0; c < m_Comments.size(); ++c) { - m_Event->AddComment(m_Comments[c]); + m_Event->AddComment(m_Comments[c]); } m_Event->Validate(); @@ -1642,6 +1643,27 @@ MRESE* MRERawEvent::GetNextRESE() //////////////////////////////////////////////////////////////////////////////// +int MRERawEvent::Parse(MString Event, int Version) +{ + // Return 0, if all lines got correctly parsed + // Return 1, and stop if a line got not correctly parsed + // Return 2, and stop if a line got not parsed + // Return -1, and stop if the end of event has been reached + + vector Lines = Event.Tokenize("\n"); + int ReturnCode = -2; + for (const MString& L: Lines) { + int ReturnCode = ParseLine(L, Version); + if (ReturnCode == 1) return ReturnCode; + } + + return ReturnCode; +} + + +//////////////////////////////////////////////////////////////////////////////// + + int MRERawEvent::ParseLine(const char* Line, int Version) { // Return 0, if the line got correctly parsed From ab49d2d899bf46b48d98167f7e113c04c35567d0 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Sun, 27 Aug 2023 22:17:05 -0700 Subject: [PATCH 20/27] CHG: Some speedups in the function evaluation --- src/global/misc/inc/MFunction3D.h | 6 ++ src/global/misc/src/MFunction3D.cxx | 106 ++++++++++++++++++- src/global/misc/src/MFunction3DSpherical.cxx | 47 ++++++++ 3 files changed, 157 insertions(+), 2 deletions(-) diff --git a/src/global/misc/inc/MFunction3D.h b/src/global/misc/inc/MFunction3D.h index 3d1b363a..83516dd7 100644 --- a/src/global/misc/inc/MFunction3D.h +++ b/src/global/misc/inc/MFunction3D.h @@ -151,10 +151,16 @@ class MFunction3D //! The x-axis data vector m_X; + //! If the edges are equidistant this is the distance + double m_XDistance; //! The y-axis data vector m_Y; + //! If the edges are equidistant this is the distance + double m_YDistance; //! The z-axis data vector m_Z; + //! If the edges are equidistant this is the distance + double m_ZDistance; //! The value-axis data vector m_V; diff --git a/src/global/misc/src/MFunction3D.cxx b/src/global/misc/src/MFunction3D.cxx index 26de4025..dec3c229 100644 --- a/src/global/misc/src/MFunction3D.cxx +++ b/src/global/misc/src/MFunction3D.cxx @@ -62,7 +62,7 @@ const unsigned int MFunction3D::c_InterpolationLinear = 2; MFunction3D::MFunction3D() - : m_InterpolationType(c_InterpolationUnknown) + : m_InterpolationType(c_InterpolationUnknown), m_XDistance(0), m_YDistance(0), m_ZDistance(0) { // Construct an instance of MFunction3D } @@ -78,8 +78,11 @@ MFunction3D::MFunction3D(const MFunction3D& F) m_InterpolationType = F.m_InterpolationType; m_X = F.m_X; + m_XDistance = F.m_XDistance; m_Y = F.m_Y; + m_YDistance = F.m_YDistance; m_Z = F.m_Z; + m_ZDistance = F.m_ZDistance; m_V = F.m_V; m_Maximum = F.m_Maximum; } @@ -104,8 +107,11 @@ const MFunction3D& MFunction3D::operator=(const MFunction3D& F) m_InterpolationType = F.m_InterpolationType; m_X = F.m_X; + m_XDistance = F.m_XDistance; m_Y = F.m_Y; + m_YDistance = F.m_YDistance; m_Z = F.m_Z; + m_ZDistance = F.m_ZDistance; m_V = F.m_V; m_Maximum = F.m_Maximum; @@ -224,6 +230,54 @@ bool MFunction3D::Set(const MString FileName, const MString KeyWord, } } + // Are m_X equidistant? + bool Equidistant = true; + double Equidistance = (m_X.back() - m_X.front()) / (m_X.size()-1); + for (unsigned int i = 2; i < m_X.size(); ++i) { + if (fabs((m_X[i] - m_X[i-1]) - Equidistance) > 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_XDistance = Equidistance; + cout<<"X is equidistant"< 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_YDistance = Equidistance; + } else { + m_YDistance = 0; + cout<<"Y not equidistant"< 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_ZDistance = Equidistance; + } else { + m_ZDistance = 0; + cout<<"Z not equidistant"<GetNTokens() == 0) continue; @@ -770,8 +824,23 @@ double MFunction3D::GetVMax() int MFunction3D::FindXBin(double x) const { - //! Find the z bin fast (switches between linear search and binary search) + //! Find the x bin fast (switches between linear search and binary search) + + if (m_XDistance == 0) { + auto I = lower_bound(m_X.begin(), m_X.end(), x); + if (I == m_X.begin()) { + return -1; // Smaller than the lowest bin edge + } else if (I == m_X.end()) { + return m_X.size(); // Greater than or equal to the largest bin edge + } else { + return distance(m_X.begin(), I); + } + } else { + // Equidistant case + return (int) ((x - m_X[0]) / m_XDistance); + } + /* massert(m_X.size() >= 2); if (x < m_X.front()) return -1; @@ -806,6 +875,7 @@ int MFunction3D::FindXBin(double x) const } return int(lower); } + */ } @@ -816,6 +886,21 @@ int MFunction3D::FindYBin(double y) const { //! Find the z bin fast (switches between linear search and binary search) + if (m_YDistance == 0) { + auto I = lower_bound(m_Y.begin(), m_Y.end(), y); + if (I == m_Y.begin()) { + return -1; // Smaller than the lowest bin edge + } else if (I == m_Y.end()) { + return m_Y.size(); // Greater than or equal to the largest bin edge + } else { + return distance(m_Y.begin(), I); + } + } else { + // Equidistant case + return (int) ((y - m_Y[0]) / m_YDistance); + } + + /* massert(m_Y.size() >= 2); if (y < m_Y.front()) return -1; @@ -850,6 +935,7 @@ int MFunction3D::FindYBin(double y) const } return int(lower); } + */ } @@ -860,6 +946,21 @@ int MFunction3D::FindZBin(double z) const { //! Find the z bin fast (switches between linear search and binary search) + if (m_ZDistance == 0) { + auto I = lower_bound(m_Z.begin(), m_Z.end(), z); + if (I == m_Z.begin()) { + return -1; // Smaller than the lowest bin edge + } else if (I == m_Z.end()) { + return m_Z.size(); // Greater than or equal to the largest bin edge + } else { + return distance(m_Z.begin(), I); + } + } else { + // Equidistant case + return (int) ((z - m_Z[0]) / m_ZDistance); + } + + /* massert(m_Z.size() >= 2); if (z < m_Z.front()) return -1; @@ -894,6 +995,7 @@ int MFunction3D::FindZBin(double z) const } return int(lower); } + */ } diff --git a/src/global/misc/src/MFunction3DSpherical.cxx b/src/global/misc/src/MFunction3DSpherical.cxx index 97be6590..a452e903 100644 --- a/src/global/misc/src/MFunction3DSpherical.cxx +++ b/src/global/misc/src/MFunction3DSpherical.cxx @@ -224,6 +224,53 @@ bool MFunction3DSpherical::Set(const MString FileName, const MString KeyWord, } } + // Are m_X equidistant? + bool Equidistant = true; + double Equidistance = (m_X.back() - m_X.front()) / (m_X.size()-1); + for (unsigned int i = 2; i < m_X.size(); ++i) { + if (fabs((m_X[i] - m_X[i-1]) - Equidistance) > 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_XDistance = Equidistance; + cout<<"X is equidistant"< 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_YDistance = Equidistance; + } else { + m_YDistance = 0; + cout<<"Y not equidistant"< 1E-10) { + Equidistant = false; + break; + } + } + if (Equidistant == true) { + m_ZDistance = Equidistance; + } else { + m_ZDistance = 0; + cout<<"Z not equidistant"<GetNTokens() == 0) continue; From dc0d7b576cc9f80f8e1f13d53774e6fb1898f4fd Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Mon, 28 Aug 2023 20:52:51 -0700 Subject: [PATCH 21/27] CHG: Optimization which prevents some precision loss for very large x values --- src/global/misc/inc/MFunction.h | 2 + src/global/misc/src/MFunction.cxx | 78 ++++++++++++++++++------------- 2 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/global/misc/inc/MFunction.h b/src/global/misc/inc/MFunction.h index 798d29b2..9e1289f6 100644 --- a/src/global/misc/inc/MFunction.h +++ b/src/global/misc/inc/MFunction.h @@ -160,6 +160,8 @@ class MFunction //! The x-axis data vector m_X; + //! The x-axis data starting at 0 + vector m_XZero; //! The y-axis data vector m_Y; diff --git a/src/global/misc/src/MFunction.cxx b/src/global/misc/src/MFunction.cxx index 7f1040a0..a4295324 100644 --- a/src/global/misc/src/MFunction.cxx +++ b/src/global/misc/src/MFunction.cxx @@ -90,6 +90,7 @@ MFunction::MFunction(const MFunction& F) m_InterpolationType = F.m_InterpolationType; m_X = F.m_X; + m_XZero = F.m_XZero; m_Y = F.m_Y; m_Cumulative = F.m_Cumulative; m_YNonNegative = F.m_YNonNegative; @@ -124,6 +125,7 @@ const MFunction& MFunction::operator=(const MFunction& F) m_InterpolationType = F.m_InterpolationType; m_X = F.m_X; + m_XZero = F.m_XZero; m_Y = F.m_Y; m_Cumulative = F.m_Cumulative; m_YNonNegative = F.m_YNonNegative; @@ -271,6 +273,10 @@ bool MFunction::Set(const MString FileName, const MString KeyWord) CreateSplines(); } + for (auto x: m_X) { + m_XZero.push_back(x - m_X[0]); + } + return true; } @@ -339,6 +345,10 @@ bool MFunction::Set(const MResponseMatrixO1& Response) // Clean up: m_Cumulative.clear(); + for (auto x: m_X) { + m_XZero.push_back(x - m_X[0]); + } + return true; } @@ -364,6 +374,10 @@ bool MFunction::Set(const vector& X, const vector& Y, unsigned i // Clean up: m_Cumulative.clear(); + for (auto x: m_X) { + m_XZero.push_back(x - m_X[0]); + } + return true; } @@ -379,13 +393,16 @@ bool MFunction::Add(const double x, const double y) if (m_X.size() == 0) { m_X.push_back(x); m_Y.push_back(y); + m_XZero.push_back(x - m_X[0]); } else { if (x < m_X[0]) { m_X.insert(m_X.begin(), x); m_Y.insert(m_Y.begin(), y); + m_XZero.insert(m_X.begin(), x - m_X[0]); } else if (x > m_X.back()) { m_X.push_back(x); m_Y.push_back(y); + m_XZero.push_back(x - m_X[0]); } else { for (unsigned int i = 0; i < m_X.size(); ++i) { if (x == m_X[i]) { @@ -395,6 +412,7 @@ bool MFunction::Add(const double x, const double y) } else if (x < m_X[i]) { m_X.insert(m_X.begin()+i, x); m_Y.insert(m_Y.begin()+i, y); + m_XZero.insert(m_XZero.begin()+i, x - m_X[0]); break; } } @@ -438,9 +456,10 @@ void MFunction::ScaleX(double Scaler) { // Multiple the x-axis by some value - for (unsigned int i = 0; i < m_X.size(); ++i) { + for (unsigned int i = 0; i < m_X.size(); ++i) { m_X[i] *= Scaler; - } + m_XZero[i] = m_X[i] - m_X[0]; + } // We clear the cumulative function: m_Cumulative.clear(); @@ -1117,8 +1136,8 @@ double MFunction::FindX(double XStart, double Integral, bool Cyclic) //! Find the x value starting from Start which would be achieved after integrating for "Integral" //! If we go beyond x_max, x_max is returned if we are not cyclic, otherwise we continue at x_0 - //cout<<"XStart: "< m_X.back()) { + if (X > m_XZero.back()) { //merr<<"XStart ("< I unsigned int BinStart = 0; - if (X > m_X.front()) { - //BinStart = find_if(m_X.begin(), m_X.end(), bind2nd(greater(), X)) - m_X.begin() - 1; - BinStart = find_if(m_X.begin(), m_X.end(), bind(greater(), placeholders::_1, X)) - m_X.begin() - 1; + if (X > m_XZero.front()) { + //BinStart = find_if(m_XZero.begin(), m_XZero.end(), bind2nd(greater(), X)) - m_XZero.begin() - 1; + BinStart = find_if(m_XZero.begin(), m_XZero.end(), bind(greater(), placeholders::_1, X)) - m_XZero.begin() - 1; } //cout<<"x: "<::max(); - - //cout<<"UpperBin: "<::max(); + // Step 2: Interpolate --- only linear at the moment --- within the given bin to find the right x-value - - double m = (m_Y[NewUpperBin-1] - m_Y[NewUpperBin]) / (m_X[NewUpperBin-1] - m_X[NewUpperBin]); - double t = m_Y[NewUpperBin] - m*m_X[NewUpperBin]; - - //cout<<"m: "<= m_X[NewUpperBin-1] && x1 <= m_X[NewUpperBin] && (x2 < m_X[NewUpperBin-1] || x2 > m_X[NewUpperBin])) { + if (x1 >= m_XZero[NewUpperBin-1] && x1 <= m_XZero[NewUpperBin] && (x2 < m_XZero[NewUpperBin-1] || x2 > m_XZero[NewUpperBin])) { //mout<<"x="<= m_X[NewUpperBin-1] && x2 <= m_X[NewUpperBin] && (x1 < m_X[NewUpperBin-1] || x1 > m_X[NewUpperBin])) { + } else if (x2 >= m_XZero[NewUpperBin-1] && x2 <= m_XZero[NewUpperBin] && (x1 < m_XZero[NewUpperBin-1] || x1 > m_XZero[NewUpperBin])) { //mout<<"x="< m_X[NewUpperBin]) && (x1 < m_X[NewUpperBin-1] || x1 > m_X[NewUpperBin])) { - merr<<"FindX: Both possible results are outside choosen bin ["< Date: Wed, 30 Aug 2023 00:50:32 -0700 Subject: [PATCH 22/27] CHG: More speed ups --- src/global/misc/inc/MFunction3D.h | 3 + src/global/misc/src/MFunction3D.cxx | 2 +- src/global/misc/src/MFunction3DSpherical.cxx | 145 +++++++++++++++++-- 3 files changed, 135 insertions(+), 15 deletions(-) diff --git a/src/global/misc/inc/MFunction3D.h b/src/global/misc/inc/MFunction3D.h index 83516dd7..09e11c73 100644 --- a/src/global/misc/inc/MFunction3D.h +++ b/src/global/misc/inc/MFunction3D.h @@ -167,6 +167,9 @@ class MFunction3D //! For random number generation store the maximum double m_Maximum; + //! The cumulative function for faster random number generation + vector m_Cumulative; + // private members: private: diff --git a/src/global/misc/src/MFunction3D.cxx b/src/global/misc/src/MFunction3D.cxx index dec3c229..0d386c02 100644 --- a/src/global/misc/src/MFunction3D.cxx +++ b/src/global/misc/src/MFunction3D.cxx @@ -628,7 +628,7 @@ double MFunction3D::Evaluate(double x, double y, double z) const } if (m_InterpolationType == c_InterpolationConstant) { - return m_Z[0]; + return m_V[0]; } else if (m_InterpolationType == c_InterpolationLinear) { // Get Position: diff --git a/src/global/misc/src/MFunction3DSpherical.cxx b/src/global/misc/src/MFunction3DSpherical.cxx index a452e903..4f5e55d9 100644 --- a/src/global/misc/src/MFunction3DSpherical.cxx +++ b/src/global/misc/src/MFunction3DSpherical.cxx @@ -436,16 +436,92 @@ double MFunction3DSpherical::Integrate() const return Integral; } - + //////////////////////////////////////////////////////////////////////////////// -void MFunction3DSpherical::GetRandom(double& x, double& y, double& z) +void MFunction3DSpherical::GetRandom(double& X, double& Y, double& Z) { // Return a random number distributed as the underlying function // The following is an accurate and safe version but rather slow... + if (m_Cumulative.size() == 0) { + m_Cumulative.resize(m_X.size()*m_Y.size()*m_Z.size()); + for (unsigned int x = 0; x < m_X.size()-1; ++x) { + double xCenter = 0.5*(m_X[x+1] + m_X[x]); + double xSize = fabs((m_X[x+1] - m_X[x]))*c_Rad; + for (unsigned int y = 0; y < m_Y.size()-1; ++y) { + double yCenter = 0.5*(m_Y[y+1] + m_Y[y]); + double ySize = fabs(cos(m_Y[y]*c_Rad) - cos(m_Y[y+1]*c_Rad)); + for (unsigned int z = 0; z < m_Z.size()-1; ++z) { + double zCenter = 0.5*(m_Z[z+1] + m_Z[z]); + double zSize = fabs(m_Z[z+1] - m_Z[z]); + + unsigned long Bin = x + y*m_X.size() + z*m_X.size()*m_Y.size(); + m_Cumulative[Bin] = xSize*ySize*zSize*Evaluate(xCenter, yCenter, zCenter); + } + } + } + for (unsigned int i = 1; i < m_Cumulative.size(); ++i) { + m_Cumulative[i] += m_Cumulative[i-1]; + } + } + + + // Find a random bin + double RandomCumulative = gRandom->Rndm()*m_Cumulative.back(); + auto upperBoundIt = upper_bound(m_Cumulative.begin(), m_Cumulative.end(), RandomCumulative); + + if (upperBoundIt == m_Cumulative.end()) { + cout<<"Error: We should never, ever reach that part of the code..."<::max(); + for (unsigned int x = xBin; x <= xBin+1; ++x) { + for (unsigned int y = yBin; y <= yBin+1; ++y) { + for (unsigned int z = zBin; z <= zBin+1; ++z) { + double V = m_V[x + y*m_X.size() + z*m_X.size()*m_Y.size()]; + if (V > Max) Max = V; + } + } + } + //cout<<"Max: "<Rndm()*x_diff + x_min; + Y = acos(y_min - gRandom->Rndm()*y_diff)*c_Deg; + Z = gRandom->Rndm()*z_diff + z_min; + + V = Evaluate(X, Y, Z); + } while (Max*gRandom->Rndm() > V); + //cout<<"Final: "<Rndm()*x_diff + x_min; - y = acos(y_min - gRandom->Rndm()*y_diff)*c_Deg; - z = gRandom->Rndm()*z_diff + z_min; + X = gRandom->Rndm()*x_diff + x_min; + Y = acos(y_min - gRandom->Rndm()*y_diff)*c_Deg; + Z = gRandom->Rndm()*z_diff + z_min; - v = Evaluate(x, y, z); + v = Evaluate(X, Y, Z); } while (m_Maximum*gRandom->Rndm() > v); + */ } @@ -479,19 +556,24 @@ void MFunction3DSpherical::Plot(bool Random) if (m_X.size() >= 2 && m_Y.size() >= 2 && m_Z.size() >= 2) { - TH3D* Hist = new TH3D("MFunction3DSpherical", "MFunction3DSpherical", m_X.size(), m_X.front(), m_X.back(), m_Y.size(), m_Y.front(), m_Y.back(), m_Z.size(), m_Z.front(), m_Z.back()); + TH3D* Hist = new TH3D("MFunction3DSpherical", "MFunction3DSpherical", m_X.size()-1, &m_X[0], m_Y.size()-1, &m_Y[0], m_Z.size()-1, &m_Z[0]); Hist->SetXTitle("phi in degree"); Hist->SetYTitle("theta in degree"); Hist->SetZTitle("energy in keV"); - TH2D* Projection = new TH2D("MFunction3DSpherical-P", "MFunction3DSpherical-P", - m_X.size(), m_X.front(), m_X.back(), - m_Y.size(), m_Y.front(), m_Y.back()); + TH2D* Projection = new TH2D("MFunction3DSpherical-P", "MFunction3DSpherical-P", m_X.size()-1, &m_X[0], m_Y.size()-1, &m_Y[0]); Projection->SetXTitle("phi in degree"); Projection->SetYTitle("theta in degree"); + + TH1D* ProjectionZ = new TH1D("MFunction3DSpherical-Z", "MFunction3DSpherical-Z", m_Z.size()-1, &m_Z[0]); + ProjectionZ->SetXTitle("energy in [keV]"); + TCanvas* Canvas = new TCanvas("DiagnosticsCanvas", "DiagnosticsCanvas"); Canvas->cd(); + if (m_Z.back() / (m_Z.front() > 0 ? m_Z.front() : 1) > 1000) { + Canvas->SetLogz(); + } if (Random == true) { double x, y, z; @@ -505,13 +587,39 @@ void MFunction3DSpherical::Plot(bool Random) } GetRandom(x, y, z); Hist->Fill(x, y, z, 1); + Projection->Fill(x, y, 1); + ProjectionZ->Fill(z, 1); + } + for (int bx = 1; bx <= Hist->GetXaxis()->GetNbins(); ++bx) { + for (int by = 1; by <= Hist->GetYaxis()->GetNbins(); ++by) { + double Area = c_Pi*(Hist->GetXaxis()->GetBinUpEdge(bx)*c_Rad - Hist->GetXaxis()->GetBinLowEdge(bx)*c_Rad); + Area *= cos(Hist->GetYaxis()->GetBinLowEdge(by)*c_Rad) - cos(Hist->GetYaxis()->GetBinUpEdge(by)*c_Rad); + for (int bz = 1; bz <= Hist->GetZaxis()->GetNbins(); ++bz) { + Hist->SetBinContent(bx, by, bz, Hist->GetBinContent(bx, by, bz) / Area / Hist->GetZaxis()->GetBinWidth(bz)); + } + } + } + for (int bx = 1; bx <= Hist->GetXaxis()->GetNbins(); ++bx) { + for (int by = 1; by <= Hist->GetYaxis()->GetNbins(); ++by) { + double Area = c_Pi*(Projection->GetXaxis()->GetBinUpEdge(bx)*c_Rad - Projection->GetXaxis()->GetBinLowEdge(bx)*c_Rad); + Area *= cos(Projection->GetYaxis()->GetBinLowEdge(by)*c_Rad) - cos(Projection->GetYaxis()->GetBinUpEdge(by)*c_Rad); + Projection->SetBinContent(bx, by, Projection->GetBinContent(bx, by) / Area); + } + } + for (int bz = 1; bz <= Hist->GetZaxis()->GetNbins(); ++bz) { + ProjectionZ->SetBinContent(bz, ProjectionZ->GetBinContent(bz) / ProjectionZ->GetXaxis()->GetBinWidth(bz)); } } else { for (int bx = 1; bx <= Hist->GetXaxis()->GetNbins(); ++bx) { for (int by = 1; by <= Hist->GetYaxis()->GetNbins(); ++by) { for (int bz = 1; bz <= Hist->GetZaxis()->GetNbins(); ++bz) { - Hist->SetBinContent(bx, by, bz, Evaluate(Hist->GetXaxis()->GetBinCenter(bx), Hist->GetYaxis()->GetBinCenter(by), Hist->GetZaxis()->GetBinCenter(bz))); - Projection->SetBinContent(bx, by, Projection->GetBinContent(bx, by) + Evaluate(Hist->GetXaxis()->GetBinCenter(bx), Hist->GetYaxis()->GetBinCenter(by), Hist->GetZaxis()->GetBinCenter(bz))); + double x = Hist->GetXaxis()->GetBinCenter(bx); + double y = Hist->GetYaxis()->GetBinCenter(by); + double z = Hist->GetZaxis()->GetBinCenter(bz); + double v = Evaluate(x, y, z); + Hist->Fill(x, y, z, v); + Projection->Fill(x, y, v); + ProjectionZ->Fill(z, v); } } } @@ -525,8 +633,17 @@ void MFunction3DSpherical::Plot(bool Random) ProjectionCanvas->cd(); Projection->Draw("colz"); ProjectionCanvas->Update(); - - + + + TCanvas* ProjectionZCanvas = new TCanvas(); + if (m_Z.back() / (m_Z.front() > 0 ? m_Z.front() : 1) > 1000) { + ProjectionZCanvas->SetLogx(); + } + ProjectionZCanvas->cd(); + ProjectionZ->Draw(); + ProjectionZCanvas->Update(); + + gSystem->ProcessEvents(); for (unsigned int i = 0; i < 10; ++i) { From b68f8a1fd5e853c220946f7cb822798414ceafc3 Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Thu, 31 Aug 2023 01:41:41 -0700 Subject: [PATCH 23/27] BUG: Perform start sphere move after orientations --- src/cosima/src/MCSource.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cosima/src/MCSource.cc b/src/cosima/src/MCSource.cc index cbc6a211..73a5f62a 100644 --- a/src/cosima/src/MCSource.cc +++ b/src/cosima/src/MCSource.cc @@ -3011,7 +3011,7 @@ bool MCSource::GeneratePosition(G4GeneralParticleSource* Gun) } else { mout<GetDetectorConstruction()->IsInsideWorldVolume(m_Position) == false) { mout<<" *** ERROR *** "< Date: Sun, 3 Sep 2023 00:19:41 -0700 Subject: [PATCH 24/27] BUG: Missing header iomanip --- src/global/misc/src/MFunction.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/global/misc/src/MFunction.cxx b/src/global/misc/src/MFunction.cxx index a4295324..ece0f8bd 100644 --- a/src/global/misc/src/MFunction.cxx +++ b/src/global/misc/src/MFunction.cxx @@ -29,6 +29,7 @@ // Standard libs: #include #include +#include using namespace std; // ROOT libs: From 2a9c2c2e2ffd74c6b30cacc07cc74cd94dc1d93d Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Sun, 10 Sep 2023 21:10:30 -0700 Subject: [PATCH 25/27] ADD: Micro-COSI geometry for quick testing of simulations with high fluxes --- .../examples/geomega/special/Micro.geo.setup | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 resource/examples/geomega/special/Micro.geo.setup diff --git a/resource/examples/geomega/special/Micro.geo.setup b/resource/examples/geomega/special/Micro.geo.setup new file mode 100644 index 00000000..c2de877c --- /dev/null +++ b/resource/examples/geomega/special/Micro.geo.setup @@ -0,0 +1,73 @@ +#--------------------------------------------------------- +# A micro-COSI for quick testing + + +Name Micro +Version 2.0 + +SurroundingSphere 1.0 0.0 0.0 0.0 1.0 +ShowSurroundingSphere False + +Include $(MEGALIB)/resource/examples/geomega/materials/Materials.geo + + + +#------------------------------------------------------------ +# Volume section: + + +Volume WorldVolume +WorldVolume.Material Vacuum +WorldVolume.Visibility 0 +WorldVolume.Shape BRIK 50. 50. 50. +WorldVolume.Mother 0 + + +Volume GeWafer +GeWafer.Material Germanium +GeWafer.Shape BOX 0.5 0.5 0.5 +GeWafer.Position 0 0 0 +GeWafer.Mother WorldVolume + + +#------------------------------------------------------------ +# Detector and trigger section: + + +MDStrip3D ActiveDetector + +ActiveDetector.DetectorVolume GeWafer +ActiveDetector.SensitiveVolume GeWafer + +ActiveDetector.Offset 0.0 0.0 +ActiveDetector.StripNumber 10 10 + +ActiveDetector.NoiseThreshold 15 +ActiveDetector.TriggerThreshold 30 + +ActiveDetector.DepthResolution 10 0.02 +ActiveDetector.DepthResolution 100 0.02 +ActiveDetector.DepthResolution 1000 0.02 + +ActiveDetector.EnergyResolution Gaus 10 10 0.417 +ActiveDetector.EnergyResolution Gaus 20 20 0.425 +ActiveDetector.EnergyResolution Gaus 50 50 0.4375 +ActiveDetector.EnergyResolution Gaus 100 100 0.454 +ActiveDetector.EnergyResolution Gaus 200 200 0.492 +ActiveDetector.EnergyResolution Gaus 500 500 0.5875 +ActiveDetector.EnergyResolution Gaus 1000 1000 0.7217 +ActiveDetector.EnergyResolution Gaus 2000 2000 0.9317 +ActiveDetector.EnergyResolution Gaus 5000 5000 1.3819 +ActiveDetector.EnergyResolution Gaus 10000 10000 1.9094 +ActiveDetector.EnergyResolution Gaus 100000 100000 5.907 + + +// Trigger: at least one hit in one Germanium detector +Trigger ActiveDetectorTrigger +ActiveDetectorTrigger.Veto false +ActiveDetectorTrigger.TriggerByDetector true +ActiveDetectorTrigger.Detector ActiveDetector 1 + + + + From f07df1bcb565c9658c266357ec614a4a0a00217e Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Fri, 15 Sep 2023 10:44:01 -0700 Subject: [PATCH 26/27] CHG: Add shell scripts to counted files --- bin/mlines | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mlines b/bin/mlines index fb104ae3..ccd6588b 100755 --- a/bin/mlines +++ b/bin/mlines @@ -21,7 +21,7 @@ cd ${DIR} CMD=" " TOTAL=0 -TYPES="cxx cc f hh h C cpp" +TYPES="cxx cc f hh h C cpp sh" for TYPE in ${TYPES}; do for FILE in `find . -name "*.${TYPE}"`; do LINES=`grep -v '^\s*$' ${FILE} | grep -v '////' | wc -l` From 979810690cb585017d7d3565200c444483d3e7ad Mon Sep 17 00:00:00 2001 From: Andreas Zoglauer Date: Fri, 15 Sep 2023 10:55:13 -0700 Subject: [PATCH 27/27] CHG: Sleep 1 second between starts --- bin/mresponsecreator | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/mresponsecreator b/bin/mresponsecreator index b8672c2b..db9e075a 100755 --- a/bin/mresponsecreator +++ b/bin/mresponsecreator @@ -207,6 +207,7 @@ else nice -19 responsecreator -f ${SINGLEFILE} -r ${OUT} ${NEWCMD} &> /dev/null & fi echo "Started run ${COUNTER} out of ${COUNTERMAX} with ID ${ID}" + sleep 1 COUNTER=$(( ${COUNTER} + 1 )) done