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