|
gdynamicDigitization
|
Example demonstrating how to load and use a gdynamic digitization plugin. More...
#include "gdynamicdigitization.h"#include "gdynamicdigitization_options.h"#include "gfactory.h"#include "event/gEventDataCollection.h"#include "gthreads.h"
Go to the source code of this file.
Functions | |
| auto | run_simulation_in_threads (int nevents, int nthreads, const std::shared_ptr< GOptions > &gopt, const std::shared_ptr< GLogger > &log, const std::shared_ptr< const gdynamicdigitization::dRoutinesMap > &dynamicRoutinesMap) -> std::vector< std::unique_ptr< GEventDataCollection > > |
| Runs a small simulated event loop using multiple worker threads. | |
| int | main (int argc, char *argv[]) |
| Example program entry point. | |
Variables | |
| const std::string | plugin_name = "test_gdynamic_plugin" |
This example shows:
Definition in file plugin_load_example.cc.
| int main | ( | int | argc, |
| char * | argv[] ) |
Steps:
| argc | Standard argc. |
| argv | Standard argv. |
Definition at line 127 of file plugin_load_example.cc.
| auto run_simulation_in_threads | ( | int | nevents, |
| int | nthreads, | ||
| const std::shared_ptr< GOptions > & | gopt, | ||
| const std::shared_ptr< GLogger > & | log, | ||
| const std::shared_ptr< const gdynamicdigitization::dRoutinesMap > & | dynamicRoutinesMap ) -> std::vector<std::unique_ptr<GEventDataCollection>> |
Each worker thread repeatedly claims the next event number from an atomic counter, constructs a fresh event container, creates a few hits, and processes them through the loaded dynamic routine.
The routine collects at most two events into the shared output vector to keep the example output small (this also reduces destructor chatter in logs).
Threading model:
next) to distribute unique event numbersthread_local) to accumulate events before acquiring the lock| nevents | Number of events to simulate (upper bound; some may not be collected). |
| nthreads | Number of worker threads to launch. |
| gopt | Shared options. |
| log | Logger used for informational output. |
| dynamicRoutinesMap | Map of loaded dynamic routines. |
Definition at line 48 of file plugin_load_example.cc.
| const std::string plugin_name = "test_gdynamic_plugin" |
Definition at line 24 of file plugin_load_example.cc.