BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
MucRec3DRoad Class Reference

#include <MucRec3DRoad.h>

+ Inheritance diagram for MucRec3DRoad:

Public Member Functions

 MucRec3DRoad (MucRec2DRoad *road0, MucRec2DRoad *road1)
 Constructor.
 
MucRec3DRoadoperator= (const MucRec3DRoad &orig)
 Assignment constructor.
 
 MucRec3DRoad (const MucRec3DRoad &source)
 Copy constructor.
 
 ~MucRec3DRoad ()
 Destructor.
 
void SetIndex (const int &index)
 set the index for this road
 
void SetGroup (const int &Group)
 set the group index for this road
 
void SetSimpleFitParams (const float &m_SlopeZX, const float &m_InterceptZX, const float &m_SlopeZY, const float &m_InterceptZY)
 set the fit parameters : slope and intercept for XZ and YZ.
 
int RefitNoCurrentGap (const int &gap, float &slopeZX, float &interceptZX, float &slopeZY, float &interceptZY)
 refit the 3D road without the assigned gap
 
vector< IdentifierProjectToStrip (const int &part, const int &gap, const HepPoint3D &gPoint, const Hep3Vector &gDirection)
 
vector< IdentifierProjectToStrip (const int &part, const int &gap, const HepPoint3D &gPoint, const Hep3Vector &gDirection, vector< int > &padID, vector< float > &intersect_x, vector< float > &intersect_y, vector< float > &intersect_z)
 
