ATLAS Offline Software
Loading...
Searching...
No Matches
python.getCurrentFolderTag Namespace Reference

Functions

 _resolveTagFaster (folder, tag)
 getCurrentFolderTag (dbname, folderName, ES=False)

Variables

 dn = sys.argv[1]
 fn = sys.argv[2]
 estag = sys.argv[3]
 currTag = getCurrentFolderTag(dn,fn,estag)[0]

Function Documentation

◆ _resolveTagFaster()

python.getCurrentFolderTag._resolveTagFaster ( folder,
tag )
protected

Definition at line 12 of file getCurrentFolderTag.py.

12def _resolveTagFaster(folder,tag):
13 try:
14 import cppyy
15 # <folder> is at this point a pythonized shared_ptr<cool::IFolder>.
16 # Doing an explicit cast to the base class cool::IHvsNode
17 # significantly reduces the overhead from cling, for some reason.
18 folder=cppyy.bind_object(cppyy.addressof(folder),
19 getattr(cppyy.gbl,'cool::IHvsNode'))
20 # this is in general not a safe cast, but IFolder is an abstract class
21 # only inheriting from IHvsNode.
22 except Exception: pass
23 return folder.resolveTag(tag)
24
25

◆ getCurrentFolderTag()

python.getCurrentFolderTag.getCurrentFolderTag ( dbname,
folderName,
ES = False )

Definition at line 26 of file getCurrentFolderTag.py.

26def getCurrentFolderTag(dbname,folderName,ES=False):
27 currentTag,nextTag=None,None
28
29 #1. Get current and next global tags using resolver class in ~atlcond
30 resolver=resolveAlias()
31 if(ES):
32 currentGlobal=resolver.getCurrentES().replace("*","ST")
33 nextGlobal=resolver.getNextES().replace("*","ST")
34 else:
35 currentGlobal=resolver.getCurrent().replace("*","ST")
36 nextGlobal=resolver.getNext().replace("*","ST")
37
38 print('currentGlobal: ',currentGlobal)
39 #2. Open the DB to resolve this gobal tag for the given folder
40 dbSvc = cool.DatabaseSvcFactory.databaseService()
41 db = dbSvc.openDatabase(dbname)
42 f=db.getFolder(folderName)
43 try:
44 currentTag=_resolveTagFaster(f,currentGlobal)
45 except Exception:
46 print('Warning: could not resolve ',currentGlobal,' in db: ',dbname)
47 if "DBR2" in dbname:
48 print('resolving for the global CONDBR2-BLKPA-2022-10')
49 tmpGlobal='CONDBR2-BLKPA-2022-10'
50 else:
51 print('resolving for the global COMCOND-BLKPA-RUN1-06')
52 tmpGlobal='COMCOND-BLKPA-RUN1-06'
53
54 try:
55 currentTag=_resolveTagFaster(f,tmpGlobal)
56 except Exception:
57 print('Also not working, giving up')
58 pass
59 pass
60
61 if len(nextGlobal)>2:
62 # NEXT exists, try to resolve it
63 try:
64 nextTag=_resolveTagFaster(f,nextGlobal)
65 except Exception:
66 pass
67 pass
68
69 db.closeDatabase()
70 return (currentTag,nextTag)
71
72
if(febId1==febId2)
void print(char *figname, TCanvas *c1)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310

Variable Documentation

◆ currTag

python.getCurrentFolderTag.currTag = getCurrentFolderTag(dn,fn,estag)[0]

Definition at line 85 of file getCurrentFolderTag.py.

◆ dn

python.getCurrentFolderTag.dn = sys.argv[1]

Definition at line 78 of file getCurrentFolderTag.py.

◆ estag

bool python.getCurrentFolderTag.estag = sys.argv[3]

Definition at line 81 of file getCurrentFolderTag.py.

◆ fn

python.getCurrentFolderTag.fn = sys.argv[2]

Definition at line 79 of file getCurrentFolderTag.py.