ATLAS Offline Software
Classes | Functions | Variables
xAODRootTest Namespace Reference

Classes

class  AllocTestRead
 
class  Analysis
 
class  xAODTestClearDecor
 
class  xAODTestCopy
 
class  xAODTestDecor
 
class  xAODTestPDecor
 
class  xAODTestRead
 

Functions

def CHECK (sc)
 
def _typename (t)
 
def xAODInit ()
 
def format_int (x)
 
def format_float (x)
 
def format_str (x)
 
def format_el (x)
 
def format_el_vec (v)
 
def format_float_vec (v)
 
def format_int_vec (v)
 
def format_str_vec (v)
 
def dump_auxitem (x, auxid, f=sys.stdout)
 
def dump_auxdata (x, exclude=[], f=sys.stdout)
 
def dump_c (c, f=sys.stdout)
 
def dump_xaodobj (h, f=sys.stdout)
 
def dump_plinks (p, f=sys.stdout)
 
def copy_obj (event, obj, key)
 
def copy_vec (event, obj, key)
 
def copy_view (event, obj, key)
 

Variables

 CVec_type = ROOT.DataVector(ROOT.DMTest.C_v1)
 
dictionary accessors
 

Function Documentation

◆ _typename()

def xAODRootTest._typename (   t)
private

Definition at line 34 of file xAODRootTest.py.

34 def _typename(t):
35  return getattr (t, '__cpp_name__', t.__name__)
36 

◆ CHECK()

def xAODRootTest.CHECK (   sc)

Definition at line 25 of file xAODRootTest.py.

25 def CHECK(sc):
26  if not sc.isSuccess():
27  raise Exception ('bad StatusCode')
28  return
29 
30 
31 
32 reg=ROOT.SG.AuxTypeRegistry.instance()
33 

◆ copy_obj()

def xAODRootTest.copy_obj (   event,
  obj,
  key 
)

Definition at line 147 of file xAODRootTest.py.

147 def copy_obj (event, obj, key):
148  copy = obj.__class__()
149  copy_aux = obj.getConstStore().__class__()
150  copy.setNonConstStore (copy_aux)
151  copy.__assign__ (obj)
152  CHECK (event.record (copy, key))
153  CHECK (event.record (copy_aux, key + 'Aux.'))
154  ROOT.SetOwnership (copy, False)
155  ROOT.SetOwnership (copy_aux, False)
156  return
157 
158 

◆ copy_vec()

def xAODRootTest.copy_vec (   event,
  obj,
  key 
)

Definition at line 159 of file xAODRootTest.py.

159 def copy_vec (event, obj, key):
160  copy = obj.__class__()
161  copy_aux = obj.getConstStore().__class__()
162  copy.setNonConstStore (copy_aux)
163  for i in range(obj.size()):
164  elt_orig = obj[i]
165  if _typename (elt_orig.__class__).startswith ('DataModel_detail::ElementProxy<'):
166  elt_orig = elt_orig.__follow__()
167  elt = elt_orig.__class__()
168  copy.push_back(elt)
169  ROOT.SetOwnership (elt, False)
170  elt.__assign__ (elt_orig)
171  CHECK (event.record (copy, key))
172  CHECK (event.record (copy_aux, key + 'Aux.'))
173  ROOT.SetOwnership (copy, False)
174  ROOT.SetOwnership (copy_aux, False)
175  return
176 
177 

◆ copy_view()

def xAODRootTest.copy_view (   event,
  obj,
  key 
)

Definition at line 178 of file xAODRootTest.py.

178 def copy_view (event, obj, key):
179  copy = obj.__class__(obj)
180  copy.toPersistent()
181  CHECK (event.record (copy, key))
182  ROOT.SetOwnership (copy, False)
183  return
184 
185 

◆ dump_auxdata()

def xAODRootTest.dump_auxdata (   x,
  exclude = [],
  f = sys.stdout 
)

Definition at line 110 of file xAODRootTest.py.

110 def dump_auxdata (x, exclude=[], f = sys.stdout):
111  auxids = list(x.getAuxIDs())
112  auxids = [(reg.getName(id), id) for id in auxids]
113  auxids.sort()
114  for name, auxid in auxids:
115  if name in exclude: continue
116  if reg.isLinked (auxid): continue
117  print (name + ': ', file=f, end='')
118  dump_auxitem (x, auxid, f)
119  return
120 
121 

◆ dump_auxitem()

