ATLAS Offline Software
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
}
RandomErrorAlg::m_errorProbability
Gaudi::Property< double > m_errorProbability
Definition:
RandomErrorAlg.h:22
RandomErrorAlg.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:83
RandomErrorAlg::RandomErrorAlg
RandomErrorAlg(const std::string &name, ISvcLocator *svcLoc)
Definition:
RandomErrorAlg.cxx:9
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:221
mc.generator
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
Definition:
mc.MGH7_FxFx_H71-DEFAULT_test.py:18
RandomErrorAlg::execute
virtual StatusCode execute(const EventContext &eventContext) const override
Definition:
RandomErrorAlg.cxx:12
Generated on Thu Nov 7 2024 21:24:24 for ATLAS Offline Software by
1.8.18