CMS 3D CMS Logo

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