CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
getHLTkey.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from sys import stderr, exit
3 import commands
4 
5 
6 #
7 # E.P., 27 July 2010
8 # query to the Run Reistry taken from a script by Giovanni Petrucianni
9 #
10 
11 
12 from optparse import OptionParser
13 parser = OptionParser(usage="usage: %prog [options] ")
14 parser.add_option("--firstRun", dest="firstRun", help="first run", type="int", metavar="RUN", default="1")
15 parser.add_option("--lastRun", dest="lastRun", help="last run", type="int", metavar="RUN", default="9999999")
16 parser.add_option("--groupName", dest="groupName", help="select runs of name like NAME", metavar="NAME", default="Collisions%")
17 parser.add_option("--HLTkey", dest="HLTkey", help="name of the HLTkey e.g. /cdaq/physics/Run2010/v3.1/HLT_1.6E30/V1",metavar="HLT")
18 parser.add_option("--perKey", action="store_true",default=False,dest="perKey",help="list the runs per HLT key",metavar="perKey")
19 (options, args) = parser.parse_args()
20 
21 from queryRR import queryRR
22 
23 runKeys = queryRR(options.firstRun,options.lastRun,options.groupName)
24 runs = runKeys.keys(); runs.sort()
25 
26 if options.perKey:
27  runsPerKey={}
28  for run in runs:
29  key = runKeys[run]
30  if not key in runsPerKey.keys():
31  tmpruns=[]
32  tmpruns.append(run)
33  runsPerKey[key] = tmpruns
34  else:
35  runsPerKey[key].append(run)
36  theKeys = runsPerKey.keys()
37  for key in theKeys:
38  theruns = runsPerKey[key]
39  topr=""
40  for r in theruns:
41  topr=topr+"\t"+r
42  print key,topr
43  exit(1)
44 
45 if options.HLTkey:
46  HLTkey = options.HLTkey
47  print "List of runs taken with HLT key = ",HLTkey
48 for run in runs:
49  key = runKeys[run]
50 
51  if not options.HLTkey:
52  print run,key
53  else:
54  if key == options.HLTkey:
55  print run
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...