Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/bin/bash -l
0002 usage(){ cat << EOU
0003 cxr_geochain.sh : 3D renders using CSGOptiXRenderTest
0004 ==========================================================
0005 
0006 Rendering CSGFoundry geometry created from
0007 Geant4 C++ solid specification by GeoChain 
0008 executable. 
0009 
0010 Usage:
0011 
0012 1. create a CSGFoundry geometry folder by conversion from a Geant4 geometry using GeoChain::
0013 
0014     cd ~/opticks/GeoChain   # gc 
0015     ./translate.sh                # create geometry CF folder
0016 
0017 2. alternatively some geometry is only implemnented at CSG level, create CSGFoundry with::
0018 
0019     cd ~/opticks/CSG   # c 
0020     ./CSGMakerTest.sh 
0021 
0022 3. run the render, this works with OptiX 7 (needs manual b7 build) and also by virtue of CSGOptiX/Six.cc with OptiX 5 or 6:: 
0023  
0024     cd ~/opticks/CSGOptiX    # cx
0025 
0026     ./cxr_geochain.sh                 # render jpg 
0027     EYE=0,0,1,1 ./cxr_geochain.sh     # change viewpoint 
0028 
0029 The EYE, LOOK, UP envvars set the okc/View::home defaults 
0030 
0031 DONE: avoid outdir having -1 elem in the path, as thats tedious to handle from shell 
0032 DONE: add PUB=1 sensitivity to copy renders into standardized publication dirs based on the outdir 
0033       with the front of the path replaced 
0034 
0035 Taking a look inside, hunting speckle::
0036 
0037     EYE=0,-0.7,0. UP=0,0,1 TMIN=0. CAM=0  ./cxr_geochain.sh 
0038 
0039 
0040 Debugging unexpected renders
0041 ------------------------------
0042 
0043 1. force recompile the kernels by touching .cu 
0044 
0045    * have observed that changes to CSG headers do not automatically 
0046      trigger rebuilds of the .cu kernels : so touch the .cu to 
0047      make sure get the latest CSG headers
0048 
0049 
0050 Debugging blank renders
0051 ------------------------
0052 
0053 Arrange a viewpoint from the inside of a shape such that every pixel should intersect. 
0054 Thence can trace whats happening with any pixel. 
0055 
0056 ::
0057 
0058      EYE=0.1,0.1,0.1 ./cxr_geochain.sh 
0059           shoot from inside so every pixel should intersect 
0060           add debug to trace whats happening 
0061 
0062 
0063 EYE=1,1,1 GEOM=DifferenceBoxSphere TMIN=0.5 ./cxr_geochain.sh 
0064 
0065 
0066 EOU
0067 }
0068 
0069 msg="=== $BASH_SOURCE :"
0070 
0071 #geom=default
0072 #geom=AdditionAcrylicConstruction
0073 
0074 #geom=pmt_solid
0075 #geom=1_3
0076 
0077 #geom=UnionOfHemiEllipsoids        # looks fine, like full ellipsoid
0078 #geom=UnionOfHemiEllipsoids-50    # lower hemi-ellipsoid is smaller than upper : looks like the translation transform stomps on the scale transform
0079 
0080 #geom=body_solid
0081 #geom=inner_solid
0082 #geom=inner1_solid
0083 #geom=inner2_solid
0084 
0085 #geom=body_phys
0086 #geom=inner1_phys
0087 #geom=inner2_phys
0088 
0089 #geom=SphereWithPhiSegment
0090 #geom=Orb
0091 #geom=PolyconeWithMultipleRmin
0092 
0093 #geom=hmsk_solidMask
0094 #geom=hmsk_solidMaskTail
0095 
0096 #geom=nmsk_solidMask
0097 #geom=nmsk_solidMaskTail
0098 
0099 #geom=XJfixtureConstruction
0100 #geom=AltXJfixtureConstruction
0101 #geom=XJanchorConstruction
0102 #geom=AnnulusBoxUnion
0103 #geom=AnnulusTwoBoxUnion
0104 #geom=AnnulusFourBoxUnion
0105 #geom=AnnulusOtherTwoBoxUnion
0106 
0107 #geom=BoxFourBoxUnion
0108 #geom=BoxFourBoxContiguous
0109 
0110 #geom=SphereWithPhiCutDEV
0111 #geom=GeneralSphereDEV
0112 #geom=OverlapBoxSphere
0113 #geom=ContiguousBoxSphere
0114 #geom=DiscontiguousBoxSphere
0115 
0116 #geom=ContiguousThreeSphere
0117 #geom=OverlapThreeSphere
0118 #geom=parade
0119 # export GEOM=${GEOM:-$geom}
0120 
0121 source $PWD/../bin/GEOM.sh trim   ## sets GEOM envvar 
0122 
0123 # cfname picks the CSGFoundry geometry to load
0124 if [ "$(uname)" == "Linux" ]; then
0125     cfname=GeoChain/$GEOM            
0126 else
0127     cfname=GeoChain_Darwin/$GEOM            
0128 fi
0129 
0130 
0131 moi=ALL
0132 zoom=1
0133 
0134 if [ "$GEOM" == "default" ]; then  
0135    eye=-1,0,1,1 
0136    tmin=0.5
0137    icam=0         
0138 elif [ "$GEOM" == "XJfixtureConstruction" ]; then  
0139    eye=1,1,1
0140    tmin=0.1 
0141    icam=1
0142    zoom=2
0143 else
0144    eye=-2,0,0,1        
0145    tmin=1
0146    icam=1     # 0:perspective  1:ortho        
0147 fi 
0148 
0149 emm=t0    # default to no solid skips with GeoChain, which is typically single solid geometry 
0150 
0151 stamp=$(date +"%Y-%m-%d %H:%M")
0152 version=$(CSGOptiXVersion 2>/dev/null)
0153 export MOI=${1:-$moi}
0154 export CFNAME=${CFNAME:-$cfname}
0155 export EMM=${EMM:-$emm}
0156 export TMIN=${TMIN:-$tmin}
0157 export EYE=${EYE:-$eye}
0158 export ICAM=${ICAM:-$icam}    # 0:perspective 1:ortho  
0159 export ZOOM=${ZOOM:-$zoom}
0160 
0161 
0162 export Camera=INFO
0163 
0164 export NAMEPREFIX=cxr_geochain_${GEOM}_   # MOI is appended by tests/CSGOptiXRender.cc when --solid_label yields no solids
0165 export RELDIR=cxr_geochain/cam_${ICAM}
0166 export TOPLINE="./cxr_geochain.sh $MOI      # EYE $EYE  $stamp  $version $GEOM   " 
0167 
0168 vars="GEOM MOI CFNAME EMM TMIN EYE ICAM NAMEPREFIX RELDIR TOPLINE"
0169 echo $msg 
0170 for var in $vars ; do printf "%-20s : %s \n" $var "${!var}" ; done  
0171 
0172 echo $msg invoke ./cxr.sh 
0173 ./cxr.sh 
0174 
0175 exit 0
0176