void ProjectWithSigma (const int &gap, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
 Where does the trajectory of this road intersect a specific gap?
 
void ProjectNoCurrentGap (const int &gap, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ, float &quad_x1, float &quad_y1, float &quad_z1, float &quad_x2, float &quad_y2, float &quad_z2)
 Where does the trajectory of this road intersect a specific gap when refit without current gap!!!
 
void Project (const int &gap, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2)
 Where does the trajectory of this road intersect two surfaces of a specific gap?
 
void Project (const int &gap, const float zx, const float x0, const float zy, const float y0, float &x1, float &y1, float &z1)
 project with assigned pos and dir
 
void TransformPhiRToXY (const float &vk, const float &vr, const float &k0, const float &r0, float &vx, float &vy, float &x0, float &y0) const
 Where does the trajectory of this road intersect the reference plane?
 
float GetVxSign (const float vk) const
 Get sign of vx in TransformPhiRToXY.
 
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 GetGroup () const
 unique index of group this road belongs to
 
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 segment?
 
int GetNSharedHits (const MucRec3DRoad *road) const
 How many hits do two roads share?
 
int GetLastGapDelta () const
 Difference between the last gap in the two 1-D roads.
 
int GetTotalHitsDelta () const
 Difference between the number of hits in the two 1-D roads.
 
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.
 
float GetSlopeZX () const
 Get Z-X dimension slope.
 
float GetInterceptZX () const
 Get Z-X dimension intercept.
 
float GetSlopeZY () const
 Get Z-Y dimension slope.
 
float GetInterceptZY () const
 Get Z-Y dimension intercept.
 
MucRecHitGetHit (const int &gap) const
 Get a pointer to the first hit attached in a particular gap.
 
MucRec2DRoadGet2DRoad (const int &orient=0) const
 Is the intersection of a pair of H and V clusters inside a panel?
 
vector< IdentifierGetHitsID () const
 Get indices of all hits in the road.
 
void PrintHitsInfo ()
 Print Hits Infomation.
 

Detailed Description

Describes a road found in the muon chamber.

A 3Droad is a set of hits in muon chamber strips that we expect to be associated with a single particle traversing the muon chamber. (Roads are found by the MucRecRoadFinder class.) Methods include adding hits, calculating and retrieving the trajectory indicated by the hits, projecting along the trajectory to an arbitrary gap, etc.

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

Definition at line 35 of file MucRec3DRoad.h.

Constructor & Destructor Documentation

◆ MucRec3DRoad() [1/2]

MucRec3DRoad::MucRec3DRoad ( MucRec2DRoad road0,
MucRec2DRoad road1 
)

Constructor.

Definition at line 26 of file MucRec3DRoad.cxx.

27 : m_Road0(road0), m_Road1(road1),
28 m_Index(-1),
29 m_Part(road0->GetPart()),
30 m_Seg(road0->GetSeg()),
31 m_LastGap(0),
32 m_Group(-1)
33{
34 float x, y, z;
35 road0->GetVertexPos(x, y, z);
36 m_VertexPos.setX(x);
37 m_VertexPos.setY(y);
38 m_VertexPos.setZ(z);
39
40 // If the part numbers don't match, something is seriously wrong!
41 if ( (road1->GetPart() != m_Part) || (road1->GetSeg() != m_Seg) ) {
42 cout << "MucRec3DRoad(ctor)-E1 mismatched 2D roads:"
43 << " x part = " << road0->GetPart() << " seg = " << road0->GetSeg() << endl
44 << " y part = " << road1->GetPart() << " seg = " << road1->GetSeg() << endl;
45 m_Part = -1;
46 m_Seg = -1;
47 }
48
49 // Compute the last-gap parameter; take the deeper of the 1D roads.
50 if ( road1->GetLastGap() > road0->GetLastGap() ) {
51 m_LastGap = road1->GetLastGap();
52 } else {
53 m_LastGap = road0->GetLastGap();
54 }
55
56 // Check that the two 1D roads have clusters in the same panels.
57 // FIXME: logic needs more thought!
58
59 // Calculate the chi-square and number of degrees of freedom of the
60 // 2-D trajectory (use the "simple" fits).
61 // FIXME: Can we calc. chi-square without brute force?
62
63 m_DOF = m_Road0->GetDegreesOfFreedom() + m_Road1->GetDegreesOfFreedom();
64 m_Chi2 = 0.0;
65
66 for (int gap = 0; gap < (int)MucID::getGapMax(); gap++)
67 {
68 MucRecHit* hit;
69 float dist, sigma;
70 hit = m_Road0->GetHit(gap);
71 if (hit) {
72 if ( hit->Part() == 1 ) sigma = hit->GetCenterSigma().y(); // ???
73 else sigma = hit->GetCenterSigma().y();
74
75 dist = m_Road0->GetHitDistance(hit) / sigma;
76 m_Chi2 += dist * dist;
77 //cout<<"in MucRec3DRoad dist1="<<dist<<" hitdis "<<dist*sigma<<" sigma="<<sigma<<" chi2="<<m_Chi2<<endl;
78 }
79
80 hit = m_Road1->GetHit(gap);
81 if (hit) {
82 if ( hit->Part() == 1 ) {
83 // sigma = fabs(sqrt( (hit->GetCenterSigma().x())*(hit->GetCenterSigma().x())
84 // + (hit->GetCenterSigma().y())*(hit->GetCenterSigma().y()) ));
85 sigma = hit->GetCenterSigma().x();
86 }
87 else {
88 sigma = hit->GetCenterSigma().x();
89 }
90 dist = m_Road1->GetHitDistance(hit) / sigma;
91 m_Chi2 += dist * dist;
92 // cout<<"in MucRec3DRoad dist2="<<dist<<" hitdis "<<dist*sigma<<" sigma="<<sigma<<" chi2="<<m_Chi2<<endl;
93 }
94 }
95
96}
TTree * sigma
static value_type getGapMax()
Definition: MucID.cxx:195
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 GetPart() const
In which part was this road found?
float GetHitDistance(const MucRecHit *hit)
Distance to a hit.
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
int GetSeg() const
In which segment was this road found?
MucRecHit * GetHit(const int &gap) const
Get a pointer to the first found hit attached in a particular gap.
Hep3Vector GetCenterSigma() const
Get Center position uncertainty of the strip (global coords).
Definition: MucRecHit.cxx:114
int Part() const
Get Part.
Definition: MucRecHit.h:71
double y[1000]
double x[1000]

◆ MucRec3DRoad() [2/2]

MucRec3DRoad::MucRec3DRoad ( const MucRec3DRoad source)

Copy constructor.

Definition at line 99 of file MucRec3DRoad.cxx.

100 : m_VertexPos(source.m_VertexPos),
101 m_VertexSigma(source.m_VertexSigma),
102 m_Road0(source.m_Road0), m_Road1(source.m_Road1),
103 m_Index(source.m_Index),
104 m_Part(source.m_Part), m_Seg(source.m_Seg),
105 m_LastGap(source.m_LastGap),
106 m_Chi2(source.m_Chi2), m_DOF(source.m_DOF),
107 m_Group(source.m_Group)
108{ }

◆ ~MucRec3DRoad()

MucRec3DRoad::~MucRec3DRoad ( )

Destructor.

Definition at line 111 of file MucRec3DRoad.cxx.

112{
113 // The 3D road objects do not "own" 2D objects, so don't delete them
114 // here!
115}

Member Function Documentation

◆ Get2DRoad()

MucRec2DRoad * MucRec3DRoad::Get2DRoad ( const int &  orient = 0) const

Is the intersection of a pair of H and V clusters inside a panel?

get a pointer to the 2D road in the 3D road.

Definition at line 679 of file MucRec3DRoad.cxx.

680{
681 if (orient == 0) {
682 return m_Road0;
683 }
684 else {
685 return m_Road1;
686 }
687}

Referenced by GetNSharedHits().

◆ GetDegreesOfFreedom()

int MucRec3DRoad::GetDegreesOfFreedom ( ) const

How many degrees of freedom in the trajectory fit?

Definition at line 269 of file MucRec3DRoad.cxx.

270{
271 return m_DOF;
272}

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

◆ GetGroup()

int MucRec3DRoad::GetGroup ( ) const

unique index of group this road belongs to

Definition at line 154 of file MucRec3DRoad.cxx.

155{
156 return m_Group;
157}

◆ GetHit()

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

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

Definition at line 321 of file MucRec3DRoad.cxx.

322{
323 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
324 cout << "MucRec3DRoad::GetHit-E1 invalid gap = " << gap << endl;
325 return 0;
326 }
327
328 if ( m_Road0->GetHit(gap) ) {
329 return m_Road0->GetHit(gap);
330 }
331 else {
332 if ( m_Road1->GetHit(gap) ) {
333 return m_Road1->GetHit(gap);
334 }
335 }
336 return 0;
337}

◆ GetHitsID()

vector< Identifier > MucRec3DRoad::GetHitsID ( ) const

Get indices of all hits in the road.

