StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiTrackNode.h
1 #ifndef StiTrackNode_H
2 #define StiTrackNode_H 1
3 
4 #include <Stiostream.h>
5 #include <stdlib.h>
6 
7 #include "StiTreeNode.h"
8 #include "StiHit.h"
9 #include "StiNodePars.h"
10 class StiDetector;
11 double sign(const double *b,int n);
12 
13 enum eTkPars {kNPars=6,kNErrs=21};
14 class StiNodeMtx {
15 public:
16 void reset(){memset(this,0,sizeof(StiNodeMtx));}
17  double A[kNPars][kNPars];
18 };
19 
20 
21 
22 class StiNodeErrs {
23 public:
24 enum {kBigLen = 20};
25 
26 
27 void reset() {memset(this,0,sizeof(StiNodeErrs));}
28 double getDelta() const {return sqrt(_cXX+_cYY+_cZZ);}
29 double getDelta2() const {return (_cXX+_cYY+_cZZ);}
30 const double* G() const { return &_cXX;}
31  double* G() { return &_cXX;}
32 StiNodeErrs &operator*=(double f) {for (int i=0;i<kNErrs;i++){G()[i]*=f;}; return *this;}
33 StiNodeErrs &merge(double wt,StiNodeErrs &other);
34 void rotate(double alpha,const StiNodePars &pars );
35  int nan() const;
36 
37 void get00( double *a) const;
38 void set00(const double *a) ;
39 void get10( double *a) const;
40 void set10(const double *a) ;
41 void get11( double *a) const;
42 void set11(const double *a) ;
43 
44 void recov(int force=0);
45 int check(const char *pri=0) const;
46 double sign() const;
47 double zign() const;
48 double operator()(int i,int j) const;
49 void zeroX();
50 void print() const;
51 
52 public:
53  double _cXX;
54  double _cYX,_cYY;
55  double _cZX,_cZY, _cZZ;
56  double _cEX,_cEY, _cEZ, _cEE;
57  double _cPX,_cPY, _cPZ, _cPE, _cPP;
58  double _cTX,_cTY, _cTZ, _cTE, _cTP, _cTT;
59 };
60 class StiHitErrs{
61 public:
62 void reset() {memset(this,0,sizeof(*this));}
63 StiHitErrs &operator*=(double f) {for (int i=0;i<6;i++){G()[i]*=f;};return *this;}
64 void rotate(double angle);
65 const double* G() const { return &hXX;}
66  double* G() { return &hXX;}
67 
68  double hXX;
69  double hYX,hYY;
70  double hZX,hZY, hZZ;
71 };
72 
82 {
83 public:
84 void set(const StiNodePars &pars,StiNodeErrs &errs);
85 public:
86 float mPar[2]; // Node_Y , Node_Z
87 float mErr[3]; // yy,yz,zz
88 };
89 
90 
98 public:
99  StiHitContino() {reset();}
100  void reset();
101  StiHit *getHit (int idx) const {return mHits[idx];}
102  int getNHits () const;
103  double getChi2 (int idx=0) const {return mChi2[idx];}
104  double getDetr (int idx=0) const {return mDetr[idx];}
105  void add (StiHit *hit,double chi2,double detr=1.);
106  void print (const char* opt="") const;
107 private:
108  enum {kMaxSize=10};
109  StiHit *mHits[kMaxSize+1];
110  double mChi2[kMaxSize+1];
111  double mDetr[kMaxSize+1];
112 };
113 
114 
115 
116 class StiTrackNode : public StiTreeNode
117 {
118 public:
119 enum eTrackNodeStatus {
120  kTNReset = 0, // TrackNode after reset
121  kTNRotBeg = 1, // TrackNode start rotation
122  kTNRotEnd = 2, // TrackNode rotated, errmatrix 3d
123  kTNProBeg = 3, // TrackNode start propagation, errmatrix wrong
124  kTNProEnd = 4, // TrackNode end propagation, errmatrix still wrong
125  kTNNudBeg = 5, // TrackNode start nudge
126  kTNFitBeg = 6, // TrackNode start fit
127 
128  kTNReady =10, // TrackNode propagateError called,errmatrix OK
129  kTNNudEnd =11, // TrackNode end nudge
130  kTNFitEnd =12, // TrackNode end fit
131  kTNInit =13}; // TrackNode initialized
132 enum eTrackNodeFlags {
133  kTNRefit = 1 // TrackNode in refit stage
134 };
135 
136  virtual ~StiTrackNode(){};
137  virtual double getPt() const=0;
138  const StiTrackNode& operator=(const StiTrackNode& node);
139  void reset();
140  void unset(){;}
141 
142 virtual double x_g() const =0;
143 virtual double y_g() const =0;
144 virtual double z_g() const =0;
145 virtual double x() const =0;
146 virtual double y() const =0;
147 virtual double z() const =0;
148 
149  StiHit * getHit() const {return _hit;}
150  void setHit(StiHit* hit) {_hit =hit;}
151  const StiDetector *getDetector() const;
152  void setDetector(const StiDetector *detector);
153  double getChi2 () const {return _chi2;}
154  double getDeterm() const {return _det ;}
155  void setChi2(double chi2) {_chi2 =chi2;}
156  int getState() const {return _state;}
157  void setInvalid() { _state=0;}
158  void setReady() { _state=kTNReady;}
159  int isValid() const {return _state>=kTNReady;}
160  int isFitted() const {return (_hit && _chi2<1e3);}
161  double getRefPosition() const;
162  double getLayerAngle() const;
163 public:
164 static void mult6(double Rot[kNPars][kNPars],const double Pro[kNPars][kNPars]);
165 static void errPropag6(double G[21],const double F[6][6],int nF);
166 static int cylCross(const double Xp[2],const double Dp[2], const double Rho, const double r
167  , int dir, double out[2][3]);
168 
169 static double sinX(double x); // (sin(x)-x)/x**3
170 
171  StiTrackNode() {reset();}
172  int _state;
173  const StiDetector * _detector;
174  StiHit* _hit;
175  double _det;
176  double _chi2;
177 public:
178 static int mgFlag;
179 };
180 
181 
182 inline void StiTrackNode::reset()
183 {
184  StiTreeNode::reset();
185  _state = kTNReset;
186  _detector = 0;
187  _hit=0;
188  _chi2 = 1e60;
189 }
190 
191 
192 inline const StiDetector * StiTrackNode::getDetector() const
193 {
194  return _detector;
195 }
196 
197 inline void StiTrackNode::setDetector(const StiDetector *detector)
198 {
199  _detector = detector;
200 }
201 inline const StiTrackNode& StiTrackNode::operator=(const StiTrackNode& node)
202 {
203  //not called StiTreeNode::operator=(); //Relationship is not changed
204  _state = node._state;
205  _detector = node._detector;
206  _hit = node._hit;
207  _chi2 = node._chi2;
208  return *this;
209 }
210 
211 #endif
212 
213 
214 
Definition: StiHit.h:51
static void errPropag6(double G[21], const double F[6][6], int nF)