BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
MucRec2DRoad Class Reference

#include <MucRec2DRoad.h>

+ Inheritance diagram for MucRec2DRoad:

Public Member Functions

 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.
 
MucRec2DRoadoperator= (const MucRec2DRoad &orig)
 Assignment constructor.
 
 MucRec2DRoad (const MucRec2DRoad &source)
 Copy constructor.
 
 ~MucRec2DRoad ()
 Destructor.
 
void SetIndex (const int &index)
 Set the index for this road.
 
void AttachHit (MucRecHit *hit)
 Attach the given hit to this road.
 
void AttachHitNoFit (MucRecHit *hit)
 Attach the given hit to this road, but not fit this road.
 
void SetMaxNSkippedGaps (const int &nGaps)
 
int SimpleFit (float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof)
 Calculate the best-fit straight line with "simple" weights.
 
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!!!
 
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.
 
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?
 
float WeightFunc (const float &chisq, const float &distance) const
 
float WindowFunc (const float &chisq, const float &distance) const
 
int GetIndex () const
 A unique identifier for this road in the current event.
 
int GetPart () const
 In which part was this road found?
 
int GetSeg () const
 In which segment was this road found?
 
int GetOrient () const
 In which orientation was this road found?
 
void GetVertexPos (float &x, float &y, float &z) const
 Position of the vertex point.
 
int GetLastGap () const
 Which gap is the last one with hits attached to this road?
 
int GetNGapsWithHits () const
 How many gaps provide hits attached to this road?
 
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?
 
int GetMaxHitsPerGap () const
 How many hits were attached in the gap with the most attached hits?
 
bool HasHitInGap (const int &gap) const
 Does this road contain any hits in the given gap?
 
int GetNSharedHits (const MucRec2DRoad *road) const
 How many hits do two roads share?
 
float GetSlope () const
 Slope of trajectory.
 
float GetIntercept () const
 Intercept of trajectory.
 
int GetDegreesOfFreedom () const
 How many degrees of freedom in the trajectory fit?
 
float GetReducedChiSquare () const
 Chi-square parameter (per degree of freedom) of the trajectory fit.
 
void GetSimpleFitParams (float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof) const
 Get the parameters from the simple fit.
 
void GetSimpleFitParams (float &a, float &b, float &c, int &whichhalf, float &sigmaa, float &sigmab, float &sigmac, float &chisq, int &ndof) const
 Get the parameters from the simple quad fit.
 
bool GetQuadFitOk ()
 
void GetPosSigma (float &possigma) const
 
MucRecHitGetHit (const int &gap) const
 Get a pointer to the first found hit attached in a particular gap.
 
float GetHitDistance (const MucRecHit *hit)
 Distance to a hit.
 
float GetSearchWindowSize (const int &gap) const
 Determine the size of the search window in the given gap.
 
bool HasHit (MucRecHit *hit) const
 Does the hit exist in the road .
 
vector< IdentifierGetHitsID () const
 Get indices of all hits in the road.
 
vector< MucRecHit * > GetHits () const
 
void PrintHitsInfo () const
 Print Hits Infomation.
 

Detailed Description

Describes a "two-dimensional" road found in the muon chamber. part and orient decides dimension of the road. part orient dimension 1 0 Z-R 1 1 Phi-R 0,2 0 Y-Z 0,2 1 X-Z A full "three-dimensional" road is composed of two 2D roads with different orients on the same part.

Author
Zhengyun You \URL{youzy.nosp@m.@hep.nosp@m..pku..nosp@m.cn}

Definition at line 38 of file MucRec2DRoad.h.

Constructor & Destructor Documentation

◆ MucRec2DRoad() [1/2]

MucRec2DRoad::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.

Definition at line 28 of file MucRec2DRoad.cxx.

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),
40 m_FitOK(false), m_QuadFitOK(false),
41 m_HitDistance(5, float(muckInfinity)),
42 m_pHits(0), m_fittingMethod(fittingMethod)
43{ }
const double muckInfinity

◆ MucRec2DRoad() [2/2]

MucRec2DRoad::MucRec2DRoad ( const MucRec2DRoad source)

Copy constructor.

Definition at line 72 of file MucRec2DRoad.cxx.

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)
84{ }

◆ ~MucRec2DRoad()

MucRec2DRoad::~MucRec2DRoad ( )

Destructor.

Definition at line 87 of file MucRec2DRoad.cxx.

88{ }

Member Function Documentation

◆ AttachHit()

void MucRec2DRoad::AttachHit ( MucRecHit hit)

Attach the given hit to this road.

Definition at line 100 of file MucRec2DRoad.cxx.

101{
102 // cout << "MucRec2DRoad::AttachHit-I0 hit = " << hit << endl;
103 if (!hit) {
104 cout << "MucRec2DRoad::AttachHit-E1 null hit pointer!" << endl;
105 return ;
106 }
107
108 int gap = hit->Gap();
109 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
110 // The gap number of the hit is out of range.
111 cout << "MucRec2DRoad::AttachHit-W3 bad gap number = " << gap
112 << endl;
113 return;
114 }
115
116 // Attach the hit to the road.
117 //bool hitExist = false;
118 for (int i = 0; i < (int)m_pHits.size(); i++) {
119 if (m_pHits[i] == hit) return;
120 }
121 m_pHits.push_back(hit);
122 //cout << "before Count " << m_pHits.size() << endl;
123 // m_HitDistance[gap] = dX;
124
125 // Now recalculate the total number of hits and the max. number of
126 // hits per gap.
127 CountHits();
128 //cout << "after Count " << m_pHits.size() << endl;
129
130 // Redo the "simple" least-squares fit to the positions ...
131 float a, sa, b, sb, chi;
132 int n;
133 int status = SimpleFit(a, b, sa, sb, chi, n);
134 if (status < 0) {
135 //cout << "MucRec2DRoad::AttachHit-E5 simple fit fail status = " << status << endl;
136 }
137
138 //cout << "Hit center = " << hit->GetCenterPos() << endl;
139 //cout << "After attach hit, slope = " << a << " intercept = " << b << endl;
140}
const Int_t n
static value_type getGapMax()
Definition: MucID.cxx:195
int SimpleFit(float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof)
Calculate the best-fit straight line with "simple" weights.
int Gap() const
Get Gap.
Definition: MucRecHit.h:77

Referenced by MucRecRoadFinder::execute(), and RecMucTrack::LineFit().

◆ AttachHitNoFit()

void MucRec2DRoad::AttachHitNoFit ( MucRecHit hit)

Attach the given hit to this road, but not fit this road.

Definition at line 145 of file MucRec2DRoad.cxx.

146{
147 // cout << "MucRec2DRoad::AttachHit-I0 hit = " << hit << endl;
148 if (!hit) {
149 cout << "MucRec2DRoad::AttachHit-E1 null hit pointer!" << endl;
150 return ;
151 }
152
153 int gap = hit->Gap();
154 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
155 // The gap number of the hit is out of range.
156 cout << "MucRec2DRoad::AttachHit-W3 bad gap number = " << gap
157 << endl;
158 return;
159 }
160
161 // Attach the hit to the road.
162 //bool hitExist = false;
163 for (int i = 0; i < (int)m_pHits.size(); i++) {
164 if (m_pHits[i] == hit) return;
165 }
166 m_pHits.push_back(hit);
167 //cout << "before Count " << m_pHits.size() << endl;
168 // m_HitDistance[gap] = dX;
169
170 // Now recalculate the total number of hits and the max. number of
171 // hits per gap.
172 CountHits();
173 //cout << "after Count " << m_pHits.size() << endl;
174
175}

