-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add documentation on how to use uniqueidgensvc (#84)
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
``` |