Skip to content

Commit

Permalink
[tests] first attempt to organise all the test outputs into a LaTeX d…
Browse files Browse the repository at this point in the history
…ocument
  • Loading branch information
tdixon97 committed Jan 15, 2025
1 parent 5678c73 commit 2751f06
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Start testing: Jan 14 00:54 CET
----------------------------------------------------------
End testing: Jan 14 00:54 CET
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ add_subdirectory(internals)
add_subdirectory(output)
add_subdirectory(python)
add_subdirectory(vertex)
add_subdirectory(tex)
2 changes: 1 addition & 1 deletion tests/basics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
28 changes: 28 additions & 0 deletions tests/basics/template-basic.tex
Original file line number Diff line number Diff line change
@@ -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.}}
}
7 changes: 3 additions & 4 deletions tests/confinement/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/confinement/macros/_vis.mac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
171 changes: 171 additions & 0 deletions tests/confinement/template-confinement.tex
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 1 addition & 2 deletions tests/confinement/test-surface-sampler-methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/germanium/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
Expand Down
27 changes: 27 additions & 0 deletions tests/tex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
27 changes: 27 additions & 0 deletions tests/tex/validation-report.tex
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 2751f06

Please sign in to comment.