File indexing completed on 2026-04-09 07:48:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 """
0022 tpmt_distrib.py : PmtInBox Opticks vs Geant4 distributions
0023 ================================================================
0024
0025 Usage
0026 -------
0027
0028 As this can create many tens of plot windows, a way of wading through them
0029 without getting finger stain is to resize the invoking ipython window very
0030 small and then repeatedly run::
0031
0032 plt.close()
0033
0034 To close each window in turn.
0035
0036 See Also
0037 ----------
0038
0039 :doc:`tpmt`
0040 history comparison and how to create the events
0041
0042 :doc:`tpmt_debug`
0043 development notes debugging simulation to achieve *pmt_test.py* matching
0044
0045 """
0046 import os, sys, logging, numpy as np
0047 log = logging.getLogger(__name__)
0048
0049 try:
0050 import matplotlib.pyplot as plt
0051 plt.rcParams['figure.figsize'] = 18,10.2
0052 import matplotlib.gridspec as gridspec
0053 except ImportError:
0054 print "matplotlib missing : you need this to make plots"
0055 plt = None
0056
0057
0058 from opticks.ana.base import opticks_main
0059 from opticks.ana.evt import Evt
0060 from opticks.ana.nbase import chi2, vnorm
0061 from opticks.ana.cf import CF
0062 from opticks.ana.cfplot import cfplot, qwns_plot, qwn_plot, multiplot
0063
0064
0065
0066 if __name__ == '__main__':
0067 np.set_printoptions(precision=4, linewidth=200)
0068 args = opticks_main(tag="10", src="torch", det="PmtInBox")
0069 log.info(" args %s " % repr(args))
0070
0071 plt.ion()
0072 plt.close()
0073
0074 select = slice(1,2)
0075
0076 try:
0077 cf = CF(tag=args.tag, src=args.src, det=args.det, select=select )
0078 except IOError as err:
0079 log.fatal(err)
0080 sys.exit(args.mrc)
0081
0082 cf.dump()
0083 multiplot(cf, pages=["XYZT","ABCR"])
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095