Referenced by MucRecRoadFinder::execute().

◆ Fit()

int MucRec2DRoad::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.

Definition at line 570 of file MucRec2DRoad.cxx.

576{
577 int status;
578
579 // If the "simple" fit has not been done yet, do it now.
580 if (!m_SimpleFitOK) {
581 // Least-squares fit to the positions ...
582 float a, sa, b, sb, chi;
583 int n;
584 status = SimpleFit(a, b, sa, sb, chi, n);
585 if (status < 0) {
586 //cout << "MucRec2DRoad::Fit-E2 simple fit fail status = "
587 // << status << endl;
588 return status;
589 }
590 }
591
592 // Assign to temporary arrays to be used in fit.
593 float px[100];
594 float py[100];
595 float pw[100];
596 int npoints = 0;
597 float dx, dy, dr;
598
599
600 // include vertex point when do the fancy fitting
601 //if (m_Orient == kHORIZ) {
602 // px[npoints] = m_VertexPos.y();
603 // dx = px[npoints] - y;
604 //} else {
605 // px[npoints] = m_VertexPos.x();
606 // dx = px[npoints] - x;
607 //}
608 //pz[npoints] = m_VertexPos.z();
609 //dz = pz[npoints] - z;
610 //dr = sqrt(dx*dx + dz*dz);
611 //pw[npoints] = WeightFunc(m_SimpleChi2,dr);
612 //npoints++;
613
614 vector<MucRecHit*>::const_iterator iHit;
615
616 // Determine the weights based on the chi-square of the fit
617 // (the scatter of the points should be roughly related to the
618 // momentum) and the distance from the center to the estimated
619 // location.
620
621 //cout << m_pHits.size() << endl;
622 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
623 if (*iHit) { // Check for a null pointer.
624
625 Hep3Vector center = (*iHit)->GetCenterPos();
626 Hep3Vector sigma = (*iHit)->GetCenterSigma();
627
628 if (m_Part == 1) { // change from 0 to 1 at 2006.11.30
629 if ( m_Orient == 0) {
630 px[npoints] = center.z();
631 dx = px[npoints] - z;
632 py[npoints] = sqrt(center.x()*center.x()
633 + center.y()*center.y());
634 if(m_Seg==2) py[npoints] = center.y(); //deal with seg2 seperately! because there is a hole here. 2006.11.9
635 dy = py[npoints] - sqrt(x*x + y*y);
636 }
637 else {
638 px[npoints] = center.x();
639 dx = px[npoints] - x;
640 py[npoints] = center.y();
641 dy = py[npoints] - y;
642 }
643 }
644 else {
645 if ( m_Orient == 0) {
646 px[npoints] = center.z();
647 dx = px[npoints] - z;
648 py[npoints] = center.y();
649 dy = py[npoints] - y;
650 }
651 else {
652 px[npoints] = center.z();
653 dx = px[npoints] - z;
654 py[npoints] = center.x();
655 dy = py[npoints] - x;
656 }
657 }
658
659 dr = sqrt(dx*dx + dy*dy);
660 pw[npoints] = WeightFunc(m_SimpleChi2, dr);
661 //pw[npoints] = WeightFunc(m_SimpleChi2,dr);
662
663 // cout << " " << npoints << " "
664 // << px[npoints] << " " << py[npoints] << " " << pw[npoints]
665 // << " " << dx << " " << dy << " " << dr
666 // << endl;
667
668 npoints++;
669
670 if(npoints > 99)
671 { cout<<"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
672 return -1;
673 }
674
675 }
676 }
677
678 // Refit ...
679 ndof = npoints - 2;
680 if (npoints == 1) {
681 if (m_Part == 1) { // change from 0 to 1 at 2006.11.30
682 if ( m_Orient == 0) {
683 px[npoints] = m_VertexPos.z();
684 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
685 + m_VertexPos.y()*m_VertexPos.y());
686 if(m_Seg==2) py[npoints] = m_VertexPos.y();
687 }
688 else {
689 px[npoints] = m_VertexPos.x();
690 py[npoints] = m_VertexPos.y();
691 }
692 }
693 else {
694 if ( m_Orient == 0) {
695 px[npoints] = m_VertexPos.z();
696 py[npoints] = m_VertexPos.y();
697 }
698 else {
699 px[npoints] = m_VertexPos.z();
700 py[npoints] = m_VertexPos.x();
701 }
702 }
703 pw[npoints] = 1.0;
704 npoints++;
705 }
706 else {
707 if (npoints == 0) {
708 return -1;
709 }
710 }
711
712 MucRecLineFit fit;
713 //cout << "npoints " << npoints << endl;
714 status = fit.LineFit(px, py, pw, npoints,
715 &slope, &intercept, &chisq,
716 &sigmaSlope, &sigmaIntercept);
717 m_DOF = ndof;
718 m_Chi2 = chisq;
719
720 if (status < 0) {
721 //cout << "MucRec2DRoad::Fit-E3 fit fail status = " << status << endl;
722 }
723
724 return status;
725}
Double_t x[10]
float WeightFunc(const float &chisq, const float &distance) const
int LineFit(float x[], float y[], float w[], int n, float *a, float *b, float *chisq, float *siga, float *sigb)

Referenced by Project().

◆ GetDegreesOfFreedom()

int MucRec2DRoad::GetDegreesOfFreedom ( ) const

How many degrees of freedom in the trajectory fit?

Definition at line 1059 of file MucRec2DRoad.cxx.

1059{ return m_SimpleDOF; }

Referenced by MucRecRoadFinder::execute(), and MucRec3DRoad::MucRec3DRoad().

◆ GetHit()

MucRecHit * MucRec2DRoad::GetHit ( const int &  gap) const

Get a pointer to the first found hit attached in a particular gap.

Definition at line 1126 of file MucRec2DRoad.cxx.

1127{
1128 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
1129 cout << "MucRec2DRoad::Hit-E1 invalid gap = " << gap << endl;
1130 return 0;
1131 }
1132
1133 vector<MucRecHit*>::const_iterator iHit;
1134
1135 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1136 if (*iHit) { // Check for a null pointer.
1137 if ( (*iHit)->Gap() == gap) {
1138 return (*iHit);
1139 }
1140 }
1141 }
1142
1143 return 0L;
1144}

Referenced by MucRec3DRoad::GetHit(), and MucRec3DRoad::MucRec3DRoad().

◆ GetHitDistance()

float MucRec2DRoad::GetHitDistance ( const MucRecHit hit)

Distance to a hit.

Definition at line 1149 of file MucRec2DRoad.cxx.

