Skip to content

Commit

Permalink
update common doc
Browse files Browse the repository at this point in the history
  • Loading branch information
martinunland committed Aug 1, 2024
1 parent db3534a commit aebcd16
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion common/framework/include/OMSimCommandArgsTable.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ inline OMSimCommandArgsTable* gCommandArgsTable = nullptr;
* @brief A class used to hold OMSim command arguments with global instance access.
*
* This class uses a map to hold key-value pairs of simulation command arguments.
* It provides a method to write the parameters to a JSON file.
* It provides a method to write the parameters to a JSON file. Its lifecycle is managed by the OMSim class.
*
* @ingroup common
*/
class OMSimCommandArgsTable
Expand Down
5 changes: 1 addition & 4 deletions common/framework/include/OMSimHitManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ struct HitStats
* @brief Manages detected photon information.
*
* Stores, manages, and provides access information related to detected photons across multiple optical modules.
* The manager uses a global instance pattern, ensuring a unified access point for photon hit data.
*
* The class must be initialized with `OMSimHitManager::init()` before use and shut down with
* `OMSimHitManager::shutdown()` when no longer needed. This is handled by the OMSim class.
* The manager uses a global instance pattern, ensuring a unified access point for photon hit data. Its lifecycle is managed by the OMSim class.
*
* The hits are stored using 'OMSimHitManager::appendHitInfo'.
* The analysis manager of each study is in charge of writing the stored information into a file (see for example 'OMSimEffectiveAreaAnalyisis::writeScan' or 'OMSimDecaysAnalysis::writeHitInformation').
Expand Down
16 changes: 12 additions & 4 deletions documentation/extra_doc/0_common.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ Additionally, geometry data used during PMT construction are also stored in JSON

This approach was adopted because various PMTs are constructed similarly, eliminating the need to define a unique class for each PMT type, as is done for the optical modules.

If you wish to load additional data, you can either define a new type in OMSimDataFileTypes or load it into a tree as previously mentioned. For simpler tasks, use the static method `Tools::loadtxt` provided in `OMSimTools.hh`, which operates similarly to Python's numpy.loadtxt. For example:
If you wish to load additional data, you can either define a new type in OMSimDataFileTypes or use a json file to load it into a tree as previously mentioned. For simpler tasks, use the static method `Tools::loadtxt` provided by the `Tools` namespace.

## The Tools namespace

The tools namespace provide several methods that could help you. For example, `Tools::loadtxt`, `Tools::linspace` and `Tools::logspace` operate similarly to their Python's numpy counterparts:

```cpp
#include "OMSimTools.hh"
std::vector<G4PV2DDataVector> data = Tools::loadtxt("path/file_name.txt");
std::vector<G4double> first_column = data.at(0);
std::vector<G4double> second_column = data.at(1);
std::vector<G4PV2DDataVector> lData = Tools::loadtxt("path/file_name.txt", true);
std::vector<G4double> lFirstColumn = lData.at(0);
std::vector<G4double> lSecondColumn = lData.at(1);

std::vector<double> lWavelengths = Tools::linspace(275, 750, 96);
std::vector<double> lAbsLengths = Tools::logspace(1e-9, 1e-4, 20);

// ...
```

Expand Down

0 comments on commit aebcd16

Please sign in to comment.