16#include <CLHEP/Vector/ThreeVector.h>
17#include <CLHEP/Geometry/Point3D.h>
19#include "Identifier/MucID.h"
20#include "MucGeomSvc/MucGeomSvc.h"
21#include "MucGeomSvc/MucConstant.h"
22#include "MucRecEvent/MucRec2DRoad.h"
23#include "MucRecEvent/MucRecLineFit.h"
24#include "MucRecEvent/MucRecQuadFit.h"
34 const int& fittingMethod)
35 : m_VertexPos(xVertex, yVertex, zVertex),
36 m_VertexSigma(0.0, 0.0, 0.0),
37 m_Part(part), m_Seg(seg), m_Orient(orient),
38 m_Chi2(0.0), m_DOF(0),
39 m_MaxHitsPerGap(0), m_LastGap(0), m_TotalHits(0),
42 m_pHits(0), m_fittingMethod(fittingMethod)
50 if (
this != &orig ) {
51 m_VertexPos = orig.m_VertexPos;
52 m_VertexSigma = orig.m_VertexSigma;
53 m_Index = orig.m_Index;
56 m_Orient = orig.m_Orient;
59 m_FitOK = orig.m_FitOK;
60 m_MaxHitsPerGap = orig.m_MaxHitsPerGap;
61 m_LastGap = orig.m_LastGap;
62 m_TotalHits = orig.m_TotalHits;
63 m_HitDistance = orig.m_HitDistance;
64 m_pHits = orig.m_pHits;
65 m_fittingMethod = orig.m_fittingMethod;
73 : m_VertexPos(source.m_VertexPos),
74 m_VertexSigma(source.m_VertexSigma),
75 m_Index(source.m_Index),
76 m_Part(source.m_Part), m_Seg(source.m_Seg), m_Orient(source.m_Orient),
77 m_Chi2(source.m_Chi2), m_DOF(source.m_DOF),
78 m_MaxHitsPerGap(source.m_MaxHitsPerGap),
79 m_LastGap(source.m_LastGap), m_TotalHits(source.m_TotalHits),
80 m_FitOK(source.m_FitOK),
81 m_HitDistance(source.m_HitDistance),
82 m_pHits(source.m_pHits),
83 m_fittingMethod(source.m_fittingMethod)
94 if (index >= 0) m_Index = index;
104 cout <<
"MucRec2DRoad::AttachHit-E1 null hit pointer!" << endl;
108 int gap = hit->
Gap();
111 cout <<
"MucRec2DRoad::AttachHit-W3 bad gap number = " << gap
118 for (
int i = 0; i < (int)m_pHits.size(); i++) {
119 if (m_pHits[i] == hit)
return;
121 m_pHits.push_back(hit);
131 float a, sa, b, sb, chi;
149 cout <<
"MucRec2DRoad::AttachHit-E1 null hit pointer!" << endl;
153 int gap = hit->
Gap();
156 cout <<
"MucRec2DRoad::AttachHit-W3 bad gap number = " << gap
163 for (
int i = 0; i < (int)m_pHits.size(); i++) {
164 if (m_pHits[i] == hit)
return;
166 m_pHits.push_back(hit);
182 m_MaxNSkippedGaps = numGaps;
191 float& sigmaIntercept,
196 if(m_pHits.size()>100){
197 cout<<
"MucRec2DRoad: too many hits in this track!"<<endl;
206 vector<MucRecHit*>::const_iterator iHit;
213 for (
int i = 0; i < m_pHits.size(); i++) {
216 for(
int j = 0; j < m_pHits.size(); j++){
219 if(m_pHits[i]->Part() == m_pHits[j]->Part() &&
220 m_pHits[i]->Seg() == m_pHits[j]->Seg() &&
221 m_pHits[i]->Gap() == m_pHits[j]->Gap() )
223 int deltaStrip = fabs(m_pHits[i]->Strip()- m_pHits[j]->Strip());
227 cout<<
"deltaStrip == 0 ? check it"<<endl;
230 weight[i] *= (deltaStrip+1) * (deltaStrip+1);
237 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
257 Hep3Vector center = (*iHit)->GetCenterPos();
258 Hep3Vector sigma = (*iHit)->GetCenterSigma();
262 if ( m_Orient == 0) {
263 px[npoints] = center.z();
264 py[npoints] = sqrt(center.x()*center.x()
265 + center.y()*center.y());
266 if(m_Seg==2) py[npoints] = center.y();
268 pw[npoints] = 4.0 * 1.0/(sigma.y()*sigma.y()) /
weight[npoints];
271 px[npoints] = center.x();
272 py[npoints] = center.y();
273 pw[npoints] = 4.0 * 1.0/(sigma.x()*sigma.x()) /
weight[npoints];
277 if ( m_Orient == 0) {
278 px[npoints] = center.z();
279 py[npoints] = center.y();
280 pw[npoints] = 4.0 * 1.0/(sigma.y()*sigma.y()) /
weight[npoints];
283 px[npoints] = center.z();
284 py[npoints] = center.x();
285 pw[npoints] = 4.0 * 1.0/(sigma.x()*sigma.x()) /
weight[npoints];
293 { cout<<
"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
327if (ndof < 0)
return -1;
331 if ( m_Orient == 0) {
332 px[npoints] = m_VertexPos.z();
333 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
334 + m_VertexPos.y()*m_VertexPos.y());
335 if(m_Seg==2) py[npoints] = m_VertexPos.y();
338 px[npoints] = m_VertexPos.x();
339 py[npoints] = m_VertexPos.y();
343 if ( m_Orient == 0) {
344 px[npoints] = m_VertexPos.z();
345 py[npoints] = m_VertexPos.y();
348 px[npoints] = m_VertexPos.z();
349 py[npoints] = m_VertexPos.x();
363 int status = fit.
LineFit(px, py, pw, npoints,
364 &slope, &intercept, &chisq,
365 &sigmaSlope, &sigmaIntercept);
368 float tempslope, tempintercept,tempchisq, tempsigmaslope, sigmaPos;
369 int status4 = fit.
LineFit(px, py, pw,m_Part,m_Seg,m_Orient, npoints,
370 &tempslope, &tempintercept, &tempchisq,
371 &tempsigmaslope, &sigmaPos);
374 float quad_a, quad_b, quad_c, sigmaquad_a, sigmaquad_b, sigmaquad_c, chisq_quad;
375 int whichhalf, status2;
377 if(m_fittingMethod == 2){
378 status2 = quadfit.
QuadFit(px, py, pw, npoints,
379 &quad_a, &quad_b, &quad_c, &whichhalf, &chisq_quad,
380 &sigmaquad_a, &sigmaquad_b, &sigmaquad_c);
385 if (slope > 1.0e10 || slope < -1.0e10) {
386 if (m_Seg > 4) slope *= -1.0;
389 m_SimpleSlope = slope;
390 m_SimpleSlopeSigma = sigmaSlope;
391 m_SimpleIntercept = intercept;
392 m_SimpleInterceptSigma = sigmaIntercept;
393 m_SimplePosSigma = sigmaPos;
394 m_SimpleChi2 = chisq;
396 m_SimpleFitOK = (status == 0) && (chisq < 1000.0);
397 m_QuadFitOK = (status2 == 1);
399 m_SimpleQuad_a = quad_a;
400 m_SimpleQuad_b = quad_b;
401 m_SimpleQuad_c = quad_c;
402 m_SimpleQuad_whichhalf = whichhalf;
403 m_SimpleQuad_aSigma = sigmaquad_a;
404 m_SimpleQuad_bSigma = sigmaquad_b;
405 m_SimpleQuad_cSigma = sigmaquad_c;
419 float& sigmaIntercept,
431 vector<MucRecHit*>::const_iterator iHit;
434 for(
int i = 0; i< 100; i++) {
439 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
441 if( (*iHit)->Gap()==currentgap )
continue;
443 Hep3Vector center = (*iHit)->GetCenterPos();
444 Hep3Vector sigma = (*iHit)->GetCenterSigma();
448 if ( m_Orient == 0) {
449 px[npoints] = center.z();
450 py[npoints] = sqrt(center.x()*center.x()
451 + center.y()*center.y());
452 if(m_Seg==2) py[npoints] = center.y();
454 pw[npoints] = 1.0/(sigma.y()*sigma.y())/pw2[npoints]/pw2[npoints];
457 px[npoints] = center.x();
458 py[npoints] = center.y();
459 pw[npoints] = 1.0/(sigma.x()*sigma.x())/pw2[npoints]/pw2[npoints];
463 if ( m_Orient == 0) {
464 px[npoints] = center.z();
465 py[npoints] = center.y();
466 pw[npoints] = 1.0/(sigma.y()*sigma.y())/pw2[npoints]/pw2[npoints];
469 px[npoints] = center.z();
470 py[npoints] = center.x();
471 pw[npoints] = 1.0/(sigma.x()*sigma.x())/pw2[npoints]/pw2[npoints];
480 { cout<<
"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
487 if (ndof < 0)
return -1;
491 if ( m_Orient == 0) {
492 px[npoints] = m_VertexPos.z();
493 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
494 + m_VertexPos.y()*m_VertexPos.y());
495 if(m_Seg==2) py[npoints] = m_VertexPos.y();
498 px[npoints] = m_VertexPos.x();
499 py[npoints] = m_VertexPos.y();
503 if ( m_Orient == 0) {
504 px[npoints] = m_VertexPos.z();
505 py[npoints] = m_VertexPos.y();
508 px[npoints] = m_VertexPos.z();
509 py[npoints] = m_VertexPos.x();
524int status = fit.
LineFit(px, py, pw, npoints,
525 &slope, &intercept, &chisq,
526 &sigmaSlope, &sigmaIntercept);
529float quad_a, quad_b, quad_c, sigmaquad_a, sigmaquad_b, sigmaquad_c, chisq_quad;
530int whichhalf, status2;
532if(m_fittingMethod == 2){
533 status2 = quadfit.
QuadFit(px, py, pw, npoints,
534 &quad_a, &quad_b, &quad_c, &whichhalf, &chisq_quad,
535 &sigmaquad_a, &sigmaquad_b, &sigmaquad_c);
540if (slope > 1.0e10 || slope < -1.0e10) {
541 if (m_Seg > 4) slope *= -1.0;
545 m_SimpleSlope = slope;
546 m_SimpleSlopeSigma = sigmaSlope;
547 m_SimpleIntercept = intercept;
548 m_SimpleInterceptSigma = sigmaIntercept;
550 m_SimpleChi2 = chisq;
552 m_SimpleFitOK = (status == 0) && (chisq < 1000.0);
553 m_QuadFitOK = (status2 == 1);
555 m_SimpleQuad_a = quad_a;
556 m_SimpleQuad_b = quad_b;
557 m_SimpleQuad_c = quad_c;
558 m_SimpleQuad_whichhalf = whichhalf;
559 m_SimpleQuad_aSigma = sigmaquad_a;
560 m_SimpleQuad_bSigma = sigmaquad_b;
561 m_SimpleQuad_cSigma = sigmaquad_c;
578 float& slope,
float& intercept,
579 float& sigmaSlope,
float& sigmaIntercept,
580 float& chisq,
int& ndof)
585 if (!m_SimpleFitOK) {
587 float a, sa, b, sb, chi;
619 vector<MucRecHit*>::const_iterator iHit;
627 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
630 Hep3Vector center = (*iHit)->GetCenterPos();
631 Hep3Vector sigma = (*iHit)->GetCenterSigma();
634 if ( m_Orient == 0) {
635 px[npoints] = center.z();
636 dx = px[npoints] - z;
637 py[npoints] = sqrt(center.x()*center.x()
638 + center.y()*center.y());
639 if(m_Seg==2) py[npoints] = center.y();
640 dy = py[npoints] - sqrt(
x*
x + y*y);
643 px[npoints] = center.x();
644 dx = px[npoints] -
x;
645 py[npoints] = center.y();
646 dy = py[npoints] - y;
650 if ( m_Orient == 0) {
651 px[npoints] = center.z();
652 dx = px[npoints] - z;
653 py[npoints] = center.y();
654 dy = py[npoints] - y;
657 px[npoints] = center.z();
658 dx = px[npoints] - z;
659 py[npoints] = center.x();
660 dy = py[npoints] -
x;
664 dr = sqrt(dx*dx + dy*dy);
676 { cout<<
"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
687 if ( m_Orient == 0) {
688 px[npoints] = m_VertexPos.z();
689 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
690 + m_VertexPos.y()*m_VertexPos.y());
691 if(m_Seg==2) py[npoints] = m_VertexPos.y();
694 px[npoints] = m_VertexPos.x();
695 py[npoints] = m_VertexPos.y();
699 if ( m_Orient == 0) {
700 px[npoints] = m_VertexPos.z();
701 py[npoints] = m_VertexPos.y();
704 px[npoints] = m_VertexPos.z();
705 py[npoints] = m_VertexPos.x();
719 status = fit.
LineFit(px, py, pw, npoints,
720 &slope, &intercept, &chisq,
721 &sigmaSlope, &sigmaIntercept);
735 float& x,
float& y,
float& z,
float& x2,
float& y2,
float& z2)
737 float sigmaX, sigmaY, sigmaZ;
739 x = 0.0; sigmaX = 0.0; x2 = 0.0;
740 y = 0.0; sigmaY = 0.0; y2 = 0.0;
741 z = 0.0; sigmaZ = 0.0; z2 = 0.0;
744 cout <<
"MucRec2DRoad::Project-E1 invalid gap = " << gap << endl;
749 float x0, y0, z0, sigmaX0, sigmaY0, sigmaZ0;
750 float phi = m_Seg*0.25*
kPi;
756 m_SimpleSlope*
cos(phi), m_SimpleSlope*
sin(phi), 1.0,
757 m_SimpleIntercept*
cos(phi),m_SimpleIntercept*
sin(phi), 0.0,
758 m_SimpleSlopeSigma, 0.0, 0.0,
759 m_SimpleInterceptSigma, 0.0, 0.0,
761 sigmaX0, sigmaY0, sigmaZ0);
763 if(m_SimpleSlope>10000){
765 m_SimpleSlope*
cos(phi), m_SimpleSlope*
sin(phi), 1.0,
766 0.0, 0.0, m_SimpleIntercept,
767 m_SimpleSlopeSigma, 0.0, 0.0,
768 m_SimpleInterceptSigma, 0.0, 0.0,
770 sigmaX0, sigmaY0, sigmaZ0);
777 1.0, m_SimpleSlope, 0.0,
778 0.0, m_SimpleIntercept, 0.0,
779 0.0, m_SimpleSlopeSigma, 0.0,
780 0.0, m_SimpleInterceptSigma, 0.0,
782 sigmaX0, sigmaY0, sigmaZ0);
790 m_SimpleSlope, m_SimpleSlope, 1.0,
791 0.0, m_SimpleIntercept, 0.0,
792 0.0, m_SimpleSlopeSigma, 0.0,
793 0.0, m_SimpleInterceptSigma, 0.0,
795 sigmaX0, sigmaY0, sigmaZ0);
799 m_SimpleSlope, m_SimpleSlope, 1.0,
800 m_SimpleIntercept, 0.0, 0.0,
801 m_SimpleSlopeSigma, 0.0, 0.0,
802 m_SimpleInterceptSigma, 0.0, 0.0,
804 sigmaX0, sigmaY0, sigmaZ0);
816 float a,b,sa,sb,chi2;
819 int status =
Fit(x0, y0, z0, a, b, sa, sb, chi2, ndof);
835 a*
cos(phi), a*
sin(phi), 1.0,
837 b*
cos(phi), b*
sin(phi), 0.0,
841 sigmaX, sigmaY, sigmaZ);
845 a*
cos(phi), a*
sin(phi), 1.0,
852 sigmaX, sigmaY, sigmaZ);
863 sigmaX, sigmaY, sigmaZ);
865 if(m_fittingMethod == 2 && m_QuadFitOK ){
867 float sa, sb, sc, chi2x;
int ydof;
int whichhalf;
871 10E30, 0.0, m_SimpleIntercept, 0.0,
874 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
876 sigmaX, sigmaY, sigmaZ);
891 sigmaX, sigmaY, sigmaZ);
900 sigmaX, sigmaY, sigmaZ);
955 vector<int> firedGap;
956 for ( gap = 0; gap < ngap; gap++) {
957 firedGap.push_back(0);
960 vector<MucRecHit*>::const_iterator iHit;
961 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
963 gap = (*iHit)->Gap();
968 for ( gap = 0; gap < ngap; gap++) {
969 count += firedGap[gap];
980 cout <<
"MucRec2DRoad::GetHitsPerGap-E1 invalid gap = " << gap << endl;
984 vector<MucRecHit*>::const_iterator iHit;
987 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
990 cout <<
"MucRec2DRoad::GetHitsPerGap()-E2 null hit pointer !" << endl;
994 if( gap == (*iHit)->Gap() ) hitsInGap += 1;
1006 cout <<
"MucRec2DRoad::HasHitInGap-E2 invalid gap = " << gap << endl;
1011 vector<MucRecHit*>::const_iterator iHit;
1013 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1015 if ( (*iHit)->Gap() == gap ) {
1033 vector<MucRecHit*>::const_iterator iHit1;
1034 vector<MucRecHit*>::const_iterator iHit2;
1037 for( iHit1 = m_pHits.begin(); iHit1 != m_pHits.end(); iHit1++){
1038 for( iHit2 = road2->m_pHits.begin();
1039 iHit2 != road2->m_pHits.end(); iHit2++){
1043 if ( (hit1 != 0) && (hit2 != 0) ) {
1070 if ( (!m_SimpleFitOK) || (m_SimpleDOF < 0) ) {
1073 else if (m_SimpleDOF == 0) {
1077 return (m_SimpleChi2 / m_SimpleDOF);
1084 float& sigmaSlope,
float& sigmaIntercept,
1085 float& chisq,
int& ndof)
const
1087 slope = m_SimpleSlope;
1088 intercept = m_SimpleIntercept;
1089 sigmaSlope = m_SimpleSlopeSigma;
1090 sigmaIntercept = m_SimpleInterceptSigma;
1091 chisq = m_SimpleChi2;
1101 possigma = m_SimplePosSigma;
1109 float& sigmaa,
float& sigmab,
float& sigmac,
1110 float& chisq,
int& ndof)
const
1115 whichhalf = m_SimpleQuad_whichhalf;
1117 sigmaa = m_SimpleQuad_aSigma;
1118 sigmab = m_SimpleQuad_bSigma;
1119 sigmac = m_SimpleQuad_cSigma;
1121 chisq = m_SimpleChi2;
1134 cout <<
"MucRec2DRoad::Hit-E1 invalid gap = " << gap << endl;
1138 vector<MucRecHit*>::const_iterator iHit;
1140 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1142 if ( (*iHit)->Gap() == gap) {
1158 cout <<
"MucRec2DRoad::GetHitDistance-E1 null hit pointer!" << endl;
1162 int gap = hit->
Gap();
1164 cout <<
"MucRec2DRoad::HitDistance-W2 bad gap number = " << gap << endl;
1170 cout <<
"MucRec2DRoad::GetHitDistance-W3 "
1171 <<
" hit has wrong orientation = "
1184 float delta, delta1,delta2;
1191 Project(gap, x0, y0, z0, x2, y2, z2);
1196 if(x0==y0&&x0==z0&&x0==0) {x0+=-9999;y0+=-9999;z0+=-9999;}
1197 if(x2==y2&&x2==z2&&x2==0) {x2+=-9999;y2+=-9999;z2+=-9999;}
1207 if ( m_Part == 0 ) {
1208 if ( m_Orient == 0 ) {
1209 delta1 = fabs( sl.y() - rl.y() );
1210 delta2= fabs( s_2l.y() - rl.y() );
1213 delta1 = fabs( sl.x() - rl.x() );
1214 delta2= fabs( s_2l.x() - rl.x() );
1218 if ( m_Orient == 0 ) {
1219 delta1 = fabs( sl.y() - rl.y() );
1220 delta2= fabs( s_2l.y() - rl.y() );
1223 delta1 = fabs( sl.x() - rl.x() );
1224 delta2= fabs( s_2l.x() - rl.x() );
1233 if(delta1 < delta2)
return delta1;
1242 cout <<
"MucRec2DRoad::GetSearchWindowSize-E1 invalid gap = " << gap << endl;
1253 float x1, y1, z1, x2, y2, z2, dx, dy, dr;
1254 float sigmaX, sigmaY, sigmaZ;
1257 if (m_Orient == 0) {
1259 1.0, m_SimpleSlope, 0.0,
1260 0.0, m_SimpleIntercept, 0.0,
1261 0.0, m_SimpleSlopeSigma, 0.0,
1262 0.0, m_SimpleInterceptSigma, 0.0,
1264 sigmaX, sigmaY, sigmaZ);
1266 1.0, m_SimpleSlope, 0.0,
1267 0.0, m_SimpleIntercept, 0.0,
1268 0.0, m_SimpleSlopeSigma, 0.0,
1269 0.0, m_SimpleInterceptSigma, 0.0,
1271 sigmaX, sigmaY, sigmaZ);
1273 dy = sqrt(x2*x2 + y2*y2) - sqrt(x1*x1 + y1*y1);
1277 m_SimpleSlope, 0.0, 1.0,
1278 m_SimpleIntercept, 0.0, 0.0,
1279 m_SimpleSlopeSigma, 0.0, 0.0,
1280 m_SimpleInterceptSigma, 0.0, 0.0,
1282 sigmaX, sigmaY, sigmaZ);
1284 m_SimpleSlope, 0.0, 1.0,
1285 m_SimpleIntercept, 0.0, 0.0,
1286 m_SimpleSlopeSigma, 0.0, 0.0,
1287 m_SimpleInterceptSigma, 0.0, 0.0,
1289 sigmaX, sigmaY, sigmaZ);
1295 if (m_Orient == 0) {
1297 0.0, m_SimpleSlope, 1.0,
1298 0.0, m_SimpleIntercept, 0.0,
1299 0.0, m_SimpleSlopeSigma, 0.0,
1300 0.0, m_SimpleInterceptSigma, 0.0,
1302 sigmaX, sigmaY, sigmaZ);
1304 0.0, m_SimpleSlope, 1.0,
1305 0.0, m_SimpleIntercept, 0.0,
1306 0.0, m_SimpleSlopeSigma, 0.0,
1307 0.0, m_SimpleInterceptSigma, 0.0,
1309 sigmaX, sigmaY, sigmaZ);
1315 m_SimpleSlope, 0.0, 1.0,
1316 m_SimpleIntercept, 0.0, 0.0,
1317 m_SimpleSlopeSigma, 0.0, 0.0,
1318 m_SimpleInterceptSigma, 0.0, 0.0,
1320 sigmaX, sigmaY, sigmaZ);
1322 m_SimpleSlope, 0.0, 1.0,
1323 m_SimpleIntercept, 0.0, 0.0,
1324 m_SimpleSlopeSigma, 0.0, 0.0,
1325 m_SimpleInterceptSigma, 0.0, 0.0,
1327 sigmaX, sigmaY, sigmaZ);
1333 dr = sqrt(dx*dx + dy*dy);
1340MucRec2DRoad::CountHits()
1342 m_MaxHitsPerGap = 0;
1346 vector<MucRecHit*>::const_iterator iHit;
1348 vector<int> HitsPerGap;
1349 for (
int gap = 0; gap < ngap; gap++) {
1350 HitsPerGap.push_back(0);
1354 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1356 cout <<
"MucRec2DRoad::CountHits()-E1 null hit pointer !" << endl;
1360 int gap = (*iHit)->Gap();
1386 for (
int gap = 0; gap < StopGap; gap++) {
1387 m_TotalHits += HitsPerGap[gap];
1388 if(m_MaxHitsPerGap < HitsPerGap[gap]) m_MaxHitsPerGap = HitsPerGap[gap];
1389 if(HitsPerGap[gap] > 0) m_LastGap = gap;
1398 vector<MucRecHit*>::const_iterator iHit;
1399 bool HitExist =
false;
1406 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++ ) {
1408 if ( (*iHit)->GetID() ==
id ) HitExist =
true;
1410 if (HitExist)
break;
1420 vector<Identifier> idCon;
1422 vector<MucRecHit*>::const_iterator iHit;
1423 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1426 idCon.push_back(
id);
1451 vector<MucRecHit*>::const_iterator iHit;
1452 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1455 (*iHit)->GetStrip()->GetCenterPos(xl, yl, zl);
1457 HepPoint3D vg = (*iHit)->GetGap()->TransformToGlobal(vl);
1459 cout <<
" orient " << m_Orient
1460 <<
" part " << (*iHit)->Part()
1461 <<
" seg " << (*iHit)->Seg()
1462 <<
" gap " << (*iHit)->Gap()
1463 <<
" strip " << (*iHit)->Strip()
1464 <<
" pos (" << vg.x() <<
", " << vg.y() <<
", " << vg.z() <<
")"
HepGeom::Point3D< double > HepPoint3D
double sin(const BesAngle a)
double cos(const BesAngle a)
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
const double muckInfinity
HepPoint3D TransformToGap(const HepPoint3D gPoint) const
Transform a point from global coordinate to gap coordinate.
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
void FindIntersection(const int part, const int seg, const int gap, const float vx, const float vy, const float vz, const float x0, const float y0, const float z0, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
static value_type getGapMax()
static value_type getGapNum(int part)
~MucRec2DRoad()
Destructor.
int Fit(const float &x, const float &y, const float &z, float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof)
Fit (with weights) the hit center to a straight line.
vector< Identifier > GetHitsID() const
Get indices of all hits in the road.
int GetNGapsWithHits() const
How many gaps provide hits attached to this road?
bool HasHitInGap(const int &gap) const
Does this road contain any hits in the given gap?
void PrintHitsInfo() const
Print Hits Infomation.
int GetTotalHits() const
How many hits in all does this road contain?
int GetHitsPerGap(const int &gap) const
How many hits per gap does this road contain?
float GetReducedChiSquare() const
Chi-square parameter (per degree of freedom) of the trajectory fit.
void SetIndex(const int &index)
Set the index for this road.
void Project(const int &gap, float &x, float &y, float &z, float &x2, float &y2, float &z2)
Where does the trajectory of this road intersect a specific gap?
void GetVertexPos(float &x, float &y, float &z) const
Position of the vertex point.
void GetPosSigma(float &possigma) const
float WindowFunc(const float &chisq, const float &distance) const
MucRec2DRoad & operator=(const MucRec2DRoad &orig)
Assignment constructor.
float GetSearchWindowSize(const int &gap) const
Determine the size of the search window in the given gap.
float GetIntercept() const
Intercept of trajectory.
void AttachHit(MucRecHit *hit)
Attach the given hit to this road.
MucRec2DRoad(const int &part=0, const int &seg=0, const int &orient=0, const float &xVertex=0.0, const float &yVertex=0.0, const float &zVertex=0.0, const int &fittingMethod=0)
Constructor.
int GetMaxHitsPerGap() const
How many hits were attached in the gap with the most attached hits?
int GetLastGap() const
Which gap is the last one with hits attached to this road?
void AttachHitNoFit(MucRecHit *hit)
Attach the given hit to this road, but not fit this road.
float GetSlope() const
Slope of trajectory.
bool HasHit(MucRecHit *hit) const
Does the hit exist in the road .
int GetNSharedHits(const MucRec2DRoad *road) const
How many hits do two roads share?
void SetMaxNSkippedGaps(const int &nGaps)
int GetPart() const
In which part was this road found?
int SimpleFit(float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof)
Calculate the best-fit straight line with "simple" weights.
float GetHitDistance(const MucRecHit *hit)
Distance to a hit.
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
int GetIndex() const
A unique identifier for this road in the current event.
void GetSimpleFitParams(float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof) const
Get the parameters from the simple fit.
vector< MucRecHit * > GetHits() const
float WeightFunc(const float &chisq, const float &distance) const
int GetSeg() const
In which segment was this road found?
int GetOrient() const
In which orientation was this road found?
MucRecHit * GetHit(const int &gap) const
Get a pointer to the first found hit attached in a particular gap.
int SimpleFitNoCurrentGap(int currentgap, float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof)
Calculate the best-fit straight line with "simple" weights. not use current gap!!!
MucGeoGap * GetGap() const
Get geometry data for the gap containing this hit.
Hep3Vector GetCenterPos() const
Get Center position of the strip (global coords).
Identifier GetID() const
Get soft identifier of this hit.
int LineFit(float x[], float y[], float w[], int n, float *a, float *b, float *chisq, float *siga, float *sigb)
int QuadFit(float x[], float y[], float w[], int n, float *a, float *b, float *c, int *half, float *chisq, float *siga, float *sigb, float *sigc)