ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoopTest
Root
UnitTestAlg4.cxx
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
//
4
5
// EDM include(s).
6
#include "
xAODMetaData/FileMetaData.h
"
7
#include "
xAODEventInfo/EventInfo.h
"
8
9
// Local include(s).
10
#include "
EventLoopTest/UnitTestAlg4.h
"
11
12
namespace
EL
{
13
14
UnitTestAlg4::UnitTestAlg4
(
const
std::string& name, ISvcLocator* svcLoc )
15
:
AnaAlgorithm
( name, svcLoc ) {
16
17
}
18
19
::StatusCode
UnitTestAlg4::initialize
() {
20
21
// Greet the user.
22
ATH_MSG_INFO
(
"Initialising algorithm..."
);
23
24
// Make sure that @c beginInputFile() gets called.
25
ATH_CHECK
(
requestBeginInputFile
() );
26
27
// Read the file metadata.
28
ATH_CHECK
(
readFileMetaData
() );
29
30
// Make sure that event data can *not* be accessed yet.
31
const
xAOD::EventInfo
* ei =
nullptr
;
32
if
(
evtStore
()->retrieve( ei,
"EventInfo"
).isSuccess() ==
true
) {
33
ATH_MSG_FATAL
(
"Event information should not be available yet!"
);
34
return ::StatusCode::FAILURE;
35
}
36
37
// Return gracefully.
38
return ::StatusCode::SUCCESS;
39
}
40
41
::StatusCode
UnitTestAlg4::execute
() {
42
43
// Check that event data access is working by now.
44
const
xAOD::EventInfo
* ei =
nullptr
;
45
ATH_CHECK
(
evtStore
()->retrieve( ei,
"EventInfo"
) );
46
47
// Return gracefully.
48
return ::StatusCode::SUCCESS;
49
}
50
51
::StatusCode
UnitTestAlg4::finalize
() {
52
53
// Check whether @c beginInputFile() was called during the job.
54
if
(
m_callCount
== 0 ) {
55
ATH_MSG_FATAL
(
"The job did not call beginInputFile()"
);
56
return ::StatusCode::FAILURE;
57
}
58
59
// Return gracefully.
60
return ::StatusCode::SUCCESS;
61
}
62
63
::StatusCode
UnitTestAlg4::beginInputFile
() {
64
65
// Increment the internal counter.
66
m_callCount
++;
67
68
// Read the file metadata.
69
ATH_CHECK
(
readFileMetaData
() );
70
71
// Return gracefully.
72
return ::StatusCode::SUCCESS;
73
}
74
75
::StatusCode
UnitTestAlg4::readFileMetaData
() {
76
77
// Access the file metadata object.
78
ATH_MSG_INFO
(
"Reading the file metadata..."
);
79
const
xAOD::FileMetaData
* fmd =
nullptr
;
80
ATH_CHECK
(
inputMetaStore
()->retrieve( fmd,
"FileMetaData"
) );
81
82
// Get some information out of the object.
83
std::string amiTag, dataType, simFlavour;
84
fmd->
value
(
xAOD::FileMetaData::amiTag
, amiTag );
85
fmd->
value
(
xAOD::FileMetaData::dataType
, dataType );
86
fmd->
value
(
xAOD::FileMetaData::simFlavour
, simFlavour );
87
ATH_MSG_INFO
(
" amiTag = "
<< amiTag );
88
ATH_MSG_INFO
(
" dataType = "
<< dataType );
89
ATH_MSG_INFO
(
" simFlavour = "
<< simFlavour );
90
91
// Return gracefully.
92
return ::StatusCode::SUCCESS;
93
}
94
95
}
// namespace EL
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
FileMetaData.h
UnitTestAlg4.h
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
EL::AnaAlgorithm::inputMetaStore
ConstMetaStorePtr_t inputMetaStore() const
Definition
AnaAlgorithm.cxx:72
EL::AnaAlgorithm::requestBeginInputFile
::StatusCode requestBeginInputFile()
register this algorithm to have an implementation of beginInputFile
Definition
AnaAlgorithm.cxx:271
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::UnitTestAlg4::initialize
virtual::StatusCode initialize() override
Function initialising the algorithm.
Definition
UnitTestAlg4.cxx:19
EL::UnitTestAlg4::finalize
virtual::StatusCode finalize() override
Function finalising the algorithm.
Definition
UnitTestAlg4.cxx:51
EL::UnitTestAlg4::beginInputFile
virtual::StatusCode beginInputFile() override
Function called whenever a new input file's processing starts.
Definition
UnitTestAlg4.cxx:63
EL::UnitTestAlg4::execute
virtual::StatusCode execute() override
Function executing the algorithm.
Definition
UnitTestAlg4.cxx:41
EL::UnitTestAlg4::m_callCount
int m_callCount
Internal status flag.
Definition
UnitTestAlg4.h:48
EL::UnitTestAlg4::readFileMetaData
StatusCode readFileMetaData()
Function reading some in-file metadata.
Definition
UnitTestAlg4.cxx:75
EL::UnitTestAlg4::UnitTestAlg4
UnitTestAlg4(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
Definition
UnitTestAlg4.cxx:14
xAOD::FileMetaData_v1::dataType
@ dataType
Data type that's in the file [string].
Definition
FileMetaData_v1.h:64
xAOD::FileMetaData_v1::amiTag
@ amiTag
AMI tag used to process the file the last time [string].
Definition
FileMetaData_v1.h:58
xAOD::FileMetaData_v1::simFlavour
@ simFlavour
Fast or Full sim [string].
Definition
FileMetaData_v1.h:76
xAOD::FileMetaData_v1::value
bool value(MetaDataType type, std::string &val) const
Get a pre-defined string value out of the object.
Definition
FileMetaData_v1.cxx:195
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::FileMetaData
FileMetaData_v1 FileMetaData
Declare the latest version of the class.
Definition
Event/xAOD/xAODMetaData/xAODMetaData/FileMetaData.h:16
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0