test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
heppy_report.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from optparse import OptionParser
3 import json
4 
5 def root2map(dir,ana,treename):
6  import ROOT
7  tfile = ROOT.TFile.Open("%s/%s/%s.root"%(dir,ana,treename))
8  if not tfile:
9  print "Error: dir %s does not contain %s/%s.root" % (dir,ana,treename)
10  return None
11  tree = tfile.Get(treename)
12  if not tree:
13  print "Error: rootfile %s/%s/%s.root does not contain a TTree %s" % (dir,ana,treename,treename)
14  return None
15  jsonind = {}
16  for e in xrange(tree.GetEntries()):
17  tree.GetEntry(e)
18  run,lumi = tree.run, tree.lumi
19  if run not in jsonind:
20  jsonind[run] = [lumi]
21  else:
22  jsonind[run].append(lumi)
23  # remove duplicates
24  for run in jsonind:
25  jsonind[run] = list(set(jsonind[run]))
26 
27  nruns = len(jsonind)
28  nlumis = sum(len(v) for v in jsonind.itervalues())
29  jsonmap = {}
30  for r,lumis in jsonind.iteritems():
31  if len(lumis) == 0: continue # shouldn't happen
32  lumis.sort()
33  ranges = [ [ lumis[0], lumis[0] ] ]
34  for lumi in lumis[1:]:
35  if lumi == ranges[-1][1] + 1:
36  ranges[-1][1] = lumi
37  else:
38  ranges.append([lumi,lumi])
39  jsonmap[r] = ranges
40  return (jsonmap, nruns, nlumis)
41 
42 if __name__ == '__main__':
43  parser = OptionParser(usage='%prog <target_directories> [options]',
44  description='Check the output of the JSONAnalyzer and produce a json file of the processed runs and lumisections')
45  parser.add_option("-a", "--analyzer", dest="jsonAnalyzer", default="JSONAnalyzer", help="Name of the JSONAnalyzer")
46  parser.add_option("-t", "--tree", dest="treeName", default="RLTInfo", help="Name of the TTree produced by the JSONAnalyzer")
47  parser.add_option("-o", "--out", dest="outputFile", default="lumiSummary.json", help="Name of the output file")
48  (options,args) = parser.parse_args()
49  if len(args)==0:
50  print 'provide at least one directory in argument. Use -h to display help'
51  exit()
52  for a in args:
53  summary = root2map(a,options.jsonAnalyzer,options.treeName)
54  if summary:
55  oname = "%s/%s" % (a,options.outputFile)
56  jmap, runs, lumis = summary
57  json.dump(jmap,open(oname,'w'))
58  print "Saved %s (%d runs, %d lumis)" % (oname, runs, lumis)
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 ...
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run