Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:03

0001 #!/usr/bin/env python3
0002 from __future__ import print_function
0003 from math import *
0004 from ROOT import TFile, TObject, TTree
0005 from array import array
0006 from ROOT import gDirectory
0007 import sys
0008 import os
0009 
0010 DQMfile = sys.argv[1]
0011 RunNumber = sys.argv[2]
0012 globalTagVar = sys.argv[3]
0013 
0014 if not os.path.isfile(DQMfile):
0015 #    print "Error: file", DQMfile, "not found, exit" 
0016     sys.exit(0)
0017 
0018 
0019 
0020 thefile = TFile( DQMfile )
0021 globalTagDir = 'DQMData/Run ' + RunNumber + '/Info/Run summary/CMSSWInfo'
0022 
0023 if not gDirectory.GetDirectory( globalTagDir ):
0024 #    print "Warning: globalTag not found in DQM file"
0025     sys.exit(0)    
0026 
0027 keys = gDirectory.GetDirectory( globalTagDir ).GetListOfKeys()
0028 
0029 key = keys[0]
0030 globalTag = ''
0031 while key:
0032     obj = key.ReadObj()
0033     if globalTagVar in obj.GetName():
0034         globalTag = obj.GetName()[len("<"+globalTagVar+">s="):-len("</"+globalTagVar+">")]
0035         break
0036     key = keys.After(key)
0037 if len(globalTag) > 1:
0038     if globalTag.find('::') >= 0: 
0039         print(globalTag[0:globalTag.find('::')])
0040     else:
0041         print(globalTag)
0042 
0043