ATLAS Offline Software
xAODAuxStoreHelper.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 
4 import ROOT
5 
6 cast_offset_str="""
7 #include "TBranchElement.h"
8  #include "TObjArray.h"
9  #include "TStreamerElement.h"
10  #include "TStreamerInfo.h"
11 
12  Long_t cast_with_offset( TBranchElement* be ) {
13  Long_t offset = ((TStreamerElement*)be->GetInfo()->GetElements()->At(be->GetID()))->GetOffset();
14  return (Long_t)(be->GetObject() + offset);
15  }
16 """
17 open("cast_with_offset.C","w").write(cast_offset_str)
18 ROOT.gROOT.LoadMacro("cast_with_offset.C+")
19 
20 
21 def initBranch( tree, name ):
22 
23  tree.SetBranchStatus( name, ROOT.kTRUE )
24  be = tree.GetBranch( name )
25  be.GetEntry(0) # tickle object creation
26  values = ROOT.BindObject( ROOT.cast_with_offset( be ), be.GetTypeName() )
27  setattr( tree, name, values )
28  return values
29 
30 def initStaticStoreBranch(tree, be):
31  be.GetEntry(0) # tickle object creation
32  values = ROOT.BindObject( ROOT.cast_with_offset( be ), be.GetTypeName() )
33  setattr( tree, be.GetName(), values )
34  return values
35 
python.xAODAuxStoreHelper.initBranch
def initBranch(tree, name)
Definition: xAODAuxStoreHelper.py:21
python.xAODAuxStoreHelper.initStaticStoreBranch
def initStaticStoreBranch(tree, be)
Definition: xAODAuxStoreHelper.py:30
python.ByteStreamConfig.write
def write
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:248
Trk::open
@ open
Definition: BinningType.h:40