Skip to content

Commit 092df2c

Browse files
committed
saving doxygen doc progress
1 parent 819b87b commit 092df2c

40 files changed

Lines changed: 2157 additions & 1297 deletions

ci/create_doxygen.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ sanitize_base() {
8888
inplace_sed 's|^HIDE_FRIEND_COMPOUNDS[[:space:]]*=.*|HIDE_FRIEND_COMPOUNDS = NO|g' "$f"
8989
inplace_sed 's|^QUIET[[:space:]]*=.*|QUIET = YES|g' "$f"
9090
inplace_sed 's|^WARNINGS[[:space:]]*=.*|WARNINGS = YES|g' "$f"
91+
inplace_sed 's|^CLASS_GRAPH[[:space:]]*=.*|CLASS_GRAPH = NO|g' "$f"
92+
inplace_sed 's|^COLLABORATION_GRAPH[[:space:]]*=.*|COLLABORATION_GRAPH = NO|g' "$f"
93+
inplace_sed 's|^AUTOLINK_SUPPORT[[:space:]]*=.*|AUTOLINK_SUPPORT = YES|g' "$f"
9194

9295
replace_doxy_list_key_single_line "$f" "FILE_PATTERNS" \
9396
"*.h *.hh *.hpp *.hxx *.c *.cc *.cpp *.cxx *.C *.H"

ci/doxygen.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ set -euo pipefail
77

88
# ---- config ----
99
doc_modules=(
10-
goptions guts gfields glogging gfactory gtouchable ghit gtranslationTable
11-
gdata gdynamicDigitization g4display g4dialog
12-
)
10+
guts goptions glogging gbase gfactory textProgressBar gtouchable ghit gtranslationTable gdata gboard gdynamicDigitization
11+
gsystem gstreamer eventDispenser gqtbuttonswidget g4display g4dialog g4system gparticle gphysics gsplash gsd
12+
gfields gdetector dbselect gtree gui actions utilities)
1313

1414
script_dir="${0:A:h}"
1515
pages_dir="pages"

gdata/event/gEventDataCollection.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
* - Hit objects are owned via \c std::unique_ptr and are moved into the collection.
1212
* - The class does not enforce policies such as "truth and digitized hit counts must match";
1313
* such validation is typically performed by upstream logic or examples/tests.
14+
*
15+
* Ownership summary:
16+
* - After calling \ref GEventDataCollection::addDetectorTrueInfoData "addDetectorTrueInfoData()"
17+
* or \ref GEventDataCollection::addDetectorDigitizedData "addDetectorDigitizedData()",
18+
* the event container owns the provided object and the caller must not use the moved-from pointer.
1419
*/
1520

1621
#include "gEventDataCollection.h"
@@ -19,10 +24,10 @@
1924
///
2025
/// \details
2126
/// This exists as a convenience hook for potential future example factories.
22-
/// Current example behavior uses \ref GEventHeader::create() as the event counter.
27+
/// Current example behavior uses \ref GEventHeader::create "create()" as the event counter.
2328
std::atomic<int> GEventDataCollection::globalEventDataCollectionCounter{1};
2429

25-
/// Counter used by \ref GEventHeader::create() to generate unique event numbers in examples/tests.
30+
/// Counter used by \ref GEventHeader::create "create()" to generate unique event numbers in examples/tests.
2631
std::atomic<int> GEventHeader::globalEventHeaderCounter{1};
2732

