!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
693{
694 G4double signal_velocity_copper_mrpc_strip= 0.8*0.299792458;
695
696
697
698 G4double length_to_border_of_the_readoutstrip=0;
699
700 G4double result_radius= sqrt(x_mm*x_mm+y_mm*y_mm);
701 G4double phi= atan2(y_mm,x_mm)*180./
pi;
702
703
704
705
706
707
708
709
710
711
712
713 if(-180<phi && phi<90){phi=phi+270;}
714 else {phi=phi-90;}
715
716 G4double result_phi=0;
717 if(partId_f!=3 && partId_f!=6) result_phi=0;
718 else result_phi=9.97312;
719
720
721 if(partId_f==3 || partId_f==4) result_phi = -((19-module_mrpc_f-1)*20 - phi + result_phi);
722 else result_phi = (module_mrpc_f-1)*20 - phi + result_phi;
723
724
725 if(partId_f==4 && module_mrpc_f==18 && result_phi>350) result_phi=result_phi-360;
726 if(partId_f==5 && module_mrpc_f==1 & result_phi<-350) result_phi=result_phi+360;
727
728
729
730
731
732
733
734 result_radius= result_radius*
cos(result_phi*
pi/180.0) - 634.56 + 159.5 - 3.82;
735
736
737
738
739
740
741
742
743
744 double result_x=fabs((result_radius/
cos(result_phi*
pi/180.0)+634.56-159.5+3.82)*
sin(result_phi*
pi/180));
745
746
747 if(result_phi>=0 && result_x>0.)
748 {
749 if( (-12.5-2.0) <result_radius && result_radius < (12.5+2.0) && result_x <= (44+2.0) )
750 length_to_border_of_the_readoutstrip=sqrt( (44-result_x)*(44-result_x) + fabs((result_radius-0.)*(result_radius-0.)));
751 if( (-12.5 +(25.0+4.0)*1-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*1+2.0) && result_x <=(46+2.0))
752 length_to_border_of_the_readoutstrip=sqrt( (46-result_x)*(46-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*1)));
753 if( (-12.5 +(25.0+4.0)*2-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*2+2.0) && result_x <=(49+2.0))
754 length_to_border_of_the_readoutstrip=sqrt( (49-result_x)*(49-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*2)));
755 if( (-12.5 +(25.0+4.0)*3-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*3+2.0) && result_x <=(51+2.0))
756 length_to_border_of_the_readoutstrip=sqrt( (51-result_x)*(51-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*3)));
757 if( (-12.5 +(25.0+4.0)*4-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*4+2.0) && result_x <=(54+2.0))
758 length_to_border_of_the_readoutstrip=sqrt( (54-result_x)*(54-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*4)));
759 if( (-12.5 +(25.0+4.0)*5-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*5+2.0) && result_x <=(56+2.0))
760 length_to_border_of_the_readoutstrip=sqrt( (56-result_x)*(56-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*5)));
761 if( (-12.5 +(25.0+4.0)*6-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*6+2.0) && result_x <=(59+2.0))
762 length_to_border_of_the_readoutstrip=sqrt( (59-result_x)*(59-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*6)));
763 if( (-12.5 +(25.0+4.0)*7-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*7+2.0) && result_x <=(61+2.0))
764 length_to_border_of_the_readoutstrip=sqrt( (61-result_x)*(61-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*7)));
765 if( (-12.5 +(25.0+4.0)*8-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*8+2.0) && result_x <=(64+2.0))
766 length_to_border_of_the_readoutstrip=sqrt( (64-result_x)*(64-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*8)));
767 if( (-12.5 +(25.0+4.0)*9-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*9+2.0) && result_x <=(66+2.0))
768 length_to_border_of_the_readoutstrip=sqrt( (66-result_x)*(66-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*9)));
769 if( (-12.5 +(25.0+4.0)*10-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*10+2.0) && result_x <=(69+2.0))
770 length_to_border_of_the_readoutstrip=sqrt( (69-result_x)*(69-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*10)));
771 if( (-12.5 +(25.0+4.0)*11-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*11+2.0) && result_x <=(71+2.0))
772 length_to_border_of_the_readoutstrip=sqrt( (71-result_x)*(71-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*11)));
773 }
774 else if(result_phi<0 && result_x>0.)
775 {
776 if( (-12.5-2.0) <result_radius && result_radius < (12.5+2.0) && result_x <= (44+2.0) )
777 length_to_border_of_the_readoutstrip=sqrt( (44-result_x)*(44-result_x) + fabs((result_radius-0.)*(result_radius-0.)));
778 if( (-12.5 +(25.0+4.0)*1-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*1+2.0) && result_x <=(46+2.0))
779 length_to_border_of_the_readoutstrip=sqrt( (46-result_x)*(46-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*1)));
780 if( (-12.5 +(25.0+4.0)*2-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*2+2.0) && result_x <=(49+2.0))
781 length_to_border_of_the_readoutstrip=sqrt( (49-result_x)*(49-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*2)));
782 if( (-12.5 +(25.0+4.0)*3-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*3+2.0) && result_x <=(51+2.0))
783 length_to_border_of_the_readoutstrip=sqrt( (51-result_x)*(51-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*3)));
784 if( (-12.5 +(25.0+4.0)*4-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*4+2.0) && result_x <=(54+2.0))
785 length_to_border_of_the_readoutstrip=sqrt( (54-result_x)*(54-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*4)));
786 if( (-12.5 +(25.0+4.0)*5-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*5+2.0) && result_x <=(56+2.0))
787 length_to_border_of_the_readoutstrip=sqrt( (56-result_x)*(56-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*5)));
788 if( (-12.5 +(25.0+4.0)*6-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*6+2.0) && result_x <=(59+2.0))
789 length_to_border_of_the_readoutstrip=sqrt( (59-result_x)*(59-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*6)));
790 if( (-12.5 +(25.0+4.0)*7-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*7+2.0) && result_x <=(61+2.0))
791 length_to_border_of_the_readoutstrip=sqrt( (61-result_x)*(61-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*7)));
792 if( (-12.5 +(25.0+4.0)*8-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*8+2.0) && result_x <=(64+2.0))
793 length_to_border_of_the_readoutstrip=sqrt( (64-result_x)*(64-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*8)));
794 if( (-12.5 +(25.0+4.0)*9-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*9+2.0) && result_x <=(66+2.0))
795 length_to_border_of_the_readoutstrip=sqrt( (66-result_x)*(66-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*9)));
796 if( (-12.5 +(25.0+4.0)*10-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*10+2.0) && result_x <=(69+2.0))
797 length_to_border_of_the_readoutstrip=sqrt( (69-result_x)*(69-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*10)));
798 if( (-12.5 +(25.0+4.0)*11-2.0 ) <result_radius && result_radius < (12.5+(25.0+4.0)*11+2.0) && result_x <=(71+2.0))
799 length_to_border_of_the_readoutstrip=sqrt( (71-result_x)*(71-result_x) + fabs((result_radius-(25.0+4.0)*1.)*(result_radius-(25.0+4.0)*11)));
800 }
801
802 double transition_time = length_to_border_of_the_readoutstrip/signal_velocity_copper_mrpc_strip/1000.;
803 return transition_time;
804
805}