476 const HepVector helixPat,
const HepSymMatrix errMat,
477 bool passCellRequired )
const {
479 if ( m_debug ) std::cout <<
" helixPat " << helixPat << std::endl;
480 if ( m_debug ) std::cout <<
" layer " << layer <<
" cell " << cell << std::endl;
491 std::cout <<
" cellId in " << cellId_in <<
" out " << cellId_out << std::endl;
492 cout <<
"cell = " << cell <<
", cellId_in = " << cellId_in
493 <<
", cellId_out = " << cellId_out << endl;
495 if ( passCellRequired && ( cell < cellId_in && cell > cellId_out ) )
return -999.;
502 int innerOrOuter = 1;
504 double fltTrack = 0.1 * m_mdcGeomSvc->Layer( layer )->Radius();
507 std::cout <<
" cell_IO " << cell_IO << std::endl;
508 std::cout <<
" fltTrack " << fltTrack << std::endl;
518 std::cout <<
" sag " << m_wireTraj->
sag() << std::endl;
519 std::cout <<
" east -------- " << start_In->x() <<
"," << start_In->y() <<
","
520 << start_In->z() << std::endl;
528 double zWire = cell_IO.z();
532 std::cout <<
" zWire " << zWire <<
" zEndDC " << sWire->
zEndDC() << std::endl;
535 double fltWire = sqrt( ( pos_in.x() - start_In->x() ) * ( pos_in.x() - start_In->x() ) +
536 ( pos_in.y() - start_In->y() ) * ( pos_in.y() - start_In->y() ) +
537 ( pos_in.z() - start_In->z() ) * ( pos_in.z() - start_In->z() ) );
538 trkPoca =
new TrkPoca( *trajHelix, fltTrack, *trajWire, fltWire );
541 double hitLen = trkPoca->
flt2();
542 double startLen = trajWire->
lowRange() - 5.;
543 double endLen = trajWire->
hiRange() + 5.;
544 if ( hitLen < startLen || hitLen > endLen )
547 std::cout <<
"WARNING MdcUtilitySvc::docaPatPar() isBeyondEndflange! hitLen=" << hitLen
548 <<
" startLen=" << startLen <<
" endLen " << endLen << std::endl;
554 if ( m_debug ) std::cout <<
" doca " <<
doca << std::endl;
601 int& cellId_in,
int& cellId_out )
const {
602 int nCell = m_mdcGeomSvc->Layer( layer )->NCell();
604 double dPhiz = ( m_mdcGeomSvc->Wire( layer, 0 )->Forward().phi() -
605 m_mdcGeomSvc->Wire( layer, 0 )->Backward().phi() ) *
607 double rEnd = m_mdcGeomSvc->Wire( layer, 0 )->Backward().rho() / 10.;
608 double rMid = rEnd *
cos( dPhiz );
613 double fltLenIn = rMid;
614 double phiIn = helixPat[1] + helixPat[2] * fltLenIn;
617 m_mdcGeomSvc->Wire( layer, 0 )->Backward().phi();
618 BesAngle tmp( phiIn - phiEPOffset );
620 std::cout <<
"cellTrackPassed nCell " << nCell <<
" layer " << layer <<
" fltLenIn "
621 << fltLenIn <<
" phiEPOffset " << phiEPOffset << std::endl;
623 int wlow = (int)floor( nCell * tmp.
rad() / twopi );
624 int wbig = (int)ceil( nCell * tmp.
rad() / twopi );
631 if ( ( wlow % nCell ) < 0 ) wlow += nCell;
634 if ( ( wbig % nCell ) < 0 ) wbig += nCell;
637 bool passedOneCell = ( cellId_in == cellId_out );
639 return passedOneCell;
652 int& cellId_out )
const {
653 int charge,
type, nCell;
654 double dr0, phi0, kappa, dz0, tanl;
655 double ALPHA_loc, rho, phi, cosphi0, sinphi0, x_hc, y_hc, z_hc;
656 double dphi0, IO_phi, C_alpha, xx, yy;
657 double inlow, inup, outlow, outup, phi_in, phi_out, phi_bin;
658 double rCize1, rCize2, rLay, length, phioffset, slant, shift;
659 double m_crio[2], phi_io[2], stphi[2], phioff[2], dphi[2];
667 ALPHA_loc = 1000 / ( 2.99792458 * Bz() );
668 charge = ( kappa >= 0 ) ? 1 : -1;
669 rho = ALPHA_loc / kappa;
671 phi = fmod( phi0 + 4 *
pi, 2 *
pi );
672 cosphi0 =
cos( phi );
673 sinphi0 = ( 1.0 - cosphi0 ) * ( 1.0 + cosphi0 );
674 sinphi0 = sqrt( ( sinphi0 > 0. ) ? sinphi0 : 0. );
675 if ( phi >
pi ) sinphi0 = -sinphi0;
677 x_hc = 0. + ( dr0 + rho ) * cosphi0;
678 y_hc = 0. + ( dr0 + rho ) * sinphi0;
684 double m_c_perp( hcenter.perp() );
685 Hep3Vector m_c_unit( (
HepPoint3D)hcenter.unit() );
688 dphi0 = fmod( IO.phi() + 4 *
pi, 2 *
pi ) - phi;
689 IO_phi = fmod( IO.phi() + 4 *
pi, 2 *
pi );
691 if ( dphi0 >
pi ) dphi0 -= 2 *
pi;
692 else if ( dphi0 < -
pi ) dphi0 += 2 *
pi;
694 phi_io[0] = -( 1 + charge ) *
pi / 2 - charge * dphi0;
695 phi_io[1] = phi_io[0] + 1.5 *
pi;
697 bool outFlag =
false;
699 rCize1 = 0.1 * m_mdcGeomSvc->Layer( lay )->RCSiz1();
700 rCize2 = 0.1 * m_mdcGeomSvc->Layer( lay )->RCSiz2();
701 rLay = 0.1 * m_mdcGeomSvc->Layer( lay )->Radius();
702 length = 0.1 * m_mdcGeomSvc->Layer( lay )->Length();
705 nCell = m_mdcGeomSvc->Layer( lay )->NCell();
706 phioffset = m_mdcGeomSvc->Layer( lay )->Offset();
707 slant = m_mdcGeomSvc->Layer( lay )->Slant();
708 shift = m_mdcGeomSvc->Layer( lay )->Shift();
709 type = m_mdcGeomSvc->Layer( lay )->Sup()->Type();
711 m_crio[0] = rLay - rCize1;
712 m_crio[1] = rLay + rCize2;
716 Hep3Vector iocand[2];
717 Hep3Vector cell_IO[2];
719 for (
int ii = 0; ii < 2; ii++ )
722 double cos_alpha = ( m_c_perp * m_c_perp + m_crio[ii] * m_crio[ii] - rho * rho ) /
723 ( 2 * m_c_perp * m_crio[ii] );
724 if ( fabs( cos_alpha ) > 1 && ( ii == 0 ) )
729 if ( fabs( cos_alpha ) > 1 && ( ii == 1 ) )
731 cos_alpha = ( m_c_perp * m_c_perp + m_crio[0] * m_crio[0] - rho * rho ) /
732 ( 2 * m_c_perp * m_crio[0] );
733 C_alpha = 2 *
pi - acos( cos_alpha );
735 else { C_alpha = acos( cos_alpha ); }
737 iocand[ii] = m_c_unit;
738 iocand[ii].rotateZ( charge * sign * C_alpha );
739 iocand[ii] *= m_crio[ii];
741 xx = iocand[ii].x() - x_hc;
742 yy = iocand[ii].y() - y_hc;
744 dphi[ii] = atan2( yy, xx ) - phi0 - 0.5 *
pi * ( 1 - charge );
745 dphi[ii] = fmod( dphi[ii] + 8.0 *
pi, 2 *
pi );
747 if ( dphi[ii] < phi_io[0] ) { dphi[ii] += 2 *
pi; }
748 else if ( dphi[ii] > phi_io[1] )
753 cell_IO[ii] =
Hel( piv, dr0, phi, ALPHA_loc, kappa, dz0, dphi[ii], tanl );
756 if ( ( cell_IO[ii].
x() == 0 ) && ( cell_IO[ii].y() == 0 ) && ( cell_IO[ii].z() == 0 ) )
762 cellId_in = cellId_out = -1;
763 phi_in = cell_IO[0].phi();
764 phi_in = fmod( phi_in + 4 *
pi, 2 *
pi );
765 phi_out = cell_IO[1].phi();
766 phi_out = fmod( phi_out + 4 *
pi, 2 *
pi );
767 phi_bin = 2.0 *
pi / nCell;
770 stphi[0] = shift * phi_bin * ( 0.5 - cell_IO[0].z() / length );
771 stphi[1] = shift * phi_bin * ( 0.5 - cell_IO[1].z() / length );
774 phioff[0] = phioffset + stphi[0];
775 phioff[1] = phioffset + stphi[1];
777 for (
int kk = 0; kk < nCell; kk++ )
780 inlow = phioff[0] + phi_bin * kk - phi_bin * 0.5;
781 inlow = fmod( inlow + 4.0 *
pi, 2.0 *
pi );
782 inup = phioff[0] + phi_bin * kk + phi_bin * 0.5;
783 inup = fmod( inup + 4.0 *
pi, 2.0 *
pi );
784 outlow = phioff[1] + phi_bin * kk - phi_bin * 0.5;
785 outlow = fmod( outlow + 4.0 *
pi, 2.0 *
pi );
786 outup = phioff[1] + phi_bin * kk + phi_bin * 0.5;
787 outup = fmod( outup + 4.0 *
pi, 2.0 *
pi );
789 if ( ( phi_in >= inlow && phi_in <= inup ) ) cellId_in = kk;
790 if ( ( phi_out >= outlow && phi_out < outup ) ) cellId_out = kk;
793 if ( ( phi_in >= inlow && phi_in < 2.0 *
pi ) || ( phi_in >= 0.0 && phi_in < inup ) )
796 if ( outlow > outup )
798 if ( ( phi_out >= outlow && phi_out <= 2.0 *
pi ) ||
799 ( phi_out >= 0.0 && phi_out < outup ) )
804 return ( cellId_in == cellId_out );
1020 int trackIndex,
const MdcDigiVec mdcDigiVecInput,
1021 std::map<
int, std::map<MdcDigi*, MdcMcHit*>>& mdcMCAssociation ) {
1024 IDataProviderSvc* eventSvc = NULL;
1025 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc );
1026 SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol( eventSvc,
"/Event/MC/MdcMcHitCol" );
1029 std::cout <<
"MdcUtilitySvc::getMdcMCAssoiciation() does not find MdcMcHitCol!"
1033 std::map<int, Event::MdcMcHit*> mdcMcHitMap;
1034 Event::MdcMcHitCol::iterator iterMdcMcHit = mdcMcHitCol->begin();
1035 for ( ; iterMdcMcHit != mdcMcHitCol->end(); iterMdcMcHit++ )
1037 int id = m_mdcGeomSvc
1041 mdcMcHitMap.insert( std::pair<int, Event::MdcMcHit*>(
id, *iterMdcMcHit ) );
1045 MdcDigiVec::const_iterator iterMdcDigi = mdcDigiVecInput.begin();
1046 for ( ; iterMdcDigi != mdcDigiVecInput.end(); iterMdcDigi++ )
1048 int digiTrackIndex = ( *iterMdcDigi )->getTrackIndex();
1049 std::cout << __FILE__ <<
" " << __LINE__ <<
" " << digiTrackIndex << std::endl;
1050 if ( digiTrackIndex > 999 ) digiTrackIndex -= 1000;
1051 if ( digiTrackIndex != digiTrackIndex )
continue;
1052 int id = m_mdcGeomSvc
1056 std::map<MdcDigi*, MdcMcHit*> temp;
1057 std::map<int, Event::MdcMcHit*>::iterator itMdcMcHit = mdcMcHitMap.find(
id );
1058 if ( itMdcMcHit != mdcMcHitMap.end() )
1060 temp.insert( make_pair( *iterMdcDigi, ( *itMdcMcHit ).second ) );
1061 mdcMCAssociation.insert( make_pair( trackIndex, temp ) );
const HepLorentzVector & initialPosition() const
Retrieve pointer to the start, end vertex positions.