1150{
1151 // Use straight-line projection?
1152 if (!hit) {
1153 cout << "MucRec2DRoad::GetHitDistance-E1 null hit pointer!" << endl;
1154 return muckInfinity;
1155 }
1156
1157 int gap = hit->Gap();
1158 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
1159 cout << "MucRec2DRoad::HitDistance-W2 bad gap number = " << gap << endl;
1160 return muckInfinity;
1161 }
1162
1163 if ( hit->GetGap()->Orient() != m_Orient) {
1164 // The orientation of the hit is different from that of the road.
1165 cout << "MucRec2DRoad::GetHitDistance-W3 "
1166 << " hit has wrong orientation = "
1167 << hit->GetGap()->Orient()
1168 << endl;
1169 return muckInfinity;
1170 }
1171
1172 HepPoint3D r = hit->GetCenterPos();
1173 HepPoint3D rl = hit->GetGap()->TransformToGap(r);
1174 // cout << "hit center " << r << endl;
1175 // cout << "hit center local " << rl << endl;
1176
1177 // Determine the projection point of the "simple" fit to the desired gap.
1178 // FIXME(?): need to use fit with fancy weights instead?
1179 float delta, delta1,delta2;
1180 float x0, y0, z0;
1181 float x2, y2, z2;
1182 //float sigmaX0, sigmaY0, sigmaZ0;
1183
1184 //cout << "y:x = " << m_SimpleSlope << endl;
1185
1186 Project(gap, x0, y0, z0, x2, y2, z2);
1187 // cout << " gap = " << gap << " x0 = " << x0
1188 // << " y0 = " << y0 << " z0 = " << z0
1189 // << endl;
1190
1191 if(x0==y0&&x0==z0&&x0==0) {x0+=-9999;y0+=-9999;z0+=-9999;}//cout<<"wrong intersection"<<endl;}
1192 if(x2==y2&&x2==z2&&x2==0) {x2+=-9999;y2+=-9999;z2+=-9999;}//cout<<"wrong intersection"<<endl;} //wrong intersection!!!
1193 HepPoint3D s = HepPoint3D(x0, y0, z0);
1194 HepPoint3D s_2 = HepPoint3D(x2, y2, z2);
1195 HepPoint3D sl = hit->GetGap()->TransformToGap(s);
1196 HepPoint3D s_2l = hit->GetGap()->TransformToGap(s_2);
1197 //cout << "project center " << s << endl;
1198
1199// cout << "project center local sl= " << sl << endl;
1200// cout << "project center local sl= " << s_2l << endl;
1201// cout << "project center local rl= " << rl << endl;
1202 if ( m_Part == 0 ) {
1203 if ( m_Orient == 0 ) {
1204 delta1 = fabs( sl.y() - rl.y() );
1205 delta2= fabs( s_2l.y() - rl.y() );
1206 }
1207 else {
1208 delta1 = fabs( sl.x() - rl.x() );
1209 delta2= fabs( s_2l.x() - rl.x() );
1210 }
1211 }
1212 else {
1213 if ( m_Orient == 0 ) {
1214 delta1 = fabs( sl.y() - rl.y() );
1215 delta2= fabs( s_2l.y() - rl.y() );
1216 }
1217 else {
1218 delta1 = fabs( sl.x() - rl.x() );
1219 delta2= fabs( s_2l.x() - rl.x() );
1220 }
1221 }
1222// if(which==0) {
1223// if(delta1<delta2)delta = delta1;
1224// else delta = delta2;
1225// }
1226 //cout<<"which = "<<which<<" distance = "<<delta1<<" "<<delta2<<endl;
1227
1228 if(delta1 < delta2) return delta1;
1229 else return delta2;
1230}
HepGeom::Point3D< double > HepPoint3D
Definition: Gam4pikp.cxx:37
XmlRpcServer s
Definition: HelloServer.cpp:11
HepPoint3D TransformToGap(const HepPoint3D gPoint) const
Transform a point from global coordinate to gap coordinate.
Definition: MucGeoGap.cxx:627
int Orient() const
Definition: MucGeoGap.h:108
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?
MucGeoGap * GetGap() const
Get geometry data for the gap containing this hit.
Definition: MucRecHit.h:83
Hep3Vector GetCenterPos() const
Get Center position of the strip (global coords).
Definition: MucRecHit.cxx:104

Referenced by MucRecRoadFinder::execute(), and MucRec3DRoad::MucRec3DRoad().

◆ GetHits()

vector< MucRecHit * > MucRec2DRoad::GetHits ( ) const

Definition at line 1434 of file MucRec2DRoad.cxx.

1435{
1436return m_pHits;
1437
1438}

Referenced by MucRecRoadFinder::execute().

◆ GetHitsID()

vector< Identifier > MucRec2DRoad::GetHitsID ( ) const

Get indices of all hits in the road.

Definition at line 1413 of file MucRec2DRoad.cxx.

1414{
1415 vector<Identifier> idCon;
1416
1417 vector<MucRecHit*>::const_iterator iHit;
1418 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1419 if (*iHit) { // Check for a null pointer.
1420 Identifier id = (*iHit)->GetID();
1421 idCon.push_back(id);
1422 /*
1423 cout << " MucRec2DRoad::HitIndices gap orientation twopack= "
1424 << (*iHit)->ChannelID().Plane() << " "
1425 << (*iHit)->ChannelID().Orient() << " "
1426 << (*iHit)->ChannelID().TwoPack() << endl;
1427 */
1428 }
1429 }
1430 return idCon;
1431}

Referenced by MucRec3DRoad::GetHitsID().

◆ GetHitsPerGap()

int MucRec2DRoad::GetHitsPerGap ( const int &  gap) const

How many hits per gap does this road contain?

Definition at line 972 of file MucRec2DRoad.cxx.

973{
974 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
975 cout << "MucRec2DRoad::GetHitsPerGap-E1 invalid gap = " << gap << endl;
976 return 0;
977 }
978
979 vector<MucRecHit*>::const_iterator iHit;
980 int hitsInGap = 0;
981
982 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
983
984 if ( !(*iHit) ) {
985 cout << "MucRec2DRoad::GetHitsPerGap()-E2 null hit pointer !" << endl;
986 return 0;
987 }
988 else {
989 if( gap == (*iHit)->Gap() ) hitsInGap += 1;
990 }
991 }
992
993 return hitsInGap;
994}

Referenced by MucRec3DRoad::GetHitsPerGap(), and MucRec3DRoad::GetNGapsWithHits().

◆ GetIndex()

int MucRec2DRoad::GetIndex ( ) const

A unique identifier for this road in the current event.

Definition at line 904 of file MucRec2DRoad.cxx.

905{
906 return m_Index;
907}

◆ GetIntercept()

float MucRec2DRoad::GetIntercept ( ) const

Intercept of trajectory.

Definition at line 1055 of file MucRec2DRoad.cxx.

1055{ return m_SimpleIntercept; }

Referenced by MucRecRoadFinder::execute(), and RecMucTrack::LineFit().

◆ GetLastGap()

int MucRec2DRoad::GetLastGap ( ) const

Which gap is the last one with hits attached to this road?

Definition at line 934 of file MucRec2DRoad.cxx.

934{ return m_LastGap; }

Referenced by MucRecRoadFinder::execute(), MucRec3DRoad::GetLastGapDelta(), and MucRec3DRoad::MucRec3DRoad().

◆ GetMaxHitsPerGap()

int MucRec2DRoad::GetMaxHitsPerGap ( ) const

How many hits were attached in the gap with the most attached hits?

Definition at line 938 of file MucRec2DRoad.cxx.

938{ return m_MaxHitsPerGap; }

Referenced by MucRec3DRoad::GetMaxHitsPerGap().

◆ GetNGapsWithHits()

int MucRec2DRoad::GetNGapsWithHits ( ) const

How many gaps provide hits attached to this road?

Definition at line 946 of file MucRec2DRoad.cxx.

947{
948 const int ngap = (int)MucID::getGapMax();
949 int gap, count = 0;
950 vector<int> firedGap;
951 for ( gap = 0; gap < ngap; gap++) {
952 firedGap.push_back(0);
953 }
954
955 vector<MucRecHit*>::const_iterator iHit;
956 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
957 if (*iHit) { // Check for a null pointer.
958 gap = (*iHit)->Gap();
959 firedGap[gap] = 1;
960 }
961 }
962
963 for ( gap = 0; gap < ngap; gap++) {
964 count += firedGap[gap];
965 }
966
967 return count;
968}
uint32_t count(const node_t &list)
Definition: node.cxx:42