Definition at line 691 of file MucRec3DRoad.cxx.

693{
694 vector<Identifier> idCon;
695 vector<Identifier>::iterator hit;
696 vector<Identifier> hitRoad0 = m_Road0->GetHitsID();
697 vector<Identifier> hitRoad1 = m_Road1->GetHitsID();
698
699 // List will be ordered by orientation.
700
701 // Road0 first ...
702 for ( hit = hitRoad0.begin(); hit != hitRoad0.end(); hit++) {
703 int index = *hit;
704 idCon.push_back(*hit);
705 //cout << " MucRec3DRoad::HitIndices Road0 = " << index << endl;
706 }
707
708 // ... then Road1.
709 for ( hit = hitRoad1.begin(); hit != hitRoad1.end();hit++) {
710 int index = *hit;
711 idCon.push_back(*hit);
712 //cout << " MucRec3DRoad::HitIndices Road1 = " << index << endl;
713 }
714
715 return idCon;
716}
vector< Identifier > GetHitsID() const
Get indices of all hits in the road.

◆ GetHitsPerGap()

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

How many hits per gap does this road contain?

Definition at line 202 of file MucRec3DRoad.cxx.

203{
204 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
205 cout << "MucRec3DRoad::HitsPerGap-E1 invalid gap = " << gap << endl;
206 return 0;
207 }
208
209 return ( m_Road0->GetHitsPerGap(gap) + m_Road1->GetHitsPerGap(gap) );
210}
int GetHitsPerGap(const int &gap) const
How many hits per gap does this road contain?

◆ GetIndex()

int MucRec3DRoad::GetIndex ( ) const

A unique identifier for this road in the current event.

Definition at line 147 of file MucRec3DRoad.cxx.

148{
149 return m_Index;
150}

◆ GetInterceptZX()

float MucRec3DRoad::GetInterceptZX ( ) const

Get Z-X dimension intercept.

Definition at line 300 of file MucRec3DRoad.cxx.

301{
302 return m_InterceptZX;
303}

Referenced by MucRecRoadFinder::execute().

◆ GetInterceptZY()

float MucRec3DRoad::GetInterceptZY ( ) const

Get Z-Y dimension intercept.

Definition at line 314 of file MucRec3DRoad.cxx.

315{
316 return m_InterceptZY;
317}

Referenced by MucRecRoadFinder::execute().

◆ GetLastGap()

int MucRec3DRoad::GetLastGap ( ) const

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

Definition at line 175 of file MucRec3DRoad.cxx.

176{
177 return m_LastGap;
178}

Referenced by MucRecRoadFinder::execute().

◆ GetLastGapDelta()

int MucRec3DRoad::GetLastGapDelta ( ) const

Difference between the last gap in the two 1-D roads.

Definition at line 255 of file MucRec3DRoad.cxx.

256{
257 return abs( m_Road0->GetLastGap() - m_Road1->GetLastGap() );
258}

Referenced by MucRecRoadFinder::execute().

◆ GetMaxHitsPerGap()

int MucRec3DRoad::GetMaxHitsPerGap ( ) const

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

Definition at line 214 of file MucRec3DRoad.cxx.

215{
216 int nHit0 = m_Road0->GetMaxHitsPerGap();
217 int nHit1 = m_Road1->GetMaxHitsPerGap();
218 if( nHit0 > nHit1 ) {
219 return nHit0;
220 }
221 else {
222 return nHit1;
223 }
224}
int GetMaxHitsPerGap() const
How many hits were attached in the gap with the most attached hits?

Referenced by MucRecRoadFinder::execute().

◆ GetNGapsWithHits()

int MucRec3DRoad::GetNGapsWithHits ( ) const

How many gaps provide hits attached to this road?

Definition at line 182 of file MucRec3DRoad.cxx.

183{
184 int count = 0;
185 for (int gap = 0; gap < (int)MucID::getGapMax(); gap++) {
186 if ( (m_Road0->GetHitsPerGap(gap) > 0) || (m_Road1->GetHitsPerGap(gap) > 0) ) {
187 count++;
188 }
189 }
190 return count;
191}
DOUBLE_PRECISION count[3]

Referenced by MucRecRoadFinder::execute().

◆ GetNSharedHits()

int MucRec3DRoad::GetNSharedHits ( const MucRec3DRoad road) const

How many hits do two roads share?

Definition at line 240 of file MucRec3DRoad.cxx.

241{
242 if (!road) {
243 return 0;
244 }
245
246 int count = 0;
247 count += m_Road0->GetNSharedHits( road->Get2DRoad(int(0)) );
248 count += m_Road1->GetNSharedHits( road->Get2DRoad(int(1)) );
249
250 return count;
251}
int GetNSharedHits(const MucRec2DRoad *road) const
How many hits do two roads share?
MucRec2DRoad * Get2DRoad(const int &orient=0) const
Is the intersection of a pair of H and V clusters inside a panel?

◆ GetPart()

int MucRec3DRoad::GetPart ( ) const

In which part was this road found?

Definition at line 161 of file MucRec3DRoad.cxx.

162{
163 return m_Part;
164}

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

◆ GetReducedChiSquare()

float MucRec3DRoad::GetReducedChiSquare ( ) const

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

Definition at line 276 of file MucRec3DRoad.cxx.

