Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:49:22

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 tlaser.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, numpy as np
0031 log = logging.getLogger(__name__)
0032 
0033 try:
0034     import matplotlib.pyplot as plt
0035     plt.rcParams['figure.figsize'] = 18,10.2   # plt.gcf().get_size_inches()   after maximize
0036     import matplotlib.gridspec as gridspec
0037 except ImportError:
0038     print "matplotlib missing : you need this to make plots"
0039     plt = None 
0040 
0041 from opticks.ana.base import opticks_main
0042 from opticks.ana.nbase import vnorm
0043 from opticks.ana.evt  import Evt
0044 from opticks.ana.cf import CF 
0045 from opticks.ana.cfplot import cfplot, qwns_plot, qwn_plot, multiplot
0046 
0047 
0048 if __name__ == '__main__':
0049     np.set_printoptions(precision=4, linewidth=200)
0050     args = opticks_main(tag="1", src="torch", det="laser")
0051     log.info(" args %s " % repr(args))
0052     log.info("tag %s src %s det %s c2max %s  " % (args.utag,args.src,args.det, args.c2max))
0053 
0054     plt.ion()
0055     plt.close()
0056 
0057     select = slice(1,2)
0058     #select = slice(0,8)
0059 
0060     try:
0061         cf = CF(tag=args.tag, src=args.src, det=args.det, select=select )
0062     except IOError as err:
0063         log.fatal(err)
0064         sys.exit(args.mrc)
0065 
0066 
0067     cf.dump()
0068 
0069     irec = 1 
0070 
0071     #multiplot(cf, pages=["XYZT","ABCR"])
0072   
0073     #qwn_plot( cf.ss[0], "T", -1, c2_ymax=2000)
0074     #qwn_plot( cf, "R", irec)
0075     #qwns_plot( cf, "XYZT", irec)
0076     #qwns_plot( cf, "ABCR", irec)
0077 
0078 
0079     binsx,ax,bx,lx = cf.rqwn("X",irec)
0080     binsy,ay,by,ly = cf.rqwn("Y",irec)
0081     binsz,az,bz,lz = cf.rqwn("Z",irec)
0082 
0083    
0084 
0085 
0086 
0087 
0088 
0089 
0090