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