File indexing completed on 2026-04-10 07:49:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 """
0022 tokg4.py
0023 =============================================
0024
0025 Loads test events from Opticks and Geant4 and
0026 created by OKG4Test and
0027 compares their bounce histories.
0028
0029 """
0030 import os, sys, logging, argparse, numpy as np
0031 log = logging.getLogger(__name__)
0032
0033 from opticks.ana.main import opticks_main
0034 from opticks.ana.ab import AB
0035 from opticks.ana.nbase import vnorm
0036 from opticks.ana.seq import seq2msk
0037
0038
0039
0040 if __name__ == '__main__':
0041 ok = opticks_main(doc=__doc__, tag="1", src="torch", det="g4live", pfx="source", tagoffset=0)
0042
0043
0044 log.info(ok.brief)
0045
0046 ab = AB(ok)
0047 ab.dump()
0048
0049 rc = ab.RC
0050
0051 level = "fatal" if rc > 0 else "info"
0052 getattr(log, level)(" RC 0x%.2x %s " % (rc,bin(rc)) )
0053
0054
0055 if not ok.ipython:
0056 log.info("early exit as non-interactive")
0057 sys.exit(rc)
0058 else:
0059 pass
0060 pass
0061
0062 a = ab.a
0063 b = ab.b
0064
0065
0066
0067
0068
0069
0070 if 0:
0071 if a.valid:
0072 a0 = a.rpost_(0)
0073
0074 a0r = vnorm(a0[:,:2])
0075 if len(a0r)>0:
0076 print " ".join(map(lambda _:"%6.3f" % _, (a0r.min(),a0r.max())))
0077
0078 if b.valid:
0079 b0 = b.rpost_(0)
0080
0081 b0r = vnorm(b0[:,:2])
0082 if len(b0r)>0:
0083 print " ".join(map(lambda _:"%6.3f" % _, (b0r.min(),b0r.max())))
0084
0085