277{
278 if (m_DOF < 0) {
279 return -1.0;
280 }
281 else {
282 if (m_DOF == 0) {
283 return 0.0;
284 }
285 else {
286 return (m_Chi2/m_DOF);
287 }
288 }
289}

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

◆ GetSeg()

int MucRec3DRoad::GetSeg ( ) const

In which segment was this road found?

Definition at line 168 of file MucRec3DRoad.cxx.

169{
170 return m_Seg;
171}

Referenced by MucRecRoadFinder::execute().

◆ GetSlopeZX()

float MucRec3DRoad::GetSlopeZX ( ) const

Get Z-X dimension slope.

Definition at line 293 of file MucRec3DRoad.cxx.

294{
295 return m_SlopeZX;
296}

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

◆ GetSlopeZY()

float MucRec3DRoad::GetSlopeZY ( ) const

Get Z-Y dimension slope.

Definition at line 307 of file MucRec3DRoad.cxx.

308{
309 return m_SlopeZY;
310}

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

◆ GetTotalHits()

int MucRec3DRoad::GetTotalHits ( ) const

How many hits in all does this road contain?

Definition at line 195 of file MucRec3DRoad.cxx.

196{
197 return ( m_Road0->GetTotalHits() + m_Road1->GetTotalHits() );
198}
int GetTotalHits() const
How many hits in all does this road contain?

Referenced by MucRecRoadFinder::execute().

◆ GetTotalHitsDelta()

int MucRec3DRoad::GetTotalHitsDelta ( ) const

Difference between the number of hits in the two 1-D roads.

Definition at line 262 of file MucRec3DRoad.cxx.

263{
264 return abs( m_Road0->GetTotalHits() - m_Road1->GetTotalHits() );
265}

Referenced by MucRecRoadFinder::execute().

◆ GetVxSign()

float MucRec3DRoad::GetVxSign ( const float  vk) const

Get sign of vx in TransformPhiRToXY.

Definition at line 786 of file MucRec3DRoad.cxx.

787{
788 float segmentPhiMin = 0.25*kPi*(m_Seg-2);
789 float segmentPhiMax = 0.25*kPi*(m_Seg+2);
790 if (m_Seg > 4) {
791 segmentPhiMin -= 2.0*kPi;
792 segmentPhiMax -= 2.0*kPi;
793 }
794
795 // vk = tan(theta); theta = atan(vk); -90<theta<90
796 float theta = atan(vk);
797 if (theta >= segmentPhiMin && theta <= segmentPhiMax) return 1.0;
798 else return -1.0;
799}
const double kPi
Definition: MucConstant.h:6

Referenced by TransformPhiRToXY().

◆ HasHitInGap()

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

Does this road contain any hits in the given segment?

Definition at line 228 of file MucRec3DRoad.cxx.

229{
230 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
231 cout << "MucRec3DRoad::HasHitInGap-E2 invalid gap = " << gap << endl;
232 return false;
233 }
234
235 return ( m_Road0->HasHitInGap(gap) || m_Road1->HasHitInGap(gap) );
236}
bool HasHitInGap(const int &gap) const
Does this road contain any hits in the given gap?

◆ operator=()

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

Assignment constructor.

◆ PrintHitsInfo()

void MucRec3DRoad::PrintHitsInfo ( )

Print Hits Infomation.

Definition at line 803 of file MucRec3DRoad.cxx.

804{
805 m_Road0->PrintHitsInfo();
806 m_Road1->PrintHitsInfo();
807
808 cout << "Intersection with each gap : " << endl;
809 for (int iGap = 0; iGap <= m_LastGap; iGap++) {
810 float x, y, z, sigmaX, sigmaY, sigmaZ;
811 ProjectWithSigma(iGap, x, y, z, sigmaX, sigmaY, sigmaZ);
812 cout << " gap " << iGap
813 << " (" << x
814 << ", " << y
815 << ", " << z
816 << ")"
817 << endl;
818 }
819}
void PrintHitsInfo() const
Print Hits Infomation.
void ProjectWithSigma(const int &gap, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
Where does the trajectory of this road intersect a specific gap?

◆ Project() [1/2]

void MucRec3DRoad::Project ( const int &  gap,
const float  zx,
const float  x0,
const float  zy,
const float  y0,
float &  x1,
float &  y1,
float &  z1 
)

project with assigned pos and dir

Definition at line 584 of file MucRec3DRoad.cxx.

585{
586 float svx=0, svy=0, sx0=0, sy0=0;
587 float sigmaX,sigmaY,sigmaZ;
588 MucGeoGeneral::Instance()->FindIntersection(m_Part, m_Seg, gap,
589 vx, vy, 1.0, x0, y0, 0.0,
590 svx, svy, 0.0, sx0, sy0, 0.0,
591 x, y, z,
592 sigmaX, sigmaY, sigmaZ);
593}
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)

◆ Project() [2/2]

void MucRec3DRoad::Project ( const int &  gap,
float &  x1,
float &  y1,
float &  z1,
float &  x2,
float &  y2,
float &  z2 
)

Where does the trajectory of this road intersect two surfaces of a specific gap?

Definition at line 598 of file MucRec3DRoad.cxx.

