462{
463
464 const static G4double silicon_oil_index = 1.43;
465 const static G4double glass_index = 1.532;
466
467
468 G4double cos_span=1-
cos( asin(silicon_oil_index/m_refIndex) );
469
470 G4double dcos, ran;
471 ran=G4UniformRand();
472
473 dcos=cos_span*(ran*2.0-1.0);
474
475 G4double r2=sqrt(emtPos.x()*emtPos.x()+emtPos.y()*emtPos.y());
476 G4int nRef=0;
477 G4double costheta,sintheta;
478 G4double theta,thetaR;
479 costheta=dcos>0?(1-dcos):(1+dcos);
480 theta=acos(costheta);
482 thetaR=asin(1/m_refIndex);
483 G4double R1;
485 G4double ratio1Mean=(CLHEP::pi)*25.5*25.5/(57.1+60.7)/25.0;
486 G4double ratio2Mean=(19.5/25.5)*(19.5/25.5);
487 G4double ratio1=G4RandGauss::shoot(ratio1Mean,0.015);
488 G4double ratio2=G4RandGauss::shoot(ratio2Mean,0.015);
489 G4double ratio3Mean=0.945*ratio1Mean*ratio2Mean;
490 G4double ratio3=G4RandGauss::shoot(ratio3Mean,0.015);
491
492 G4double R2=1-
Reflectivity(m_refIndex,silicon_oil_index, glass_index, theta);
493 if (dcos > 0 && dcos != 1)
494 {
495 if (theta < thetaR)
496 {
497 if (G4UniformRand()<ratio1)
498 {
499 if (G4UniformRand()<R2)
500 {
501 if (G4UniformRand()<ratio2)
502 {
503 forb=0;
504 pathL=(m_scinLength/2-emtPos.z())/costheta;
505 }
506 }
507 else
508 {
509 if (G4UniformRand()<ratio3)
510 {
511 forb=1;
512 pathL=(1.5*m_scinLength-emtPos.z())/costheta;
513 }
514 }
515 }
516 else
517 {
518 if (G4UniformRand()<R1)
519 {
520 G4double tempran=G4UniformRand();
521 if (tempran<ratio3)
522 {
523 forb=1;
524 pathL=(1.5*m_scinLength-emtPos.z())/costheta;
525 }
526 else if (tempran>ratio1&&G4UniformRand()<R1&&G4UniformRand()<ratio3)
527 {
528 forb=0;
529 pathL=(2.5*m_scinLength-emtPos.z())/costheta;
530 }
531 }
532 }
533 }
534 else
535 {
536 if (G4UniformRand()<ratio1)
537 {
538 if (G4UniformRand()<R2)
539 {
540 if (G4UniformRand()<ratio2)
541 {
542 forb=0;
543 pathL=(m_scinLength/2-emtPos.z())/costheta;
544 }
545 }
546 else
547 {
548 if (G4UniformRand()<ratio3)
549 {
550 forb=1;
551 pathL=(1.5*m_scinLength-emtPos.z())/costheta;
552 }
553 }
554 }
555 else
556 {
557 G4double tempran=G4UniformRand();
558 if (tempran<ratio3)
559 {
560 forb=1;
561 pathL=(1.5*m_scinLength-emtPos.z())/costheta;
562 }
563 else if (tempran>ratio1 && G4UniformRand()<ratio3)
564 {
565 forb=0;
566 pathL=(2.5*m_scinLength-emtPos.z())/costheta;
567 }
568 }
569 }
570 }
571 else if (dcos < 0 && dcos != -1)
572 {
573 if (theta < thetaR)
574 {
575 if (G4UniformRand()<ratio1)
576 {
577 if (G4UniformRand()<R2)
578 {
579 if (G4UniformRand()<ratio2)
580 {
581 forb=1;
582 pathL=(m_scinLength/2+emtPos.z())/costheta;
583 }
584 }
585 else
586 {
587 if (G4UniformRand()<ratio3)
588 {
589 forb=0;
590 pathL=(1.5*m_scinLength+emtPos.z())/costheta;
591 }
592 }
593 }
594 else
595 {
596 if (G4UniformRand()<R1)
597 {
598 G4double tempran=G4UniformRand();
599 if (tempran<ratio3)
600 {
601 forb=0;
602 pathL=(1.5*m_scinLength+emtPos.z())/costheta;
603 }
604 else if (tempran>ratio1&&G4UniformRand()<R1&&G4UniformRand()<ratio3)
605 {
606 forb=1;
607 pathL=(2.5*m_scinLength+emtPos.z())/costheta;
608 }
609 }
610 }
611 }
612 else
613 {
614 if (G4UniformRand()<ratio1)
615 {
616 if (G4UniformRand()<R2)
617 {
618 if (G4UniformRand()<ratio2)
619 {
620 forb=1;
621 pathL=(m_scinLength/2+emtPos.z())/costheta;
622 }
623 }
624 else
625 {
626 if (G4UniformRand()<ratio3)
627 {
628 forb=0;
629 pathL=(1.5*m_scinLength+emtPos.z())/costheta;
630 }
631 }
632 }
633 else
634 {
635 G4double tempran=G4UniformRand();
636 if (tempran<ratio3)
637 {
638 forb=0;
639 pathL=(1.5*m_scinLength+emtPos.z())/costheta;
640 }
641 else if (tempran>ratio1 && G4UniformRand()<ratio3)
642 {
643 forb=1;
644 pathL=(2.5*m_scinLength+emtPos.z())/costheta;
645 }
646 }
647 }
648 }
649
650 G4double convFactor=180./3.1415926;
651 if (theta>asin(1)-thetaR)
652 {
653 G4double
alpha = G4UniformRand()*asin(1.);
654 G4int nRef1 = pathL*sintheta*
cos(
alpha)/50.0+0.5;
655 G4int nRef2 = pathL*sintheta*
sin(
alpha)/58.9+0.5;
656 G4double beta1=acos(sintheta*
cos(
alpha));
657 G4double beta2=acos(sintheta*
sin(
alpha));
658 beta2 -= 3.75/convFactor;
659 G4double R21,R22;
662 for (G4int i=0;i<nRef1;i++)
663 {
664 if (G4UniformRand()<(1-R21) && G4UniformRand()<0.15)
665 pathL=-9;
666 }
667 for (G4int i=0;i<nRef2;i++)
668 {
669 if (G4UniformRand()<(1-R22) && G4UniformRand()<0.15)
670 pathL=-9;
671 }
672 }
673}
double sin(const BesAngle a)
double cos(const BesAngle a)
G4double Reflectivity(G4double n1, G4double n2, G4double theta)