def xAODRootTest.dump_auxitem (   x,
  auxid,
  f = sys.stdout 
)

Definition at line 98 of file xAODRootTest.py.

98 def dump_auxitem (x, auxid, f = sys.stdout):
99  tname = reg.getTypeName (auxid)
100  ac_p = accessors.get (tname)
101  if not ac_p:
102  print ('<unknown %s>'%tname, end='', file=f)
103  else:
104  (ac_cl, formatter) = ac_p
105  val = ac_cl(reg.getName(auxid))(x)
106  print (formatter(val) + '; ', end='', file=f)
107  return
108 
109 

◆ dump_c()

def xAODRootTest.dump_c (   c,
  f = sys.stdout 
)

Definition at line 122 of file xAODRootTest.py.

122 def dump_c (c, f=sys.stdout):
123  if hasattr(c, '__deref__'):
124  c = c.__deref__()
125  print (' anInt1: %d; aFloat: %.1f; ' % (c.anInt(), c.aFloat()), end='')
126  dump_auxdata (c, exclude = ['anInt1', 'aFloat'])
127  print ('')
128  return
129 
130 

◆ dump_plinks()

def xAODRootTest.dump_plinks (   p,
  f = sys.stdout 
)

Definition at line 139 of file xAODRootTest.py.

139 def dump_plinks (p, f=sys.stdout):
140  if hasattr(p, '__deref__'):
141  p = p.__deref__()
142  dump_auxdata (p)
143  print ('')
144  return
145 
146 

◆ dump_xaodobj()

def xAODRootTest.dump_xaodobj (   h,
  f = sys.stdout 
)

Definition at line 131 of file xAODRootTest.py.

131 def dump_xaodobj (h, f=sys.stdout):
132  if hasattr(h, '__deref__'):
133  h = h.__deref__()
134  dump_auxdata (h)
135  print ('')
136  return
137 
138 

◆ format_el()

def xAODRootTest.format_el (   x)

Definition at line 55 of file xAODRootTest.py.

55 def format_el(x): return '%s[%s]' % (x.dataID(), ('inv' if x.isDefaultIndex() else x.index()))

◆ format_el_vec()

def xAODRootTest.format_el_vec (   v)

Definition at line 56 of file xAODRootTest.py.

56 def format_el_vec(v): return '[' + ', '.join([format_el(el) for el in v.asVector()]) + ']'

◆ format_float()

def xAODRootTest.format_float (   x)

Definition at line 53 of file xAODRootTest.py.

53 def format_float(x): return '%.1f'%x

◆ format_float_vec()

def xAODRootTest.format_float_vec (   v)

Definition at line 57 of file xAODRootTest.py.

57 def format_float_vec(v):
58  l = [format_float(x) for x in v]
59  return '[' + ','.join(l) + ']'

◆ format_int()

def xAODRootTest.format_int (   x)

Definition at line 52 of file xAODRootTest.py.

52 def format_int(x): return '%d'%x

◆ format_int_vec()

def xAODRootTest.format_int_vec (   v)

Definition at line 60 of file xAODRootTest.py.

60 def format_int_vec(v):
61  l = [format_int(x) for x in v]
62  return '[' + ','.join(l) + ']'

◆ format_str()

def xAODRootTest.format_str (   x)

Definition at line 54 of file xAODRootTest.py.

54 def format_str(x): return f"'{x}'"

◆ format_str_vec()

def xAODRootTest.format_str_vec (   v)

Definition at line 63 of file xAODRootTest.py.

63 def format_str_vec(v):
64  l = [format_str(x) for x in v]
65  return '[' + ','.join(l) + ']'

◆ xAODInit()

def xAODRootTest.xAODInit ( )

Definition at line 37 of file xAODRootTest.py.

37 def xAODInit():
38  ROOT.xAOD.TEvent
39  CHECK(ROOT.xAOD.Init())
40  import sys
41  if len(sys.argv) >= 2 and sys.argv[1] == '--rntuple':
42  return True
43  return False
44 
45 
46 
47 cvec_cls=ROOT.DataVector(ROOT.DMTest.C_v1)
48 cel_cls=ROOT.ElementLink(cvec_cls)
49 
50 
51 

Variable Documentation

◆ accessors

