StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcVertex.hh
1 // $Id: StFtpcVertex.hh,v 1.16 2015/07/20 17:21:31 jeromel Exp $
2 // $Log: StFtpcVertex.hh,v $
3 // Revision 1.16 2015/07/20 17:21:31 jeromel
4 // Use std::isnan instead for C++11
5 //
6 // Revision 1.15 2009/11/23 16:38:11 fisyak
7 // Remove dependence on dst_vertex_st
8 //
9 // Revision 1.14 2004/04/06 18:59:21 oldi
10 // New constructor which takes input data from StVertex added.
11 //
12 // Revision 1.13 2004/02/12 19:37:11 oldi
13 // *** empty log message ***
14 //
15 // Revision 1.12 2003/09/02 17:58:17 perev
16 // gcc 3.2 updates + WarnOff
17 //
18 // Revision 1.11 2002/11/06 13:48:06 oldi
19 // IFlag and Id added as data members.
20 // New functionality introduced (to clean up StFtpcTrackMaker.cxx).
21 //
22 // Revision 1.10 2002/06/04 13:43:54 oldi
23 // Minor change: 'west' -> 'hemisphere' (just a naming convention)
24 //
25 // Revision 1.9 2002/04/05 16:51:20 oldi
26 // Cleanup of MomentumFit (StFtpcMomentumFit is now part of StFtpcTrack).
27 // Each Track inherits from StHelix, now.
28 // Therefore it is possible to calculate, now:
29 // - residuals
30 // - vertex estimations obtained by back extrapolations of FTPC tracks
31 // Chi2 was fixed.
32 // Many additional minor (and major) changes.
33 //
34 // Revision 1.8 2002/03/15 10:04:41 oldi
35 // Adjust eta segments not only to z-position of vertex but to x,y as well.
36 // Avoid tracking if vertex position is outside of the inner radius of the Ftpc.
37 //
38 // Revision 1.7 2001/07/12 13:05:03 oldi
39 // QA histogram of FTPC vertex estimation is generated.
40 // FTPC vertex estimation is stored as pre vertex (id = 301) in any case, now.
41 //
42 // Revision 1.6 2001/01/25 15:22:43 oldi
43 // Review of the complete code.
44 // Fix of several bugs which caused memory leaks:
45 // - Tracks were not allocated properly.
46 // - Tracks (especially split tracks) were not deleted properly.
47 // - TClonesArray seems to have a problem (it could be that I used it in a
48 // wrong way). I changed all occurences to TObjArray which makes the
49 // program slightly slower but much more save (in terms of memory usage).
50 // Speed up of HandleSplitTracks() which is now 12.5 times faster than before.
51 // Cleanup.
52 //
53 // Revision 1.5 2000/11/10 18:39:25 oldi
54 // Changes due to replacement of StThreeVector by TVector3.
55 // New constructor added to find the main vertex with given point array.
56 //
57 // Revision 1.4 2000/07/18 21:22:17 oldi
58 // Changes due to be able to find laser tracks.
59 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint
60 // to bundle often called functions
61 // - short functions inlined
62 // - formulas of StFormulary made static
63 // - avoid streaming of objects of unknown size
64 // (removes the bunch of CINT warnings during compile time)
65 // - two or three minor bugs cured
66 //
67 // Revision 1.3 2000/05/15 14:28:16 oldi
68 // problem of preVertex solved: if no main vertex is found (z = NaN) StFtpcTrackMaker stops with kStWarn,
69 // refitting procedure completed and included in StFtpcTrackMaker (commented),
70 // new constructor of StFtpcVertex due to refitting procedure,
71 // minor cosmetic changes
72 //
73 // Revision 1.2 2000/05/11 15:14:54 oldi
74 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent
75 //
76 // Revision 1.1 2000/05/10 13:39:36 oldi
77 // Initial version of StFtpcTrackMaker
78 //
79 
81 // //
82 // StFtpcVertex class - representation of the main vertex one //
83 // //
85 
86 #ifndef STAR_StFtpcVertex
87 #define STAR_StFtpcVertex
88 
89 #include <Stiostream.h>
90 #include "TObject.h"
91 #include "TObjArray.h"
92 #include "TH1.h"
93 #include "TMath.h"
94 #include "TVector3.h"
95 #include "St_DataSet.h"
96 
97 class StVertex;
98 
99 class StFtpcVertex : public TObject {
100 
101 private:
102 
103  TVector3 mCoord; // coordinates of vertex
104  TVector3 mError; // errors on coordinates
105  Int_t mIFlag; // flag to indicate vertex state
106  Int_t mId; // vertex identification number
107 
108 public:
109 
110  StFtpcVertex(); // default constructor
111  StFtpcVertex(TObjArray *hits, TH1F *vtx_pos = 0); // constructor from point array
112  StFtpcVertex(St_DataSet *const geant); // constructor from geant
113  StFtpcVertex(StVertex *vertex); // constructor from StPrimaryVertex
114  StFtpcVertex(TObjArray *tracks, StFtpcVertex *vertex, Char_t hemisphere); // constructor form track array
115  StFtpcVertex(Double_t pos[6], Int_t iFlag = 0, Int_t id = 0); // constructor from array of doubles
116  StFtpcVertex(Double_t pos[3], Double_t err[3],
117  Int_t iFlag = 0, Int_t id = 0); // constructor from arrays of doubles (with errors)
118  StFtpcVertex(Double_t x, Double_t y, Double_t z,
119  Double_t x_err, Double_t y_err, Double_t z_err,
120  Int_t iFlag = 0, Int_t id = 0); // constructor from doubles with errors
121  StFtpcVertex(const StFtpcVertex &vertex); // Copy constructor
122  virtual ~StFtpcVertex(); // destructor
123 
124  // getter
125  Double_t GetX() const { return mCoord.X(); }
126  Double_t GetY() const { return mCoord.Y(); }
127  Double_t GetZ() const { return mCoord.Z(); }
128  Double_t GetAbsZ() const { return TMath::Abs(mCoord.Z()); }
129  Double_t GetXerr() const { return mError.X(); }
130  Double_t GetYerr() const { return mError.Y(); }
131  Double_t GetZerr() const { return mError.Z(); }
132  Double_t GetRadius2() const { return TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); }
133  Double_t GetRadius3() const { return mCoord.Mag(); }
134  TVector3 GetCoord() const { return mCoord; }
135  TVector3 GetError() const { return mError; }
136  Int_t GetIFlag() const { return mIFlag; }
137  Int_t GetId() const { return mId; }
138 
139  // setter
140  void SetX(Double_t f) { mCoord.SetX(f); }
141  void SetY(Double_t f) { mCoord.SetY(f); }
142  void SetZ(Double_t f) { mCoord.SetZ(f); }
143  void SetXerr(Double_t f) { mError.SetX(f); }
144  void SetYerr(Double_t f) { mError.SetY(f); }
145  void SetZerr(Double_t f) { mError.SetZ(f); }
146  void SetIFlag(Int_t f) { mIFlag = f; }
147  void SetId(Int_t f) { mId = f; }
148 
149  void CheckXerr() { if ( std::isnan( mError.x()) ) mError.SetX(0.); }
150  void CheckYerr() { if ( std::isnan( mError.y()) ) mError.SetY(0.); }
151  void CheckZerr() { if ( std::isnan( mError.z()) ) mError.SetZ(0.); }
152  void CheckErr() { CheckXerr(); CheckYerr(); CheckZerr(); }
153  Bool_t CoordIsNan() { return (Bool_t)( std::isnan(GetX()) || std::isnan(GetY()) || std::isnan(GetZ())); }
154  Int_t CheckVertex();
155 
156  StFtpcVertex& operator=(const StFtpcVertex &vertex); // Assignment operator
157 
158  ClassDef(StFtpcVertex, 1) //Ftpc vertex class
159 };
160 
161 ostream& operator<< (ostream& s, const StFtpcVertex &vertex); // cout
162 
163 #endif
164