2833
void GEventDataCollection::addDetectorTrueInfoData(const std::string& sdName, std::unique_ptr<GTrueInfoData> data) {

gdata/event/gEventDataCollection.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* \file gEventDataCollection.h
5-
* \brief Defines \ref GEventDataCollection event-level aggregation of per-detector hit data.
5+
* \brief Defines \ref GEventDataCollection, event-level aggregation of per-detector hit data.
66
*
77
* \details
88
* An event data collection groups all hit data produced during a single event.
@@ -15,7 +15,8 @@
1515
* \endcode
1616
*
1717
* ## Event-level semantics
18-
* - each call to \ref GEventDataCollection::addDetectorTrueInfoData() or \ref GEventDataCollection::addDetectorDigitizedData()
18+
* - each call to \ref GEventDataCollection::addDetectorTrueInfoData "addDetectorTrueInfoData()"
19+
* or \ref GEventDataCollection::addDetectorDigitizedData "addDetectorDigitizedData()"
1920
* appends one hit entry to the specified detector’s vectors.
2021
* - the detector entry is created on demand if it does not already exist.
2122
*
@@ -50,6 +51,8 @@ namespace gevent_data {
5051
* - touchable (for identity creation in examples)
5152
*
5253
* This provides a single "options bundle" for event-level examples/applications.
54+
*
55+
* \return Composite options group rooted at \ref GEVENTDATA_LOGGER.
5356
*/
5457
inline auto defineOptions() -> GOptions {
5558
auto goptions = GOptions(GEVENTDATA_LOGGER);
@@ -72,6 +75,10 @@ inline auto defineOptions() -> GOptions {
7275
* - local event number
7376
* - thread ID label
7477
* - timestamp string
78+
*
79+
* \note
80+
* This class intentionally does not enforce invariants such as "truth hits must equal digitized hits".
81+
* If an application requires such invariants, it should validate them at a higher level.
7582
*/
7683
class GEventDataCollection : public GBase<GEventDataCollection>
7784
{
@@ -135,6 +142,10 @@ class GEventDataCollection : public GBase<GEventDataCollection>
135142

136143
/**
137144
* \brief Convenience accessor for the event number.
145+
*
146+
* \details
147+
* Equivalent to \ref GEventHeader::getG4LocalEvn "getG4LocalEvn()" on the owned header.
148+
*
138149
* \return Event number stored in the header.
139150
*/
140151
[[nodiscard]] auto getEventNumber() const -> int { return gevent_header->getG4LocalEvn(); }
@@ -144,7 +155,7 @@ class GEventDataCollection : public GBase<GEventDataCollection>
144155
*
145156
* \details
146157
* This method exists to support examples/tests. It:
147-
* - creates a new \ref GEventHeader
158+
* - creates a new \ref GEventHeader via \ref GEventHeader::create "create()"
148159
* - constructs an event data collection
149160
* - inserts one \ref GDigitizedData and one \ref GTrueInfoData entry under detector "ctof"
150161
*

gdata/event/gEventHeader.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
* - a timestamp string (\c timeStamp)
1919
*
2020
* In production GEMC/Geant4, event number and thread ID would typically come from Geant4
21-
* (e.g. G4Event and G4Threading). In this library, \ref GEventHeader::create() provides a
22-
* deterministic generator for examples and tests.
21+
* (e.g. G4Event and G4Threading). In this library, \ref GEventHeader::create "create()"
22+
* provides a deterministic generator for examples and tests.
2323
*
24-
* \note Time stamp is generated using the local system time at construction.
24+
* Timestamp behavior:
25+
* - Time stamp is generated using local system time at construction.
26+
*
27+
* \note Threading
28+
* The factory \ref GEventHeader::create "create()" uses an atomic counter so that concurrent calls
29+
* from multiple threads produce unique event numbers in examples/tests.
2530
*/
2631

2732
constexpr const char* GDATAEVENTHEADER_LOGGER = "event_header";
@@ -32,6 +37,8 @@ namespace geventheader {
3237
*
3338
* \details
3439
* Event header logging can be enabled/controlled by including this in composite option bundles.
40+
*
41+
* \return An options group rooted at the \ref GDATAEVENTHEADER_LOGGER domain.
3542
*/
3643
inline GOptions defineOptions() {
3744
auto goptions = GOptions(GDATAEVENTHEADER_LOGGER);
@@ -49,7 +56,8 @@ inline GOptions defineOptions() {
4956
* - labeling events in logs/output
5057
* - reproducing the event/thread provenance for debugging
5158
*/
52-
class GEventHeader : public GBase<GEventHeader> {
59+
class GEventHeader : public GBase<GEventHeader>
60+
{
5361
public:
5462
/**
5563
* \brief Construct an event header with explicit values.
@@ -104,7 +112,10 @@ class GEventHeader : public GBase<GEventHeader> {
104112

105113
/**
106114
* \brief Get the local event number.
107-
* \details This is "run-local" in typical Geant4 usage.
115+
*
116+
* \details
117+
* This is "run-local" in typical Geant4 usage (i.e. it resets each run).
118+
*
108119
* \return Event number.
109120
*/
110121
[[nodiscard]] inline int getG4LocalEvn() const { return g4localEventNumber; }

gdata/examples/event_example.cc

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
* This example emulates a simplified event loop where each event produces hit data for one or more
99
* sensitive detectors and stores them into a \ref GEventDataCollection.
1010
*
11-
* The \ref GEventDataCollection owns *per-hit* objects (event-level semantics):
12-
* - \ref GTrueInfoData: "truth" observables derived from simulation / tracking (energy deposition, positions, times, …)
13-
* - \ref GDigitizedData: "digitized" observables produced by electronics/digitization (ADC/TDC-like quantities, readout coords, …)
11+
* The \ref GEventDataCollection owns *per-hit* objects (event-level semantics). For each hit, two
12+
* complementary views may be produced and stored:
13+
* - \ref GTrueInfoData stores simulation-level ("truth") observables derived from tracking
14+
* (energy deposition, step-averaged kinematics, positions, times, provenance labels, ...).
15+
* - \ref GDigitizedData stores electronics-level ("digitized") observables produced by
16+
* detector response and digitization logic (ADC/TDC-like quantities, calibrated values, readout coordinates, ...).
1417
*
1518
* For each event, data are organized as:
1619
* \code
@@ -20,31 +23,34 @@
2023
* \endcode
2124
*
2225
* \section event_demo What this example demonstrates
23-
* - Creating event containers (\ref GEventDataCollection::create()).
24-
* - Adding *additional hits* and *additional detectors* to the same event via:
25-
* - \ref GEventDataCollection::addDetectorTrueInfoData()
26-
* - \ref GEventDataCollection::addDetectorDigitizedData()
27-
* - Inspecting the stored data:
26+
* - Creating event containers with the factory \ref GEventDataCollection::create "create()".
27+
* - Adding *additional hits* and *additional detectors* to the same event with:
28+
* - \ref GEventDataCollection::addDetectorTrueInfoData "addDetectorTrueInfoData()"
29+
* - \ref GEventDataCollection::addDetectorDigitizedData "addDetectorDigitizedData()"
30+
* - Inspecting stored data:
2831
* - per-detector hit counts
29-
* - identity strings (\ref GTrueInfoData::getIdentityString, \ref GDigitizedData::getIdentityString)
32+
* - identity strings (\ref GTrueInfoData::getIdentityString "getIdentityString()",
33+
* \ref GDigitizedData::getIdentityString "getIdentityString()")
3034
* - truth and digitized observable maps
31-
* - Demonstrating digitized filtering of streaming-readout (SRO) keys:
32-
* - \ref GDigitizedData::getIntObservablesMap(int)
33-
* - \ref GDigitizedData::getDblObservablesMap(int)
35+
* - Demonstrating filtering of streaming-readout (SRO) keys for digitized data:
36+
* - \ref GDigitizedData::getIntObservablesMap "getIntObservablesMap(int)"
37+
* - \ref GDigitizedData::getDblObservablesMap "getDblObservablesMap(int)"
3438
*
3539
* \section event_threading Threading model
3640
* The example uses a simple work-distribution pattern:
3741
* - A shared atomic counter assigns event numbers.
3842
* - Each worker thread builds independent \ref GEventDataCollection objects.
3943
* - Results are appended to a shared vector under a mutex.
4044
*
41-
* \note \ref GEventHeader::create() and the test factories \ref GTrueInfoData::create and
42-
* \ref GDigitizedData::create use internal thread-safe counters, so concurrent execution
43-
* is supported for this example-style workload.
45+
* \note \ref GEventHeader::create "create()" and the test factories
46+
* \ref GTrueInfoData::create "create()" and \ref GDigitizedData::create "create()"
47+
* use internal thread-safe counters, so concurrent execution is supported for this
48+
* example-style workload.
4449
*
4550
* \section gdata_event_usage Usage
4651
* Build this example together with the GData library components and required GEMC utilities
47-
* (logging, options, threads abstraction).
52+
* (logging, options, threads abstraction). Then run it to print a readable dump of each generated
53+
* event container.
4854
*
4955
* \author \n &copy; Maurizio Ungaro
5056
* \author e-mail: ungaro@jlab.org
@@ -70,8 +76,11 @@
7076
* \brief Convert a scalar map into a compact, deterministic string for logging.
7177
*
7278
* \details
73-
* This helper exists purely for examples/tests: it prints key/value pairs in the
74-
* order given by the container (std::map order is lexicographic by key).
79+
* This helper exists purely for examples/tests. It prints key/value pairs in the order given
80+
* by the container.
81+
*
82+
* Determinism note:
83+
* - \c std::map iterates in lexicographic key order, which makes the output stable across runs.
7584
*
7685
* \tparam MapType A map-like type with string keys and printable scalar values.
7786
* \param m The map to stringify.
@@ -96,16 +105,16 @@ static std::string map_to_string(const MapType& m) {
96105
*
97106
* \details
98107
* This performs a deep inspection of the \ref GEventDataCollection structure:
99-
* - loops over detectors (sdName)
100-
* - prints number of truth hits and digitized hits
108+
* - loops over detectors (\c sdName)
109+
* - prints the number of truth hits and digitized hits
101110
* - for each hit prints identity and observables
102111
*
103-
* For digitized data, this also prints both filtered views:
104-
* - which=0: non-SRO (physics/content) keys
105-
* - which=1: SRO-only keys (crate/slot/channel/timeAtElectronics/chargeAtElectronics)
112+
* For digitized data, this prints both filtered views to demonstrate SRO separation:
113+
* - \c which=0: non-SRO (physics/content) keys
114+
* - \c which=1: SRO-only keys (crate/slot/channel/timeAtElectronics/chargeAtElectronics)
106115
*
107116
* \param edc The event to inspect.
108-
* \param log Logger to emit messages to.
117+
* \param log Logger used to emit messages.
109118
*/
110119
static void dump_event(const std::shared_ptr<GEventDataCollection>& edc, const std::shared_ptr<GLogger>& log) {
111120
log->info(0, "------------------------------------------------------------");
@@ -165,7 +174,7 @@ static void dump_event(const std::shared_ptr<GEventDataCollection>& edc, const s
165174
log->info(0, " dbl non-SRO: ", map_to_string(dbls_non_sro));
166175
log->info(0, " dbl SRO: ", map_to_string(dbls_sro_only));
167176

168-
// Convenience accessor demo (shows sentinel if missing):
177+
// Convenience accessor demo (shows sentinel if missing).
169178
log->info(0, " timeAtElectronics() = ", dh->getTimeAtElectronics());
170179
}
171180
}
@@ -176,15 +185,17 @@ static void dump_event(const std::shared_ptr<GEventDataCollection>& edc, const s
176185
*
177186
* \details
178187
* This performs a few sanity checks that are useful when evolving the library:
179-
* - event has at least one detector
180-
* - each detector collection has consistent hit vectors (non-null pointers)
188+
* - the event has at least one detector
189+
* - each detector collection has non-null hit pointers
181190
*
182-
* \note This is intentionally non-fatal; it logs diagnostics rather than aborting.
191+
* This is intentionally non-fatal. It logs diagnostics rather than aborting so the example
192+
* can continue printing the full event content for debugging.
183193
*
184194
* \param edc The event to validate.
185195
* \param log Logger instance.
186196
*/
187-
static void validate_event_structure(const std::shared_ptr<GEventDataCollection>& edc, const std::shared_ptr<GLogger>& log) {
197+
static void validate_event_structure(const std::shared_ptr<GEventDataCollection>& edc,
198+
const std::shared_ptr<GLogger>& log) {
188199
const auto& dcm = edc->getDataCollectionMap();
189200
if (dcm.empty()) {
190201
log->info(0, "VALIDATION: event ", edc->getEventNumber(), " has no detectors (unexpected in this example).");
@@ -207,9 +218,9 @@ static void validate_event_structure(const std::shared_ptr<GEventDataCollection>
207218
if (!digiHits[i]) log->info(0, "VALIDATION: detector <", sdName, "> digitized hit ", i, " is null.");
208219
}
209220

210-
// A very common expectation in practice: same number of truth and digitized hits per detector.
211-
// This is not guaranteed by the API (you can add one without the other), but it is a useful
212-
// check for this demo-style data producer.
221+
// A common expectation in production is matching truth and digitized hit counts per detector.
222+
// This is not enforced by the API (you can add one without the other), but it is a useful
223+
// consistency check for this demo-style producer.
213224
if (truthHits.size() != digiHits.size()) {
214225
log->info(0, "VALIDATION: detector <", sdName, "> truthHits(", truthHits.size(),
215226
") != digitizedHits(", digiHits.size(), ") in event ", edc->getEventNumber());
@@ -221,10 +232,14 @@ static void validate_event_structure(const std::shared_ptr<GEventDataCollection>
221232
* \brief Produce a set of events using multiple worker threads.
222233
*
223234
* \details
224-
* Each event is created via \ref GEventDataCollection::create(), then extended to demonstrate:
235+
* Each event is created via \ref GEventDataCollection::create "create()", then extended to demonstrate:
225236
* - adding additional hits under the same detector key
226237
* - adding a second detector key
227238
*
239+
* Concurrency notes:
240+
* - Each worker produces independent event containers (no shared mutation of events).
241+
* - A mutex is used only when appending thread-local results to the shared output vector.
242+
*
228243
* \param nevents Total number of events to generate.
229244
* \param nthreads Number of worker threads.
230245
* \param gopt Shared options.
@@ -240,7 +255,7 @@ static auto run_simulation_in_threads(int nevents,
240255
std::vector<std::shared_ptr<GEventDataCollection>> collected;
241256
collected.reserve(static_cast<size_t>(nevents));
242257

243-
// Thread-safe integer event counter starts at 1.
258+
// Thread-safe integer event counter starts at 1 (local to this example run).
244259
std::atomic<int> next{1};
245260

246261
// Pool of threads. (jthread_alias joins on destruction.)

gdata/examples/gframe_example.cc

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
/**
2-
* \file gframe_example.cc
2+
* \file gframe_example.cc
33
* \brief Example demonstrating frame data collection.
44
*
55
* \page gdata_frame_example Frame data example
66
*
77
* \section frame_overview Overview
8-
* This example demonstrates how to build a frame container (\ref GFrameDataCollection)
9-
* that owns:
8+
* This example demonstrates how to build a frame container (\ref GFrameDataCollection) that owns:
109
* - a \ref GFrameHeader (frame ID + duration)
1110
* - a list of \ref GIntegralPayload objects (crate/slot/channel/charge/time)
1211
*
13-
* Frames are typically used for streaming/readout-style output where data are grouped
14-
* by time windows rather than by Geant4 events.
12+
* Frames are typically used for streaming/readout-style output where data are grouped by
13+
* time windows rather than by Geant4 events. Conceptually, a frame corresponds to a fixed
14+
* integration window (for example 33.33 ms), during which many channels may fire.
15+
*
16+
* \section frame_payload_layout Payload layout
17+
* The \ref GFrameDataCollection::addIntegralPayload "addIntegralPayload()" API accepts a packed
18+
* integer vector with a fixed order (size must be exactly 5):
19+
* - payload[0] crate
20+
* - payload[1] slot
21+
* - payload[2] channel
22+
* - payload[3] charge
23+
* - payload[4] time
24+
*
25+
* This example constructs three such payloads and inserts them into the frame collection.
1526
*
1627
* \section gdata_frame_usage Usage
17-
* Compile this file along with the frame classes and the logging/options utilities.
28+
* Compile this file along with the frame classes and the logging/options utilities. Run it to:
29+
* - print the frame ID and computed frame time
30+
* - print each stored payload in its fixed order
1831
*
1932
* \author \n &copy; Maurizio Ungaro
2033
* \author e-mail: ungaro@jlab.org
@@ -36,8 +49,8 @@
3649

3750
using namespace std;
3851

39-
// TODO: run this in multiple threads and collect results in frames like in runAction
40-
int main(int argc, char *argv[]) {
52+
// TODO: Run this in multiple threads and collect results into frames (similar to a runAction-style aggregator).
53+
int main(int argc, char* argv[]) {
4154
auto gopts = std::make_shared<GOptions>(argc, argv, gevent_data::defineOptions());
4255

4356
auto log = std::make_shared<GLogger>(gopts, SFUNCTION_NAME, GEVENTDATA_LOGGER);
@@ -60,7 +73,7 @@ int main(int argc, char *argv[]) {
6073
cout << "Frame ID: " << frameData->getFrameID() << endl;
6174
cout << "Frame Header Time: " << frameData->getHeader()->getTime() << endl;
6275

63-
const vector<GIntegralPayload*> *payloads = frameData->getIntegralPayload();
76+
const vector<GIntegralPayload*>* payloads = frameData->getIntegralPayload();
6477
cout << "Number of integral payloads: " << payloads->size() << endl;
6578

6679
for (size_t i = 0; i < payloads->size(); ++i) {
@@ -72,7 +85,7 @@ int main(int argc, char *argv[]) {
7285
cout << endl;
7386
}
7487

75-
delete frameData; // deletes header and all payloads inside
88+
delete frameData; // deletes header and all payloads inside
7689

7790
return EXIT_SUCCESS;
7891
}

0 commit comments

Comments
 (0)