ATLAS Offline Software
xAODTEventBranch.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):
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  m_object = m_event->getInputObject( GetName(), *m_ti );
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* xAODTEventBranch::IsA() const {
74 
76 }
xAODTEventBranch::xAODTEventBranch
xAODTEventBranch(::TTree &parent, xAOD::TEvent &event, const std::type_info &ti, const char *brName, const char *brType)
Constructor with all the needed parameters.
checkxAOD.brName
brName
Definition: Tools/PyUtils/bin/checkxAOD.py:113
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
xAOD::TEvent::getInputObject
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent=false) override
Function for retrieving an input object in a non-template way.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1938
xAODTEventBranch::m_event
xAOD::TEvent * m_event
Pointer to the TEvent object reading the persistent tree.
Definition: xAODTEventBranch.h:52
xAODTEventBranch.h
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
xAODTEventBranch::IsA
virtual ::TClass * IsA() const
Function returning the type of ::TBranchObject.
Definition: xAODTEventBranch.cxx:73
xAODTEventBranch::m_object
const void * m_object
Pointer to the object read in using TEvent.
Definition: xAODTEventBranch.h:56
xAODTEventBranch::m_ti
const std::type_info * m_ti
The type of the object that needs to be read.
Definition: xAODTEventBranch.h:54
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
xAODTEventBranch::GetEntry
virtual ::Int_t GetEntry(::Long64_t entry, ::Int_t getall)
Function getting the current entry for this branch.
Definition: xAODTEventBranch.cxx:32
xAOD::TEvent::getEntry
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0)
Function loading a given entry of the input TTree.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1324
Message.h
TEvent.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
xAODTEventBranch
Specialised class for browsing xAOD event interface objects in ROOT.
Definition: xAODTEventBranch.h:32
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81
ClassImp
ClassImp(xAODTEventBranch) xAODTEventBranch
Definition: xAODTEventBranch.cxx:10
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31