CMS 3D CMS Logo

Functions | Variables
diffTrackingNtuple Namespace Reference

Functions

def body (opts, ev1, ev2, printTrack)
 
def inOrder (opts, ntpl1, ntpl2, args, kwargs)
 
def main (opts)
 
def outOfOrder (opts, ntpl1, ntpl2, args, kwargs)
 

Variables

 action
 
 default
 
 description
 
 help
 
 int
 
 opts
 
 parser
 
 type
 

Function Documentation

def diffTrackingNtuple.body (   opts,
  ev1,
  ev2,
  printTrack 
)

Definition at line 9 of file diffTrackingNtuple.py.

References str.

Referenced by inOrder(), and outOfOrder().

9 def body(opts, ev1, ev2, printTrack):
10  print ev1.eventIdStr()
11 
12  tracks1 = ev1.tracks()
13  tracks2 = ev2.tracks()
14 
15  singleTrack = (opts.track is not None)
16  if singleTrack:
17  tracks1 = [tracks1[opts.track]]
18 
19  diff = ntuple.diffTrackListsGeneric(printTrack, tracks1, tracks2, ignoreAdditionalLst2=singleTrack)
20  if diff.hasDifference():
21  print str(diff)
22  print
23 
def body(opts, ev1, ev2, printTrack)
#define str(s)
def diffTrackingNtuple.inOrder (   opts,
  ntpl1,
  ntpl2,
  args,
  kwargs 
)

Definition at line 24 of file diffTrackingNtuple.py.

References body().

Referenced by main().

24 def inOrder(opts, ntpl1, ntpl2, *args, **kwargs):
25  if opts.entry is not None:
26  ev1 = ntpl1.getEvent(opts.entry)
27  ev2 = ntpl2.getEvent(opts.entry)
28 
29  if ev1.eventId() != ev2.eventId():
30  raise Exception("Events are out of order, entry %d file1 has %s and file %s. Use --outOfOrder option instead." % (ev1.entry(), ev1.eventIdStr(), ev2.eventIdStr()))
31 
32  body(opts, ev1, ev2, *args, **kwargs)
33  return
34 
35  for i, (ev1, ev2) in enumerate(itertools.izip(ntpl1, ntpl2)):
36  if opts.maxEvents >= 0 and i >= opts.maxEvents:
37  break
38 
39  if ev1.eventId() != ev2.eventId():
40  raise Exception("Events are out of order, entry %d file1 has %s and file %s. Use --outOfOrder option instead." % (ev1.entry(), ev1.eventIdStr(), ev2.eventIdStr()))
41 
42  body(opts, ev1, ev2, *args, **kwargs)
43 
44 
def body(opts, ev1, ev2, printTrack)
def inOrder(opts, ntpl1, ntpl2, args, kwargs)
def diffTrackingNtuple.main (   opts)

Definition at line 70 of file diffTrackingNtuple.py.

References inOrder(), and outOfOrder().

70 def main(opts):
71  ntpl1 = ntuple.TrackingNtuple(opts.file1)
72  ntpl2 = ntuple.TrackingNtuple(opts.file2)
73 
74  print "--- %s" % opts.file1
75  print "+++ %s" % opts.file2
76 
77  printTrack = ntuple.TrackPrinter(trackingParticlePrinter=ntuple.TrackingParticlePrinter(parentage=False), diffForTwiki=opts.twiki)
78 
79  if opts.outOfOrder:
80  outOfOrder(opts, ntpl1, ntpl2, printTrack)
81  else:
82  inOrder(opts, ntpl1, ntpl2, printTrack)
83 
def inOrder(opts, ntpl1, ntpl2, args, kwargs)
def outOfOrder(opts, ntpl1, ntpl2, args, kwargs)
def diffTrackingNtuple.outOfOrder (   opts,
  ntpl1,
  ntpl2,
  args,
  kwargs 
)

Definition at line 45 of file diffTrackingNtuple.py.

References body().

Referenced by main().

45 def outOfOrder(opts, ntpl1, ntpl2, *args, **kwargs):
46  if opts.entry is not None:
47  raise Exception("--entry does not make sense with --outOfOrder")
48 
49  events2 = collections.OrderedDict()
50  for ev2 in ntpl2:
51  events2[ev2.eventIdStr()] = ev2.entry()
52 
53  for i, ev1 in enumerate(ntpl1):
54  if opts.maxEvents >= 0 and i >= opts.maxEvents:
55  break
56 
57  if not ev1.eventId() in events2:
58  print "-", ev1.eventIdStr()
59  continue
60 
61  ev2 = ntpl2.getEvent(events2[ev1.eventIdStr()])
62  events2.remove(ev1.eventId())
63 
64  body(opts, ev1, ev2, *args, **kwargs)
65 
66 
67  for eventIdStr in events2.iterkeys():
68  print "+", eventIdStr
69 
def body(opts, ev1, ev2, printTrack)
def outOfOrder(opts, ntpl1, ntpl2, args, kwargs)

Variable Documentation

diffTrackingNtuple.action

Definition at line 90 of file diffTrackingNtuple.py.

diffTrackingNtuple.default

Definition at line 94 of file diffTrackingNtuple.py.

diffTrackingNtuple.description

Definition at line 85 of file diffTrackingNtuple.py.

diffTrackingNtuple.help

Definition at line 87 of file diffTrackingNtuple.py.

diffTrackingNtuple.int

Definition at line 94 of file diffTrackingNtuple.py.

diffTrackingNtuple.opts

Definition at line 101 of file diffTrackingNtuple.py.

diffTrackingNtuple.parser

Definition at line 85 of file diffTrackingNtuple.py.

diffTrackingNtuple.type

Definition at line 86 of file diffTrackingNtuple.py.