599{
600 float sigmaX1, sigmaY1, sigmaZ1;
601 float sigmaX2, sigmaY2, sigmaZ2;
602
603 x1 = 0.0; sigmaX1 = 0.0;
604 y1 = 0.0; sigmaY1 = 0.0;
605 z1 = 0.0; sigmaZ1 = 0.0;
606 x2 = 0.0; sigmaX2 = 0.0;
607 y2 = 0.0; sigmaY2 = 0.0;
608 z2 = 0.0; sigmaZ2 = 0.0;
609
610 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
611 cout << "MucRec3DRoad::Project-E1 invalid gap = " << gap << endl;
612 return;
613 }
614
615 float vx, vy, vk, vr;
616 float x0, y0, k0, r0;
617 float svx, svy, svk, svr;
618 float sx0, sy0, sk0, sr0;
619 int xdof, ydof;
620 float chi2x, chi2y;
621
622 // Determine the projection point of the "simple" fit to the desired gap.
623
624 if( m_Part == 1 ) {
625 m_Road0->GetSimpleFitParams(vr, r0, svr, sr0, chi2x, xdof);
626 m_Road1->GetSimpleFitParams(vk, k0, svk, sk0, chi2y, ydof);
627 TransformPhiRToXY(vk, vr, k0, r0,
628 vx, vy, x0, y0);
629
630 //cout<<"in MucRec3DRoad after vx,vy"<<endl;
631 TransformPhiRToXY(svk, svr, sk0, sr0,
632 svx, svy, sx0, sy0);
633 }
634 else {
635 m_Road0->GetSimpleFitParams(vy, y0, svy, sy0, chi2y, ydof);
636 m_Road1->GetSimpleFitParams(vx, x0, svx, sx0, chi2x, xdof);
637 }
638 /*
639 cout << " vr " << vr << " vk " << vk << endl;
640 cout << " r0 " << r0 << " k0 " << k0 << endl;
641 cout << " vx " << vx << " vy " << vy << endl;
642 cout << " x0 " << x0 << " y0 " << y0 << endl;
643 */
644
646 vx, vy, 1.0, x0, y0, 0.0,
647 svx, svy, 0.0, sx0, sy0, 0.0,
648 x1, y1, z1, x2, y2, z2,
649 sigmaX1, sigmaY1, sigmaZ1,
650 sigmaX2, sigmaY2, sigmaZ2);
651
652 float a, b, c;
653 float sa, sb, sc; int whichhalf;
654 //cout<<"in MucRec3DRoad xyz form linefit "<<x1<<" "<<y1<<" "<<z1<<" "<<x2<<" "<<y2<<" "<<z2<<endl;
655
656 //if this trajectory is parabola!
657 int projectwithquad = 0;
658 if( m_Part == 1 && projectwithquad) {
659 m_Road1->GetSimpleFitParams(a, b, c, whichhalf, sa, sb, sc, chi2x, ydof);
660
661 //cout<<"in MucRec3DRoad "<<vy<<" "<<y0<<" "<<a<<" "<<b<<" "<<c<<endl;
662 if(m_Road1->GetQuadFitOk()){
664 vy, x0, y0, 0.0,
665 a, b, c, //y = a*x*x + b*x +c
666 whichhalf,
667 svx, svy, 0.0, sx0, sy0, 0.0,
668 x1, y1, z1, x2, y2, z2,
669 sigmaX1, sigmaY1, sigmaZ1);
670 }
671
672 }
673
674 return;
675}
void FindIntersectionSurface(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 &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX1, float &sigmaY1, float &sigmaZ1, float &sigmaX2, float &sigmaY2, float &sigmaZ2)
void GetSimpleFitParams(float &slope, float &intercept, float &sigmaSlope, float &sigmaIntercept, float &chisq, int &ndof) const
Get the parameters from the simple fit.
bool GetQuadFitOk()
Definition: MucRec2DRoad.h:160
void TransformPhiRToXY(const float &vk, const float &vr, const float &k0, const float &r0, float &vx, float &vy, float &x0, float &y0) const
Where does the trajectory of this road intersect the reference plane?
const double b
Definition: slope.cxx:9

Referenced by RecMucTrack::LineFit().

◆ ProjectNoCurrentGap()

void MucRec3DRoad::ProjectNoCurrentGap ( const int &  gap,
float &  x,
float &  y,
float &  z,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ,
float &  quad_x1,
float &  quad_y1,
float &  quad_z1,
float &  quad_x2,
float &  quad_y2,
float &  quad_z2 
)

Where does the trajectory of this road intersect a specific gap when refit without current gap!!!

Definition at line 495 of file MucRec3DRoad.cxx.

