Classes | Functions | Variables
ValidateOpDetReco Namespace Reference

Classes

class  Assoc
 
class  Flash
 Define objects #. More...
 
class  Hit
 

Functions

def ApproxCompare (left, right, tolerance=0.001)
 Define utility functions #. More...
 
def CountFailures (left, right)
 
def ListFailures (left, right)
 
def ListFailuresFlash (left, right)
 
def ListFailuresAssoc (left, right)
 
def ListFailuresHit (left, right)
 

Variables

bool startup = False
 Parse arguments #. More...
 
string usage = "usage: %prog -n <nominal file> -t <test file> [-o <dir>] [-s] [-d] [-e 0,1] [--opdets=0,1] "
 
 parser = OptionParser(usage=usage)
 
 dest
 
 help
 
 metavar
 
 default
 
 False
 
 action
 
 options
 
 args
 
list versions = [ "nominal", "test" ]
 
 S = versions[0]
 
 R = versions[1]
 
dictionary files = {}
 
dictionary hittrees = {}
 
dictionary flashtrees = {}
 
dictionary assoctrees = {}
 
dictionary all = {}
 Flash Comparison #. More...
 
 onlies = copy.deepcopy(all)
 Hit Comparison #. More...
 
int iS = 0
 
list matches = []
 
int failures = [0]*8
 
bool found = False
 
 index = all[E][v].index(flsh)
 
 failures_here = ListFailures(flsh[S],flsh[R])
 
 maxval = len(onlies[E][S])
 
