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