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 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, argparse, numpy as np
0031 log = logging.getLogger(__name__)
0032 
0033 from opticks.ana.base import opticks_main
0034 from opticks.ana.nbase import vnorm
0035 from opticks.ana.evt  import Evt
0036 
0037 
0038 
0039 if __name__ == '__main__':
0040     np.set_printoptions(precision=4, linewidth=200)
0041 
0042     args = opticks_main(doc=__doc__, tag="1", src="torch", det="laser", c2max=2.0, tagoffset=0,  dbgseqhis=0)
0043 
0044     log.info("tag %s src %s det %s c2max %s  " % (args.utag,args.src,args.det, args.c2max))
0045 
0046 
0047     #a_seqs = ["8ccccd"]
0048     #b_seqs = ["8ccccccd"]
0049     #a_seqs = ["8ccccd"]
0050     #b_seqs = ["8ccccd"]
0051 
0052     a_seqs = []
0053     b_seqs = []
0054 
0055 
0056     try:
0057         a = Evt(tag="%s" % args.utag, src=args.src, det=args.det, seqs=a_seqs, dbgseqhis=args.dbgseqhis, args=args)
0058         b = Evt(tag="-%s" % args.utag , src=args.src, det=args.det, seqs=b_seqs, dbgseqhis=args.dbgseqhis, args=args )
0059     except IOError as err:
0060         log.fatal(err)
0061         sys.exit(args.mrc)
0062   
0063 
0064     #print "A",a
0065     #print "B",b
0066 
0067     log.info( " a : %s " % a.brief)
0068     log.info( " b : %s " % b.brief )
0069 
0070 
0071 
0072 if 0:
0073     if a.valid:
0074         a0 = a.rpost_(0)
0075         #a0r = np.linalg.norm(a0[:,:2],2,1)
0076         a0r = vnorm(a0[:,:2])
0077         if len(a0r)>0:
0078             print " ".join(map(lambda _:"%6.3f" % _, (a0r.min(),a0r.max())))
0079 
0080     if b.valid:
0081         b0 = b.rpost_(0)
0082         #b0r = np.linalg.norm(b0[:,:2],2,1)
0083         b0r = vnorm(b0[:,:2])
0084         if len(b0r)>0:
0085             print " ".join(map(lambda _:"%6.3f" % _, (b0r.min(),b0r.max())))
0086 
0087 if 1:
0088 
0089     tables = ["seqhis_ana"] + ["seqhis_ana_%d" % imsk for imsk in range(1,8)] + ["seqmat_ana"] 
0090     Evt.compare_table(a,b, tables, lmx=120, c2max=None, cf=True)
0091 
0092 
0093     Evt.compare_table(a,b, "pflags_ana hflags_ana".split(), lmx=20, c2max=None, cf=True)
0094 
0095 
0096 
0097 
0098     #a.history_table(slice(0,20))
0099     #b.history_table(slice(0,20))
0100 
0101