ATLAS Offline Software
Loading...
Searching...
No Matches
xAODTEventBranch.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3//
4
5// Local include(s):
9
11
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 xAODTEventBranch::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 entry:
45 if( m_event->getEntry( entry ) < 0 ) {
46 Error( "GetEntry",
47 XAOD_MESSAGE( "Problems with loading entry %lld" ), entry );
48 return -1;
49 }
50
51 // Update the internal pointer:
52 static constexpr bool SILENT = false;
53 static constexpr bool METADATA = false;
54 m_object = m_event->getInputObject( GetName(), *m_ti, SILENT, METADATA );
55 if( ! m_object ) {
56 Error( "GetEntry",
57 XAOD_MESSAGE( "Failed to read variable of type \"%s\" with "
58 "key \"%s\"" ),
59 GetClassName(), GetName() );
60 return -1;
61 }
62
63 // We were successful:
64 fReadEntry = entry;
65 return 1;
66}
67
75::TClass* xAODTEventBranch::IsA() const {
76
77 return ::TBranchObject::IsA();
78}
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Specialised class for browsing xAOD event interface objects in ROOT.
const std::type_info * m_ti
The type of the object that needs to be read.
const void * m_object
Pointer to the object read in using TEvent.
xAOD::TEvent * m_event
Pointer to the TEvent object reading the persistent tree.
virtual::Int_t GetEntry(::Long64_t entry, ::Int_t getall)
Function getting the current entry for this branch.
virtual::TClass * IsA() const
Function returning the type of TBranchObject.
xAODTEventBranch(::TTree &parent, xAOD::TEvent &event, const std::type_info &ti, const char *brName, const char *brType)
Constructor with all the needed parameters.
Tool for accessing xAOD files outside of Athena.
ClassImp(xAODTEventBranch) xAODTEventBranch