Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Copyright (c) 2019 Opticks Team. All Rights Reserved.
0003  *
0004  * This file is part of Opticks
0005  * (see https://bitbucket.org/simoncblyth/opticks).
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License"); 
0008  * you may not use this file except in compliance with the License.  
0009  * You may obtain a copy of the License at
0010  *
0011  *   http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software 
0014  * distributed under the License is distributed on an "AS IS" BASIS, 
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0016  * See the License for the specific language governing permissions and 
0017  * limitations under the License.
0018  */
0019 
0020 
0021 
0022 #include "OPTICKS_LOG.hh"
0023 #include "BFile.hh"
0024 #include "X4.hh"
0025 #include "X4CSG.hh"
0026 
0027 #include "G4Box.hh"
0028 #include "G4Orb.hh"
0029 #include "G4Tubs.hh"
0030 #include "G4Sphere.hh"
0031 #include "G4Trd.hh"
0032 #include "G4Polycone.hh"
0033 #include "G4Cons.hh"
0034 #include "G4Ellipsoid.hh"
0035 #include "G4Torus.hh"
0036 
0037 #include "G4UnionSolid.hh"
0038 #include "G4IntersectionSolid.hh"
0039 #include "G4SubtractionSolid.hh"
0040 
0041 #include "G4RotationMatrix.hh"
0042 #include "G4ThreeVector.hh"
0043 
0044 
0045 #define USE_CONE 1
0046 
0047 
0048 
0049 // start portion generated by nnode::to_g4code 
0050 G4VSolid* make_solid()
0051 { 
0052     G4VSolid* d = new G4Ellipsoid("PMT_20inch_inner_solid_1_Ellipsoid0x4c91130", 249.000000, 249.000000, 179.000000, -179.000000, 179.000000) ; // 3
0053 
0054 #ifdef USE_CONE
0055     // see x018_torus_hyperboloid_plt.py
0056     // In [26]: run x018_torus_hyperboloid_plt.py
0057     // x.f  f :                 Cons : array([   0.    , -193.7543]) : [44.99, 83.9935, 25.245702570206376] 
0058 
0059     G4double pRmin1 = 0. ;          // inside radius at  -fDz
0060     G4double pRmax1 = 44.99 ;       // outside radius at -fDz  
0061     G4double pRmin2 = 0. ;          // inside radius at  +fDz
0062     G4double pRmax2 =  83.9935  ;   // outside radius at +fDz  
0063     G4double pDz = 25.245702570206376  ;   // half length in z
0064     G4double pSPhi = 0   ; 
0065     G4double pDPhi = CLHEP::twopi ;
0066 
0067     G4VSolid* f = new G4Cons("cons", pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi ); 
0068     G4ThreeVector B(0.000000,0.000000, -193.7543);
0069 #else
0070     G4VSolid* g = new G4Tubs("PMT_20inch_inner_solid_2_Tube0x4c91210", 0.000000, 75.951247, 23.782510, 0.000000, CLHEP::twopi) ; // 4
0071     G4VSolid* i = new G4Torus("PMT_20inch_inner_solid_2_Torus0x4c91340", 0.000000, 52.010000, 97.000000, -0.000175, CLHEP::twopi) ; // 4    
0072     G4ThreeVector A(0.000000,0.000000,-23.772510);
0073     G4VSolid* f = new G4SubtractionSolid("PMT_20inch_inner_solid_part20x4cb2d80", g, i, NULL, A) ; // 3
0074     G4ThreeVector B(0.000000,0.000000,-195.227490);
0075 #endif
0076     
0077     G4VSolid* c = new G4UnionSolid("PMT_20inch_inner_solid_1_20x4cb30f0", d, f, NULL, B) ; // 2
0078     G4VSolid* k = new G4Tubs("PMT_20inch_inner_solid_3_EndTube0x4cb2fc0", 0.000000, 45.010000, 57.510000, 0.000000, CLHEP::twopi) ; // 2
0079     
0080     G4ThreeVector C(0.000000,0.000000,-276.500000);
0081     G4VSolid* b = new G4UnionSolid("PMT_20inch_inner_solid0x4cb32e0", c, k, NULL, C) ; // 1
0082 
0083 #ifdef USE_CONE
0084     return b ;
0085 #else
0086     G4VSolid* m = new G4Tubs("Inner_Separator0x4cb3530", 0.000000, 254.000000, 92.000000, 0.000000, CLHEP::twopi) ; // 1
0087     G4ThreeVector D(0.000000,0.000000,92.000000);
0088     G4VSolid* a = new G4SubtractionSolid("PMT_20inch_inner2_solid0x4cb3870", b, m, NULL, D) ; // 0
0089     return a ; 
0090 #endif
0091 } 
0092 // end portion generated by nnode::to_g4code 
0093 
0094 
0095 int main( int argc , char** argv )
0096 {
0097     OPTICKS_LOG(argc, argv);
0098 
0099     const char* exename = PLOG::instance->args.exename() ; 
0100 
0101     G4VSolid* solid = make_solid() ; 
0102 
0103     std::string csgpath = BFile::FormPath(X4::X4GEN_DIR, exename) ; 
0104 
0105     X4CSG::Serialize( solid, csgpath.c_str() ) ;
0106 
0107     return 0 ; 
0108 }