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