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 x020(X):
0029     """
0030     // LV=20
0031     // start portion generated by nnode::to_g4code 
0032     G4VSolid* make_solid()
0033     { 
0034         G4VSolid* c = new G4Ellipsoid("PMT_20inch_body_solid_1_Ellipsoid0x4c81db0", 254.000000, 254.000000, 184.000000, -184.000000, 184.000000) ; // 2
0035         G4VSolid* f = new G4Tubs("PMT_20inch_body_solid_2_Tube0x4c81e90", 0.000000, 77.976127, 21.496692, 0.000000, CLHEP::twopi) ; // 3
0036         G4VSolid* h = new G4Torus("PMT_20inch_body_solid_2_Torus0x4c81fc0", 0.000000, 47.010000, 97.000000, -0.000175, CLHEP::twopi) ; // 3
0037         
0038         G4ThreeVector A(0.000000,0.000000,-21.486692);
0039         G4VSolid* e = new G4SubtractionSolid("PMT_20inch_body_solid_part20x4c820b0", f, h, NULL, A) ; // 2
0040         
0041         G4ThreeVector B(0.000000,0.000000,-197.513308);
0042         G4VSolid* b = new G4UnionSolid("PMT_20inch_body_solid_1_20x4c90cd0", c, e, NULL, B) ; // 1
0043         G4VSolid* j = new G4Tubs("PMT_20inch_body_solid_3_EndTube0x4c90ba0", 0.000000, 50.010000, 60.010000, 0.000000, CLHEP::twopi) ; // 1
0044         
0045         G4ThreeVector C(0.000000,0.000000,-279.000000);
0046         G4VSolid* a = new G4UnionSolid("PMT_20inch_body_solid0x4c90e50", b, j, NULL, C) ; // 0
0047         return a ; 
0048     } 
0049     // end portion generated by nnode::to_g4code 
0050 
0051     """
0052     def __init__(self):
0053         c = SEllipsoid( "c", [254.000, 184.000 ] )
0054         f = STubs(      "f", [77.976127, 21.496692] )
0055         h = STorus(     "h", [ 47.010000, 97.000000] )
0056 
0057         A = np.array( [0, -21.486692] )
0058         e = SSubtractionSolid( "e" , [f, h, A] )
0059 
0060         B = np.array( [0, -197.513308] )  
0061         b = SUnionSolid( "b", [c, e, B] )
0062          
0063         j = STubs( "j", [50.010000, 60.010000] )
0064         C = np.array( [0, -279.000000] )
0065         a = SUnionSolid( "a", [b, j, C] )
0066 
0067         X.__init__(self, a )   # sets root
0068 
0069         self.prims = [c,f,h,j]   
0070 
0071 
0072 
0073 if __name__ == '__main__':
0074     x = x020()
0075     print(repr(x))
0076