Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:31

0001 #!/usr/bin/env python
0002 import numpy as np
0003 from opticks.ana.fold import Fold
0004 
0005 X,Y,Z,W=0,1,2,3
0006 
0007 class SCenterExtentGenstep(object):
0008 
0009     @classmethod
0010     def Lim(cls, xyz):
0011         lim = np.zeros( (3,2), dtype=np.float32 )
0012         for A in [X,Y,Z]: lim[A] = [xyz[:,A].min(), xyz[:,A].max() ]
0013         return lim 
0014 
0015 
0016     def __init__(self, path):
0017         if path is None:
0018             path = "/tmp/$USER/opticks/SCenterExtentGenstep"
0019         pass
0020 
0021         fold = Fold.Load(path)
0022 
0023         photons = fold.photons
0024         gs = fold.gs
0025 
0026         self.fold = fold
0027         self.peta = fold.peta
0028         self.gs = gs
0029         self.photons = photons
0030         self.plim = self.Lim( photons[:,0] )
0031         self.glim = self.Lim( gs[:,5] )
0032    
0033 
0034 if __name__ == '__main__':
0035 
0036 
0037     #path = os.path.expandvars("$CFBASE/CSGIntersectSolidTest/$GEOM")
0038     path = None
0039 
0040     cegs = SCenterExtentGenstep(path)
0041 
0042     peta = cegs.peta
0043     gs = cegs.gs 
0044     photons = cegs.photons
0045 
0046     print("cegs.plim\n", cegs.plim)
0047     print("cegs.glim\n", cegs.glim)
0048 
0049 
0050 
0051