ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
xAODRootAccess
Root
xAODTMetaBranch.cxx
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
//
4
5
// Local include(s):
6
#include "
xAODRootAccess/tools/xAODTMetaBranch.h
"
7
#include "
xAODRootAccess/tools/Message.h
"
8
#include "
xAODRootAccess/TEvent.h
"
9
10
ClassImp
(
xAODTMetaBranch
)
11
12
xAODTMetaBranch::xAODTMetaBranch
( ::TTree& parent,
xAOD::TEvent
& event,
13
const
std::type_info& ti,
14
const
char
* brName,
const
char
* brType )
15
: ::TBranchObject(),
16
m_event( &event ), m_ti( &ti ), m_object( nullptr ) {
17
18
// Now that the object is established in memory, let's initialise it:
19
Init( &parent, 0, brName, brType, &m_object, 32000, 0, -1, kTRUE );
20
}
21
32
::Int_t
xAODTMetaBranch::GetEntry
( ::Long64_t entry, ::Int_t
/*getall*/
) {
33
34
// Check if the branch is active:
35
if
( TestBit( kDoNotProcess ) ) {
36
return
0;
37
}
38
39
// Check whether we already have the requested entry:
40
if
( fReadEntry == entry ) {
41
return
1;
42
}
43
44
// Load the requested file:
45
if
(
m_event
->getFile( entry ) < 0 ) {
46
Error(
"GetEntry"
,
47
XAOD_MESSAGE
(
"Problems with loading entry/file %lld"
), entry );
48
return
-1;
49
}
50
51
// Update the internal pointer:
52
m_object
=
m_event
->getInputObject( GetName(), *
m_ti
, kFALSE, kTRUE );
53
if
( !
m_object
) {
54
Error(
"GetEntry"
,
55
XAOD_MESSAGE
(
"Failed to read variable of type \"%s\" with "
56
"key \"%s\""
),
57
GetClassName(), GetName() );
58
return
-1;
59
}
60
61
// We were successful:
62
fReadEntry = entry;
63
return
1;
64
}
65
73
::TClass*
xAODTMetaBranch::IsA
()
const
{
74
75
return ::TBranchObject::IsA();
76
}
TEvent.h
Message.h
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition
Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
xAODTMetaBranch
Specialised class for browsing xAOD metadata interface objects in ROOT.
Definition
xAODTMetaBranch.h:27
xAODTMetaBranch::GetEntry
virtual::Int_t GetEntry(::Long64_t entry, ::Int_t getall)
Function getting the current entry/file for this branch.
Definition
xAODTMetaBranch.cxx:32
xAODTMetaBranch::m_event
xAOD::TEvent * m_event
Pointer to the TEvent object reading the persistent tree.
Definition
xAODTMetaBranch.h:47
xAODTMetaBranch::xAODTMetaBranch
xAODTMetaBranch(::TTree &parent, xAOD::TEvent &event, const std::type_info &ti, const char *brName, const char *brType)
Constructor with all the needed parameters.
xAODTMetaBranch::IsA
virtual::TClass * IsA() const
Function returning the type of TBranchObject.
Definition
xAODTMetaBranch.cxx:73
xAODTMetaBranch::m_ti
const std::type_info * m_ti
The type of the object that needs to be read.
Definition
xAODTMetaBranch.h:49
xAODTMetaBranch::m_object
const void * m_object
Pointer to the object read in using TEvent.
Definition
xAODTMetaBranch.h:51
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:59
ClassImp
ClassImp(xAODTMetaBranch) xAODTMetaBranch
Definition
xAODTMetaBranch.cxx:10
xAODTMetaBranch.h
Generated on
for ATLAS Offline Software by
1.17.0