Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-27 04:17:59

0001 #!/usr/bin/env python3 
0002 from __future__ import print_function
0003 from __future__ import absolute_import
0004 from sys import stderr, exit
0005 
0006 
0007 #
0008 # E.P., 27 July 2010
0009 # query to the Run Reistry taken from a script by Giovanni Petrucianni
0010 #
0011 
0012 
0013 from optparse import OptionParser
0014 parser = OptionParser(usage="usage: %prog [options] ")
0015 parser.add_option("--firstRun",  dest="firstRun",  help="first run", type="int", metavar="RUN", default="1")
0016 parser.add_option("--lastRun",   dest="lastRun",   help="last run",  type="int", metavar="RUN", default="9999999")
0017 parser.add_option("--groupName", dest="groupName", help="select runs of name like NAME", metavar="NAME", default="Collisions%")
0018 parser.add_option("--HLTkey",    dest="HLTkey",    help="name of the HLTkey e.g. /cdaq/physics/Run2010/v3.1/HLT_1.6E30/V1",metavar="HLT")
0019 parser.add_option("--perKey",    action="store_true",default=False,dest="perKey",help="list the runs per HLT key",metavar="perKey")
0020 (options, args) = parser.parse_args()
0021 
0022 from .queryRR import queryRR
0023 
0024 runKeys = queryRR(options.firstRun,options.lastRun,options.groupName)
0025 runs = runKeys.keys(); runs.sort()
0026 
0027 if options.perKey:
0028     runsPerKey={}
0029     for run in runs:
0030         key = runKeys[run]
0031         if not key in runsPerKey.keys():
0032             tmpruns=[]
0033             tmpruns.append(run)
0034             runsPerKey[key] = tmpruns
0035         else:
0036             runsPerKey[key].append(run)
0037     theKeys = runsPerKey.keys()
0038     for key in theKeys:
0039         theruns = runsPerKey[key]
0040         topr=""
0041         for r in theruns:
0042             topr=topr+"\t"+r
0043         print(key,topr)
0044     exit(1)
0045 
0046 if options.HLTkey:
0047     HLTkey = options.HLTkey
0048     print("List of runs taken with HLT key = ",HLTkey) 
0049 for run in runs:
0050     key = runKeys[run]
0051 
0052     if not options.HLTkey:
0053         print(run,key)  
0054     else:
0055         if key == options.HLTkey:
0056             print(run)