427 {
428
429 const static G4double silicon_oil_index = 1.43;
430 const static G4double glass_index = 1.532;
431
432
433 G4double cos_span = 1 -
cos( asin( silicon_oil_index / m_refIndex ) );
434
435 G4double dcos, ran;
436 ran = G4UniformRand();
437
438 dcos = cos_span * ( ran * 2.0 - 1.0 );
439
440 G4double r2 = sqrt( emtPos.x() * emtPos.x() + emtPos.y() * emtPos.y() );
441 G4int nRef = 0;
442 G4double costheta, sintheta;
443 G4double theta, thetaR;
444 costheta = dcos > 0 ? ( 1 - dcos ) : ( 1 + dcos );
445 theta = acos( costheta );
446 sintheta =
sin( theta );
447 thetaR = asin( 1 / m_refIndex );
448 G4double R1;
450 G4double ratio1Mean = ( CLHEP::pi ) * 25.5 * 25.5 / ( 57.1 + 60.7 ) / 25.0;
451 G4double ratio2Mean = ( 19.5 / 25.5 ) * ( 19.5 / 25.5 );
452 G4double ratio1 = G4RandGauss::shoot( ratio1Mean, 0.015 );
453 G4double ratio2 = G4RandGauss::shoot( ratio2Mean, 0.015 );
454 G4double ratio3Mean = 0.945 * ratio1Mean * ratio2Mean;
455 G4double ratio3 = G4RandGauss::shoot( ratio3Mean, 0.015 );
456
457 G4double R2 = 1 -
Reflectivity( m_refIndex, silicon_oil_index, glass_index, theta );
458 if ( dcos > 0 && dcos != 1 )
459 {
460 if ( theta < thetaR )
461 {
462 if ( G4UniformRand() < ratio1 )
463 {
464 if ( G4UniformRand() < R2 )
465 {
466 if ( G4UniformRand() < ratio2 )
467 {
468 forb = 0;
469 pathL = ( m_scinLength / 2 - emtPos.z() ) / costheta;
470 }
471 }
472 else
473 {
474 if ( G4UniformRand() < ratio3 )
475 {
476 forb = 1;
477 pathL = ( 1.5 * m_scinLength - emtPos.z() ) / costheta;
478 }
479 }
480 }
481 else
482 {
483 if ( G4UniformRand() < R1 )
484 {
485 G4double tempran = G4UniformRand();
486 if ( tempran < ratio3 )
487 {
488 forb = 1;
489 pathL = ( 1.5 * m_scinLength - emtPos.z() ) / costheta;
490 }
491 else if ( tempran > ratio1 && G4UniformRand() < R1 && G4UniformRand() < ratio3 )
492 {
493 forb = 0;
494 pathL = ( 2.5 * m_scinLength - emtPos.z() ) / costheta;
495 }
496 }
497 }
498 }
499 else
500 {
501 if ( G4UniformRand() < ratio1 )
502 {
503 if ( G4UniformRand() < R2 )
504 {
505 if ( G4UniformRand() < ratio2 )
506 {
507 forb = 0;
508 pathL = ( m_scinLength / 2 - emtPos.z() ) / costheta;
509 }
510 }
511 else
512 {
513 if ( G4UniformRand() < ratio3 )
514 {
515 forb = 1;
516 pathL = ( 1.5 * m_scinLength - emtPos.z() ) / costheta;
517 }
518 }
519 }
520 else
521 {
522 G4double tempran = G4UniformRand();
523 if ( tempran < ratio3 )
524 {
525 forb = 1;
526 pathL = ( 1.5 * m_scinLength - emtPos.z() ) / costheta;
527 }
528 else if ( tempran > ratio1 && G4UniformRand() < ratio3 )
529 {
530 forb = 0;
531 pathL = ( 2.5 * m_scinLength - emtPos.z() ) / costheta;
532 }
533 }
534 }
535 }
536 else if ( dcos < 0 && dcos != -1 )
537 {
538 if ( theta < thetaR )
539 {
540 if ( G4UniformRand() < ratio1 )
541 {
542 if ( G4UniformRand() < R2 )
543 {
544 if ( G4UniformRand() < ratio2 )
545 {
546 forb = 1;
547 pathL = ( m_scinLength / 2 + emtPos.z() ) / costheta;
548 }
549 }
550 else
551 {
552 if ( G4UniformRand() < ratio3 )
553 {
554 forb = 0;
555 pathL = ( 1.5 * m_scinLength + emtPos.z() ) / costheta;
556 }
557 }
558 }
559 else
560 {
561 if ( G4UniformRand() < R1 )
562 {
563 G4double tempran = G4UniformRand();
564 if ( tempran < ratio3 )
565 {
566 forb = 0;
567 pathL = ( 1.5 * m_scinLength + emtPos.z() ) / costheta;
568 }
569 else if ( tempran > ratio1 && G4UniformRand() < R1 && G4UniformRand() < ratio3 )
570 {
571 forb = 1;
572 pathL = ( 2.5 * m_scinLength + emtPos.z() ) / costheta;
573 }
574 }
575 }
576 }
577 else
578 {
579 if ( G4UniformRand() < ratio1 )
580 {
581 if ( G4UniformRand() < R2 )
582 {
583 if ( G4UniformRand() < ratio2 )
584 {
585 forb = 1;
586 pathL = ( m_scinLength / 2 + emtPos.z() ) / costheta;
587 }
588 }
589 else
590 {
591 if ( G4UniformRand() < ratio3 )
592 {
593 forb = 0;
594 pathL = ( 1.5 * m_scinLength + emtPos.z() ) / costheta;
595 }
596 }
597 }
598 else
599 {
600 G4double tempran = G4UniformRand();
601 if ( tempran < ratio3 )
602 {
603 forb = 0;
604 pathL = ( 1.5 * m_scinLength + emtPos.z() ) / costheta;
605 }
606 else if ( tempran > ratio1 && G4UniformRand() < ratio3 )
607 {
608 forb = 1;
609 pathL = ( 2.5 * m_scinLength + emtPos.z() ) / costheta;
610 }
611 }
612 }
613 }
614
615 G4double convFactor = 180. / 3.1415926;
616 if ( theta > asin( 1 ) - thetaR )
617 {
618 G4double
alpha = G4UniformRand() * asin( 1. );
619 G4int nRef1 = pathL * sintheta *
cos(
alpha ) / 50.0 + 0.5;
620 G4int nRef2 = pathL * sintheta *
sin(
alpha ) / 58.9 + 0.5;
621 G4double beta1 = acos( sintheta *
cos(
alpha ) );
622 G4double beta2 = acos( sintheta *
sin(
alpha ) );
623 beta2 -= 3.75 / convFactor;
624 G4double R21, R22;
627 for ( G4int i = 0; i < nRef1; i++ )
628 {
629 if ( G4UniformRand() < ( 1 - R21 ) && G4UniformRand() < 0.15 ) pathL = -9;
630 }
631 for ( G4int i = 0; i < nRef2; i++ )
632 {
633 if ( G4UniformRand() < ( 1 - R22 ) && G4UniformRand() < 0.15 ) pathL = -9;
634 }
635 }
636}
double sin(const BesAngle a)
double cos(const BesAngle a)
G4double Reflectivity(G4double n1, G4double n2, G4double theta)