CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
heppy_report Namespace Reference

Functions

def root2map
 

Variables

string oname = "%s/%s"
 
tuple parser
 
tuple summary = root2map(a,options.jsonAnalyzer,options.treeName)
 

Function Documentation

def heppy_report.root2map (   dir,
  ana,
  treename 
)

Definition at line 7 of file heppy_report.py.

References bitset_utilities.append(), print(), and sistrip::SpyUtilities.range().

7 
8 def root2map(dir,ana,treename):
9  import ROOT
10  tfile = ROOT.TFile.Open("%s/%s/%s.root"%(dir,ana,treename))
11  if not tfile:
12  print("Error: dir %s does not contain %s/%s.root" % (dir,ana,treename))
13  return None
14  tree = tfile.Get(treename)
15  if not tree:
16  print("Error: rootfile %s/%s/%s.root does not contain a TTree %s" % (dir,ana,treename,treename))
17  return None
18  jsonind = {}
19  for e in range(tree.GetEntries()):
20  tree.GetEntry(e)
21  run,lumi = tree.run, tree.lumi
22  if run not in jsonind:
23  jsonind[run] = [lumi]
24  else:
25  jsonind[run].append(lumi)
26  # remove duplicates
27  for run in jsonind:
28  jsonind[run] = list(set(jsonind[run]))
29 
30  nruns = len(jsonind)
31  nlumis = sum(len(v) for v in jsonind.values())
32  jsonmap = {}
33  for r,lumis in jsonind.items():
34  if len(lumis) == 0: continue # shouldn't happen
35  lumis.sort()
36  ranges = [ [ lumis[0], lumis[0] ] ]
37  for lumi in lumis[1:]:
38  if lumi == ranges[-1][1] + 1:
39  ranges[-1][1] = lumi
40  else:
41  ranges.append([lumi,lumi])
42  jsonmap[r] = ranges
43  return (jsonmap, nruns, nlumis)
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 ...
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Variable Documentation

string heppy_report.oname = "%s/%s"

Definition at line 57 of file heppy_report.py.

Referenced by CocoaDaqReaderRoot.BuildMeasurementsFromOptAlign(), OpticalObjectMgr.findOptOs(), TritonClient.getResults(), Model.readMeasurementsFromFile(), CocoaDaqReaderText.ReadNextEvent(), and TritonClient.TritonClient().

tuple heppy_report.parser
Initial value:
1 = OptionParser(usage='%prog <target_directories> [options]',
2  description='Check the output of the JSONAnalyzer and produce a json file of the processed runs and lumisections')

Definition at line 45 of file heppy_report.py.

tuple heppy_report.summary = root2map(a,options.jsonAnalyzer,options.treeName)

Definition at line 55 of file heppy_report.py.