Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/usr/bin/env python
0002 """
0003 
0004 ::
0005 
0006     ## slot 1 counts using input photons at 7 wavelengths in OK and G4, for diametric diagonal paths (InwardsCubeCorners17999?)  
0007     ##
0008     ##      AB     RE      SC     BT    
0009 
0010     In [3]: counts.reshape(-1,4)                                                                                                                                                                      
0011     Out[3]: 
0012     array([[16040, 63928,    32,     0],
0013            [16012, 63966,    22,     0],
0014            [16019, 63919,    62,     0],
0015            [16055, 63885,    60,     0],
0016            [15843, 63243,   914,     0],
0017            [15917, 63167,   916,     0],
0018            [13237, 12934, 46479,  7350],
0019            [13268, 12948, 46507,  7277],
0020            [12882,  3636, 47795, 15687],
0021            [13027,  3709, 47669, 15595],
0022            [15538,  3168, 43614, 17680],
0023            [15417,  3278, 43348, 17957],
0024            [14691,  2319, 41745, 21245],
0025            [14695,  2264, 41777, 21264]], dtype=int32)
0026 
0027     In [4]: np.sum( counts.reshape(-1,4), axis=1 )                                                                                                                                                    
0028     Out[4]: array([80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000, 80000])
0029 
0030 
0031 """
0032 import os, sys, logging, numpy as np
0033 from opticks.ana.ab import AB 
0034 log = logging.getLogger(__name__)
0035 
0036 if __name__ == '__main__':
0037     from opticks.ana.main import opticks_main
0038     ok = opticks_main()
0039 
0040     ## TODO: propagate special things regarding the event via metadata, not manually  
0041     wavelengths = "360,380,400,420,440,460,480".split(",")
0042 
0043     nevt = len(wavelengths)
0044 
0045     slot = 1 
0046     labs = "AB RE SC BT" 
0047     nlab = len(labs.split())
0048     nab = 2 
0049 
0050     counts = np.zeros( (nevt, nab, nlab), dtype=np.int32 ) 
0051     for i in range(nevt):
0052         wavelength = wavelengths[i]
0053         itag = i + 1  
0054         name = "ab%d" % itag
0055         print("%s : input_photon start wavelength %s " % (name, wavelength) )
0056         ab = AB(ok, str(itag))  
0057         counts[i] = ab.seqhis_counts(slot, labs )
0058         globals()[name] = ab 
0059     pass
0060