BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Muc/MucRecEvent/include/MucRecEvent/MucRec2DRoad.h
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2003/12/21 Zhengyun You Peking University
7 *
8 * 2005/02/24 Zhengyun You Peking University
9 * transplanted to Gaudi framework
10 */
11
12#ifndef MUC_REC_2DROAD_H
13#define MUC_REC_2DROAD_H
14
15#include "GaudiKernel/ContainedObject.h"
16#include "GaudiKernel/ObjectVector.h"
17#include "GaudiKernel/SmartRef.h"
18
19#include "MucRecEvent/MucRecHit.h"
20
21using CLHEP::Hep3Vector; // forward declaration
22
23/**
24 * Describes a "two-dimensional" road found in the muon chamber.
25 * part and orient decides dimension of the road.
26 * part orient dimension
27 * 1 0 Z-R
28 * 1 1 Phi-R
29 * 0,2 0 Y-Z
30 * 0,2 1 X-Z
31 * A full "three-dimensional" road is composed of
32 * two 2D roads with different orients on the same part.
33 *
34 * @author Zhengyun You \URL{mailto:youzy@hep.pku.cn}
35 *
36 */
37
38class MucRec2DRoad : virtual public ContainedObject {
39public:
40 /// Constructor.
41 MucRec2DRoad( const int& part = 0, const int& seg = 0, const int& orient = 0,
42 const float& xVertex = 0.0, const float& yVertex = 0.0,
43 const float& zVertex = 0.0, const int& fittingMethod = 0 );
44
45 /// Assignment constructor.
47
48 /// Copy constructor.
49 MucRec2DRoad( const MucRec2DRoad& source );
50
51 /// Destructor.
53
54 /// Set the index for this road.
55 void SetIndex( const int& index );
56
57 /// Attach the given hit to this road.
58 void AttachHit( MucRecHit* hit );
59
60 /// Attach the given hit to this road, but not fit this road.
62
63 /// Max number of consecutive gaps allowed with no hits attached.
64 /// This parameter affects the calculation of the last gap.
65 void SetMaxNSkippedGaps( const int& nGaps );
66
67 /// Calculate the best-fit straight line with "simple" weights.
68 int SimpleFit( float& slope, float& intercept, float& sigmaSlope, float& sigmaIntercept,
69 float& chisq, int& ndof );
70
71 /// Calculate the best-fit straight line with "simple" weights. not use current gap!!!
72 int SimpleFitNoCurrentGap( int currentgap, float& slope, float& intercept, float& sigmaSlope,
73 float& sigmaIntercept, float& chisq, int& ndof );
74
75 /// Fit (with weights) the hit center to a straight line.
76 // This is a helper function for the Project methods.
77 // Give an estimated position (x,y,z) of the point to which we will
78 // project.
79 int Fit( const float& x, const float& y, const float& z, float& slope, float& intercept,
80 float& sigmaSlope, float& sigmaIntercept, float& chisq, int& ndof );
81
82 /// Where does the trajectory of this road intersect a specific gap?
83 void Project( const int& gap, float& x, float& y, float& z, float& x2, float& y2,
84 float& z2 );
85
86 //// Weight Function.
87 float WeightFunc( const float& chisq, const float& distance ) const;
88
89 //// Window Function.
90 float WindowFunc( const float& chisq, const float& distance ) const;
91
92 /// A unique identifier for this road in the current event.
93 int GetIndex() const;
94
95 /// In which part was this road found?
96 int GetPart() const;
97
98 /// In which segment was this road found?
99 int GetSeg() const;
100
101 /// In which orientation was this road found?
102 int GetOrient() const;
103
104 /// Position of the vertex point.
105 void GetVertexPos( float& x, float& y, float& z ) const;
106
107 /// Which gap is the last one with hits attached to this road?
108 int GetLastGap() const;
109
110 /// How many gaps provide hits attached to this road?
111 int GetNGapsWithHits() const;
112
113 /// How many hits in all does this road contain?
114 int GetTotalHits() const;
115
116 /// How many hits per gap does this road contain?
117 int GetHitsPerGap( const int& gap ) const;
118
119 /// How many hits were attached in the gap with the most attached hits?
120 int GetMaxHitsPerGap() const;
121
122 /// Does this road contain any hits in the given gap?
123 bool HasHitInGap( const int& gap ) const;
124
125 /// How many hits do two roads share?
126 int GetNSharedHits( const MucRec2DRoad* road ) const;
127
128 /// Slope of trajectory.
129 float GetSlope() const;
130
131 /// Intercept of trajectory.
132 float GetIntercept() const;
133
134 /// How many degrees of freedom in the trajectory fit?
136
137 /// Chi-square parameter (per degree of freedom) of the trajectory fit.
138 float GetReducedChiSquare() const;
139
140 /// Get the parameters from the simple fit.
141 void GetSimpleFitParams( float& slope, float& intercept, float& sigmaSlope,
142 float& sigmaIntercept, float& chisq, int& ndof ) const;
143
144 /// Get the parameters from the simple quad fit.
145 void GetSimpleFitParams( float& a, float& b, float& c, int& whichhalf, float& sigmaa,
146 float& sigmab, float& sigmac, float& chisq, int& ndof ) const;
147 bool GetQuadFitOk() { return m_QuadFitOK; }
148
149 void GetPosSigma( float& possigma ) const;
150
151 /// Get a pointer to the first found hit attached in a particular gap.
152 MucRecHit* GetHit( const int& gap ) const;
153
154 /// Distance to a hit.
155 float GetHitDistance( const MucRecHit* hit );
156
157 /// Determine the size of the search window in the given gap.
158 float GetSearchWindowSize( const int& gap ) const;
159
160 /// Does the hit exist in the road .
161 bool HasHit( MucRecHit* hit ) const;
162
163 /// Get indices of all hits in the road.
164 vector<Identifier> GetHitsID() const;
165
166 vector<MucRecHit*> GetHits() const;
167
168 /// Print Hits Infomation.
169 void PrintHitsInfo() const;
170
171private:
172 /// Calculate the hit counts and last gap quantities.
173 void CountHits();
174
175 Hep3Vector m_VertexPos; // Event vertex position.
176 Hep3Vector m_VertexSigma; // Uncertainty of event vertex position.
177
178 int m_Index; // uniquely identifies this road in the event
179 int m_Part; // Part in which the road was found.
180 int m_Seg; // Segment in which the road was found.
181 int m_Orient; // orientation of hits attached to this road.
182
183 float m_SimpleSlope; // slope of fit with simple weights
184 float m_SimpleIntercept; // intercept of fit with simple weights
185 float m_SimpleSlopeSigma; // uncert. in slope of fit with simple weights
186 float m_SimpleInterceptSigma; // uncert. in intercept of fit with simple weights
187 float m_SimplePosSigma; // uncert. in pos of this 2D line with first gap of MUC
188
189 float m_SimpleChi2; // Chi-square of fit with simple weights
190
191 float m_SimpleQuad_a; // y = a*x*x + b*x +c
192 float m_SimpleQuad_b;
193 float m_SimpleQuad_c;
194 int m_SimpleQuad_whichhalf;
195 float m_SimpleQuad_aSigma; // y = a*x*x + b*x +c
196 float m_SimpleQuad_bSigma;
197 float m_SimpleQuad_cSigma;
198 int m_fittingMethod;
199
200 float m_Chi2; // Chi-square parameter of trajectory fit.
201
202 int m_SimpleDOF; // degrees of freedom of fit with simple weights
203 int m_DOF; // Number of degrees of freedom of fit.
204
205 int m_MaxHitsPerGap; // Max. number of hits attached in a single gap.
206 int m_LastGap; // Last gap with attached clusters.
207 int m_TotalHits; // Total number of hits attached.
208 int m_MaxNSkippedGaps; // Max consecutive gaps allowed with no hits.
209
210 bool m_SimpleFitOK; // If == true, we have a good "simple" fit.
211 bool m_FitOK; // If == true, we have a good fit.
212 bool m_QuadFitOK;
213
214 vector<float> m_HitDistance; // distance from best hit to road
215 vector<MucRecHit*> m_pHits; // Pointers to attached hits.
216};
217
218typedef ObjectVector<MucRec2DRoad> MucRec2DRoadContainer;
219
220#endif /* MUC_REC_2DROAD_H */
~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 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.
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.
MucRec2DRoad(const MucRec2DRoad &source)
Copy constructor.
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!!!