Referenced by MucRecRoadFinder::execute().

◆ GetNSharedHits()

int MucRec2DRoad::GetNSharedHits ( const MucRec2DRoad road) const

How many hits do two roads share?

Definition at line 1021 of file MucRec2DRoad.cxx.

1022{
1023 if (!road2) {
1024 return 0;
1025 }
1026
1027 int count = 0;
1028 vector<MucRecHit*>::const_iterator iHit1;
1029 vector<MucRecHit*>::const_iterator iHit2;
1030 MucRecHit *hit1, *hit2;
1031
1032 for( iHit1 = m_pHits.begin(); iHit1 != m_pHits.end(); iHit1++){
1033 for( iHit2 = road2->m_pHits.begin();
1034 iHit2 != road2->m_pHits.end(); iHit2++){
1035 hit1 = (*iHit1);
1036 hit2 = (*iHit2);
1037
1038 if ( (hit1 != 0) && (hit2 != 0) ) {
1039 if (hit1->GetID() == hit2->GetID()) {
1040 count++;
1041 }
1042 }
1043 }
1044 }
1045
1046 return count;
1047}
Identifier GetID() const
Get soft identifier of this hit.
Definition: MucRecHit.h:68

Referenced by MucRec3DRoad::GetNSharedHits().

◆ GetOrient()

int MucRec2DRoad::GetOrient ( ) const

In which orientation was this road found?

Definition at line 919 of file MucRec2DRoad.cxx.

919{ return m_Orient; }

Referenced by MucRecRoadFinder::execute().

◆ GetPart()

int MucRec2DRoad::GetPart ( ) const

In which part was this road found?

Definition at line 911 of file MucRec2DRoad.cxx.

911{ return m_Part; }

Referenced by MucRecRoadFinder::execute(), and MucRec3DRoad::MucRec3DRoad().

◆ GetPosSigma()

void MucRec2DRoad::GetPosSigma ( float &  possigma) const

Definition at line 1094 of file MucRec2DRoad.cxx.

1095{
1096 possigma = m_SimplePosSigma;
1097
1098}

Referenced by MucRec3DRoad::ProjectNoCurrentGap(), MucRec3DRoad::ProjectWithSigma(), and MucRec3DRoad::RefitNoCurrentGap().

◆ GetQuadFitOk()

bool MucRec2DRoad::GetQuadFitOk ( )
inline

Definition at line 160 of file MucRec2DRoad.h.

160{return m_QuadFitOK;}

Referenced by MucRec3DRoad::Project(), and MucRec3DRoad::ProjectNoCurrentGap().

◆ GetReducedChiSquare()

float MucRec2DRoad::GetReducedChiSquare ( ) const

Chi-square parameter (per degree of freedom) of the trajectory fit.

Definition at line 1063 of file MucRec2DRoad.cxx.

1064{
1065 if ( (!m_SimpleFitOK) || (m_SimpleDOF < 0) ) {
1066 return -1.0;
1067 }
1068 else if (m_SimpleDOF == 0) {
1069 return 0.0;
1070 }
1071 else {
1072 return (m_SimpleChi2 / m_SimpleDOF);
1073 }
1074}

Referenced by MucRecRoadFinder::execute().

◆ GetSearchWindowSize()

float MucRec2DRoad::GetSearchWindowSize ( const int &  gap) const

Determine the size of the search window in the given gap.

Definition at line 1234 of file MucRec2DRoad.cxx.

1235{
1236 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
1237 cout << "MucRec2DRoad::GetSearchWindowSize-E1 invalid gap = " << gap << endl;
1238 return 0.0;
1239 }
1240
1241 // Determine the projection point of the "simple" fit to the last
1242 // gap and the desired gap.
1243 // FIXME? the "delta-x" variable is calculated as the scalar
1244 // difference between the positions obtained by projecting to the
1245 // last gap and to the desired gap.
1246
1248 float x1, y1, z1, x2, y2, z2, dx, dy, dr;
1249 float sigmaX, sigmaY, sigmaZ;
1250
1251 if (m_Part == 0) {
1252 if (m_Orient == 0) {
1253 geom->FindIntersection(m_Part, 0, m_LastGap,
1254 1.0, m_SimpleSlope, 0.0,
1255 0.0, m_SimpleIntercept, 0.0,
1256 0.0, m_SimpleSlopeSigma, 0.0,
1257 0.0, m_SimpleInterceptSigma, 0.0,
1258 x1, y1, z1,
1259 sigmaX, sigmaY, sigmaZ);
1260 geom->FindIntersection(m_Part, 0, gap,
1261 1.0, m_SimpleSlope, 0.0,
1262 0.0, m_SimpleIntercept, 0.0,
1263 0.0, m_SimpleSlopeSigma, 0.0,
1264 0.0, m_SimpleInterceptSigma, 0.0,
1265 x2, y2, z2,
1266 sigmaX, sigmaY, sigmaZ);
1267 dx = z2 - z1;
1268 dy = sqrt(x2*x2 + y2*y2) - sqrt(x1*x1 + y1*y1);
1269 }
1270 else {
1271 geom->FindIntersection(m_Part, m_Seg, m_LastGap,
1272 m_SimpleSlope, 0.0, 1.0,
1273 m_SimpleIntercept, 0.0, 0.0,
1274 m_SimpleSlopeSigma, 0.0, 0.0,
1275 m_SimpleInterceptSigma, 0.0, 0.0,
1276 x1, y1, z1,
1277 sigmaX, sigmaY, sigmaZ);
1278 geom->FindIntersection(m_Part, m_Seg, gap,
1279 m_SimpleSlope, 0.0, 1.0,
1280 m_SimpleIntercept, 0.0, 0.0,
1281 m_SimpleSlopeSigma, 0.0, 0.0,
1282 m_SimpleInterceptSigma, 0.0, 0.0,
1283 x2, y2, z2,
1284 sigmaX, sigmaY, sigmaZ);
1285 dx = x2 - x1;
1286 dy = y2 - y1;
1287 }
1288 }
1289 else {
1290 if (m_Orient == 0) {
1291 geom->FindIntersection(m_Part, m_Seg, m_LastGap,
1292 0.0, m_SimpleSlope, 1.0,
1293 0.0, m_SimpleIntercept, 0.0,
1294 0.0, m_SimpleSlopeSigma, 0.0,
1295 0.0, m_SimpleInterceptSigma, 0.0,
1296 x1, y1, z1,
1297 sigmaX, sigmaY, sigmaZ);
1298 geom->FindIntersection(m_Part, m_Seg, gap,
1299 0.0, m_SimpleSlope, 1.0,
1300 0.0, m_SimpleIntercept, 0.0,
1301 0.0, m_SimpleSlopeSigma, 0.0,
1302 0.0, m_SimpleInterceptSigma, 0.0,
1303 x2, y2, z2,
1304 sigmaX, sigmaY, sigmaZ);
1305 dx = z2 - z1;
1306 dy = y2 - y1;
1307 }
1308 else {
1309 geom->FindIntersection(m_Part, m_Seg, m_LastGap,
1310 m_SimpleSlope, 0.0, 1.0,
1311 m_SimpleIntercept, 0.0, 0.0,
1312 m_SimpleSlopeSigma, 0.0, 0.0,
1313 m_SimpleInterceptSigma, 0.0, 0.0,
1314 x1, y1, z1,
1315 sigmaX, sigmaY, sigmaZ);
1316 geom->FindIntersection(m_Part, m_Seg, gap,
1317 m_SimpleSlope, 0.0, 1.0,
1318 m_SimpleIntercept, 0.0, 0.0,
1319 m_SimpleSlopeSigma, 0.0, 0.0,
1320 m_SimpleInterceptSigma, 0.0, 0.0,
1321 x2, y2, z2,
1322 sigmaX, sigmaY, sigmaZ);
1323 dx = z2 - z1;
1324 dy = x2 - x1;
1325 }
1326 }
1327
1328 dr = sqrt(dx*dx + dy*dy);
1329
1330 return WindowFunc(m_SimpleChi2,dr);
1331}
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)
float WindowFunc(const float &chisq, const float &distance) const

