605 float brThickness = 0.0;
606 float ecThickness = 0.0;
610 float phi = m_MucMomentum.phi();
611 float theta = m_MucMomentum.theta();
613 vector<MucRecHit*>::const_iterator iHit;
618 int part, seg, gap, strip;
619 for (
int gap = 0; gap < ngap; gap++ ) { Seg[gap] = -1; }
620 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++ )
624 part = ( *iHit )->Part();
625 seg = ( *iHit )->Seg();
626 gap = ( *iHit )->Gap();
627 strip = ( *iHit )->Strip();
628 if ( part == 1 ) Seg[gap] = seg;
635 if ( Seg[gap] != -1 ) segTrackBr = Seg[gap];
640 float thickness = 0.0;
645 if (
sin( m_MucMomentum.theta() ) != 0 ) thickness /=
sin( m_MucMomentum.theta() );
648 deltaPhi = m_MucMomentum.phi() - segTrackBr *
kPi / 4;
649 if ( Seg[gap] == -1 && betweenSeg == 1 )
665 brThickness += thickness;
669 else cout <<
"in RecMucTrack: Wrong Gap Info" << endl;
678 for (
int gap = 0; gap != -1 && gap <=
ecLastLayer(); gap++ )
681 if (
cos( theta ) != 0.0 ) ecThickness /=
cos( theta );
684 ecThickness = fabs( ecThickness );
691 if ( ( m_Good3DLine == 1 ) && ( m_Good3DPart == 1 ) )
693 if ( m_IntersectionInner[0].
x() != -9999 )
697 if ( m_IntersectionInner[gap].
x() != -9999 &&
698 m_IntersectionInner[gap - 1].
x() != -9999 )
699 m_depth_3 += ( m_IntersectionInner[gap] - m_IntersectionOuter[gap - 1] ).mag();
702 m_depth_3 += ecThickness;
704 else m_depth_3 = brThickness + ecThickness;
706 if ( ( m_Good3DLine == 1 ) && ( m_Good3DPart != 1 ) )
710 if ( m_IntersectionInner[gap].
x() != -9999 &&
711 m_IntersectionInner[gap - 1].
x() != -9999 )
712 m_depth_3 += ( m_IntersectionInner[gap] - m_IntersectionOuter[gap - 1] ).mag();
715 m_depth_3 += brThickness;
716 if (
cos( theta ) != 0.0 )
717 m_depth_3 += 40 /
cos( theta );
719 if ( m_Good3DLine == 0 ) m_depth_3 = brThickness + ecThickness;
720 if ( m_depth_3 > 2000 )
721 m_depth_3 = brThickness + ecThickness;
724 { m_depth_3 = brThickness + ecThickness; }
726 double offset = 50.0;
846 bool firstHitFound =
false;
848 vector<MucRecHit*>::const_iterator iHit;
849 vector<MucRecHit*> hitsGap0;
850 float stripLocal[3] = { 0.0, 0.0, 0.0 };
851 float stripGlobal[3] = { 0.0, 0.0, 0.0 };
854 int part, seg, gap, strip;
855 int barrel_gap0_exist = 0;
857 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++ )
861 part = ( *iHit )->Part();
862 seg = ( *iHit )->Seg();
863 gap = ( *iHit )->Gap();
864 strip = ( *iHit )->Strip();
865 if ( !firstHitFound && gap == 0 )
868 firstHitFound =
true;
870 if ( firstGap && part == firstGap->
Part() && seg == firstGap->
Seg() &&
871 gap == firstGap->
Gap() )
874 HepPoint3D posHit = ( *iHit )->GetCenterPos();
875 HepPoint3D posHitLocal = ( *iHit )->GetGap()->TransformToGap( posHit );
876 if ( part == 1 && gap == 0 ) barrel_gap0_exist = 1;
878 stripLocal[0] += posHitLocal.x();
879 stripLocal[1] += posHitLocal.y();
880 stripLocal[2] += posHitLocal.z();
882 stripGlobal[0] += posHit.x();
883 stripGlobal[1] += posHit.y();
884 stripGlobal[2] += posHit.z();
893 int apart = -1, aseg = -1;
896 if ( apart == -1 && aseg == -1 ) { m_Dist_muc_ext.set( 0, 0, 0 ); }
900 HepPoint3D fextLocal = fakefirstGap->
TransformToGap( m_ExtMucPos );
902 float dist_x = fextLocal.x() - fmucLocal.x();
903 float dist_y = fextLocal.y() - fmucLocal.y();
904 float dist_z = fextLocal.z() - fmucLocal.z();
905 m_Dist_muc_ext.set( dist_x, dist_y, dist_z );
907 if ( fakefirstGap->
Orient() == 0 )
919 if ( nStrip == 0 || !firstGap )
926 for (
int k = 0; k < 3; k++ ) stripLocal[k] /= nStrip;
927 for (
int k = 0; k < 3; k++ ) stripGlobal[k] /= nStrip;
929 m_StripPhi.set( stripGlobal[0], stripGlobal[1], stripGlobal[2] );
939 if ( firstGap->
Orient() == 0 )
941 distance = extLocal.y() - stripLocal[1];
946 distance = extLocal.x() - stripLocal[0];
1010 int part = -1, seg = -1;
1014 if ( part < 0 || seg < 0 )
1021 float startPos[3] = { 0.0, 0.0, 0.0 };
1023 vector<MucRecHit*>::const_iterator iHit;
1024 for (
int orient = 0; orient <= 1; orient++ )
1026 road2D[orient] =
MucRec2DRoad( part, seg, orient, startPos[0], startPos[1], startPos[2],
1028 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++ )
1032 int hitPart = ( *iHit )->Part();
1033 int hitSeg = ( *iHit )->Seg();
1034 int hitOrient = ( *iHit )->GetGap()->Orient();
1035 if ( hitPart == part && hitSeg == seg && hitOrient == orient )
1046 float vx, vy, x0, y0;
1050 road2D[1].GetIntercept(), road2D[0].GetIntercept(), vx, vy, x0,
1072 m_Good3DPart = road3D.
GetPart();
1076 float startx = 0.0, starty = 0.0, startz = 0.0;
1077 float startxSigma = 0.0, startySigma = 0.0, startzSigma = 0.0;
1078 float x1 = 0.0, y1 = 0.0, z1 = 0.0, x2 = 0.0, y2 = 0.0, z2 = 0.0;
1081 if ( fittingMethod == 2 )
1083 for (
int igap = 0; igap < 9; igap++ )
1085 road3D.
Project( igap, x1, y1, z1, x2, y2, z2 );
1086 m_IntersectionInner[igap].set( x1, y1, z1 );
1087 m_IntersectionOuter[igap].set( x2, y2, z2 );
1094 road3D.
ProjectWithSigma( gap, startx, starty, startz, startxSigma, startySigma,
1097 }
while ( ( startx * startx + starty * starty + startz * startz ) <
kMinor &&
1100 if ( fabs( startx ) < 2600 && fabs( starty ) < 2600 && fabs( startz ) < 2800 )
1102 Hep3Vector MucPos_self;
1103 MucPos_self.set( startx, starty, startz );
1104 float dist = ( MucPos_self - m_MucPos ).mag();
1108 m_MucPos.set( startx, starty, startz );
1114 m_MucPosSigma.set( startxSigma, startySigma, startzSigma );
1121 float momentum = m_MucMomentum.mag();
1123 if ( m_MucMomentum.z() != 0.0 ) zDir = m_MucMomentum.z() / fabs( m_MucMomentum.z() );
1128 float segPhi = 0.25 *
kPi * seg;
1131 if ( part == 1 &&
px *
cos( segPhi ) +
py *
sin( segPhi ) < 0.0 )
1139 m_MucMomentum.set(
px,
py,
pz );
1145 Hep3Vector phi_mdc, phi_muc;
1146 phi_mdc.set( m_MdcMomentum.x(), m_MdcMomentum.y(), 0 );
1147 phi_muc.set(
px,
py, 0 );
1148 double deltaPhi = phi_mdc.angle( phi_muc );
1160 float xInsct = 0.0, yInsct = 0.0, zInsct = 0.0, sigmax = 0.0, sigmay = 0.0, sigmaz = 0.0;
1161 float quad_x1 = 0.0, quad_y1 = 0.0, quad_z1 = 0.0, quad_x2 = 0.0, quad_y2 = 0.0,
1163 for (
int ihit = 0; ihit < m_pHits.size(); ihit++ )
1165 int igap = ( m_pHits[ihit] )->Gap();
1167 quad_x1, quad_y1, quad_z1, quad_x2, quad_y2, quad_z2 );
1172 m_distHits.push_back( dist_hit_track );
1176 if ( fittingMethod == 2 )
1179 Hep3Vector center = m_pHits[ihit]->GetCenterPos();
1180 int iPart = m_pHits[ihit]->Part();
1181 int iSeg = m_pHits[ihit]->Seg();
1182 int iGap = m_pHits[ihit]->Gap();
1183 float xHit, yHit, zHit = 0.;
1186 if ( iGap % 2 == 1 )
1189 yHit = sqrt( center.x() * center.x() + center.y() * center.y() );
1202 if ( iGap % 2 == 0 )
1214 float distance1 = fabs( xHit - quad_x1 ) / ( xHit - quad_x1 ) *
1215 sqrt( ( xHit - quad_x1 ) * ( xHit - quad_x1 ) +
1216 ( yHit - quad_y1 ) * ( yHit - quad_y1 ) );
1217 float distance2 = fabs( xHit - quad_x2 ) / ( xHit - quad_x2 ) *
1218 sqrt( ( xHit - quad_x2 ) * ( xHit - quad_x2 ) +
1219 ( yHit - quad_y2 ) * ( yHit - quad_y2 ) );
1221 float dist_quad = distance1;
1222 if ( fabs( distance1 ) > fabs( distance2 ) ) dist_quad = distance2;
1231 if ( quad_x1 == -9999 ) m_distHits_quad.push_back( -99 );
1232 else m_distHits_quad.push_back( dist_quad );
1238 for (
int ihit = 0; ihit < m_pHits.size(); ihit++ )
1240 m_distHits.push_back( -99 );
1241 m_distHits_quad.push_back( -99 );
1249 HepPoint3D initPos( startx - m_MucMomentum.x() /
momentum,
1250 starty - m_MucMomentum.y() /
momentum,
1251 startz - m_MucMomentum.z() /
momentum );
1254 for (
int igap = 0; igap < 9; igap++ )
1257 vector<float> intersect_x;
1258 vector<float> intersect_y;
1259 vector<float> intersect_z;
1262 float zx, zy, x0, y0;
1264 Hep3Vector mom_refit;
1268 if ( m_MucMomentum.z() != 0.0 ) zDir = m_MucMomentum.z() / fabs( m_MucMomentum.z() );
1269 float px_refit = zx * zDir;
1270 float py_refit = zy * zDir;
1271 float pz_refit = zDir;
1272 float segPhi = 0.25 *
kPi * seg;
1275 if ( part == 1 && px_refit *
cos( segPhi ) + py_refit *
sin( segPhi ) < 0.0 )
1282 mom_refit.setX( px_refit );
1283 mom_refit.setY( py_refit );
1284 mom_refit.setZ( pz_refit );
1287 else mom_refit = m_MucMomentum;
1289 HepPoint3D initPos_refit;
1292 float initPosx_refit, initPosy_refit, initPosz_refit;
1293 float sigmax_refit, sigmay_refit, sigmaz_refit;
1294 road3D.
Project( 0, zx, x0, zy, y0, initPosx_refit, initPosy_refit, initPosz_refit );
1295 initPos_refit.setX( initPosx_refit - mom_refit.x() /
momentum );
1296 initPos_refit.setY( initPosy_refit - mom_refit.y() /
momentum );
1297 initPos_refit.setZ( initPosz_refit - mom_refit.z() /
momentum );
1299 else initPos_refit = initPos;
1309 1, igap, initPos_refit, mom_refit, padID, intersect_x, intersect_y, intersect_z );
1314 vector<Identifier>::const_iterator mucid;
1316 for ( mucid = MuId.begin(); mucid != MuId.end(); mucid++, i++ )
1325 m_pExpectedHits.push_back( pHit );
1332 for (
int igap = 0; igap < 8; igap++ )
1335 vector<float> intersect_x;
1336 vector<float> intersect_y;
1337 vector<float> intersect_z;
1340 float zx, zy, x0, y0;
1343 Hep3Vector mom_refit;
1347 if ( m_MucMomentum.z() != 0.0 ) zDir = m_MucMomentum.z() / fabs( m_MucMomentum.z() );
1348 float px_refit = zx * zDir;
1349 float py_refit = zy * zDir;
1350 float pz_refit = zDir;
1351 float segPhi = 0.25 *
kPi * seg;
1354 if ( part == 1 && px_refit *
cos( segPhi ) + py_refit *
sin( segPhi ) < 0.0 )
1361 mom_refit.setX( px_refit );
1362 mom_refit.setY( py_refit );
1363 mom_refit.setZ( pz_refit );
1366 else mom_refit = m_MucMomentum;
1368 HepPoint3D initPos_refit;
1371 float initPosx_refit, initPosy_refit, initPosz_refit;
1372 float sigmax_refit, sigmay_refit, sigmaz_refit;
1373 road3D.
Project( 0, zx, x0, zy, y0, initPosx_refit, initPosy_refit, initPosz_refit );
1374 initPos_refit.setX( initPosx_refit - mom_refit.x() /
momentum );
1375 initPos_refit.setY( initPosy_refit - mom_refit.y() /
momentum );
1376 initPos_refit.setZ( initPosz_refit - mom_refit.z() /
momentum );
1378 else initPos_refit = initPos;
1384 vector<Identifier> MuId =
1386 intersect_x, intersect_y, intersect_z );
1388 vector<Identifier>::const_iterator mucid;
1390 for ( mucid = MuId.begin(); mucid != MuId.end(); mucid++, i++ )
1399 m_pExpectedHits.push_back( pHit );
1406 for (
int i = 0; i < m_pExpectedHits.size(); i++ )
1415 for (
int i = 0; i < m_pHits.size(); i++ )
1429 for (
int ihit = 0; ihit < m_pHits.size(); ihit++ )
1431 m_distHits.push_back( -99 );
1432 m_distHits_quad.push_back( -99 );