ATLAS Offline Software
TrkExUnitTestBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrkExUnitTestBase.cxx, (c) ATLAS Detector software
8 
9 // TrkExUnitTests
10 #include <memory>
11 
12 
13 
15 
16 Trk::TrkExUnitTestBase::TrkExUnitTestBase(const std::string& name, ISvcLocator* pSvcLocator) :
17  AthAlgorithm(name, pSvcLocator),
18  m_numTests(100),
19  m_scanMode(false) {
20  declareProperty("NumberOfTestsPerEvent", m_numTests);
21  declareProperty("EnableScanMode", m_scanMode);
22 }
23 
25 
27  ATH_MSG_INFO("Creating random number services, call bookTree() and initializeTest()");
28 
29  // intialize the random number generators
30  m_gaussDist = std::make_unique<Rndm::Numbers>(randSvc(), Rndm::Gauss(0., 1.));
31  m_flatDist = std::make_unique<Rndm::Numbers>(randSvc(), Rndm::Flat(0., 1.));
32  m_landauDist = std::make_unique<Rndm::Numbers>(randSvc(), Rndm::Landau(0., 1.));
33 
34  if (bookTree().isFailure()) {
35  ATH_MSG_FATAL("Could not book the TTree object");
36  return StatusCode::FAILURE;
37  }
38 
39  if (initializeTest().isFailure()) {
40  ATH_MSG_FATAL("Could not initialize the test");
41  return StatusCode::FAILURE;
42  }
43 
44  return StatusCode::SUCCESS;
45 }
46 
48  if (m_scanMode) return runScan();
49 
50  return runTest();
51 }
52 
54  ATH_MSG_INFO("finalize()");
55  return StatusCode::SUCCESS;
56 }
57 
58 StatusCode Trk::TrkExUnitTestBase::bookTree() {return StatusCode::SUCCESS;}
59 
60 StatusCode Trk::TrkExUnitTestBase::initializeTest() {return StatusCode::SUCCESS;}
Trk::TrkExUnitTestBase::TrkExUnitTestBase
TrkExUnitTestBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition: TrkExUnitTestBase.cxx:16
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::TrkExUnitTestBase::execute
StatusCode execute()
standard Athena-Algorithm method
Definition: TrkExUnitTestBase.cxx:47
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::TrkExUnitTestBase::initializeTest
virtual StatusCode initializeTest()
Definition: TrkExUnitTestBase.cxx:60
Trk::TrkExUnitTestBase::initialize
StatusCode initialize()
standard Athena-Algorithm method
Definition: TrkExUnitTestBase.cxx:26
TrkExUnitTestBase.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::TrkExUnitTestBase::~TrkExUnitTestBase
virtual ~TrkExUnitTestBase()
Default Destructor.
Trk::TrkExUnitTestBase::m_numTests
size_t m_numTests
number of tests
Definition: TrkExUnitTestBase.h:60
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::TrkExUnitTestBase::bookTree
virtual StatusCode bookTree()
Definition: TrkExUnitTestBase.cxx:58
Trk::TrkExUnitTestBase::finalize
StatusCode finalize()
standard Athena-Algorithm method
Definition: TrkExUnitTestBase.cxx:53
Trk::TrkExUnitTestBase::m_scanMode
bool m_scanMode
enable scan mode
Definition: TrkExUnitTestBase.h:63