◆ GetSeg()

int MucRec2DRoad::GetSeg ( ) const

In which segment was this road found?

Definition at line 915 of file MucRec2DRoad.cxx.

915{ return m_Seg; }

Referenced by MucRecRoadFinder::execute(), and MucRec3DRoad::MucRec3DRoad().

◆ GetSimpleFitParams() [1/2]

void MucRec2DRoad::GetSimpleFitParams ( float &  a,
float &  b,
float &  c,
int &  whichhalf,
float &  sigmaa,
float &  sigmab,
float &  sigmac,
float &  chisq,
int &  ndof 
) const

Get the parameters from the simple quad fit.

Definition at line 1103 of file MucRec2DRoad.cxx.

1106{
1107 a = m_SimpleQuad_a;
1108 b = m_SimpleQuad_b;
1109 c = m_SimpleQuad_c;
1110 whichhalf = m_SimpleQuad_whichhalf;
1111
1112 sigmaa = m_SimpleQuad_aSigma;
1113 sigmab = m_SimpleQuad_bSigma;
1114 sigmac = m_SimpleQuad_cSigma;
1115
1116 chisq = m_SimpleChi2;
1117 ndof = m_SimpleDOF;
1118
1119 return;
1120}

◆ GetSimpleFitParams() [2/2]

void MucRec2DRoad::GetSimpleFitParams ( float &  slope,
float &  intercept,
float &  sigmaSlope,
float &  sigmaIntercept,
float &  chisq,
int &  ndof 
) const

Get the parameters from the simple fit.

Definition at line 1078 of file MucRec2DRoad.cxx.

1081{
1082 slope = m_SimpleSlope;
1083 intercept = m_SimpleIntercept;
1084 sigmaSlope = m_SimpleSlopeSigma;
1085 sigmaIntercept = m_SimpleInterceptSigma;
1086 chisq = m_SimpleChi2;
1087 ndof = m_SimpleDOF;
1088
1089 return;
1090}

Referenced by Project(), MucRec3DRoad::Project(), MucRec3DRoad::ProjectNoCurrentGap(), and MucRec3DRoad::ProjectWithSigma().

◆ GetSlope()

float MucRec2DRoad::GetSlope ( ) const

Slope of trajectory.

Definition at line 1051 of file MucRec2DRoad.cxx.

1051{ return m_SimpleSlope; }

Referenced by MucRecRoadFinder::execute(), and RecMucTrack::LineFit().

◆ GetTotalHits()

int MucRec2DRoad::GetTotalHits ( ) const

How many hits in all does this road contain?

Definition at line 942 of file MucRec2DRoad.cxx.

942{ return m_TotalHits; }

Referenced by MucRecRoadFinder::execute(), MucRec3DRoad::GetTotalHits(), and MucRec3DRoad::GetTotalHitsDelta().

◆ GetVertexPos()

void MucRec2DRoad::GetVertexPos ( float &  x,
float &  y,
float &  z 
) const

Position of the vertex point.

Definition at line 923 of file MucRec2DRoad.cxx.

924{
925 x = m_VertexPos.x();
926 y = m_VertexPos.y();
927 z = m_VertexPos.z();
928
929 return;
930}

Referenced by MucRec3DRoad::MucRec3DRoad().

◆ HasHit()

bool MucRec2DRoad::HasHit ( MucRecHit hit) const

Does the hit exist in the road .

Definition at line 1390 of file MucRec2DRoad.cxx.

1391{
1392
1393 vector<MucRecHit*>::const_iterator iHit;
1394 bool HitExist = false;
1395
1396 // Also, if a track hits overlap region of two panels, we avoid
1397 // to double count hits in two panels
1398
1399 Identifier id = hit->GetID();
1400
1401 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++ ) {
1402 if ( *iHit ) { // Check for a null pointer.
1403 if ( (*iHit)->GetID() == id ) HitExist = true;
1404 }
1405 if (HitExist) break;
1406 }
1407
1408 return HitExist;
1409}

◆ HasHitInGap()

bool MucRec2DRoad::HasHitInGap ( const int &  gap) const

Does this road contain any hits in the given gap?

Definition at line 998 of file MucRec2DRoad.cxx.

999{
1000 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
1001 cout << "MucRec2DRoad::HasHitInGap-E2 invalid gap = " << gap << endl;
1002 return false;
1003 }
1004
1005 bool found = false;
1006 vector<MucRecHit*>::const_iterator iHit;
1007
1008 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1009 if (*iHit) { // Check for a null pointer.
1010 if ( (*iHit)->Gap() == gap ) {
1011 found = true;
1012 }
1013 }
1014 }
1015
1016 return found;
1017}

Referenced by MucRec3DRoad::HasHitInGap().

◆ operator=()

MucRec2DRoad & MucRec2DRoad::operator= ( const MucRec2DRoad orig)

Assignment constructor.

Definition at line 47 of file MucRec2DRoad.cxx.

48{
49 // Assignment operator.
50 if ( this != &orig ) { // Watch out for self-assignment!
51 m_VertexPos = orig.m_VertexPos;
52 m_VertexSigma = orig.m_VertexSigma;
53 m_Index = orig.m_Index;
54 m_Part = orig.m_Part;
55 m_Seg = orig.m_Seg;
56 m_Orient = orig.m_Orient;
57 m_Chi2 = orig.m_Chi2;
58 m_DOF = orig.m_DOF;
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;
66 }
67
68 return *this;
69}

◆ PrintHitsInfo()

void MucRec2DRoad::PrintHitsInfo ( ) const

Print Hits Infomation.

Definition at line 1444 of file MucRec2DRoad.cxx.

1445{
1446 vector<MucRecHit*>::const_iterator iHit;
1447 for ( iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
1448 if (*iHit) { // Check for a null pointer.
1449 float xl, yl, zl;
1450 (*iHit)->GetStrip()->GetCenterPos(xl, yl, zl);
1451 HepPoint3D vl(xl, yl, zl);
1452 HepPoint3D vg = (*iHit)->GetGap()->TransformToGlobal(vl);
1453
1454 cout << " orient " << m_Orient
1455 << " part " << (*iHit)->Part()
1456 << " seg " << (*iHit)->Seg()
1457 << " gap " << (*iHit)->Gap()
1458 << " strip " << (*iHit)->Strip()
1459 << " pos (" << vg.x() << ", " << vg.y() << ", " << vg.z() << ")"
1460 << endl;
1461 }
1462 }
1463
1464}

Referenced by MucRec3DRoad::PrintHitsInfo().

◆ Project()

void MucRec2DRoad::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?

Definition at line 729 of file MucRec2DRoad.cxx.