497{
498
499 x = 0.0; sigmaX = 0.0;
500 y = 0.0; sigmaY = 0.0;
501 z = 0.0; sigmaZ = 0.0;
502
503 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
504 cout << "MucRec3DRoad::Project-E1 invalid gap = " << gap << endl;
505 return;
506 }
507
508 float vx, vy, vk, vr;
509 float x0, y0, k0, r0;
510 float svx, svy, svk, svr;
511 float sx0, sy0, sk0, sr0;
512 int xdof, ydof;
513 float chi2x, chi2y;
514 float spos0, spos1;
515
516 // Determine the projection point of the "simple" fit to the desired gap.
517
518 // now these 2 2D road have been refit without current gap!
519 if( m_Part == 1 ) {
520 m_Road0->SimpleFitNoCurrentGap(gap, vr, r0, svr, sr0, chi2x, xdof);
521 m_Road1->SimpleFitNoCurrentGap(gap, vk, k0, svk, sk0, chi2y, ydof);
522
523 m_Road0->GetPosSigma(spos0);
524 m_Road1->GetPosSigma(spos1);
525
526 TransformPhiRToXY(vk, vr, k0, r0, vx, vy, x0, y0);
527
528 //TransformPhiRToXY(svk, svr, sk0, sr0, svx, svy, sx0, sy0);
529 TransformPhiRToXY(vk+svk, vr+svr, k0+sk0, r0+sr0, svx, svy, sx0, sy0);
530 svx -= vx; svy -= vy; sx0 -= x0; sy0 -= y0;
531 }
532 else {
533 m_Road0->SimpleFitNoCurrentGap(gap, vy, y0, svy, sy0, chi2y, ydof);
534 m_Road1->SimpleFitNoCurrentGap(gap, vx, x0, svx, sx0, chi2x, xdof);
535 m_Road0->GetPosSigma(spos0);
536 m_Road1->GetPosSigma(spos1);
537
538 }
539 /*
540 cout << " vr " << vr << " vk " << vk << endl;
541 cout << " r0 " << r0 << " k0 " << k0 << endl;
542 cout << " vx " << vx << " vy " << vy << endl;
543 cout << " x0 " << x0 << " y0 " << y0 << endl;
544 */
545
546 MucGeoGeneral::Instance()->FindIntersection(m_Part, m_Seg, gap,
547 vx, vy, 1.0, x0, y0, 0.0,
548 svx, svy, 0.0, sx0, sy0, 0.0,
549 x, y, z,
550 sigmaX, sigmaY, sigmaZ);
551 if(fabs(vr)>10000) ///////////////////if fabs(vr) too big, r0 will be intersection in x coordinate!!!
552 MucGeoGeneral::Instance()->FindIntersection(m_Part, m_Seg, gap,
553 vx, vy, 1.0, x0, y0, r0,
554 svx, svy, 0.0, sx0, sy0, 0.0,
555 x, y, z,
556 sigmaX, sigmaY, sigmaZ);
557
558 sigmaX = spos1;
559 sigmaY = spos0;
560 sigmaZ = 0.0;
561
562 float a, b, c;
563 float sa, sb, sc; int whichhalf;
564
565 //calc orient now
566 int orient = 0;
567 if(m_Part == 1 && gap%2 == 0) orient = 1;
568 if(m_Part != 1 && gap%2 == 1) orient = 1;
569
570 if(orient == 0) m_Road0->GetSimpleFitParams(a, b, c, whichhalf, sa, sb, sc, chi2x, ydof);
571 else m_Road1->GetSimpleFitParams(a, b, c, whichhalf, sa, sb, sc, chi2x, ydof);
572
573 //cout<<"orient = "<<orient<<" abc: "<<a<<" "<<b<<" "<<c<<endl;
574 quad_x1 = -9999; quad_y1 = -9999; quad_z1 = -9999; quad_x2 = -9999; quad_y2 = -9999; quad_z2 = -9999;
575
576 if(orient == 0 && m_Road0->GetQuadFitOk() || orient == 1 && m_Road1->GetQuadFitOk() )
578 a, b, c, whichhalf, quad_x1, quad_y1, quad_z1, quad_x2, quad_y2, quad_z2, sigmaX, sigmaY, sigmaZ);
579
580 return;
581}
void FindIntersectionQuadLocal(const int part, const int seg, const int gap, const float a, const float b, const float c, const int whichhalf, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
void GetPosSigma(float &possigma) const
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!!!

Referenced by RecMucTrack::LineFit().

◆ ProjectToStrip() [1/2]

vector< Identifier > MucRec3DRoad::ProjectToStrip ( const int &  part,
const int &  gap,
const HepPoint3D gPoint,
const Hep3Vector &  gDirection 
)

Definition at line 388 of file MucRec3DRoad.cxx.

389{
390 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
391 cout << "MucRec3DRoad::Project-E1 invalid part = " << part << endl;
392 }
393
394 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
395 cout << "MucRec3DRoad::Project-E1 invalid gap = " << gap << endl;
396 }
397
398 return MucGeoGeneral::Instance()->FindIntersectStrips(part, gap, gPoint, gDirection);
399}
vector< Identifier > FindIntersectStrips(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
static value_type getPartNum()
Definition: MucID.cxx:159

Referenced by RecMucTrack::LineFit().

◆ ProjectToStrip() [2/2]

vector< Identifier > MucRec3DRoad::ProjectToStrip ( const int &  part,
const int &  gap,
const HepPoint3D gPoint,
const Hep3Vector &  gDirection,
vector< int > &  padID,
vector< float > &  intersect_x,
vector< float > &  intersect_y,
vector< float > &  intersect_z 
)

Definition at line 402 of file MucRec3DRoad.cxx.

403{
404 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
405 cout << "MucRec3DRoad::Project-E1 invalid part = " << part << endl;
406 }
407
408 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
409 cout << "MucRec3DRoad::Project-E1 invalid gap = " << gap << endl;
410 }
411
412 return MucGeoGeneral::Instance()->FindIntersectStrips(part, gap, gPoint, gDirection, padID, intersect_x, intersect_y, intersect_z);
413}

