ATLAS Offline Software
Loading...
Searching...
No Matches
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).
8
9// Local include(s).
11
12namespace EL {
13
14 UnitTestAlg4::UnitTestAlg4( const std::string& name, ISvcLocator* svcLoc )
15 : AnaAlgorithm( name, svcLoc ) {
16
17 }
18
20
21 // Greet the user.
22 ATH_MSG_INFO( "Initialising algorithm..." );
23
24 // Make sure that @c beginInputFile() gets called.
26
27 // Read the file metadata.
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
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
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
64
65 // Increment the internal counter.
67
68 // Read the file metadata.
70
71 // Return gracefully.
72 return ::StatusCode::SUCCESS;
73 }
74
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
ConstMetaStorePtr_t inputMetaStore() const
::StatusCode requestBeginInputFile()
register this algorithm to have an implementation of beginInputFile
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual::StatusCode initialize() override
Function initialising the algorithm.
virtual::StatusCode finalize() override
Function finalising the algorithm.
virtual::StatusCode beginInputFile() override
Function called whenever a new input file's processing starts.
virtual::StatusCode execute() override
Function executing the algorithm.
int m_callCount
Internal status flag.
StatusCode readFileMetaData()
Function reading some in-file metadata.
UnitTestAlg4(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
@ dataType
Data type that's in the file [string].
@ amiTag
AMI tag used to process the file the last time [string].
@ simFlavour
Fast or Full sim [string].
bool value(MetaDataType type, std::string &val) const
Get a pre-defined string value out of the object.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
EventInfo_v1 EventInfo
Definition of the latest event info version.
FileMetaData_v1 FileMetaData
Declare the latest version of the class.