731{
732 float sigmaX, sigmaY, sigmaZ;
733
734 x = 0.0; sigmaX = 0.0; x2 = 0.0;
735 y = 0.0; sigmaY = 0.0; y2 = 0.0;
736 z = 0.0; sigmaZ = 0.0; z2 = 0.0;
737
738 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
739 cout << "MucRec2DRoad::Project-E1 invalid gap = " << gap << endl;
740 return;
741 }
742
743 // Determine the projection point of the "simple" fit to the desired gap.
744 float x0, y0, z0, sigmaX0, sigmaY0, sigmaZ0;
745 float phi = m_Seg*0.25*kPi;
747
748 if (m_Part == 1) {
749 if (m_Orient == 0) {
750 geom->FindIntersection(m_Part, m_Seg, gap,
751 m_SimpleSlope*cos(phi), m_SimpleSlope*sin(phi), 1.0,
752 m_SimpleIntercept*cos(phi),m_SimpleIntercept*sin(phi), 0.0,
753 m_SimpleSlopeSigma, 0.0, 0.0,
754 m_SimpleInterceptSigma, 0.0, 0.0,
755 x0, y0, z0,
756 sigmaX0, sigmaY0, sigmaZ0);
757
758 if(m_SimpleSlope>10000){ //the line is in right center of this segment, we can not get intersection in y coordinate, in this case, m_SimpleIntercept is in z coordinate.
759 geom->FindIntersection(m_Part, m_Seg, gap,
760 m_SimpleSlope*cos(phi), m_SimpleSlope*sin(phi), 1.0,
761 0.0, 0.0, m_SimpleIntercept,
762 m_SimpleSlopeSigma, 0.0, 0.0,
763 m_SimpleInterceptSigma, 0.0, 0.0,
764 x0, y0, z0,
765 sigmaX0, sigmaY0, sigmaZ0);
766
767 }
768
769 }
770 else {
771 geom->FindIntersection(m_Part, m_Seg, gap,
772 1.0, m_SimpleSlope, 0.0,
773 0.0, m_SimpleIntercept, 0.0,
774 0.0, m_SimpleSlopeSigma, 0.0,
775 0.0, m_SimpleInterceptSigma, 0.0,
776 x0, y0, z0,
777 sigmaX0, sigmaY0, sigmaZ0);
778 //cout<<"in MucRec2DRoad line Project xyz0 = "<<x0<<" "<<y0<<" "<<z0<<endl;
779
780 }
781 }
782 else {
783 if (m_Orient == 0) {
784 geom->FindIntersection(m_Part, m_Seg, gap,
785 m_SimpleSlope, m_SimpleSlope, 1.0,
786 0.0, m_SimpleIntercept, 0.0,
787 0.0, m_SimpleSlopeSigma, 0.0,
788 0.0, m_SimpleInterceptSigma, 0.0,
789 x0, y0, z0,
790 sigmaX0, sigmaY0, sigmaZ0);
791 }
792 else {
793 geom->FindIntersection(m_Part, m_Seg, gap,
794 m_SimpleSlope, m_SimpleSlope, 1.0,
795 m_SimpleIntercept, 0.0, 0.0,
796 m_SimpleSlopeSigma, 0.0, 0.0,
797 m_SimpleInterceptSigma, 0.0, 0.0,
798 x0, y0, z0,
799 sigmaX0, sigmaY0, sigmaZ0);
800 }
801 //cout << " part " << m_Part
802 // << " seg " << m_Seg
803 // << " gap " << gap
804 // << " orient " << m_Orient
805 // << " slope = " << m_SimpleSlope
806 // << endl;
807 }
808
809 //cout << "In find intersection x0 = " << x0 << " y0 = " << y0 << " z0 = " << z0 << endl;
810
811 float a,b,sa,sb,chi2;
812 int ndof;
813
814 int status = Fit(x0, y0, z0, a, b, sa, sb, chi2, ndof);
815
816// m_FitOK = (status == 0) && (chi2<1000.0);
817// if (!fFitOK) {
818// cout << "MucRec2DRoad::Project-E2 fit fail status = "
819// << status << " npoints = " << npoints << " chi-sq = "
820// << chi2 << endl;
821// }
822
823// // Assign to fields of TMuiRoad object.
824// m_DOF = npoints - 2;
825// m_Chi2 = chi2;
826
827 if (m_Part == 1) { //change from 0 to 1 at 2006.11.30
828 if (m_Orient == 0) {
829 geom->FindIntersection(m_Part, m_Seg, gap,
830 a*cos(phi), a*sin(phi), 1.0,
831 //a, 0.0, 1.0,
832 b*cos(phi), b*sin(phi), 0.0,
833 sa, 0.0, 0.0,
834 sb, 0.0, 0.0,
835 x, y, z,
836 sigmaX, sigmaY, sigmaZ);
837
838 if(fabs(a)>10000){ ///
839 geom->FindIntersection(m_Part, m_Seg, gap,
840 a*cos(phi), a*sin(phi), 1.0,
841 0.0, 0.0, b,
842 //a, 0.0, 1.0,
843 //b, 0.0, 0.0,
844 sa, 0.0, 0.0,
845 sb, 0.0, 0.0,
846 x, y, z,
847 sigmaX, sigmaY, sigmaZ);
848
849 }
850 }
851 else {
852 geom->FindIntersection(m_Part, m_Seg, gap,
853 1.0, a, 0.0,
854 0.0, b, 0.0,
855 0.0, sa, 0.0,
856 0.0, sb, 0.0,
857 x, y, z,
858 sigmaX, sigmaY, sigmaZ);
859
860 if(m_fittingMethod == 2 && m_QuadFitOK ){
861 float a, b, c;
862 float sa, sb, sc, chi2x; int ydof; int whichhalf;
863
864 GetSimpleFitParams(a, b, c, whichhalf, sa, sb, sc, chi2x, ydof);
865 geom->FindIntersection(m_Part, m_Seg, gap,
866 10E30, 0.0, m_SimpleIntercept, 0.0, //vy = infinite
867 a, b, c, //y = a*x*x + b*x +c
868 whichhalf,
869 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
870 x, y, z, x2, y2, z2,
871 sigmaX, sigmaY, sigmaZ);
872
873
874 }
875
876 }
877 }
878 else {
879 if (m_Orient == 0) {
880 geom->FindIntersection(m_Part, m_Seg, gap,
881 a, a, 1.0,
882 0.0, b, 0.0,
883 0.0, sa, 0.0,
884 0.0, sb, 0.0,
885 x, y, z,
886 sigmaX, sigmaY, sigmaZ);
887 }
888 else {
889 geom->FindIntersection(m_Part, m_Seg, gap,
890 a, a, 1.0,
891 b, 0.0, 0.0,
892 sa, 0.0, 0.0,
893 sb, 0.0, 0.0,
894 x, y, z,
895 sigmaX, sigmaY, sigmaZ);
896 }
897 }
898
899 return;
900}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const double kPi
Definition: MucConstant.h:6
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.
void GetSimpleFitParams(float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof) const
Get the parameters from the simple fit.

Referenced by GetHitDistance().

◆ SetIndex()

void MucRec2DRoad::SetIndex ( const int &  index)

Set the index for this road.

Definition at line 92 of file MucRec2DRoad.cxx.

93{
94 if (index >= 0) m_Index = index;
95}

◆ SetMaxNSkippedGaps()

void MucRec2DRoad::SetMaxNSkippedGaps ( const int &  nGaps)

Max number of consecutive gaps allowed with no hits attached. This parameter affects the calculation of the last gap.

Definition at line 180 of file MucRec2DRoad.cxx.

181{
182 m_MaxNSkippedGaps = numGaps;
183 CountHits(); // recalculate the last gap and the hit counts.
184}

Referenced by MucRecRoadFinder::execute().

◆ SimpleFit()

