23 if opts.track
is None and opts.trackingParticle
is None and opts.seed
is None and opts.pixelHit
is None and opts.stripHit
is None:
26 ntpl = ntuple.TrackingNtuple(opts.file)
28 if opts.entry
is not None:
29 event = ntpl.getEvent(opts.entry)
30 print(event.eventIdStr())
31 elif opts.event
is not None:
33 print(
"Entry %d" % event.entry())
35 hasHits = ntpl.hasHits()
36 hasSeeds = ntpl.hasSeeds()
38 if not hasSeeds
and opts.seed
is not None:
39 print(
"Ntuple %s does not have seeds saved!" % opts.file)
41 if not hasHits
and (opts.pixelHit
is not None or opts.stripHit
is not None):
42 print(
"Ntuple %s does not have hits saved!" % opts.file)
45 seedArgs = dict(hits=hasHits, bestMatchingTrackingParticle=hasHits)
46 trackArgs = dict(hits=hasHits, bestMatchingTrackingParticle=hasHits)
47 tpArgs = dict(hits=hasHits, bestMatchingTrack=hasHits)
49 trackArgs[
"seedPrinter"] =
None
50 tpArgs[
"seedPrinter"] =
None
52 trackArgs[
"seedPrinter"] = ntuple.SeedPrinter(**seedArgs)
53 tpArgs[
"seedPrinter"] = ntuple.SeedPrinter(**seedArgs)
55 printSeed = ntuple.SeedPrinter(trackingParticles=
True, trackingParticlePrinter=ntuple.TrackingParticlePrinter(**tpArgs), **seedArgs)
56 printTrack = ntuple.TrackPrinter(trackingParticlePrinter=ntuple.TrackingParticlePrinter(**tpArgs), **trackArgs)
57 printTrackingParticle = ntuple.TrackingParticlePrinter(trackPrinter=ntuple.TrackPrinter(**trackArgs), **tpArgs)
59 if opts.track
is not None:
61 if opts.track >= len(trks):
62 print(
"You requested track %d, but this event has only %d tracks" % (opts.track, len(trks)))
64 trk = trks[opts.track]
67 if opts.trackingParticle
is not None:
68 tps = event.trackingParticles()
69 if opts.trackingParticle >= len(tps):
70 print(
"You requested TrackingParticle %d, but this event has ony %d TrackingParticles" % (opts.trackingParticle, len(tps)))
72 tp = tps[opts.trackingParticle]
73 printTrackingParticle(tp)
75 if opts.seed
is not None:
77 if opts.seedIteration
is not None:
78 algo = getattr(ntuple.Algo, opts.seedIteration)
79 if opts.seed >= seeds.nSeedsForAlgo(algo):
80 print(
"You requested seed %d for algo %s, but this event has only %d seeds for that algo" % (opts.seed, opts.seedIteration, seeds.nSeedsForAlgo(algo)))
82 seed = seeds.seedForAlgo(algo, opts.seed)
84 if opts.seed >= len(seeds):
85 print(
"You requested seed %d, but this event has only %d seeds" % (opts.seed, len(seeds)))
87 seed = seeds[opts.seed]
90 if opts.pixelHit
is not None:
91 hits = event.pixelHits()
92 if opts.pixelHit >= len(hits):
93 print(
"You requested pixel hit %d, but this event has only %d pixel hits" % (opts.pixelHit, len(hits)))
96 hit = hits[opts.pixelHit]
97 print(
"Pixel hit %d tracks" % opts.pixelHit)
98 for t
in hit.tracks():
101 print(
"Pixel hit %d seeds" % opts.pixelHit)
102 for s
in hit.seeds():
105 if opts.stripHit
is not None:
106 hits = event.stripHits()
107 if opts.stripHit >= len(hits):
108 print(
"You requested strip hit %d, but this event has only %d strip hits" % (opts.stripHit, len(hits)))
110 hit = hits[opts.stripHit]
111 print(
"Strip hit %d tracks" % opts.stripHit)
112 for t
in hit.tracks():
115 print(
"Strip hit %d seeds" % opts.stripHit)
116 for s
in hit.seeds():