22 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:
25 ntpl = ntuple.TrackingNtuple(opts.file)
27 if opts.entry
is not None:
28 event = ntpl.getEvent(opts.entry)
29 print(event.eventIdStr())
30 elif opts.event
is not None:
32 print(
"Entry %d" % event.entry())
34 hasHits = ntpl.hasHits()
35 hasSeeds = ntpl.hasSeeds()
37 if not hasSeeds
and opts.seed
is not None:
38 print(
"Ntuple %s does not have seeds saved!" % opts.file)
40 if not hasHits
and (opts.pixelHit
is not None or opts.stripHit
is not None):
41 print(
"Ntuple %s does not have hits saved!" % opts.file)
44 seedArgs =
dict(hits=hasHits, bestMatchingTrackingParticle=hasHits)
45 trackArgs =
dict(hits=hasHits, bestMatchingTrackingParticle=hasHits)
46 tpArgs =
dict(hits=hasHits, bestMatchingTrack=hasHits)
48 trackArgs[
"seedPrinter"] =
None 49 tpArgs[
"seedPrinter"] =
None 51 trackArgs[
"seedPrinter"] = ntuple.SeedPrinter(**seedArgs)
52 tpArgs[
"seedPrinter"] = ntuple.SeedPrinter(**seedArgs)
54 printSeed = ntuple.SeedPrinter(trackingParticles=
True, trackingParticlePrinter=ntuple.TrackingParticlePrinter(**tpArgs), **seedArgs)
55 printTrack = ntuple.TrackPrinter(trackingParticlePrinter=ntuple.TrackingParticlePrinter(**tpArgs), **trackArgs)
56 printTrackingParticle = ntuple.TrackingParticlePrinter(trackPrinter=ntuple.TrackPrinter(**trackArgs), **tpArgs)
58 if opts.track
is not None:
60 if opts.track >= len(trks):
61 print(
"You requested track %d, but this event has only %d tracks" % (opts.track, len(trks)))
63 trk = trks[opts.track]
66 if opts.trackingParticle
is not None:
67 tps = event.trackingParticles()
68 if opts.trackingParticle >= len(tps):
69 print(
"You requested TrackingParticle %d, but this event has ony %d TrackingParticles" % (opts.trackingParticle, len(tps)))
71 tp = tps[opts.trackingParticle]
72 printTrackingParticle(tp)
74 if opts.seed
is not None:
76 if opts.seedIteration
is not None:
77 algo = getattr(ntuple.Algo, opts.seedIteration)
78 if opts.seed >= seeds.nSeedsForAlgo(algo):
79 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)))
81 seed = seeds.seedForAlgo(algo, opts.seed)
83 if opts.seed >= len(seeds):
84 print(
"You requested seed %d, but this event has only %d seeds" % (opts.seed, len(seeds)))
86 seed = seeds[opts.seed]
89 if opts.pixelHit
is not None:
90 hits = event.pixelHits()
91 if opts.pixelHit >= len(hits):
92 print(
"You requested pixel hit %d, but this event has only %d pixel hits" % (opts.pixelHit, len(hits)))
95 hit = hits[opts.pixelHit]
96 print(
"Pixel hit %d tracks" % opts.pixelHit)
97 for t
in hit.tracks():
100 print(
"Pixel hit %d seeds" % opts.pixelHit)
101 for s
in hit.seeds():
104 if opts.stripHit
is not None:
105 hits = event.stripHits()
106 if opts.stripHit >= len(hits):
107 print(
"You requested strip hit %d, but this event has only %d strip hits" % (opts.stripHit, len(hits)))
109 hit = hits[opts.stripHit]
110 print(
"Strip hit %d tracks" % opts.stripHit)
111 for t
in hit.tracks():
114 print(
"Strip hit %d seeds" % opts.stripHit)
115 for s
in hit.seeds():
S & print(S &os, JobReport::InputFile const &f)
def findEvent(ntpl, event)