1495 {
1496
1498 int genlay = geosvc->
Layer(layer)->
Gen();
1505
1506 HepPoint3D East_origin(East_lay_X, East_lay_Y, East_lay_Z);
1507 HepPoint3D West_origin(West_lay_X, West_lay_Y, West_lay_Z);
1508 Hep3Vector wire = (CLHEP::Hep3Vector)East_origin - (CLHEP::Hep3Vector)West_origin;
1509 HepPoint3D piovt_z =(z*10+length/2 )/length * wire + West_origin;
1510 piovt_z = piovt_z*0.1;
1511
1512
1513
1515
1516
1517 double dr0 = hel.
a()[0];
1518 double phi0 = hel.
a()[1];
1519 double kappa = hel.
a()[2];
1520 double dz0 = hel.
a()[3];
1521 double tanl = hel.
a()[4];
1522
1523
1525 double ALPHA_loc = 1000/(2.99792458*Bz);
1526
1527
1528
1529
1530
1531 int charge = ( kappa >= 0 )? 1 : -1;
1532 double rho = ALPHA_loc/kappa;
1533 double pt = fabs( 1.0/kappa );
1534 double lambda = atan( tanl );
1535 double theta = M_PI_2- lambda;
1536 double sintheta =
sin(M_PI_2-atan(tanl));
1537
1538 double phi = fmod(phi0 +
M_PI*4,
M_PI*2);
1539 double csf0 =
cos(phi);
1540 double snf0 = (1. - csf0) * (1. + csf0);
1541 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
1542 if(phi >
M_PI) snf0 = - snf0;
1543
1544
1545
1546
1547 double x_c = piv.x() + ( hel.
dr() + rho )*csf0;
1548 double y_c = piv.y() + ( hel.
dr() + rho )*snf0;
1549 double z_c = piv.z() + hel.
dz();
1551 double m_c_perp(ccenter.perp());
1552 Hep3Vector m_c_unit((
HepPoint3D)ccenter.unit());
1553
1554
1555
1556 double x_c_boost = x_c - piovt_z.x();
1557 double y_c_boost = y_c - piovt_z.y();
1558 double z_c_boost = z_c - piovt_z.z();
1559 HepPoint3D ccenter_boost(x_c_boost, y_c_boost, 0.0);
1560 double m_c_perp_boost(ccenter_boost.perp());
1561
1562
1563 Hep3Vector m_c_unit_boost((
HepPoint3D)ccenter_boost.unit());
1564
1565
1566 double phi_io[2];
1568 double dphi0 = fmod( IO.phi()+4*
M_PI,2*
M_PI ) - phi;
1569 double IO_phi = fmod( IO.phi()+4*
M_PI,2*
M_PI );
1570
1571
1572
1573 if( dphi0 >
M_PI ) dphi0 -= 2*
M_PI;
1574 else if( dphi0 < -
M_PI ) dphi0 += 2*
M_PI;
1575
1576
1578
1579 phi_io[1] = phi_io[0]+1.5*
M_PI;
1580
1581 double m_crio[2];
1582 double m_zb, m_zf, Calpha;
1583
1584
1592
1594
1595
1596
1597
1599 int wid = w0id + cellid;
1602 double x_lay_backward = geosvc->
Wire(layer, cellid)->
Backward().x();
1603 double y_lay_backward = geosvc->
Wire(layer, cellid)->
Backward().y();
1604 double x_lay_forward = geosvc->
Wire(layer, cellid)->
Forward().x();
1605 double y_lay_forward = geosvc->
Wire(layer, cellid)->
Forward().y();
1606 double r_lay_backward = sqrt(x_lay_backward*x_lay_backward+y_lay_backward*y_lay_backward);
1607 double r_lay_forward = sqrt(x_lay_forward*x_lay_forward+y_lay_forward*y_lay_forward);
1608 double r_lay_use = ((z*10+length/2)/length)*(r_lay_backward-r_lay_forward) + r_lay_forward;
1609
1610
1611
1612
1613
1614
1615
1616 r_lay_use = 0.1*r_lay_use;
1617 rcsiz1 = 0.1*rcsiz1;
1618 rcsiz2 = 0.1*rcsiz2;
1619 rlay = 0.1*rlay;
1620 length = 0.1*length;
1621 m_zb = 0.5*length;
1622 m_zf = -0.5*length;
1623 m_crio[0] = rlay - rcsiz1;
1624 m_crio[1] = rlay + rcsiz2;
1625
1626 int sign = -1;
1627 int epflag[2];
1628 Hep3Vector iocand[2];
1629 Hep3Vector cell_IO[2];
1630 double dphi, downin;
1631 Hep3Vector zvector;
1632
1633 if( type ) {
1634 downin = (z*z-m_zb*m_zb)*pow(
tan(slant),2);
1635 m_crio[0] = sqrt(m_crio[0]*m_crio[0]+downin);
1636 m_crio[1] = sqrt(m_crio[1]*m_crio[1]+downin);
1637 }
1638
1639
1640
1641 for( int i = 0; i < 2; i++ ) {
1642 double cos_alpha = m_c_perp_boost*m_c_perp_boost + m_crio[i]*m_crio[i] - rho*rho;
1643 cos_alpha = 0.5*cos_alpha/( m_c_perp_boost*m_crio[i] );
1644 if(fabs(cos_alpha)>1&&i==0) return(-1.0);
1645 if(fabs(cos_alpha)>1&&i==1) {
1646 cos_alpha = m_c_perp_boost*m_c_perp_boost + m_crio[0]*m_crio[0] - rho*rho;
1647 cos_alpha = 0.5*cos_alpha/( m_c_perp_boost*m_crio[0] );
1648 Calpha = 2.0*
M_PI-acos( cos_alpha );
1649 } else {
1650 Calpha = acos( cos_alpha );
1651 }
1652 epflag[i] = 0;
1653 iocand[i] = m_c_unit_boost;
1654 iocand[i].rotateZ(
charge*sign*Calpha );
1655 iocand[i]*= m_crio[i];
1656
1657
1658
1659
1660
1661
1662 iocand[i] = iocand[i]+ piovt_z;
1663
1664
1665
1666
1667 double xx = iocand[i].x() - x_c;
1668 double yy = iocand[i].y() - y_c;
1669
1670 dphi = atan2(yy, xx) - phi0 - M_PI_2*(1-
charge);
1671 dphi = fmod( dphi + 8.0*
M_PI, 2*
M_PI );
1672
1673 if( dphi < phi_io[0] ) {
1675 }
1676 else if( phi_io[1] < dphi ) {
1678 }
1679
1680
1681
1682 Hep3Vector zvector( 0., 0., z_c-rho*dphi*tanl-piovt_z.z());
1683
1684 cell_IO[i] = iocand[i];
1685 cell_IO[i] += zvector;
1686
1687
1688
1689
1690 double xcio, ycio, phip;
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722 cell_IO[i] = hel.
x(dphi);
1723
1724
1725 }
1726
1727
1728
1729 Hep3Vector cl = cell_IO[1] - cell_IO[0];
1730
1731
1732 double ch_theta;
1733 double ch_dphi;
1734 double ch_ltrk = 0;
1735 double ch_ltrk_rp = 0;
1736 ch_dphi = cl.perp()*0.5/(ALPHA_loc*pt);
1737 ch_dphi = 2.0 * asin( ch_dphi );
1738 ch_ltrk_rp = ch_dphi*ALPHA_loc*pt;
1739 double rpi_path = sqrt(cl.x()*cl.x()+cl.y()*cl.y());
1740 ch_ltrk = sqrt( ch_ltrk_rp*ch_ltrk_rp + cl.z()*cl.z() );
1741 double path = ch_ltrk_rp/ sintheta;
1742 ch_theta = cl.theta();
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758 double phibin, phi_in, phi_out, inlow, inup, outlow, outup, gap,
phi1,
phi2, phi_mid, phi_midin, phi_midout;
1759 int cid_in, cid_out;
1760 double inlow_z, inup_z, outlow_z, outup_z, gap_z, phi1_z, phi2_z, phi_mid_z, phi_midin_z, phi_midout_z;
1761
1762
1763 std::vector<double> sampl;
1764 sampl.resize(ncell);
1765 for(int k=0; k<ncell; k++) {
1766 sampl[k] = -1.0;
1767 }
1768
1769 cid_in = cid_out = -1;
1770 phi_in = cell_IO[0].phi();
1771 phi_out = cell_IO[1].phi();
1772
1773
1774 phi_in = fmod( phi_in+4*
M_PI,2*
M_PI );
1775 phi_out = fmod( phi_out+4*
M_PI,2*
M_PI );
1776 phibin = 2.0*
M_PI/ncell;
1777
1778
1779
1780 Hep3Vector cell_mid=0.5*(cell_IO[0]+cell_IO[1]);
1781
1782
1783
1784
1785 double stphi[2], phioff[2];
1786 stphi[0] = shift*phibin*(0.5-cell_IO[0].z()/length);
1787 stphi[1] = shift*phibin*(0.5-cell_IO[1].z()/length);
1788
1789
1790 phioff[0] = phioffset+stphi[0];
1791 phioff[1] = phioffset+stphi[1];
1792
1793 for(int i=0; i<ncell; i++) {
1794
1795 double x_lay_backward_cell = geosvc->
Wire(layer, i)->
Backward().x()*0.1;
1796 double y_lay_backward_cell = geosvc->
Wire(layer, i)->
Backward().y()*0.1;
1797 double x_lay_forward_cell = geosvc->
Wire(layer, i)->
Forward().x()*0.1;
1798 double y_lay_forward_cell = geosvc->
Wire(layer, i)->
Forward().y()*0.1;
1799
1800
1801 Hep3Vector lay_backward(x_lay_backward_cell, y_lay_backward_cell, 0);
1802 Hep3Vector lay_forward(x_lay_forward_cell, y_lay_forward_cell, 0);
1803 Hep3Vector Cell_z[2];
1804 Cell_z[0] = ((cell_IO[0].z()+length/2)/length)*(lay_backward - lay_forward) + lay_forward;
1805 Cell_z[1] = ((cell_IO[1].z()+length/2)/length)*(lay_backward - lay_forward) + lay_forward;
1806 double z_phi[2];
1807 z_phi[0] = Cell_z[0].phi();
1808 z_phi[1] = Cell_z[1].phi();
1809 z_phi[0] = fmod( z_phi[0]+4*
M_PI,2*
M_PI );
1810 z_phi[1] = fmod( z_phi[1]+4*
M_PI,2*
M_PI );
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822 inlow_z = z_phi[0] - phibin*0.5;
1823 inup_z = z_phi[0] + phibin*0.5;
1824 outlow_z = z_phi[1] - phibin*0.5;
1825 outup_z = z_phi[1] + phibin*0.5;
1826 inlow_z = fmod( inlow_z+4*
M_PI,2*
M_PI );
1827 inup_z = fmod( inup_z+4*
M_PI,2*
M_PI );
1828 outlow_z = fmod( outlow_z+4*
M_PI,2*
M_PI );
1829 outup_z = fmod( outup_z+4*
M_PI,2*
M_PI );
1830
1831
1832
1833 inlow = phioff[0]+phibin*i-phibin*0.5;
1834 inup = phioff[0]+phibin*i+phibin*0.5;
1835 outlow = phioff[1]+phibin*i-phibin*0.5;
1836 outup = phioff[1]+phibin*i+phibin*0.5;
1837 inlow = fmod( inlow+4*
M_PI,2*
M_PI );
1839 outlow = fmod( outlow+4*
M_PI,2*
M_PI );
1840 outup = fmod( outup+4*
M_PI,2*
M_PI );
1841
1842#ifdef YDEBUG
1843 if(ntpFlag > 0) cout << "shift " << shift
1844 <<" phi_in " << phi_in << " phi_out " << phi_out
1845 << " inup "<< inup << " inlow " << inlow
1846 << " outup "<< outup << " outlow " << outlow << endl;
1847#endif
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858 if(phi_in>=inlow_z&&phi_in<inup_z) cid_in = i;
1859 if(phi_out>=outlow_z&&phi_out<outup_z) cid_out = i;
1860 if ( inlow_z>inup_z) {
1861 if((phi_in>=inlow_z&&phi_in<2.0*
M_PI)||(phi_in>=0.0&&phi_in<inup_z)) cid_in = i;
1862 }
1863 if ( outlow_z>outup_z) {
1864 if((phi_out>=outlow_z&&phi_out<2.0*
M_PI)||(phi_out>=0.0&&phi_out<outup_z)) cid_out = i;
1865 }
1866 }
1867
1868 phi_midin = phi_midout =
phi1 =
phi2 = -999.0;
1869 gap = -999.0;
1870
1871
1872 if(cid_in == -1 || cid_out == -1) return -1;
1873
1874 if( cid_in == cid_out) {
1875 sampl[cid_in]= ch_ltrk;
1876
1877 return sampl[cellid];
1878 } else if(cid_in < cid_out) {
1879
1880
1881 if( cid_out-cid_in>ncell/2 ) {
1882
1883
1884 double x_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().x()*0.1;
1885 double y_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().y()*0.1;
1886 double x_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().x()*0.1;
1887 double y_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().y()*0.1;
1888 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0);
1889 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0);
1890 Hep3Vector Cell_z[2];
1891 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin;
1892 double phi_cin_z = Cell_z[0].phi();
1893 phi_cin_z = fmod( phi_cin_z+4*
M_PI,2*
M_PI );
1894 double x_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().x()*0.1;
1895 double y_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().y()*0.1;
1896 double x_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().x()*0.1;
1897 double y_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().y()*0.1;
1898 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0);
1899 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0);
1900 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout;
1901 double phi_cout_z = Cell_z[1].phi();
1902 phi_cout_z = fmod( phi_cout_z+4*
M_PI,2*
M_PI );
1903
1904 phi_midin_z = phi_cin_z-phibin*0.5;
1905 phi_midout_z = phi_cout_z+phibin*0.5;
1906 phi_midin_z = fmod( phi_midin_z+4*
M_PI,2*
M_PI );
1907 phi_midout_z = fmod( phi_midout_z+4*
M_PI,2*
M_PI );
1908 phi1_z = phi_midout_z-phi_out;
1909 phi2_z = phi_in-phi_midin_z;
1910 phi1_z = fmod(phi1_z+2.0*
M_PI,2.0*
M_PI);
1911 phi2_z = fmod(phi2_z+2.0*
M_PI,2.0*
M_PI);
1912 gap_z = phi1_z+phi2_z+(ncell-1-cid_out+cid_in)*phibin;
1913 gap_z = fmod(gap_z+2.0*
M_PI,2.0*
M_PI);
1914 sampl[cid_in]=phi2_z/gap_z*ch_ltrk;
1915 sampl[cid_out]=phi1_z/gap_z*ch_ltrk;
1916 for( int jj = cid_out+1; jj<ncell; jj++) {
1917 sampl[jj]=phibin/gap_z*ch_ltrk;
1918 }
1919 for( int jj = 0; jj<cid_in; jj++) {
1920 sampl[jj]=phibin/gap_z*ch_ltrk;
1921 }
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952 } else {
1953
1954 double x_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().x()*0.1;
1955 double y_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().y()*0.1;
1956 double x_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().x()*0.1;
1957 double y_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().y()*0.1;
1958 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0);
1959 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0);
1960 Hep3Vector Cell_z[2];
1961 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin;
1962 double phi_cin_z = Cell_z[0].phi();
1963 phi_cin_z = fmod( phi_cin_z+4*
M_PI,2*
M_PI );
1964 double x_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().x()*0.1;
1965 double y_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().y()*0.1;
1966 double x_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().x()*0.1;
1967 double y_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().y()*0.1;
1968 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0);
1969 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0);
1970 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout;
1971 double phi_cout_z = Cell_z[1].phi();
1972 phi_cout_z = fmod( phi_cout_z+4*
M_PI,2*
M_PI );
1973
1974 phi_midin_z = phi_cin_z+phibin*0.5;
1975 phi_midout_z = phi_cout_z-phibin*0.5;
1976 phi_midin_z = fmod( phi_midin_z+4*
M_PI,2*
M_PI );
1977 phi_midout_z = fmod( phi_midout_z+4*
M_PI,2*
M_PI );
1978 phi1_z = phi_midin_z-phi_in;
1979 phi2_z = phi_out-phi_midout_z;
1980 phi1_z = fmod(phi1_z+2.0*
M_PI,2.0*
M_PI);
1981 phi2_z = fmod(phi2_z+2.0*
M_PI,2.0*
M_PI);
1982 gap_z = phi1_z+phi2_z+(cid_out-cid_in-1)*phibin;
1983 gap_z = fmod(gap_z+2.0*
M_PI,2.0*
M_PI);
1984 sampl[cid_in]=phi1_z/gap_z*ch_ltrk;
1985 sampl[cid_out]=phi2_z/gap_z*ch_ltrk;
1986 for( int jj = cid_in+1; jj<cid_out; jj++) {
1987 sampl[jj]=phibin/gap_z*ch_ltrk;
1988 }
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005 }
2006
2007 } else if(cid_in > cid_out) {
2008
2009
2010 if( cid_in-cid_out>ncell/2 ) {
2011 double x_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().x()*0.1;
2012 double y_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().y()*0.1;
2013 double x_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().x()*0.1;
2014 double y_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().y()*0.1;
2015 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0);
2016 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0);
2017 Hep3Vector Cell_z[2];
2018 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin;
2019 double phi_cin_z = Cell_z[0].phi();
2020 phi_cin_z = fmod( phi_cin_z+4*
M_PI,2*
M_PI );
2021 double x_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().x()*0.1;
2022 double y_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().y()*0.1;
2023 double x_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().x()*0.1;
2024 double y_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().y()*0.1;
2025 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0);
2026 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0);
2027 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout;
2028 double phi_cout_z = Cell_z[1].phi();
2029 phi_cout_z = fmod( phi_cout_z+4*
M_PI,2*
M_PI );
2030
2031 phi_midin_z = phi_cin_z+phibin*0.5;
2032 phi_midout_z = phi_cout_z-phibin*0.5;
2033 phi_midin_z = fmod( phi_midin_z+4*
M_PI,2*
M_PI );
2034 phi_midout_z = fmod( phi_midout_z+4*
M_PI,2*
M_PI );
2035 phi1_z = phi_midin_z-phi_in;
2036 phi2_z = phi_out-phi_midout_z;
2037 phi1_z = fmod(phi1_z+2.0*
M_PI,2.0*
M_PI);
2038 phi2_z = fmod(phi2_z+2.0*
M_PI,2.0*
M_PI);
2039 gap_z = phi1_z+phi2_z+(ncell-1-cid_in+cid_out)*phibin;
2040 gap_z = fmod(gap_z+2.0*
M_PI,2.0*
M_PI);
2041 sampl[cid_out]=phi2_z/gap_z*ch_ltrk;
2042 sampl[cid_in]=phi1_z/gap_z*ch_ltrk;
2043 for( int jj = cid_in+1; jj<ncell; jj++) {
2044 sampl[jj]=phibin/gap_z*ch_ltrk;
2045 }
2046 for( int jj = 0; jj<cid_out; jj++) {
2047 sampl[jj]=phibin/gap_z*ch_ltrk;
2048 }
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078 } else {
2079 double x_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().x()*0.1;
2080 double y_lay_backward_cin = geosvc->
Wire(layer, cid_in)->
Backward().y()*0.1;
2081 double x_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().x()*0.1;
2082 double y_lay_forward_cin = geosvc->
Wire(layer, cid_in)->
Forward().y()*0.1;
2083 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0);
2084 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0);
2085 Hep3Vector Cell_z[2];
2086 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin;
2087 double phi_cin_z = Cell_z[0].phi();
2088 phi_cin_z = fmod( phi_cin_z+4*
M_PI,2*
M_PI );
2089 double x_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().x()*0.1;
2090 double y_lay_backward_cout = geosvc->
Wire(layer, cid_out)->
Backward().y()*0.1;
2091 double x_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().x()*0.1;
2092 double y_lay_forward_cout = geosvc->
Wire(layer, cid_out)->
Forward().y()*0.1;
2093 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0);
2094 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0);
2095 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout;
2096 double phi_cout_z = Cell_z[1].phi();
2097 phi_cout_z = fmod( phi_cout_z+4*
M_PI,2*
M_PI );
2098
2099 phi_midin_z = phi_cin_z-phibin*0.5;
2100 phi_midout_z = phi_cout_z+phibin*0.5;
2101 phi_midin_z = fmod( phi_midin_z+4*
M_PI,2*
M_PI );
2102 phi_midout_z = fmod( phi_midout_z+4*
M_PI,2*
M_PI );
2103 phi1_z = phi_midout_z-phi_out;
2104 phi2_z = phi_in-phi_midin_z;
2105 phi1_z = fmod(phi1_z+2.0*
M_PI,2.0*
M_PI);
2106 phi2_z = fmod(phi2_z+2.0*
M_PI,2.0*
M_PI);
2107 gap_z = phi1_z+phi2_z+(cid_in-cid_out-1)*phibin;
2108 gap_z = fmod(gap_z+2.0*
M_PI,2.0*
M_PI);
2109 sampl[cid_in]=phi2_z/gap_z*ch_ltrk;
2110 sampl[cid_out]=phi1_z/gap_z*ch_ltrk;
2111 for( int jj = cid_out+1; jj<cid_in; jj++) {
2112 sampl[jj]=phibin/gap_z*ch_ltrk;
2113 }
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131 }
2132 }
2133
2134#ifdef YDEBUG
2135 if(sampl[cellid]<0.0) {
2136 if(cid_in!=cid_out) cout<<"?????????"<<endl;
2137 cout<< "layerId " << layer <<" cell id "<< cellid <<" shift " << shift
2138 << " cid_in " << cid_in << " cid_out " << cid_out << endl;
2139
2140 cout <<" phi_in " << phi_in <<" phi_midin " << phi_midin << " phi_out "
2141 << phi_out << " phi_midout " << phi_midout <<endl;
2142 cout<<"total sampl " << ch_ltrk << " gap "<< gap << " phi1 "
2143 <<
phi1 <<
" phi2 " <<
phi2 <<
" phibin " << phibin << endl;
2144
2145
2146 for(int l=0; l<ncell; l++) {
2147 if(sampl[l]>=0.0)
2148 cout<<"picked cellid " << l << " sampling length "<< sampl[l]<< endl;
2149 }
2150 }
2151#endif
2152 return sampl[cellid];
2153}
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
const HepVector & a(void) const
returns helix parameters.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
const HepPoint3D & pivot(void) const
returns pivot position.
double dr(void) const
returns an element of parameters.
virtual double getReferField()=0
virtual const MdcGeoLayer *const Layer(unsigned id)=0
virtual const MdcGeoWire *const Wire(unsigned id)=0
virtual const MdcGeoGeneral *const GeneralLayer(unsigned id)=0
double SzWest(void) const
double SxEast(void) const
double SyWest(void) const
double SxWest(void) const
double SzEast(void) const
double SyEast(void) const
double Radius(void) const
double RCSiz2(void) const
double Length(void) const
MdcGeoSuper * Sup(void) const
double RCSiz1(void) const
double Offset(void) const
HepPoint3D FWirePos(void) const
HepPoint3D BWirePos(void) const
HepPoint3D Forward(void) const
HepPoint3D Backward(void) const