◆ ProjectWithSigma()

void MucRec3DRoad::ProjectWithSigma ( const int &  gap,
float &  x,
float &  y,
float &  z,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ 
)

Where does the trajectory of this road intersect a specific gap?

Definition at line 417 of file MucRec3DRoad.cxx.

418{
419 x = 0.0; sigmaX = 0.0;
420 y = 0.0; sigmaY = 0.0;
421 z = 0.0; sigmaZ = 0.0;
422
423 if ( (gap < 0) || (gap >= (int)MucID::getGapMax()) ) {
424 cout << "MucRec3DRoad::Project-E1 invalid gap = " << gap << endl;
425 return;
426 }
427
428 float vx, vy, vk, vr;
429 float x0, y0, k0, r0;
430 float svx, svy, svk, svr;
431 float sx0, sy0, sk0, sr0;
432 int xdof, ydof;
433 float chi2x, chi2y;
434 float spos0, spos1;
435
436 // Determine the projection point of the "simple" fit to the desired gap.
437 if( m_Part == 1 ) {
438 m_Road0->GetSimpleFitParams(vr, r0, svr, sr0, chi2x, xdof);
439 m_Road1->GetSimpleFitParams(vk, k0, svk, sk0, chi2y, ydof);
440 m_Road0->GetPosSigma(spos0);
441 m_Road1->GetPosSigma(spos1);
442
443 TransformPhiRToXY(vk, vr, k0, r0, vx, vy, x0, y0);
444 //TransformPhiRToXY(svk, svr, sk0, sr0, svx, svy, sx0, sy0);
445 TransformPhiRToXY(vk+svk, vr+svr, k0+sk0, r0+sr0, svx, svy, sx0, sy0);
446 svx -= vx; svy -= vy; sx0 -= x0; sy0 -= y0;
447 }
448 else {
449 m_Road0->GetSimpleFitParams(vy, y0, svy, sy0, chi2y, ydof);
450 m_Road1->GetSimpleFitParams(vx, x0, svx, sx0, chi2x, xdof);
451 m_Road0->GetPosSigma(spos0);
452 m_Road1->GetPosSigma(spos1);
453
454 }
455
456/*
457 cout << " vr " << vr << " vk " << vk << endl;
458 cout << " r0 " << r0 << " k0 " << k0 << endl;
459 cout << " vx " << vx << " vy " << vy << endl;
460 cout << " x0 " << x0 << " y0 " << y0 << endl;
461*/
462
463 MucGeoGeneral::Instance()->FindIntersection(m_Part, m_Seg, gap,
464 vx, vy, 1.0, x0, y0, 0.0,
465 svx, svy, 0.0, sx0, sy0, 0.0,
466 x, y, z,
467 sigmaX, sigmaY, sigmaZ);
468/*
469 if(fabs(vr)>10000) ///////////////////if fabs(vr) too big, r0 will be intersection in x coordinate!!!
470 MucGeoGeneral::Instance()->FindIntersection(m_Part, m_Seg, gap,
471 vx, vy, 1.0, x0, y0, r0,
472 svx, svy, 0.0, sx0, sy0, 0.0,
473 x, y, z,
474 sigmaX, sigmaY, sigmaZ);
475*/
476
477 sigmaX = spos1;
478 sigmaY = spos0;
479 sigmaZ = 0.0;
480
481 float a, b, c;
482 float sa, sb, sc; int whichhalf;
483 //cout<<"in MucRec3DRoad xyz form linefit "<<x<<" "<<y<<" "<<z<<endl;
484
485 if( m_Part == 1 ) {
486 m_Road1->GetSimpleFitParams(a, b, c, whichhalf, sa, sb, sc, chi2x, ydof);
487 //cout<<"in MucRec3DRoad "<<vy<<" "<<y0<<" "<<a<<" "<<b<<" "<<c<<endl;
488 }
489
490 return;
491}

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

◆ RefitNoCurrentGap()

int MucRec3DRoad::RefitNoCurrentGap ( const int &  gap,
float &  slopeZX,
float &  interceptZX,
float &  slopeZY,
float &  interceptZY 
)

refit the 3D road without the assigned gap

Definition at line 340 of file MucRec3DRoad.cxx.

