Skip to content

Commit 9155a99

Browse files
authored
add documentation on how to use uniqueidgensvc (#84)
1 parent d1061e2 commit 9155a99

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Diff for: doc/uniqueIDGen.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# How to use UniqueIDGenSvc
2+
3+
A Service to generate unique identifiers can be used with the following inputs:
4+
- Event number, Run number and Algorithm name
5+
- Seed number: set in the options python file
6+
7+
To set a seed for the UniqueIDGenSvc, add the following to an options file:
8+
9+
```python
10+
from Configurables import UniqueIDGenSvc
11+
UniqueIDGenSvc().Seed = 987654321
12+
```
13+
14+
Declare the service in the header file:
15+
16+
```cpp
17+
#include <k4FWCore/IUniqueIDGenSvc.h>
18+
19+
SmartIF<IUniqueIDGenSvc> m_service;
20+
```
21+
22+
Initialize the service:
23+
24+
```cpp
25+
StatusCode SomeGaudiAlgorithm::initialize() {
26+
m_service = serviceLocator()->service("UniqueIDGenSvc");
27+
```
28+
29+
Then use the service during execution:
30+
31+
```cpp
32+
StatusCode MarlinProcessorWrapper::execute() {
33+
m_service->getUniqueID(1, 2, name());
34+
}
35+
```

0 commit comments

Comments
 (0)