dictionary xAODRootTest.accessors
Initial value:
1 = {
2  'int' : (ROOT.SG.ConstAccessor(int), format_int),
3  'unsigned int' : (getattr (ROOT, 'SG::ConstAccessor<unsigned int>'), format_int),
4  'float' : (ROOT.SG.ConstAccessor(float), format_float),
5  'std::vector<float>' : (getattr (ROOT, 'SG::ConstAccessor<std::vector<float> >'), format_float_vec),
6  'std::vector<int>' : (getattr (ROOT, 'SG::ConstAccessor<std::vector<int> >'), format_int_vec),
7  'ElementLink<DataVector<DMTest::C_v1> >' :
8  (ROOT.SG.ConstAccessor(cel_cls), format_el),
9  'SG::JaggedVecElt<int>' :
10  (ROOT.SG.ConstAccessor(ROOT.SG.JaggedVecElt(ROOT.int)),
11  format_int_vec),
12  'SG::JaggedVecElt<float>' :
13  (ROOT.SG.ConstAccessor(ROOT.SG.JaggedVecElt(ROOT.float)),
14  format_float_vec),
15  'SG::JaggedVecElt<double>' :
16  (ROOT.SG.ConstAccessor(ROOT.SG.JaggedVecElt(ROOT.double)),
17  format_float_vec),
18  'SG::JaggedVecElt<std::string>' :
19  (ROOT.SG.ConstAccessor(ROOT.SG.JaggedVecElt(ROOT.std.string)),
20  format_str_vec),
21  'SG::JaggedVecElt<ElementLink<DataVector<DMTest::C_v1> > >' :
22  (ROOT.SG.ConstAccessor(ROOT.SG.JaggedVecElt(ROOT.ElementLink(CVec_type))),
23  format_el_vec),
24  'SG::PackedLink<DataVector<DMTest::C_v1> >' :
25  (ROOT.SG.ConstAccessor(ROOT.SG.PackedLink(ROOT.DataVector(ROOT.DMTest.C_v1))),
26  format_el),
27  'std::vector<SG::PackedLink<DataVector<DMTest::C_v1> > >' :
28  (ROOT.SG.ConstAccessor(ROOT.std.vector(ROOT.SG.PackedLink(ROOT.DataVector(ROOT.DMTest.C_v1)))),
29  format_el_vec),
30  }

Definition at line 67 of file xAODRootTest.py.

◆ CVec_type

xAODRootTest.CVec_type = ROOT.DataVector(ROOT.DMTest.C_v1)

Definition at line 66 of file xAODRootTest.py.

xAODRootTest.format_str
def format_str(x)
Definition: xAODRootTest.py:54
xAODRootTest.format_el_vec
def format_el_vec(v)
Definition: xAODRootTest.py:56
xAODRootTest.dump_plinks
def dump_plinks(p, f=sys.stdout)
Definition: xAODRootTest.py:139
xAODRootTest._typename
def _typename(t)
Definition: xAODRootTest.py:34
xAODRootTest.format_int_vec
def format_int_vec(v)
Definition: xAODRootTest.py:60
xAODRootTest.dump_c
def dump_c(c, f=sys.stdout)
Definition: xAODRootTest.py:122
xAODRootTest.format_int
def format_int(x)
Definition: xAODRootTest.py:52
xAODRootTest.format_el
def format_el(x)
Definition: xAODRootTest.py:55
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
xAODRootTest.copy_view
def copy_view(event, obj, key)
Definition: xAODRootTest.py:178
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
xAODRootTest.format_str_vec
def format_str_vec(v)
Definition: xAODRootTest.py:63
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
vtune_athena.formatter
formatter
Definition: vtune_athena.py:19
xAODRootTest.format_float
def format_float(x)
Definition: xAODRootTest.py:53
xAODRootTest.xAODInit
def xAODInit()
Definition: xAODRootTest.py:37
xAODRootTest.dump_auxitem
def dump_auxitem(x, auxid, f=sys.stdout)
Definition: xAODRootTest.py:98
xAODRootTest.CHECK
def CHECK(sc)
Definition: xAODRootTest.py:25
xAODRootTest.dump_xaodobj
def dump_xaodobj(h, f=sys.stdout)
Definition: xAODRootTest.py:131
xAODRootTest.copy_obj
def copy_obj(event, obj, key)
Definition: xAODRootTest.py:147
xAODRootTest.format_float_vec
def format_float_vec(v)
Definition: xAODRootTest.py:57
xAODRootTest.copy_vec
def copy_vec(event, obj, key)
Definition: xAODRootTest.py:159
xAODRootTest.dump_auxdata
def dump_auxdata(x, exclude=[], f=sys.stdout)
Definition: xAODRootTest.py:110