Skip to content

Commit 7943cd1

Browse files
committed
doxygen docs and making shared volume and material pointers in gsystem instead of unique
1 parent ff36942 commit 7943cd1

60 files changed

Lines changed: 2919 additions & 1615 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

actions/gactionsDoxy.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* \mainpage GActions
3+
*
4+
* @section intro_sec Introduction
5+
*
6+
* \n\n
7+
* \author \n © Maurizio Ungaro
8+
* \author e-mail: ungaro@jlab.org
9+
* \n\n\n
10+
*/

ci/generate_html.py

Lines changed: 131 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/usr/bin/env python3
22

33
import os
4+
import html
5+
6+
modules_map = {
7+
"base": "guts goptions glogging gbase textProgressBar utilities",
8+
"plugins": "gfactory gdynamicDigitization gsd",
9+
"hits": "gtouchable ghit",
10+
"gui": "gboard gqtbuttonswidget g4display g4dialog gsplash gtree dbselect gui",
11+
"detector": "gsystem g4system gdetector gtranslationTable",
12+
"i/o": "gdata gstreamer eventDispenser",
13+
"geant4": "gparticle gphysics gfields actions",
14+
}
415

516
# Path to the directory containing subdirectories with Doxygen documentation
617
pages_directory = "pages"
@@ -16,72 +27,84 @@
1627
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1728
<title>Doxygen Documentation Links</title>
1829
<style>
30+
:root {
31+
--fg: #24292f;
32+
--muted: #57606a;
33+
--border: #d0d7de;
34+
--link: #0969da;
35+
--bg: #ffffff;
36+
}
37+
1938
body {
20-
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
2139
margin: 0;
22-
padding: 0;
23-
background-color: #f4f4f9;
24-
color: #333;
25-
display: flex;
26-
justify-content: center;
27-
align-items: center;
28-
min-height: 100vh;
40+
background: var(--bg);
41+
color: var(--fg);
42+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
2943
}
3044
45+
/* GitHub-ish readable content width */
3146
.container {
32-
text-align: center;
33-
padding: 120px;
34-
background-color: #ffffff;
35-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
36-
border-radius: 10px;
37-
width: 90%;
38-
max-width: 600px;
39-
}
40-
41-
h1 {
42-
color: #4a90e2;
43-
margin-bottom: 10px;
47+
max-width: 980px;
48+
margin: 0 auto;
49+
padding: 32px 24px 24px 24px;
4450
}
4551
52+
/* Intro line like a README paragraph */
4653
p {
47-
color: #555;
48-
font-size: 1.1em;
49-
margin-bottom: 20px;
54+
margin: 0 0 16px 0;
55+
color: var(--muted);
56+
font-size: 16px;
57+
line-height: 1.5;
5058
}
5159
60+
/* Outer list holds sections (footer expects one outer <ul>) */
5261
.link-list {
53-
display: flex;
54-
flex-wrap: wrap;
55-
justify-content: center;
62+
list-style: none;
5663
padding: 0;
57-
margin: 0;
64+
margin: 16px 0 0 0;
65+
}
66+
67+
/* Each section as a list item */
68+
.section {
69+
margin: 0 0 20px 0;
70+
}
71+
72+
/* “Same font as ## but smaller” */
73+
.section-title {
74+
font-weight: 600;
75+
font-size: 18px; /* smaller than typical H2 */
76+
line-height: 1.25;
77+
margin: 24px 0 10px 0;
78+
padding-bottom: 6px;
79+
border-bottom: 1px solid var(--border);
80+
}
81+
82+
/* Links under each section */
83+
.section-links {
5884
list-style: none;
85+
padding: 0;
86+
margin: 10px 0 0 0;
87+
88+
/* compact grid-ish layout without “button” styling */
89+
column-count: {{NUM_COLUMNS}};
90+
column-gap: 18px;
5991
}
6092
61-
.link-list li {
62-
margin: 10px;
63-
flex: 0 1 calc(100% / {{NUM_COLUMNS}} - 20px);
64-
display: flex;
65-
justify-content: center;
93+
.section-links li {
94+
break-inside: avoid;
95+
margin: 6px 0;
6696
}
6797
68-
.link-list a {
98+
a {
99+
color: var(--link);
69100
text-decoration: none;
70-
color: #ffffff;
71-
background-color: #333392;
72-
padding: 10px 20px;
73-
border-radius: 5px;
74-
transition: background-color 0.1s;
75-
display: inline-block;
76-
width: 100%;
77-
max-width: 300px;
78-
text-align: center;
79101
}
80102
81-
.link-list a:hover {
82-
background-color: #4a70e2;
103+
a:hover {
104+
text-decoration: underline;
83105
}
84106
107+
/* Keep footer styles as originally referenced */
85108
.footer {
86109
margin-top: 20px;
87110
font-size: 0.9em;
@@ -95,7 +118,7 @@
95118
<ul class="link-list">
96119
"""
97120

98-
# HTML template for the footer
121+
# HTML template for the footer (KEEP AS IS)
99122
html_footer = """
100123
</ul>
101124
<div class="footer">
@@ -110,31 +133,79 @@
110133
"""
111134

112135

113-
def generate_html(directory: str, columns: int) -> str:
114-
"""Generate the index.html content listing subdirectories alphabetically."""
115-
links = ""
136+
def _existing_doc_dirs(directory: str) -> dict[str, str]:
137+
"""
138+
Return {subdir_name: relative_index_file} for subdirectories that contain index.html.
139+
"""
140+
out: dict[str, str] = {}
141+
for name in sorted(os.listdir(directory), key=str.casefold):
142+
subdir_path = os.path.join(directory, name)
143+
if not os.path.isdir(subdir_path):
144+
continue
145+
index_file = os.path.join(subdir_path, "index.html")
146+
if not os.path.exists(index_file):
147+
continue
148+
out[name] = os.path.relpath(index_file, directory)
149+
return out
116150

151+
152+
def generate_html(directory: str, columns: int) -> str:
153+
"""Generate the index.html content listing subdirectories organized by modules_map."""
117154
# Clamp columns to at least 1 (avoids division by zero / bad CSS)
118155
columns = max(1, int(columns))
119156

120-
# Alphabetical order (case-insensitive)
121-
subdirs = sorted(os.listdir(directory), key=str.casefold)
157+
existing = _existing_doc_dirs(directory)
158+
used: set[str] = set()
122159

123-
for subdir in subdirs:
124-
subdir_path = os.path.join(directory, subdir)
125-
if not os.path.isdir(subdir_path):
126-
continue
160+
sections_html: list[str] = []
127161

128-
index_file = os.path.join(subdir_path, "index.html")
129-
if not os.path.exists(index_file):
162+
# Build sections in insertion order of modules_map
163+
for section_name, modules_str in modules_map.items():
164+
modules = [m for m in modules_str.split() if m.strip()]
165+
# Only include modules that actually exist and have index.html
166+
present = [m for m in modules if m in existing]
167+
if not present:
130168
continue
131169

132-
# Link relative to the pages directory
133-
relative_index_file = os.path.relpath(index_file, directory)
134-
links += f' <li><a href="{relative_index_file}" target="_blank">{subdir}</a></li>\n'
170+
used.update(present)
171+
172+
section_title = html.escape(section_name)
173+
section_block = [
174+
' <li class="section">\n',
175+
f' <div class="section-title">{section_title}</div>\n',
176+
' <ul class="section-links">\n',
177+
]
178+
179+
for m in present:
180+
href = html.escape(existing[m], quote=True)
181+
label = html.escape(m)
182+
# Text must visibly include square brackets: [ link ]
183+
section_block.append(f' <li><a href="{href}" target="_blank">[ {label} ]</a></li>\n')
184+
185+
section_block.append(" </ul>\n")
186+
section_block.append(" </li>\n")
187+
section_block.append(" <br/>\n")
188+
sections_html.append("".join(section_block))
189+
190+
# Optional: any leftover documented dirs not in modules_map
191+
leftovers = sorted([k for k in existing.keys() if k not in used], key=str.casefold)
192+
if leftovers:
193+
section_block = [
194+
' <li class="section">\n',
195+
' <div class="section-title">other</div>\n',
196+
' <ul class="section-links">\n',
197+
]
198+
for m in leftovers:
199+
href = html.escape(existing[m], quote=True)
200+
label = html.escape(m)
201+
section_block.append(f' <li><a href="{href}" target="_blank">[ {label} ]</a></li>\n')
202+
section_block.append(" </ul>\n")
203+
section_block.append(" </li>\n")
204+
section_block.append(" <br/>\n")
205+
sections_html.append("".join(section_block))
135206

136207
header = html_header.replace("{{NUM_COLUMNS}}", str(columns))
137-
return header + links + html_footer
208+
return header + "".join(sections_html) + html_footer
138209

139210

140211
def write_html_file(directory: str, columns: int) -> None:

dbselect/dbselectDoxy.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* \mainpage GDetector
3+
*
4+
* @section intro_sec Introduction
5+
*
6+
* \n\n
7+
* \author \n &copy; Maurizio Ungaro
8+
* \author e-mail: ungaro@jlab.org
9+
* \n\n\n
10+
*/

g4dialog/g4dialogDoxy.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* \mainpage G4Dialog
3+
*
4+
* @section intro_sec Introduction
5+
*
6+
* \n\n
7+
* \author \n &copy; Maurizio Ungaro
8+
* \author e-mail: ungaro@jlab.org
9+
* \n\n\n
10+
*/

gboard/examples/gboard_example.cc

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,42 @@
1111
#include <QMainWindow>
1212
#include <QTimer>
1313

14+
/**
15+
* @file gboard_example.cc
16+
* @brief Example program showing how to route Geant4 output into a GBoard widget.
17+
*
18+
* This example demonstrates two modes:
19+
* - **GUI mode** (enabled with \c --gui): creates a \c QApplication, shows a \c QMainWindow containing GBoard,
20+
* and installs a GUI_Session so Geant4 output is forwarded to the board.
21+
* - **CLI mode** (default): runs without creating Qt objects and simply exits after setup messages.
22+
*
23+
* The example also supports a timeout (scalar option \c tt) that automatically quits the Qt event loop
24+
* after the specified duration.
25+
*
26+
* Key behaviors illustrated:
27+
* - Creating module options via \c gboard::defineOptions().
28+
* - Constructing a GBoard owned by the Qt parent (the main window).
29+
* - Creating a GUI_Session that forwards Geant4 output to the board (session does not own the board).
30+
* - Running and terminating a Qt event loop using \c QTimer.
31+
*/
32+
33+
/**
34+
* @brief Entry point for the gboard example application.
35+
*
36+
* Responsibilities:
37+
* - Initializes options and logging.
38+
* - Optionally initializes Qt GUI objects and shows a window that embeds GBoard.
39+
* - Initializes a Geant4 visualization manager to ensure Geant4 subsystems are active for the demo.
40+
* - In GUI mode, installs GUI_Session to route Geant4 UI output to the board.
41+
* - Exits either after the Qt event loop ends (GUI) or immediately (CLI).
42+
*
43+
* @param argc Standard C/C++ argument count.
44+
* @param argv Standard C/C++ argument vector.
45+
* @return \c EXIT_SUCCESS on normal completion, otherwise a non-zero status.
46+
*/
1447
int main(int argc, char* argv[]) {
15-
// Initialize options and logging
48+
// Initialize options and logging.
49+
// The options structure is shared across module components via shared_ptr.
1650
auto gopts = std::make_shared<GOptions>(argc, argv, gboard::defineOptions());
1751
auto log = std::make_shared<GLogger>(gopts, SFUNCTION_NAME, GBOARD_LOGGER);
1852
auto gui = gopts->getSwitch("gui");
@@ -21,7 +55,8 @@ int main(int argc, char* argv[]) {
2155

2256
log->info(0, "Starting gboard example...");
2357

24-
// Optional GUI setup (only if --gui is passed)
58+
// Optional GUI setup (only if --gui is passed).
59+
// Note: We allocate Qt objects dynamically here because the example explicitly deletes them.
2560
QApplication* app = nullptr;
2661
QMainWindow* window = nullptr;
2762

@@ -32,17 +67,24 @@ int main(int argc, char* argv[]) {
3267
window->setWindowTitle(QString::fromUtf8("displayUI example"));
3368
}
3469

70+
// Initialize Geant4 visualization manager.
71+
// This is included to resemble the typical environment where Geant4 produces UI output.
3572
auto visManager = new G4VisExecutive;
3673
visManager->Initialize();
3774

38-
// If GUI, show the window and run Qt loop
75+
// If GUI, show the window and run Qt loop.
3976
if (gui) {
40-
auto* gboard = new GBoard(gopts, window);
41-
auto gui_session = std::make_unique<GUI_Session>(gopts, gboard);
77+
// GBoard is parented to the window, but the example explicitly deletes it at the end as well.
78+
auto* gboard = new GBoard(gopts, window);
79+
80+
// GUI_Session installs itself as Geant4 cout destination and forwards to the board.
81+
// The session does not own the board.
82+
auto gui_session = std::make_unique<GUI_Session>(gopts, gboard);
83+
4284
window->setCentralWidget(gboard);
4385
window->show();
4486

45-
// quit after timeout
87+
// Quit after timeout: this demonstrates deterministic shutdown for automated runs.
4688
QTimer::singleShot(timeout, [] {
4789
QCoreApplication::quit(); // stop the event loop
4890
});
@@ -54,7 +96,7 @@ int main(int argc, char* argv[]) {
5496
delete app;
5597
}
5698
else {
57-
// CLI mode
99+
// CLI mode: no Qt objects are created.
58100
log->info(0, "Running gboard in command line mode...");
59101
}
60102

0 commit comments

Comments
 (0)