1482 double length = geosvc->Layer( layer )->Length();
1483 int genlay = geosvc->Layer( layer )->Gen();
1484 double East_lay_X = geosvc->GeneralLayer( genlay )->SxEast();
1485 double East_lay_Y = geosvc->GeneralLayer( genlay )->SyEast();
1486 double East_lay_Z = geosvc->GeneralLayer( genlay )->SzEast();
1487 double West_lay_X = geosvc->GeneralLayer( genlay )->SxWest();
1488 double West_lay_Y = geosvc->GeneralLayer( genlay )->SyWest();
1489 double West_lay_Z = geosvc->GeneralLayer( genlay )->SzWest();
1491 HepPoint3D East_origin( East_lay_X, East_lay_Y, East_lay_Z );
1492 HepPoint3D West_origin( West_lay_X, West_lay_Y, West_lay_Z );
1493 Hep3Vector wire = (CLHEP::Hep3Vector)East_origin - (CLHEP::Hep3Vector)West_origin;
1494 HepPoint3D piovt_z = ( z * 10 + length / 2 ) / length * wire + West_origin;
1495 piovt_z = piovt_z * 0.1;
1498 HepPoint3D piv( hel.
pivot() );
1501 double dr0 = hel.
a()[0];
1502 double phi0 = hel.
a()[1];
1503 double kappa = hel.
a()[2];
1504 double dz0 = hel.
a()[3];
1505 double tanl = hel.
a()[4];
1508 double Bz = 1000 * ( m_pIMF->getReferField() );
1509 double ALPHA_loc = 1000 / ( 2.99792458 * Bz );
1515 int charge = ( kappa >= 0 ) ? 1 : -1;
1516 double rho = ALPHA_loc / kappa;
1517 double pt = fabs( 1.0 / kappa );
1518 double lambda = atan( tanl );
1519 double theta = M_PI_2 - lambda;
1520 double sintheta =
sin( M_PI_2 - atan( tanl ) );
1522 double phi = fmod( phi0 +
M_PI * 4,
M_PI * 2 );
1523 double csf0 =
cos( phi );
1524 double snf0 = ( 1. - csf0 ) * ( 1. + csf0 );
1525 snf0 = sqrt( ( snf0 > 0. ) ? snf0 : 0. );
1526 if ( phi >
M_PI ) snf0 = -snf0;
1531 double x_c = piv.x() + ( hel.
dr() + rho ) * csf0;
1532 double y_c = piv.y() + ( hel.
dr() + rho ) * snf0;
1533 double z_c = piv.z() + hel.
dz();
1534 HepPoint3D ccenter( x_c, y_c, 0.0 );
1535 double m_c_perp( ccenter.perp() );
1536 Hep3Vector m_c_unit( (HepPoint3D)ccenter.unit() );
1540 double x_c_boost = x_c - piovt_z.x();
1541 double y_c_boost = y_c - piovt_z.y();
1542 double z_c_boost = z_c - piovt_z.z();
1543 HepPoint3D ccenter_boost( x_c_boost, y_c_boost, 0.0 );
1544 double m_c_perp_boost( ccenter_boost.perp() );
1547 Hep3Vector m_c_unit_boost( (HepPoint3D)ccenter_boost.unit() );
1551 HepPoint3D IO = ( -1 ) * charge * m_c_unit;
1552 double dphi0 = fmod( IO.phi() + 4 *
M_PI, 2 *
M_PI ) - phi;
1553 double IO_phi = fmod( IO.phi() + 4 *
M_PI, 2 *
M_PI );
1557 if ( dphi0 >
M_PI ) dphi0 -= 2 *
M_PI;
1558 else if ( dphi0 < -
M_PI ) dphi0 += 2 *
M_PI;
1561 phi_io[0] = -( 1 + charge ) * M_PI_2 - charge * dphi0;
1563 phi_io[1] = phi_io[0] + 1.5 *
M_PI;
1566 double m_zb, m_zf, Calpha;
1569 double rcsiz1 = geosvc->Layer( layer )->RCSiz1();
1570 double rcsiz2 = geosvc->Layer( layer )->RCSiz2();
1571 double rlay = geosvc->Layer( layer )->Radius();
1572 int ncell = geosvc->Layer( layer )->NCell();
1573 double phioffset = geosvc->Layer( layer )->Offset();
1574 float shift = geosvc->Layer( layer )->Shift();
1575 double slant = geosvc->Layer( layer )->Slant();
1577 int type = geosvc->Layer( layer )->Sup()->Type();
1582 int w0id = geosvc->Layer( layer )->Wirst();
1583 int wid = w0id + cellid;
1584 HepPoint3D backkward = geosvc->Wire( wid )->BWirePos();
1585 HepPoint3D forward = geosvc->Wire( wid )->FWirePos();
1586 double x_lay_backward = geosvc->Wire( layer, cellid )->Backward().x();
1587 double y_lay_backward = geosvc->Wire( layer, cellid )->Backward().y();
1588 double x_lay_forward = geosvc->Wire( layer, cellid )->Forward().x();
1589 double y_lay_forward = geosvc->Wire( layer, cellid )->Forward().y();
1590 double r_lay_backward =
1591 sqrt( x_lay_backward * x_lay_backward + y_lay_backward * y_lay_backward );
1592 double r_lay_forward = sqrt( x_lay_forward * x_lay_forward + y_lay_forward * y_lay_forward );
1594 ( ( z * 10 + length / 2 ) / length ) * ( r_lay_backward - r_lay_forward ) +
1603 r_lay_use = 0.1 * r_lay_use;
1604 rcsiz1 = 0.1 * rcsiz1;
1605 rcsiz2 = 0.1 * rcsiz2;
1607 length = 0.1 * length;
1608 m_zb = 0.5 * length;
1609 m_zf = -0.5 * length;
1610 m_crio[0] = rlay - rcsiz1;
1611 m_crio[1] = rlay + rcsiz2;
1615 Hep3Vector iocand[2];
1616 Hep3Vector cell_IO[2];
1617 double dphi, downin;
1622 downin = ( z * z - m_zb * m_zb ) * pow(
tan( slant ), 2 );
1623 m_crio[0] = sqrt( m_crio[0] * m_crio[0] + downin );
1624 m_crio[1] = sqrt( m_crio[1] * m_crio[1] + downin );
1629 for (
int i = 0; i < 2; i++ )
1631 double cos_alpha = m_c_perp_boost * m_c_perp_boost + m_crio[i] * m_crio[i] - rho * rho;
1632 cos_alpha = 0.5 * cos_alpha / ( m_c_perp_boost * m_crio[i] );
1633 if ( fabs( cos_alpha ) > 1 && i == 0 )
return ( -1.0 );
1634 if ( fabs( cos_alpha ) > 1 && i == 1 )
1636 cos_alpha = m_c_perp_boost * m_c_perp_boost + m_crio[0] * m_crio[0] - rho * rho;
1637 cos_alpha = 0.5 * cos_alpha / ( m_c_perp_boost * m_crio[0] );
1638 Calpha = 2.0 *
M_PI - acos( cos_alpha );
1640 else { Calpha = acos( cos_alpha ); }
1642 iocand[i] = m_c_unit_boost;
1643 iocand[i].rotateZ( charge * sign * Calpha );
1644 iocand[i] *= m_crio[i];
1651 iocand[i] = iocand[i] + piovt_z;
1656 double xx = iocand[i].x() - x_c;
1657 double yy = iocand[i].y() - y_c;
1659 dphi = atan2( yy, xx ) - phi0 - M_PI_2 * ( 1 - charge );
1660 dphi = fmod( dphi + 8.0 *
M_PI, 2 *
M_PI );
1662 if ( dphi < phi_io[0] ) { dphi += 2 *
M_PI; }
1663 else if ( phi_io[1] < dphi ) { dphi -= 2 *
M_PI; }
1667 Hep3Vector zvector( 0., 0., z_c - rho * dphi * tanl - piovt_z.z() );
1669 cell_IO[i] = iocand[i];
1670 cell_IO[i] += zvector;
1675 double xcio, ycio, phip;
1707 cell_IO[i] = hel.
x( dphi );
1714 Hep3Vector cl = cell_IO[1] - cell_IO[0];
1720 double ch_ltrk_rp = 0;
1721 ch_dphi = cl.perp() * 0.5 / ( ALPHA_loc * pt );
1722 ch_dphi = 2.0 * asin( ch_dphi );
1723 ch_ltrk_rp = ch_dphi * ALPHA_loc * pt;
1724 double rpi_path = sqrt( cl.x() * cl.x() + cl.y() * cl.y() );
1725 ch_ltrk = sqrt( ch_ltrk_rp * ch_ltrk_rp + cl.z() * cl.z() );
1726 double path = ch_ltrk_rp / sintheta;
1727 ch_theta = cl.theta();
1743 double phibin, phi_in, phi_out, inlow, inup, outlow, outup, gap,
phi1,
phi2, phi_mid,
1744 phi_midin, phi_midout;
1745 int cid_in, cid_out;
1746 double inlow_z, inup_z, outlow_z, outup_z, gap_z, phi1_z, phi2_z, phi_mid_z, phi_midin_z,
1750 std::vector<double> sampl;
1751 sampl.resize( ncell );
1752 for (
int k = 0; k < ncell; k++ ) { sampl[k] = -1.0; }
1754 cid_in = cid_out = -1;
1755 phi_in = cell_IO[0].phi();
1756 phi_out = cell_IO[1].phi();
1759 phi_in = fmod( phi_in + 4 *
M_PI, 2 *
M_PI );
1760 phi_out = fmod( phi_out + 4 *
M_PI, 2 *
M_PI );
1761 phibin = 2.0 *
M_PI / ncell;
1765 Hep3Vector cell_mid = 0.5 * ( cell_IO[0] + cell_IO[1] );
1770 double stphi[2], phioff[2];
1771 stphi[0] = shift * phibin * ( 0.5 - cell_IO[0].z() / length );
1772 stphi[1] = shift * phibin * ( 0.5 - cell_IO[1].z() / length );
1775 phioff[0] = phioffset + stphi[0];
1776 phioff[1] = phioffset + stphi[1];
1778 for (
int i = 0; i < ncell; i++ )
1781 double x_lay_backward_cell = geosvc->Wire( layer, i )->Backward().x() * 0.1;
1782 double y_lay_backward_cell = geosvc->Wire( layer, i )->Backward().y() * 0.1;
1783 double x_lay_forward_cell = geosvc->Wire( layer, i )->Forward().x() * 0.1;
1784 double y_lay_forward_cell = geosvc->Wire( layer, i )->Forward().y() * 0.1;
1788 Hep3Vector lay_backward( x_lay_backward_cell, y_lay_backward_cell, 0 );
1789 Hep3Vector lay_forward( x_lay_forward_cell, y_lay_forward_cell, 0 );
1790 Hep3Vector Cell_z[2];
1791 Cell_z[0] = ( ( cell_IO[0].z() + length / 2 ) / length ) * ( lay_backward - lay_forward ) +
1793 Cell_z[1] = ( ( cell_IO[1].z() + length / 2 ) / length ) * ( lay_backward - lay_forward ) +
1796 z_phi[0] = Cell_z[0].phi();
1797 z_phi[1] = Cell_z[1].phi();
1798 z_phi[0] = fmod( z_phi[0] + 4 *
M_PI, 2 *
M_PI );
1799 z_phi[1] = fmod( z_phi[1] + 4 *
M_PI, 2 *
M_PI );
1813 inlow_z = z_phi[0] - phibin * 0.5;
1814 inup_z = z_phi[0] + phibin * 0.5;
1815 outlow_z = z_phi[1] - phibin * 0.5;
1816 outup_z = z_phi[1] + phibin * 0.5;
1817 inlow_z = fmod( inlow_z + 4 *
M_PI, 2 *
M_PI );
1818 inup_z = fmod( inup_z + 4 *
M_PI, 2 *
M_PI );
1819 outlow_z = fmod( outlow_z + 4 *
M_PI, 2 *
M_PI );
1820 outup_z = fmod( outup_z + 4 *
M_PI, 2 *
M_PI );
1823 inlow = phioff[0] + phibin * i - phibin * 0.5;
1824 inup = phioff[0] + phibin * i + phibin * 0.5;
1825 outlow = phioff[1] + phibin * i - phibin * 0.5;
1826 outup = phioff[1] + phibin * i + phibin * 0.5;
1827 inlow = fmod( inlow + 4 *
M_PI, 2 *
M_PI );
1828 inup = fmod( inup + 4 *
M_PI, 2 *
M_PI );
1829 outlow = fmod( outlow + 4 *
M_PI, 2 *
M_PI );
1830 outup = fmod( outup + 4 *
M_PI, 2 *
M_PI );
1834 cout <<
"shift " << shift <<
" phi_in " << phi_in <<
" phi_out " << phi_out <<
" inup "
1835 << inup <<
" inlow " << inlow <<
" outup " << outup <<
" outlow " << outlow << endl;
1847 if ( phi_in >= inlow_z && phi_in < inup_z ) cid_in = i;
1848 if ( phi_out >= outlow_z && phi_out < outup_z ) cid_out = i;
1849 if ( inlow_z > inup_z )
1851 if ( ( phi_in >= inlow_z && phi_in < 2.0 *
M_PI ) ||
1852 ( phi_in >= 0.0 && phi_in < inup_z ) )
1855 if ( outlow_z > outup_z )
1857 if ( ( phi_out >= outlow_z && phi_out < 2.0 *
M_PI ) ||
1858 ( phi_out >= 0.0 && phi_out < outup_z ) )
1863 phi_midin = phi_midout =
phi1 =
phi2 = -999.0;
1867 if ( cid_in == -1 || cid_out == -1 )
return -1;
1869 if ( cid_in == cid_out )
1871 sampl[cid_in] = ch_ltrk;
1873 return sampl[cellid];
1875 else if ( cid_in < cid_out )
1879 if ( cid_out - cid_in > ncell / 2 )
1883 double x_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().x() * 0.1;
1884 double y_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().y() * 0.1;
1885 double x_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().x() * 0.1;
1886 double y_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().y() * 0.1;
1887 Hep3Vector lay_backward_cin( x_lay_backward_cin, y_lay_backward_cin, 0 );
1888 Hep3Vector lay_forward_cin( x_lay_forward_cin, y_lay_forward_cin, 0 );
1889 Hep3Vector Cell_z[2];
1890 Cell_z[0] = ( ( cell_IO[0].z() + length / 2 ) / length ) *
1891 ( lay_backward_cin - lay_forward_cin ) +
1893 double phi_cin_z = Cell_z[0].phi();
1894 phi_cin_z = fmod( phi_cin_z + 4 *
M_PI, 2 *
M_PI );
1895 double x_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().x() * 0.1;
1896 double y_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().y() * 0.1;
1897 double x_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().x() * 0.1;
1898 double y_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().y() * 0.1;
1899 Hep3Vector lay_backward_cout( x_lay_backward_cout, y_lay_backward_cout, 0 );
1900 Hep3Vector lay_forward_cout( x_lay_forward_cout, y_lay_forward_cout, 0 );
1901 Cell_z[1] = ( ( cell_IO[1].z() + length / 2 ) / length ) *
1902 ( lay_backward_cout - lay_forward_cout ) +
1904 double phi_cout_z = Cell_z[1].phi();
1905 phi_cout_z = fmod( phi_cout_z + 4 *
M_PI, 2 *
M_PI );
1907 phi_midin_z = phi_cin_z - phibin * 0.5;
1908 phi_midout_z = phi_cout_z + phibin * 0.5;
1909 phi_midin_z = fmod( phi_midin_z + 4 *
M_PI, 2 *
M_PI );
1910 phi_midout_z = fmod( phi_midout_z + 4 *
M_PI, 2 *
M_PI );
1911 phi1_z = phi_midout_z - phi_out;
1912 phi2_z = phi_in - phi_midin_z;
1913 phi1_z = fmod( phi1_z + 2.0 *
M_PI, 2.0 *
M_PI );
1914 phi2_z = fmod( phi2_z + 2.0 *
M_PI, 2.0 *
M_PI );
1915 gap_z = phi1_z + phi2_z + ( ncell - 1 - cid_out + cid_in ) * phibin;
1916 gap_z = fmod( gap_z + 2.0 *
M_PI, 2.0 *
M_PI );
1917 sampl[cid_in] = phi2_z / gap_z * ch_ltrk;
1918 sampl[cid_out] = phi1_z / gap_z * ch_ltrk;
1919 for (
int jj = cid_out + 1; jj < ncell; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
1920 for (
int jj = 0; jj < cid_in; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
1955 double x_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().x() * 0.1;
1956 double y_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().y() * 0.1;
1957 double x_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().x() * 0.1;
1958 double y_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().y() * 0.1;
1959 Hep3Vector lay_backward_cin( x_lay_backward_cin, y_lay_backward_cin, 0 );
1960 Hep3Vector lay_forward_cin( x_lay_forward_cin, y_lay_forward_cin, 0 );
1961 Hep3Vector Cell_z[2];
1962 Cell_z[0] = ( ( cell_IO[0].z() + length / 2 ) / length ) *
1963 ( lay_backward_cin - lay_forward_cin ) +
1965 double phi_cin_z = Cell_z[0].phi();
1966 phi_cin_z = fmod( phi_cin_z + 4 *
M_PI, 2 *
M_PI );
1967 double x_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().x() * 0.1;
1968 double y_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().y() * 0.1;
1969 double x_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().x() * 0.1;
1970 double y_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().y() * 0.1;
1971 Hep3Vector lay_backward_cout( x_lay_backward_cout, y_lay_backward_cout, 0 );
1972 Hep3Vector lay_forward_cout( x_lay_forward_cout, y_lay_forward_cout, 0 );
1973 Cell_z[1] = ( ( cell_IO[1].z() + length / 2 ) / length ) *
1974 ( lay_backward_cout - lay_forward_cout ) +
1976 double phi_cout_z = Cell_z[1].phi();
1977 phi_cout_z = fmod( phi_cout_z + 4 *
M_PI, 2 *
M_PI );
1979 phi_midin_z = phi_cin_z + phibin * 0.5;
1980 phi_midout_z = phi_cout_z - phibin * 0.5;
1981 phi_midin_z = fmod( phi_midin_z + 4 *
M_PI, 2 *
M_PI );
1982 phi_midout_z = fmod( phi_midout_z + 4 *
M_PI, 2 *
M_PI );
1983 phi1_z = phi_midin_z - phi_in;
1984 phi2_z = phi_out - phi_midout_z;
1985 phi1_z = fmod( phi1_z + 2.0 *
M_PI, 2.0 *
M_PI );
1986 phi2_z = fmod( phi2_z + 2.0 *
M_PI, 2.0 *
M_PI );
1987 gap_z = phi1_z + phi2_z + ( cid_out - cid_in - 1 ) * phibin;
1988 gap_z = fmod( gap_z + 2.0 *
M_PI, 2.0 *
M_PI );
1989 sampl[cid_in] = phi1_z / gap_z * ch_ltrk;
1990 sampl[cid_out] = phi2_z / gap_z * ch_ltrk;
1991 for (
int jj = cid_in + 1; jj < cid_out; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
2010 else if ( cid_in > cid_out )
2014 if ( cid_in - cid_out > ncell / 2 )
2016 double x_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().x() * 0.1;
2017 double y_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().y() * 0.1;
2018 double x_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().x() * 0.1;
2019 double y_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().y() * 0.1;
2020 Hep3Vector lay_backward_cin( x_lay_backward_cin, y_lay_backward_cin, 0 );
2021 Hep3Vector lay_forward_cin( x_lay_forward_cin, y_lay_forward_cin, 0 );
2022 Hep3Vector Cell_z[2];
2023 Cell_z[0] = ( ( cell_IO[0].z() + length / 2 ) / length ) *
2024 ( lay_backward_cin - lay_forward_cin ) +
2026 double phi_cin_z = Cell_z[0].phi();
2027 phi_cin_z = fmod( phi_cin_z + 4 *
M_PI, 2 *
M_PI );
2028 double x_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().x() * 0.1;
2029 double y_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().y() * 0.1;
2030 double x_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().x() * 0.1;
2031 double y_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().y() * 0.1;
2032 Hep3Vector lay_backward_cout( x_lay_backward_cout, y_lay_backward_cout, 0 );
2033 Hep3Vector lay_forward_cout( x_lay_forward_cout, y_lay_forward_cout, 0 );
2034 Cell_z[1] = ( ( cell_IO[1].z() + length / 2 ) / length ) *
2035 ( lay_backward_cout - lay_forward_cout ) +
2037 double phi_cout_z = Cell_z[1].phi();
2038 phi_cout_z = fmod( phi_cout_z + 4 *
M_PI, 2 *
M_PI );
2040 phi_midin_z = phi_cin_z + phibin * 0.5;
2041 phi_midout_z = phi_cout_z - phibin * 0.5;
2042 phi_midin_z = fmod( phi_midin_z + 4 *
M_PI, 2 *
M_PI );
2043 phi_midout_z = fmod( phi_midout_z + 4 *
M_PI, 2 *
M_PI );
2044 phi1_z = phi_midin_z - phi_in;
2045 phi2_z = phi_out - phi_midout_z;
2046 phi1_z = fmod( phi1_z + 2.0 *
M_PI, 2.0 *
M_PI );
2047 phi2_z = fmod( phi2_z + 2.0 *
M_PI, 2.0 *
M_PI );
2048 gap_z = phi1_z + phi2_z + ( ncell - 1 - cid_in + cid_out ) * phibin;
2049 gap_z = fmod( gap_z + 2.0 *
M_PI, 2.0 *
M_PI );
2050 sampl[cid_out] = phi2_z / gap_z * ch_ltrk;
2051 sampl[cid_in] = phi1_z / gap_z * ch_ltrk;
2052 for (
int jj = cid_in + 1; jj < ncell; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
2053 for (
int jj = 0; jj < cid_out; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
2086 double x_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().x() * 0.1;
2087 double y_lay_backward_cin = geosvc->Wire( layer, cid_in )->Backward().y() * 0.1;
2088 double x_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().x() * 0.1;
2089 double y_lay_forward_cin = geosvc->Wire( layer, cid_in )->Forward().y() * 0.1;
2090 Hep3Vector lay_backward_cin( x_lay_backward_cin, y_lay_backward_cin, 0 );
2091 Hep3Vector lay_forward_cin( x_lay_forward_cin, y_lay_forward_cin, 0 );
2092 Hep3Vector Cell_z[2];
2093 Cell_z[0] = ( ( cell_IO[0].z() + length / 2 ) / length ) *
2094 ( lay_backward_cin - lay_forward_cin ) +
2096 double phi_cin_z = Cell_z[0].phi();
2097 phi_cin_z = fmod( phi_cin_z + 4 *
M_PI, 2 *
M_PI );
2098 double x_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().x() * 0.1;
2099 double y_lay_backward_cout = geosvc->Wire( layer, cid_out )->Backward().y() * 0.1;
2100 double x_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().x() * 0.1;
2101 double y_lay_forward_cout = geosvc->Wire( layer, cid_out )->Forward().y() * 0.1;
2102 Hep3Vector lay_backward_cout( x_lay_backward_cout, y_lay_backward_cout, 0 );
2103 Hep3Vector lay_forward_cout( x_lay_forward_cout, y_lay_forward_cout, 0 );
2104 Cell_z[1] = ( ( cell_IO[1].z() + length / 2 ) / length ) *
2105 ( lay_backward_cout - lay_forward_cout ) +
2107 double phi_cout_z = Cell_z[1].phi();
2108 phi_cout_z = fmod( phi_cout_z + 4 *
M_PI, 2 *
M_PI );
2110 phi_midin_z = phi_cin_z - phibin * 0.5;
2111 phi_midout_z = phi_cout_z + phibin * 0.5;
2112 phi_midin_z = fmod( phi_midin_z + 4 *
M_PI, 2 *
M_PI );
2113 phi_midout_z = fmod( phi_midout_z + 4 *
M_PI, 2 *
M_PI );
2114 phi1_z = phi_midout_z - phi_out;
2115 phi2_z = phi_in - phi_midin_z;
2116 phi1_z = fmod( phi1_z + 2.0 *
M_PI, 2.0 *
M_PI );
2117 phi2_z = fmod( phi2_z + 2.0 *
M_PI, 2.0 *
M_PI );
2118 gap_z = phi1_z + phi2_z + ( cid_in - cid_out - 1 ) * phibin;
2119 gap_z = fmod( gap_z + 2.0 *
M_PI, 2.0 *
M_PI );
2120 sampl[cid_in] = phi2_z / gap_z * ch_ltrk;
2121 sampl[cid_out] = phi1_z / gap_z * ch_ltrk;
2122 for (
int jj = cid_out + 1; jj < cid_in; jj++ ) { sampl[jj] = phibin / gap_z * ch_ltrk; }
2144 if ( sampl[cellid] < 0.0 )
2146 if ( cid_in != cid_out ) cout <<
"?????????" << endl;
2147 cout <<
"layerId " << layer <<
" cell id " << cellid <<
" shift " << shift
2148 <<
" cid_in " << cid_in <<
" cid_out " << cid_out << endl;
2150 cout <<
" phi_in " << phi_in <<
" phi_midin " << phi_midin <<
" phi_out " << phi_out
2151 <<
" phi_midout " << phi_midout << endl;
2152 cout <<
"total sampl " << ch_ltrk <<
" gap " << gap <<
" phi1 " <<
phi1 <<
" phi2 " <<
phi2
2153 <<
" phibin " << phibin << endl;
2155 for (
int l = 0; l < ncell; l++ )
2157 if ( sampl[l] >= 0.0 )
2158 cout <<
"picked cellid " << l <<
" sampling length " << sampl[l] << endl;
2162 return sampl[cellid];