Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:51

0001 #!/usr/bin/env python
0002 #
0003 # Copyright (c) 2019 Opticks Team. All Rights Reserved.
0004 #
0005 # This file is part of Opticks
0006 # (see https://bitbucket.org/simoncblyth/opticks).
0007 #
0008 # Licensed under the Apache License, Version 2.0 (the "License"); 
0009 # you may not use this file except in compliance with the License.  
0010 # You may obtain a copy of the License at
0011 #
0012 #   http://www.apache.org/licenses/LICENSE-2.0
0013 #
0014 # Unless required by applicable law or agreed to in writing, software 
0015 # distributed under the License is distributed on an "AS IS" BASIS, 
0016 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0017 # See the License for the specific language governing permissions and 
0018 # limitations under the License.
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   # plt.gcf().get_size_inches()   after maximize
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     #select = slice(0,8)
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     #qwn_plot( cf.ss[0], "T", -1, c2_ymax=2000)
0086     #qwn_plot( scf, "R", irec)
0087     #qwns_plot( scf, "XYZT", irec)
0088     #qwns_plot( scf, "ABCR", irec)
0089 
0090 
0091 
0092 
0093 
0094 
0095