345{
346 float vx, vy, vk, vr;
347 float x0, y0, k0, r0;
348 float svx, svy, svk, svr;
349 float sx0, sy0, sk0, sr0;
350 int xdof, ydof;
351 float chi2x, chi2y;
352 float spos0, spos1;
353
354 // Determine the projection point of the "simple" fit to the desired gap.
355 int status1, status2;
356
357 // now these 2 2D road have been refit without current gap!
358 if( m_Part == 1 ) {
359 status1 = m_Road0->SimpleFitNoCurrentGap(gap, vr, r0, svr, sr0, chi2x, xdof);
360 status2 = m_Road1->SimpleFitNoCurrentGap(gap, vk, k0, svk, sk0, chi2y, ydof);
361
362 m_Road0->GetPosSigma(spos0);
363 m_Road1->GetPosSigma(spos1);
364
365 TransformPhiRToXY(vk, vr, k0, r0,
366 vx, vy, x0, y0);
367
368// TransformPhiRToXY(svk, svr, sk0, sr0, svx, svy, sx0, sy0);
369 TransformPhiRToXY(vk+svk, vr+svr, k0+sk0, r0+sr0, svx, svy, sx0, sy0);
370 svx -= vx; svy -= vy; sx0 -= x0; sy0 -= y0;
371 }
372 else {
373 status1 = m_Road0->SimpleFitNoCurrentGap(gap, vy, y0, svy, sy0, chi2y, ydof);
374 status2 = m_Road1->SimpleFitNoCurrentGap(gap, vx, x0, svx, sx0, chi2x, xdof);
375 m_Road0->GetPosSigma(spos0);
376 m_Road1->GetPosSigma(spos1);
377 }
378
379 if(status1 == -1 || status2 == -1) return -1;
380 slopeZX = vx; interceptZX = x0;
381 slopeZY = vy; interceptZY = y0;
382
383 return 0;
384}

Referenced by RecMucTrack::LineFit().

◆ SetGroup()

void MucRec3DRoad::SetGroup ( const int &  Group)

set the group index for this road

Definition at line 126 of file MucRec3DRoad.cxx.

127{
128 if (Group >= 0) m_Group = Group;
129}

◆ SetIndex()

void MucRec3DRoad::SetIndex ( const int &  index)

set the index for this road

Definition at line 119 of file MucRec3DRoad.cxx.

120{
121 if (index >= 0) m_Index = index;
122}

◆ SetSimpleFitParams()

void MucRec3DRoad::SetSimpleFitParams ( const float &  m_SlopeZX,
const float &  m_InterceptZX,
const float &  m_SlopeZY,
const float &  m_InterceptZY 
)

set the fit parameters : slope and intercept for XZ and YZ.

Definition at line 133 of file MucRec3DRoad.cxx.

137{
138 m_SlopeZX = slopeZX;
139 m_InterceptZX = interceptZX;
140 m_SlopeZY = slopeZY;
141 m_InterceptZY = interceptZY;
142}

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

◆ TransformPhiRToXY()

void MucRec3DRoad::TransformPhiRToXY ( const float &  vk,
const float &  vr,
const float &  k0,
const float &  r0,
float &  vx,
float &  vy,
float &  x0,
float &  y0 
) const

Where does the trajectory of this road intersect the reference plane?

Where does the trajectory of this road intersect a z=const plane? Transform the Phi, ZR cord. to ZX, ZY cord.

Definition at line 720 of file MucRec3DRoad.cxx.

724{
725 vx = 0.0; vy = 0.0;
726 x0 = 0.0; y0 = 0.0;
727
728 // cout << vk << " " << vr << " " << endl;
729
730 //float pi = 3.1415926536;
731 float phi = 0.25*kPi*m_Seg;
732
733 // From y0 = vk * x0 + k0;
734 // y0 - r0*sin(phi)
735 // ------------------ = tan(phi + 0.5*kPi);
736 // x0 - r0*cos(phi)
737
738 if ( cos(phi) + vk*sin(phi) == 0.0 ) {
739 cout << " track parallel to gap, some error occurs! " << endl;
740 // m_Seg = 1, and vk = -1;
741 // 2, 0;
742 // 3, 1;
743 // 5, -1;
744 // 6, 0;
745 // 7, 1;
746 }
747 else {
748 /*
749 vx = vr / ( cos(phi) + vk*sin(phi) );
750 vy = vk * vx;
751 x0 = (r0 - k0) / ( cos(phi) + vk );
752 y0 = vk * x0 + k0;
753 */
754
755 float atan_vk = atan(vk);
756 if(atan_vk<0) atan_vk += kPi;
757
758 //float deltaPhi = fabs(atan(vk)) - int( fabs(atan(vk))/(0.25*kPi) )*0.25*kPi;
759 //if (deltaPhi > 0.125*kPi) deltaPhi = 0.25*kPi - delta
760
761 float deltaPhi = atan_vk - (m_Seg%4)*(0.25*kPi);
762
763 //vx = vr*cos(deltaPhi)*GetVxSign(vk)/sqrt(1.0+vk*vk); //change to vr/cos()... liangyt 2007.4.10
764 //I think it should be vr/cos...
765
766 vx = (vr/fabs(cos(deltaPhi)))*GetVxSign(vk)/sqrt(1.0+vk*vk);
767 vy = vk*vx;
768 x0 = (r0 - k0*sin(phi)) / (vk*sin(phi) + cos(phi));
769 y0 = vk * x0 + k0;
770
771 float safe_vr = vr;
772
773 if(fabs(vr)>10000){
774 if(vr>0) safe_vr = 10000;
775 else safe_vr = -10000;
776 vx = (safe_vr/fabs(cos(deltaPhi)))*GetVxSign(vk)/sqrt(1.0+vk*vk);
777 vy = vk*vx;
778 y0 = -vy*r0;
779 x0 = (y0 - k0)/vk;
780 }
781
782 }
783}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
float GetVxSign(const float vk) const
Get sign of vx in TransformPhiRToXY.

Referenced by MucRecRoadFinder::execute(), RecMucTrack::LineFit(), Project(), ProjectNoCurrentGap(), ProjectWithSigma(), and RefitNoCurrentGap().


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