| 75 |
|
# Kbin to produce incident direction in full Klems basis with (x1,x2) randoms |
| 76 |
|
my $tcal = ' |
| 77 |
|
DEGREE : PI/180; |
| 78 |
+ |
sq(x) : x*x; |
| 79 |
|
Kpola(r) : select(r+1, -5, 5, 15, 25, 35, 45, 55, 65, 75, 90); |
| 80 |
|
Knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12); |
| 81 |
|
Kaccum(r) : if(r-.5, Knaz(r) + Kaccum(r-1), 0); |
| 89 |
|
Dx = -cos(Kazi)*sin_kpol; |
| 90 |
|
Dy = sin(Kazi)*sin_kpol; |
| 91 |
|
Dz = sqrt(1 - sin_kpol*sin_kpol); |
| 92 |
< |
Komega = 2*PI*if(Kbin-.5, |
| 93 |
< |
(cos(Kpola(Krow-1)*DEGREE) - cos(Kpola(Krow)*DEGREE))/Knaz(Krow), |
| 94 |
< |
1 - cos(Kpola(1)*DEGREE)); |
| 92 |
> |
KprojOmega = PI * if(Kbin-.5, |
| 93 |
> |
(sq(cos(Kpola(Krow-1)*DEGREE)) - sq(cos(Kpola(Krow)*DEGREE)))/Knaz(Krow), |
| 94 |
> |
1 - sq(cos(Kpola(1)*DEGREE))); |
| 95 |
|
'; |
| 96 |
|
# Compute Klems bin from exiting ray direction |
| 97 |
|
my $kcal = ' |
| 131 |
|
q{-e '$1=xp;$2=yp;$3=zp;$4=Dx;$5=Dy;$6=Dz' } . |
| 132 |
|
"| rtcontrib -h -ff -n $nproc -c $nsamp -e '$kcal' -b kbin -bn $ndiv " . |
| 133 |
|
"-m $modnm -w -ab 5 -ad 700 -lw 3e-6 $octree " . |
| 134 |
< |
"| rcalc -e 'x1:.5;x2:.5;$tcal' " . |
| 135 |
< |
"-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-1,$ndiv)' " . |
| 136 |
< |
q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/(Komega*Dz)'}; |
| 134 |
> |
"| rcalc -e '$tcal' " . |
| 135 |
> |
"-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-.999,$ndiv)' " . |
| 136 |
> |
q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega'}; |
| 137 |
|
my @darr = `$cmd`; |
| 138 |
|
die "Failure running: $cmd\n" if ( $? ); |
| 139 |
|
# Output XML prologue |