diff --git a/Testing/Temporary/LastTest.log b/Testing/Temporary/LastTest.log new file mode 100644 index 00000000..851b12a7 --- /dev/null +++ b/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: Jan 14 00:54 CET +---------------------------------------------------------- +End testing: Jan 14 00:54 CET diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4b1ce4f0..90ba5ec7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,3 +14,4 @@ add_subdirectory(internals) add_subdirectory(output) add_subdirectory(python) add_subdirectory(vertex) +add_subdirectory(tex) diff --git a/tests/basics/CMakeLists.txt b/tests/basics/CMakeLists.txt index f30b7f8d..b701cffe 100644 --- a/tests/basics/CMakeLists.txt +++ b/tests/basics/CMakeLists.txt @@ -2,7 +2,7 @@ file( GLOB _aux RELATIVE ${PROJECT_SOURCE_DIR} - macros/*.mac gdml/*.gdml gdml/*.xml) + macros/*.mac gdml/*.gdml gdml/*.xml *.tex) # copy them to the build area foreach(_file ${_aux}) diff --git a/tests/basics/template-basic.tex b/tests/basics/template-basic.tex new file mode 100644 index 00000000..89e2cb2b --- /dev/null +++ b/tests/basics/template-basic.tex @@ -0,0 +1,28 @@ +The first set of checks shown below test that remage is running and has reasonable seeming results. +\IfFileExists{vis-2nbb.output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{vis-2nbb.output_0000.pdf} + \caption{Geant4 visualisation of a simulation of $2\nu\beta\beta$ decay in a HPGe detector for a typical screeing \ + setup. You should see the trajectories focused around the HPGe detector and mainly electrons (red), with a \ + few gamma (green) being produced. \ + } + \end{figure} +}{ + \noindent \fbox{\textbf{The test of visualising $2\nu\beta\beta$ either failed or was not run. + }} +} + + +\IfFileExists{vis-co60.output_0000.pdf}{ + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{vis-co60.output_0000.pdf} + \caption{Geant4 visualisation of a simulation of $^{60}Co$ decay in a source close to a HPGe + detector for a typical screening station setup. You should see $\gamma$ particles (in green) throughout + the experimental setup starting from a source above the detector.} + \end{figure} +}{ + \noindent \fbox{\textbf{The test of visualising $^{60}Co$ either failed or was not run.}} +} diff --git a/tests/confinement/CMakeLists.txt b/tests/confinement/CMakeLists.txt index b83832e6..cf4f5304 100644 --- a/tests/confinement/CMakeLists.txt +++ b/tests/confinement/CMakeLists.txt @@ -2,7 +2,7 @@ file( GLOB _aux RELATIVE ${PROJECT_SOURCE_DIR} - macros/*.mac macros/*.json gdml/*.gdml gdml/*.xml *.py) + macros/*.mac macros/*.json gdml/*.gdml gdml/*.xml *.py *.tex) # copy them to the build area foreach(_file ${_aux}) @@ -70,9 +70,8 @@ set_tests_properties( confine-gdml-fixture) # analyse subtraction -add_test(NAME confinment-lar/subtraction - COMMAND ${PYTHONPATH} ./test_lar_subtraction.py test-confine-lar-out.lh5 - lar-sub-check.output.pdf) +add_test(NAME confinment-lar/subtraction COMMAND ${PYTHONPATH} ./test_lar_subtraction.py + test-confine-lar-out.lh5 lar-sub-check.output.pdf) set_tests_properties(confinment-lar/subtraction PROPERTIES LABELS extra FIXTURES_REQUIRED confine-lar-out-output-fixture) diff --git a/tests/confinement/macros/_vis.mac b/tests/confinement/macros/_vis.mac index 894be177..0e6910db 100644 --- a/tests/confinement/macros/_vis.mac +++ b/tests/confinement/macros/_vis.mac @@ -9,7 +9,7 @@ /vis/viewer/set/lineSegmentsPerCircle 10 # /vis/viewer/set/defaultColour black # /vis/viewer/set/background white -# /vis/scene/add/axes 0 0 0 3 m +/vis/scene/add/axes 0 0 0 3 m /vis/viewer/set/upVector 0 0 -1 /vis/viewer/set/viewpointVector -1 1 1 diff --git a/tests/confinement/template-confinement.tex b/tests/confinement/template-confinement.tex new file mode 100644 index 00000000..5472a922 --- /dev/null +++ b/tests/confinement/template-confinement.tex @@ -0,0 +1,171 @@ + +These tests check the generation of primary vertices by remage. +\subsection{Native sampling} +The first checks plot the positions for natively sampleable objects. + + +\IfFileExists{native-surface.output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{native-surface.output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for the surface of + some natively sampled shapes. Primaries should be present on the G4Box (bottom row second from right), + G4Orb (full sphere - above the box) and G4Tubs (left). The primaries should be on the detector surface, although this + is hard to appreciate with Geant4 visualisation. + } + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating natively sampled surface primaries either failed or did not run. + }} +} + + +\IfFileExists{native-surface.output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{native-volume.output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for the volume of + some natively sampled shapes. Primaries should be present on the G4Box (bottom row second from right), + G4Orb (full sphere - above the box), G4Tubs and G4Sphere (sector of a sphere - bottom center). The primaries should be on the detector surface, although this + be in the detector volume although this is hard to appreciate with Geant4 visualisation. + } + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating natively sampled volume primaries either failed or did not run. + }} +} + +Finally, we check the generation of points on complex objects. + + +\IfFileExists{complex-volume.output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{complex-volume.output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for the volume of + some complex shapes. A polycone (top center), a box with a hole (center), the union of an orb and box (upper right) + and an orb (right). + } + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating complex sampled volume primaries either failed or did not run. + }} +} + + + +\subsection{Geometrical volumes and intersections} +The next tests check the generation of points in geometrical (user defined) volumes and intersections / unions of +geometrical and physical volumes. + +\IfFileExists{geometrical-output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{geometrical-output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for some geometrical (user defined ) volumes. + The primaries should be located in a sphere of center $(0,2,2)$ m and radius $0.7$ m (center overlapping box), a partially filled cylinder with center + $(-2,-2,-2)$ m and outer radius $0.7$ m and height 1 m (far right) and a box of center $(0,2,-2)$ m and sides of length 0.7, 0.5 and 1.2 m (top). + } + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating geometrically volume primaries either failed or did not run. + }} +} + +\IfFileExists{geometrical-and-physical-output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{geometrical-and-physical-output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for the Union of physical volumes defined + by the union of the box and orb (upper left) and the partially filled sphere (lower center) and a geometric volume defined by + sphere of center $(0,2,2)$ m and radius $0.7$ m near the center overlapping the box. + The primaries should be in these three locations.} + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating geometric or physical volume primaries either failed or did not run. + }} +} +\IfFileExists{geometrical-and-physical-output_0000.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.6\textwidth]{geometrical-and-physical-output_0000.pdf} + \caption{Geant4 visualisation of a simulation of the primary positions for the intersection of + physical volumes defined by a user defined sphere of center $(1.5,2,2)$ m and radius $0.4$ m and the orb in the lower right. + The primaries should be located in a subset of this orb.} + \end{figure} +}{ + \noindent \fbox{\textbf{The test of generating geometric and physical volume primaries either failed or did not run. + }} +} + +\subsection{Union and intersection tests} +The next test simulates $2\nu\beta\beta$ decay in a hypothetical HPGe array and makes a +statistical comparison of the number of primaries in each volume. +\IfFileExists{relative-ge.output.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.9\textwidth]{relative-ge.output.pdf} + + \end{figure} +}{ + \noindent \fbox{\textbf{Relative HPGe sampling test either failed or did not run + }} +} + +To check the intersection we generate events inside a cylinder around the HPGe detectors and again check the +positions and relative fractions. + +\IfFileExists{lar-in-check.output.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.9\textwidth,page=1]{lar-in-check.output.pdf} + \includegraphics[width=0.9\textwidth,page=2]{lar-in-check.output.pdf} + \includegraphics[width=0.9\textwidth,page=3]{lar-in-check.output.pdf} + + \end{figure} +}{ + \noindent \fbox{\textbf{Intersection of physical and geometrical volume test (LAr cylinder) either failed or did not run + }} +} + +Finally check subtraction by generating events excluding these regions. + +\IfFileExists{lar-sub-check.output.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.9\textwidth,page=1]{lar-sub-check.output.pdf} + \includegraphics[width=0.9\textwidth,page=2]{lar-sub-check.output.pdf} + + \end{figure} +}{ + \noindent \fbox{\textbf{Subtraction of physical and geometrical volume test (LAr cylinder) either failed or did not run + }} + +} +Finally, both an intersection and a subtraction. + +\IfFileExists{lar-int-and-sub-check.output.pdf}{ + + \begin{figure}[h!] + \centering + \includegraphics[width=0.9\textwidth,page=1]{lar-int-and-sub-check.output.pdf} + \includegraphics[width=0.9\textwidth,page=2]{lar-int-and-sub-check.output.pdf} + + \end{figure} +}{ + \noindent \fbox{\textbf{Subtraction of physical and geometrical volume test (LAr cylinder) either failed or did not run + }} + +} + +\subsection{Generic surface sampling} +The final part of this report describes checks on the generic surface sampler algorithm. diff --git a/tests/confinement/test-surface-sampler-methods.cpp b/tests/confinement/test-surface-sampler-methods.cpp index ef757ff8..f98421f3 100644 --- a/tests/confinement/test-surface-sampler-methods.cpp +++ b/tests/confinement/test-surface-sampler-methods.cpp @@ -154,8 +154,7 @@ int RunVis(RMGVertexConfinement::SampleableObject obj, std::string name) { UImanager->ApplyCommand("/vis/viewer/set/globalLineWidthScale 1.5"); UImanager->ApplyCommand("/vis/viewer/set/upVector 0 0 1"); - UImanager->ApplyCommand( - "/vis/ogl/export surface-sample-bounding-box-" + name + ".output.pdf"); + UImanager->ApplyCommand("/vis/ogl/export surface-sample-bounding-box-" + name + ".output.pdf"); delete visManager; diff --git a/tests/germanium/CMakeLists.txt b/tests/germanium/CMakeLists.txt index 9fde7cab..6018bf27 100644 --- a/tests/germanium/CMakeLists.txt +++ b/tests/germanium/CMakeLists.txt @@ -1,7 +1,7 @@ file( GLOB _aux RELATIVE ${PROJECT_SOURCE_DIR} - macros/*.mac gdml/*.gdml *.py) + macros/*.mac gdml/*.gdml *.py *.tex) # copy them to the build area foreach(_file ${_aux}) diff --git a/tests/tex/CMakeLists.txt b/tests/tex/CMakeLists.txt new file mode 100644 index 00000000..31afa1dd --- /dev/null +++ b/tests/tex/CMakeLists.txt @@ -0,0 +1,27 @@ +file( + GLOB _aux + RELATIVE ${PROJECT_SOURCE_DIR} + *.tex) + +# copy them to the build area +foreach(_file ${_aux}) + configure_file(${PROJECT_SOURCE_DIR}/${_file} ${PROJECT_BINARY_DIR}/${_file} COPYONLY) +endforeach() + +# copy all files +add_test( + NAME tex/copy-files + COMMAND + /bin/sh -c + "find ../ -type f \\( -name '*.output*' -o -name '*.tex' \\) ! -path '../tex/*' -exec cp {} . \; " +) +set_tests_properties(tex/copy-files PROPERTIES LABELS tex FIXTURES_SETUP copy-files-fixture) + +find_program(PDFLATEX_COMPILER pdflatex) +if(PDFLATEX_COMPILER) + add_test(NAME tex/compile COMMAND ${PDFLATEX_COMPILER} validation-report.tex) + set_tests_properties(tex/copy-files PROPERTIES LABELS tex FIXTURES_REQUIRED copy-files-fxiture) + +else() + message(STATUS "No LaTeX compiler found, report cannot be compiled.") +endif() diff --git a/tests/tex/validation-report.tex b/tests/tex/validation-report.tex new file mode 100644 index 00000000..ecb27877 --- /dev/null +++ b/tests/tex/validation-report.tex @@ -0,0 +1,27 @@ +\documentclass[a4paper,12pt]{article} + +% Packages for enhanced functionality +\usepackage{amsmath} % For math equations +\usepackage{amsfonts} % For special fonts +\usepackage{graphicx} % For including graphics +\usepackage{hyperref} % For hyperlinks +\usepackage{geometry} % To adjust margins + +% Adjust margins +\geometry{left=1in, right=1in, top=1in, bottom=0.5in} + +\title{{\Large \bf remage validation suite.}} +\author{{\normalsize Citation: \url{https://doi.org/10.5281/zenodo.11115662}}} +\date{{\it\normalsize \today}} % Date is automatically set to the current date + +\begin{document} +\maketitle + +\section{Basics} +\input{template-basic} + +\section{Confinement} +\input{template-confinement} + + +\end{document}