int MucRec2DRoad::SimpleFit ( float &  slope,
float &  intercept,
float &  sigmaSlope,
float &  sigmaIntercept,
float &  chisq,
int &  ndof 
)

Calculate the best-fit straight line with "simple" weights.

Definition at line 188 of file MucRec2DRoad.cxx.

194{
195 // Assign to temporary arrays to be used in fit.
196 float px[100];
197 float py[100];
198 float pw[100];
199 int npoints = 0;
200
201 vector<MucRecHit*>::const_iterator iHit;
202
203 float weight[100];
204
205// for (int i = 0; i < m_pHits.size(); i++) {
206// cout<<"info: "<<m_pHits[i]->Seg()<<" "<<m_pHits[i]->Gap()<<" "<< m_pHits[i]->Strip()<<endl;
207// }
208 for (int i = 0; i < m_pHits.size(); i++) {
209 weight[i] = 1;
210
211 for(int j = 0; j < m_pHits.size(); j++){
212
213 if(j == i) continue;
214 if(m_pHits[i]->Part() == m_pHits[j]->Part() &&
215 m_pHits[i]->Seg() == m_pHits[j]->Seg() &&
216 m_pHits[i]->Gap() == m_pHits[j]->Gap() )
217 {
218 int deltaStrip = fabs(m_pHits[i]->Strip()- m_pHits[j]->Strip());
219
220 //cout<<i<<" "<<m_pHits[i]->Seg()<<" "<<m_pHits[i]->Gap()<<" "<<m_pHits[i]->Strip()<<" - "<<m_pHits[j]->Strip()<<endl;
221 if(deltaStrip == 0){
222 cout<<"deltaStrip == 0 ? check it"<<endl;
223 }
224 else{
225 weight[i] *= (deltaStrip+1) * (deltaStrip+1);
226 }
227
228 }
229 }
230 }
231
232 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
233 if (*iHit) { // Check for a null pointer.
234
235 /*
236 float localx, localy, localz;
237 (*iHit)->GetStrip()->GetCenterPos(localx, localy, localz);
238 if ( m_Orient == 0) {
239 px[npoints] = localy;
240 py[npoints] = localz;
241 }
242 else {
243 px[npoints] = localx;
244 py[npoints] = localz;
245 }
246 npoints++;
247 }
248 }
249 */
250
251
252 Hep3Vector center = (*iHit)->GetCenterPos();
253 Hep3Vector sigma = (*iHit)->GetCenterSigma();
254 //Hep3Vector sigma(1.0, 1.0, 1.0);
255
256 if (m_Part == 1) {
257 if ( m_Orient == 0) {
258 px[npoints] = center.z();
259 py[npoints] = sqrt(center.x()*center.x()
260 + center.y()*center.y());
261 if(m_Seg==2) py[npoints] = center.y(); //deal with seg2 seperately! because there is a hole here. 2006.11.9
262
263 pw[npoints] = 4.0 * 1.0/(sigma.y()*sigma.y()) / weight[npoints];
264 }
265 else {
266 px[npoints] = center.x();
267 py[npoints] = center.y();
268 pw[npoints] = 4.0 * 1.0/(sigma.x()*sigma.x()) / weight[npoints];
269 }
270 }
271 else {
272 if ( m_Orient == 0) {
273 px[npoints] = center.z();
274 py[npoints] = center.y();
275 pw[npoints] = 4.0 * 1.0/(sigma.y()*sigma.y()) / weight[npoints];
276 }
277 else {
278 px[npoints] = center.z();
279 py[npoints] = center.x();
280 pw[npoints] = 4.0 * 1.0/(sigma.x()*sigma.x()) / weight[npoints];
281 }
282 }
283
284 //cout << " in MucRec2DRoad ID: " <<(*iHit)->Part()<<" "<<(*iHit)->Seg()<<" "<<(*iHit)->Gap()<<" "<< (*iHit)->Strip()<<" "<<px[npoints] << " " << py[npoints] << " " << pw[npoints] << endl;
285 npoints++;
286
287 if(npoints > 99)
288 { cout<<"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
289 return -1;
290 }
291 }
292}
293/*
294float px2[100];
295float py2[100];
296for (int i = 0; i < m_pHits.size(); i++) {
297 int hitsInGap = 1;
298 px2[i] = -999; py2[i] = -999;
299 for(int j = 0; j < m_pHits.size(); j++){
300
301 if(j == i) continue;
302 if(m_pHits[i]->Part() == m_pHits[j]->Part() &&
303 m_pHits[i]->Seg() == m_pHits[j]->Seg() &&
304 m_pHits[i]->Gap() == m_pHits[j]->Gap() )
305 {
306 hitsInGap++;
307 px2[i] = (px[i]*(hitsInGap-1) + px[j])/hitsInGap;
308 py2[i] = (py[i]*(hitsInGap-1) + py[j])/hitsInGap;
309 cout<<hitsInGap<<" "<<px[i]<<" "<<px[j]<<" "<<px2[i]<<endl;
310 }
311 }
312}
313
314for(int i = 0; i < m_pHits.size(); i++){
315 if(px2[i] != -999&&py2[i] != -999){
316 px[i] = px2[i]; py[i] = py2[i];
317 }
318}
319*/
320
321ndof = npoints - 2;
322if (ndof < 0) return -1;
323
324if (npoints == 1) {
325 if (m_Part == 1) {
326 if ( m_Orient == 0) {
327 px[npoints] = m_VertexPos.z();
328 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
329 + m_VertexPos.y()*m_VertexPos.y());
330 if(m_Seg==2) py[npoints] = m_VertexPos.y();
331 }
332 else {
333 px[npoints] = m_VertexPos.x();
334 py[npoints] = m_VertexPos.y();
335 }
336 }
337 else {
338 if ( m_Orient == 0) {
339 px[npoints] = m_VertexPos.z();
340 py[npoints] = m_VertexPos.y();
341 }
342 else {
343 px[npoints] = m_VertexPos.z();
344 py[npoints] = m_VertexPos.x();
345 }
346 }
347 pw[npoints] = 1.0;
348 npoints++;
349}
350else {
351 if (npoints == 0 ) {
352 return -1;
353 }
354}
355
356// Do the fits here.
357MucRecLineFit fit;
358 int status = fit.LineFit(px, py, pw, npoints,
359 &slope, &intercept, &chisq,
360 &sigmaSlope, &sigmaIntercept);
361
362
363 float tempslope, tempintercept,tempchisq, tempsigmaslope, sigmaPos;
364 int status4 = fit.LineFit(px, py, pw,m_Part,m_Seg,m_Orient, npoints,
365 &tempslope, &tempintercept, &tempchisq,
366 &tempsigmaslope, &sigmaPos);
367
368 MucRecQuadFit quadfit;
369 float quad_a, quad_b, quad_c, sigmaquad_a, sigmaquad_b, sigmaquad_c, chisq_quad;
370 int whichhalf, status2;
371
372 if(m_fittingMethod == 2){
373 status2 = quadfit.QuadFit(px, py, pw, npoints,
374 &quad_a, &quad_b, &quad_c, &whichhalf, &chisq_quad,
375 &sigmaquad_a, &sigmaquad_b, &sigmaquad_c);
376
377 }
378 //cout << " in MucRec2DRoad slope " << slope << " "<<intercept<<endl;
379
380 if (slope > 1.0e10 || slope < -1.0e10) {
381 if (m_Seg > 4) slope *= -1.0; // to avoid wrong direction
382 }
383
384 m_SimpleSlope = slope;
385 m_SimpleSlopeSigma = sigmaSlope;
386 m_SimpleIntercept = intercept;
387 m_SimpleInterceptSigma = sigmaIntercept;
388 m_SimplePosSigma = sigmaPos; //new 20071227
389 m_SimpleChi2 = chisq;
390 m_SimpleDOF = ndof;
391 m_SimpleFitOK = (status == 0) && (chisq < 1000.0);
392 m_QuadFitOK = (status2 == 1);
393
394 m_SimpleQuad_a = quad_a;
395 m_SimpleQuad_b = quad_b;
396 m_SimpleQuad_c = quad_c;
397 m_SimpleQuad_whichhalf = whichhalf;
398 m_SimpleQuad_aSigma = sigmaquad_a;
399 m_SimpleQuad_bSigma = sigmaquad_b;
400 m_SimpleQuad_cSigma = sigmaquad_c;
401
402 return status;
403}
*********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
Definition: KarFin.h:34
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)

