7 def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.ValidityKeyMax>>32,selection=""):
8 dbSvc = cool.DatabaseSvcFactory.databaseService()
10 db= dbSvc.openDatabase(dbname)
11 except Exception
as e:
12 print (
"Problems connecting to database:",e)
18 ss=selection.split(
",")
23 c1=cool.ChannelId(
int(s))
26 c1=cool.ChannelId(
int(s[:idx]))
27 c2=cool.ChannelId(
int(s[1+idx:]))
30 sel=cool.ChannelSelection(c1,c2,cool.ChannelSelection.sinceBeforeChannel)
35 print (
"ExtractFolderInfo: No COOL channel selection given, work on all channels")
36 sel=cool.ChannelSelection.all()
41 nodelist=db.listAllNodes()
43 if not db.existsFolder(fn):
continue
46 for cf
in checkFolders:
47 if cf[-1] ==
"/": cf=cf[0:-1]
50 if pyfn.startswith(cf)
and (idx>=len(pyfn)
or pyfn[idx]==
"/"):
53 if not takeFolder:
continue
56 print (
"Analyzing",fn)
61 descr=
str(f.description())
62 i1=descr.find(
"<typeName>")+len(
"<typeName>")
63 i2=descr.find(
"</typeName>",i1)
64 if (i1==-1
or i2==-1):
65 print (
"ERROR could not get typename of object stored in folder",fn)
70 i1=descr.find(
"<key>")+len(
"<key>")
71 i2=descr.find(
"</key>",i1)
72 if (i1==-1
or i2==-1):
73 print (
"ERROR could not get SG key of object stored in folder",fn)
83 elif len(tagList)>1
and globaltag!=
"":
85 tagList=[f.resolveTag(globaltag)]
87 print (
"Hierachical tag", globaltag,
"not defined in folder",fn)
91 itr=f.findObjects(runnumber<<32,sel,t)
92 minIOV=cool.ValidityKeyMax>>32
93 maxIOV=cool.ValidityKeyMin>>32
101 if minIOV>since: minIOV=since
102 if maxIOV<until: maxIOV=until
106 folderinfo=(
str(fn),typename,key,
str(t),minIOV,maxIOV)
107 folderInfoList+=[folderinfo]
110 return folderInfoList