Skip to content

Commit

Permalink
add documentation on how to use uniqueidgensvc (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdplacido committed Jun 3, 2022
1 parent d1061e2 commit 9155a99
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions doc/uniqueIDGen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# How to use UniqueIDGenSvc

A Service to generate unique identifiers can be used with the following inputs:
- Event number, Run number and Algorithm name
- Seed number: set in the options python file

To set a seed for the UniqueIDGenSvc, add the following to an options file:

```python
from Configurables import UniqueIDGenSvc
UniqueIDGenSvc().Seed = 987654321
```

Declare the service in the header file:

```cpp
#include <k4FWCore/IUniqueIDGenSvc.h>

SmartIF<IUniqueIDGenSvc> m_service;
```

Initialize the service:

```cpp
StatusCode SomeGaudiAlgorithm::initialize() {
m_service = serviceLocator()->service("UniqueIDGenSvc");
```
Then use the service during execution:
```cpp
StatusCode MarlinProcessorWrapper::execute() {
m_service->getUniqueID(1, 2, name());
}
```

0 comments on commit 9155a99

Please sign in to comment.