Referenced by AttachHit(), and Fit().

◆ SimpleFitNoCurrentGap()

int MucRec2DRoad::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!!!

Definition at line 409 of file MucRec2DRoad.cxx.

417{
418 // Assign to temporary arrays to be used in fit.
419 float px[100];
420 float py[100];
421 float pw[100];
422 int npoints = 0;
423
424 int notused = 0;
425
426 vector<MucRecHit*>::const_iterator iHit;
427
428 float pw2[100];
429 for(int i = 0; i< m_pHits.size(); i++) {
430 pw2[i] = 1;
431 //----if( m_pHits[i]->Gap()==currentgap ) pw2[i] = 9999;
432 }
433
434 for (iHit = m_pHits.begin(); iHit != m_pHits.end(); iHit++) {
435 if (*iHit) { // Check for a null pointer.
436 if( (*iHit)->Gap()==currentgap ) continue;
437
438 Hep3Vector center = (*iHit)->GetCenterPos();
439 Hep3Vector sigma = (*iHit)->GetCenterSigma();
440 //Hep3Vector sigma(1.0, 1.0, 1.0);
441
442 if (m_Part == 1) {
443 if ( m_Orient == 0) {
444 px[npoints] = center.z();
445 py[npoints] = sqrt(center.x()*center.x()
446 + center.y()*center.y());
447 if(m_Seg==2) py[npoints] = center.y(); //deal with seg2 seperately! because there is a hole here. 2006.11.9
448
449 pw[npoints] = 1.0/(sigma.y()*sigma.y())/pw2[npoints]/pw2[npoints];
450 }
451 else {
452 px[npoints] = center.x();
453 py[npoints] = center.y();
454 pw[npoints] = 1.0/(sigma.x()*sigma.x())/pw2[npoints]/pw2[npoints];
455 }
456 }
457 else {
458 if ( m_Orient == 0) {
459 px[npoints] = center.z();
460 py[npoints] = center.y();
461 pw[npoints] = 1.0/(sigma.y()*sigma.y())/pw2[npoints]/pw2[npoints];
462 }
463 else {
464 px[npoints] = center.z();
465 py[npoints] = center.x();
466 pw[npoints] = 1.0/(sigma.x()*sigma.x())/pw2[npoints]/pw2[npoints];
467 }
468 }
469
470 //cout << " in MucRec2DRoad ID: " <<(*iHit)->Part()<<" "<<(*iHit)->Seg()<<" "<<(*iHit)->Gap()<<" "<< (*iHit)->Strip()<<" "<<px[npoints] << " " << py[npoints] << " " << pw[npoints] << endl;
471 //cout<<"process ngap: "<<currentgap<<" current: "<<(*iHit)->Gap()<<" x: "<<px[npoints]<<" y: "<<py[npoints]<<" weight: "<<pw[npoints]<<endl;
472 npoints++;
473
474 if(npoints > 99)
475 { cout<<"MucRec2DRoad: to many hits in this track, ignore it!"<<endl;
476 return -1;
477 }
478 }
479 }
480
481 ndof = npoints - 2;
482 if (ndof < 0) return -1;
483
484 if (npoints == 1) {
485 if (m_Part == 1) {
486 if ( m_Orient == 0) {
487 px[npoints] = m_VertexPos.z();
488 py[npoints] = sqrt(m_VertexPos.x()*m_VertexPos.x()
489 + m_VertexPos.y()*m_VertexPos.y());
490 if(m_Seg==2) py[npoints] = m_VertexPos.y();
491 }
492 else {
493 px[npoints] = m_VertexPos.x();
494 py[npoints] = m_VertexPos.y();
495 }
496 }
497 else {
498 if ( m_Orient == 0) {
499 px[npoints] = m_VertexPos.z();
500 py[npoints] = m_VertexPos.y();
501 }
502 else {
503 px[npoints] = m_VertexPos.z();
504 py[npoints] = m_VertexPos.x();
505 }
506 }
507 pw[npoints] = 1.0;
508 npoints++;
509 }
510else {
511 if (npoints == 0 ) {
512 return -1;
513 }
514
515}
516
517// Do the fits here.
518MucRecLineFit fit;
519int status = fit.LineFit(px, py, pw, npoints,
520 &slope, &intercept, &chisq,
521 &sigmaSlope, &sigmaIntercept);
522
523MucRecQuadFit quadfit;
524float quad_a, quad_b, quad_c, sigmaquad_a, sigmaquad_b, sigmaquad_c, chisq_quad;
525int whichhalf, status2;
526
527if(m_fittingMethod == 2){
528 status2 = quadfit.QuadFit(px, py, pw, npoints,
529 &quad_a, &quad_b, &quad_c, &whichhalf, &chisq_quad,
530 &sigmaquad_a, &sigmaquad_b, &sigmaquad_c);
531
532}
533//cout << " in MucRec2DRoad slope " << slope << " "<<intercept<<endl;
534
535if (slope > 1.0e10 || slope < -1.0e10) {
536 if (m_Seg > 4) slope *= -1.0; // to avoid wrong direction
537}
538
539////////2009-03-12
540 m_SimpleSlope = slope;
541 m_SimpleSlopeSigma = sigmaSlope;
542 m_SimpleIntercept = intercept;
543 m_SimpleInterceptSigma = sigmaIntercept;
544 //m_SimplePosSigma = sigmaPos; //new 20071227
545 m_SimpleChi2 = chisq;
546 m_SimpleDOF = ndof;
547 m_SimpleFitOK = (status == 0) && (chisq < 1000.0);
548 m_QuadFitOK = (status2 == 1);
549
550 m_SimpleQuad_a = quad_a;
551 m_SimpleQuad_b = quad_b;
552 m_SimpleQuad_c = quad_c;
553 m_SimpleQuad_whichhalf = whichhalf;
554 m_SimpleQuad_aSigma = sigmaquad_a;
555 m_SimpleQuad_bSigma = sigmaquad_b;
556 m_SimpleQuad_cSigma = sigmaquad_c;
557
558
559return status;
560}

Referenced by MucRec3DRoad::ProjectNoCurrentGap(), and MucRec3DRoad::RefitNoCurrentGap().

◆ WeightFunc()

float MucRec2DRoad::WeightFunc ( const float &  chisq,
const float &  distance 
) const

Definition at line 1468 of file MucRec2DRoad.cxx.

1469{
1470 return 1.0;
1471}

Referenced by Fit().

◆ WindowFunc()

float MucRec2DRoad::WindowFunc ( const float &  chisq,
const float &  distance 
) const

Definition at line 1475 of file MucRec2DRoad.cxx.

1476{
1477 return 1.0;
1478}

Referenced by GetSearchWindowSize().


The documentation for this class was generated from the following files: