ATLAS Offline Software
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigGenericAlgs
src
RandomErrorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <random>
6
7
#include "
RandomErrorAlg.h
"
8
9
RandomErrorAlg::RandomErrorAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
10
:
AthReentrantAlgorithm
(name, pSvcLocator) {}
11
12
StatusCode
RandomErrorAlg::execute
(
const
EventContext&
/*eventContext*/
)
const
{
13
14
static
thread_local
std::random_device rd;
15
static
thread_local
std::default_random_engine generator (rd());
16
std::uniform_real_distribution<double> distribution (0., 1.);
17
18
if
( distribution(generator) <
m_errorProbability
) {
19
ATH_MSG_ERROR
(
"Returning random StatusCode::FAILURE"
);
20
return
StatusCode::FAILURE;
21
}
22
23
return
StatusCode::SUCCESS;
24
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
RandomErrorAlg.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
RandomErrorAlg::RandomErrorAlg
RandomErrorAlg(const std::string &name, ISvcLocator *svcLoc)
Definition
RandomErrorAlg.cxx:9
RandomErrorAlg::execute
virtual StatusCode execute(const EventContext &eventContext) const override
Definition
RandomErrorAlg.cxx:12
RandomErrorAlg::m_errorProbability
Gaudi::Property< double > m_errorProbability
Definition
RandomErrorAlg.h:22
Generated on
for ATLAS Offline Software by
1.14.0