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 Aiming for this to be generated, so keep it simple
0023 """
0024 import numpy as np
0025 from opticks.ana.shape import X, SEllipsoid, STubs, STorus, SCons, SSubtractionSolid, SUnionSolid, SIntersectionSolid
0026 
0027 
0028 class x021(X):
0029     """
0030     // LV=21
0031     // start portion generated by nnode::to_g4code 
0032     G4VSolid* make_solid()
0033     { 
0034         G4VSolid* c = new G4Ellipsoid("PMT_20inch_pmt_solid_1_Ellipsoid0x4c3bc00", 254.001000, 254.001000, 184.001000, -184.001000, 184.001000) ; // 2
0035         G4VSolid* f = new G4Tubs("PMT_20inch_pmt_solid_2_Tube0x4c3bc90", 0.000000, 77.976532, 21.496235, 0.000000, CLHEP::twopi) ; // 3
0036         G4VSolid* h = new G4Torus("PMT_20inch_pmt_solid_2_Torus0x4c84bd0", 0.000000, 47.009000, 97.000000, -0.000175, CLHEP::twopi) ; // 3
0037         
0038         G4ThreeVector A(0.000000,0.000000,-21.486235);
0039         G4VSolid* e = new G4SubtractionSolid("PMT_20inch_pmt_solid_part20x4c84c70", f, h, NULL, A) ; // 2
0040            
0041         G4ThreeVector B(0.000000,0.000000,-197.513765);
0042         G4VSolid* b = new G4UnionSolid("PMT_20inch_pmt_solid_1_20x4c84f90", c, e, NULL, B) ; // 1
0043         G4VSolid* j = new G4Tubs("PMT_20inch_pmt_solid_3_EndTube0x4c84e60", 0.000000, 50.011000, 60.010500, 0.000000, CLHEP::twopi) ; // 1
0044            
0045         G4ThreeVector C(0.000000,0.000000,-279.000500);
0046         G4VSolid* a = new G4UnionSolid("PMT_20inch_pmt_solid0x4c81b40", b, j, NULL, C) ; // 0
0047         return a ; 
0048     } 
0049     // end portion generated by nnode::to_g4code 
0050     """
0051     def __init__(self):
0052         c = SEllipsoid( "c", [254.001000, 184.001000] )
0053         f = STubs(     "f", [77.976532, 21.496235] )
0054         h = STorus(    "h", [47.009000, 97.000000] )
0055 
0056         A = np.array( [0.000000,-21.486235] )
0057         e = SSubtractionSolid( "e" , [f, h, A] )
0058 
0059         B = np.array( [0.000000,-197.513765])
0060         b = SUnionSolid( "b", [c, e, B] )
0061          
0062         j = STubs( "j", [50.011000, 60.010500] )
0063         C = np.array( [0.000000,-279.000500] )
0064         a = SUnionSolid( "a", [b, j, C] )
0065 
0066         X.__init__(self, a )   # sets root
0067 
0068 
0069 
0070 if __name__ == '__main__':
0071     x = x021()
0072     print(repr(x))
0073 
0074     c = x.find("SEllipsoid")
0075     print(repr(c))
0076 
0077     import copy 
0078     xc = copy.deepcopy(x)
0079     print(repr(xc))
0080 
0081