list widgets
 
 pbar = pb.ProgressBar(widgets=widgets, maxval=maxval, term_width=100)
 
 end
 while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for iR in range(len(onlies[E][R])): if onlies[E][S][iS] == onlies[E][R][iR]: matches.append( { S: onlies[E][S].pop( iS ), R: onlies[E][R].pop( iR ) } ) found = True break if not found: matches.append( { S: iS += 1 if iS >= len(onlies[E][S]): break pbar.finish() print "" More...
 
dictionary color = { S:kBlack, R:kRed }
 Flash and Hit Plots #. More...
 
string hstyle = "hist"
 
int mstyle = 20
 
int lstyle = 2
 
int nbins = 100
 
 c1 = TCanvas("c1","c1")
 
 h1 = gROOT.FindObject("h"+name+"1")
 
 h2 = gROOT.FindObject("h"+name+"2")
 
 hRatio = h2.Clone("hRatio")
 
 ratio
 
 True
 
 forceOne
 
 ignoreError
 
 l1 = TLine(gPad.GetUxmin(), 1, gPad.GetUxmax(), 1)
 

Function Documentation

def ValidateOpDetReco.ApproxCompare (   left,
  right,
  tolerance = 0.001 
)

Define utility functions #.

Definition at line 58 of file ValidateOpDetReco.py.

58 def ApproxCompare(left, right, tolerance = 0.001):
59  try:
60  return ( abs(right / left - 1.) < tolerance )
61  except ZeroDivisionError:
62  return (right == 0)
63 
def ApproxCompare(left, right, tolerance=0.001)
Define utility functions #.
T abs(T value)
def ValidateOpDetReco.CountFailures (   left,
  right 
)

Definition at line 64 of file ValidateOpDetReco.py.

64 def CountFailures(left, right):
65  return len(ListFailures(left,right))
66 
def ListFailures(left, right)
def CountFailures(left, right)
def ValidateOpDetReco.ListFailures (   left,
  right 
)

Definition at line 67 of file ValidateOpDetReco.py.

67 def ListFailures(left, right):
68  if isinstance(left, Flash): return ListFailuresFlash(left, right)
69  if isinstance(left, Assoc): return ListFailuresAssoc(left, right)
70  if isinstance(left, Hit): return ListFailuresHit(left, right)
71 
def ListFailures(left, right)
def ListFailuresHit(left, right)
def ListFailuresFlash(left, right)
def ListFailuresAssoc(left, right)
def ValidateOpDetReco.ListFailuresAssoc (   left,
  right 
)

Definition at line 87 of file ValidateOpDetReco.py.

87 def ListFailuresAssoc(left, right):
88  failures = []
89  tolerance = 0.000001
90  if left.EventID != right.EventID: failures += [ 'EventID' ]
91  if left.HitFrame != right.HitFrame: failures += [ 'HitFrame' ]
92  if left.FlashFrame != right.FlashFrame: failures += [ 'FlashFrame' ]
93  #if left.FlashID != right.FlashID: failures += [ 'FlashID' ]
94  if not ApproxCompare(left.HitPeakTime, right.HitPeakTime, tolerance): failures += [ 'HitPeakTime' ]
95  if not ApproxCompare(left.HitPE, right.HitPE, tolerance): failures += [ 'HitPE' ]
96  if not ApproxCompare(left.FlashTime, right.FlashTime, tolerance): failures += [ 'FlashTime' ]
97  if not ApproxCompare(left.FlashPE, right.FlashPE, tolerance): failures += [ 'FlashPE' ]
98  return failures
99 
def ApproxCompare(left, right, tolerance=0.001)
Define utility functions #.
def ListFailuresAssoc(left, right)
def ValidateOpDetReco.ListFailuresFlash (   left,
  right 
)

Definition at line 72 of file ValidateOpDetReco.py.

72 def ListFailuresFlash(left, right):
73  failures = []
74  tolerance = 0.001
75  if left.InBeamFrame != right.InBeamFrame: failures += [ 'InBeamFrame']
76  if left.OnBeamTime != right.OnBeamTime: failures += [ 'OnBeamTime' ]
77  if not ApproxCompare(left.YCenter, right.YCenter, tolerance): failures += [ 'YCenter' ]
78  if not ApproxCompare(left.ZCenter, right.ZCenter, tolerance): failures += [ 'ZCenter' ]
79  if not ApproxCompare(left.YWidth, right.YWidth, tolerance): failures += [ 'YWidth' ]
80  if not ApproxCompare(left.ZWidth, right.ZWidth, tolerance): failures += [ 'YWidth' ]
81  if not ApproxCompare(left.FlashTime, right.FlashTime, tolerance): failures += [ 'FlashTime' ]
82  if not ApproxCompare(left.FlashFrame,right.FlashFrame,tolerance): failures += [ 'Frame' ]
83  if not ApproxCompare(left.AbsTime, right.AbsTime, tolerance): failures += [ 'AbsTime' ]
84  if not ApproxCompare(left.TotalPE, right.TotalPE, 0.5): failures += [ 'TotalPE' ]
85  return failures
86 
def ApproxCompare(left, right, tolerance=0.001)
Define utility functions #.
def ListFailuresFlash(left, right)
def ValidateOpDetReco.ListFailuresHit (   left,
  right 
)

Definition at line 100 of file ValidateOpDetReco.py.

100 def ListFailuresHit(left, right):
101  failures = []
102  tolerance = 0.000000001
103  if left.Frame != right.Frame: failures += [ 'Frame' ]
104  if not ApproxCompare(left.PeakTimeAbs, right.PeakTimeAbs, tolerance): failures += [ 'PeakTimeAbs' ]
105  if not ApproxCompare(left.PeakTime, right.PeakTime, tolerance): failures += [ 'PeakTime' ]
106  if not ApproxCompare(left.Width, right.Width, tolerance): failures += [ 'Width' ]
107  if not ApproxCompare(left.Area, right.Area, tolerance): failures += [ 'Area' ]
108  if not ApproxCompare(left.Amplitude, right.Amplitude, tolerance): failures += [ 'Amplitude' ]
109  if not ApproxCompare(left.PE, right.PE, tolerance): failures += [ 'PE' ]
110  if not ApproxCompare(left.FastToTotal, right.FastToTotal, tolerance): failures += [ 'FastToTotal' ]
111  return failures
112 
113 
114 
def ApproxCompare(left, right, tolerance=0.001)
Define utility functions #.
def ListFailuresHit(left, right)

Variable Documentation

ValidateOpDetReco.action

Definition at line 26 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.all = {}

Flash Comparison #.

Definition at line 335 of file ValidateOpDetReco.py.

ValidateOpDetReco.args

Definition at line 32 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.assoctrees = {}

Definition at line 319 of file ValidateOpDetReco.py.

ValidateOpDetReco.c1 = TCanvas("c1","c1")

Definition at line 586 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.color = { S:kBlack, R:kRed }

Flash and Hit Plots #.

Definition at line 578 of file ValidateOpDetReco.py.

ValidateOpDetReco.default

Definition at line 25 of file ValidateOpDetReco.py.

ValidateOpDetReco.dest

Definition at line 23 of file ValidateOpDetReco.py.

ValidateOpDetReco.end

while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for iR in range(len(onlies[E][R])): if onlies[E][S][iS] == onlies[E][R][iR]: matches.append( { S: onlies[E][S].pop( iS ), R: onlies[E][R].pop( iR ) } ) found = True break if not found: matches.append( { S: iS += 1 if iS >= len(onlies[E][S]): break pbar.finish() print ""

Definition at line 548 of file ValidateOpDetReco.py.

int ValidateOpDetReco.failures = [0]*8

Definition at line 354 of file ValidateOpDetReco.py.

ValidateOpDetReco.failures_here = ListFailures(flsh[S],flsh[R])

Definition at line 385 of file ValidateOpDetReco.py.

ValidateOpDetReco.False

Definition at line 26 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.files = {}

Definition at line 313 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.flashtrees = {}

Definition at line 318 of file ValidateOpDetReco.py.

ValidateOpDetReco.forceOne

Definition at line 614 of file ValidateOpDetReco.py.

bool ValidateOpDetReco.found = False

Definition at line 358 of file ValidateOpDetReco.py.

ValidateOpDetReco.h1 = gROOT.FindObject("h"+name+"1")

Definition at line 601 of file ValidateOpDetReco.py.

ValidateOpDetReco.h2 = gROOT.FindObject("h"+name+"2")

Definition at line 602 of file ValidateOpDetReco.py.

ValidateOpDetReco.help

Definition at line 23 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.hittrees = {}

Definition at line 317 of file ValidateOpDetReco.py.

ValidateOpDetReco.hRatio = h2.Clone("hRatio")

Definition at line 610 of file ValidateOpDetReco.py.

string ValidateOpDetReco.hstyle = "hist"

Definition at line 579 of file ValidateOpDetReco.py.

ValidateOpDetReco.ignoreError

Definition at line 614 of file ValidateOpDetReco.py.

ValidateOpDetReco.index = all[E][v].index(flsh)

Definition at line 379 of file ValidateOpDetReco.py.

int ValidateOpDetReco.iS = 0

Definition at line 351 of file ValidateOpDetReco.py.

ValidateOpDetReco.l1 = TLine(gPad.GetUxmin(), 1, gPad.GetUxmax(), 1)

Definition at line 616 of file ValidateOpDetReco.py.

int ValidateOpDetReco.lstyle = 2

Definition at line 581 of file ValidateOpDetReco.py.

list ValidateOpDetReco.matches = []

Definition at line 353 of file ValidateOpDetReco.py.

ValidateOpDetReco.maxval = len(onlies[E][S])

Definition at line 420 of file ValidateOpDetReco.py.

ValidateOpDetReco.metavar

Definition at line 23 of file ValidateOpDetReco.py.

int ValidateOpDetReco.mstyle = 20

Definition at line 580 of file ValidateOpDetReco.py.

int ValidateOpDetReco.nbins = 100

Definition at line 583 of file ValidateOpDetReco.py.

dictionary ValidateOpDetReco.onlies = copy.deepcopy(all)

Hit Comparison #.

Assoc Comparison #.

Definition at line 348 of file ValidateOpDetReco.py.

ValidateOpDetReco.options

Definition at line 32 of file ValidateOpDetReco.py.

ValidateOpDetReco.parser = OptionParser(usage=usage)

Definition at line 22 of file ValidateOpDetReco.py.

ValidateOpDetReco.pbar = pb.ProgressBar(widgets=widgets, maxval=maxval, term_width=100)

Definition at line 424 of file ValidateOpDetReco.py.

ValidateOpDetReco.R = versions[1]

Definition at line 311 of file ValidateOpDetReco.py.

ValidateOpDetReco.ratio

Definition at line 614 of file ValidateOpDetReco.py.

ValidateOpDetReco.S = versions[0]

Definition at line 310 of file ValidateOpDetReco.py.

bool ValidateOpDetReco.startup = False

Parse arguments #.

Definition at line 15 of file ValidateOpDetReco.py.

ValidateOpDetReco.True

Definition at line 614 of file ValidateOpDetReco.py.

string ValidateOpDetReco.usage = "usage: %prog -n <nominal file> -t <test file> [-o <dir>] [-s] [-d] [-e 0,1] [--opdets=0,1] "

Definition at line 21 of file ValidateOpDetReco.py.

list ValidateOpDetReco.versions = [ "nominal", "test" ]

Definition at line 309 of file ValidateOpDetReco.py.

list ValidateOpDetReco.widgets
Initial value:
1 = [ 'Entries: ',pb.Value(), '/', pb.Total(), ' ', pb.Percentage(), ' ',
2  pb.Bar(marker='=',left='[',right=']'),
3  ' ',pb.ETA() ]

Definition at line 421 of file ValidateOpDetReco.py.