14 ROOT.gROOT.SetBatch(
True)
25 return toiter (c.begin(), c.end())
29 for i
in range(1, len(sys.argv) ):
30 if sys.argv[i] ==
'-src':
31 collection_name = sys.argv[i+1]
33 collection_name = re.sub(
'\.root$',
'', collection_name)
34 if sys.argv[i] ==
'-query':
35 query_string = sys.argv[i+1]
37 if sys.argv[i] ==
'-h':
38 print "Currently implemented options: -src -query"
41 colsvc = ROOT.pool.CollectionService()
43 col=colsvc.open(collection_name,
'RootCollection',
'', read_only_flag)
45 des = col.description()
46 attributes = map(
lambda n: des.attributeColumn(n, 0).
name(),
range(0, des.numberOfAttributeColumns()) )
47 if 'RunNumber' not in attributes
or 'EventNumber' not in attributes:
48 print "RunNumber/EventNumber attribute not found in the collection"
56 query = col.newQuery()
58 query.setCondition( query_string )
62 cursor = query.execute()
65 row = cursor.currentRow()
67 tlist = row.tokenList()
68 alist = row.attributeList()
69 print "Attributes # = ", alist.size(),
" References # = ", tlist.size()
71 for i
in range(0,alist.size()):
72 attr_name = alist[i].specification().
name()
74 queryopt = [
'RunNumber',
'EventNumber']
76 attrdata_func_name = {}
79 attrdata_func_name[atr] =
'data<' + alist[atr].specification().
typeName() +
'>'
80 line +=
"%10.10s " % atr
82 line +=
"%38.38s " % t.tokenName()
87 alist = cursor.currentRow().attributeList()
88 tlist = cursor.currentRow().tokenList()
91 line +=
"%10.10s " %
str(getattr(alist[atr], attrdata_func_name[atr])())
92 for i
in range(0, tlist.size()):
93 line +=
"%38.38s " % tlist[i].dbID()
95 has_row = cursor.next()