StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcPoint.hh
1 // $Id: StFtpcPoint.hh,v 1.15 2004/05/07 14:19:25 oldi Exp $
2 // $Log: StFtpcPoint.hh,v $
3 // Revision 1.15 2004/05/07 14:19:25 oldi
4 // const added to GedtDetectorId() and GetHardwarePosition().
5 // Creation of StEvent/StFtpcHit removed. This is done in a new constructor of StFtpcit itself, now.
6 //
7 // Revision 1.14 2004/04/06 18:36:13 oldi
8 // New data mebers for pad and time position and pad and time sigma added.
9 // Reference to StFtpcHit added.
10 // Possibility to update StFtpcHit coordinates directly included.
11 //
12 // Revision 1.13 2004/02/12 19:37:10 oldi
13 // *** empty log message ***
14 //
15 // Revision 1.12 2003/09/16 15:27:02 jcs
16 // removed inline as it would leave a few undefined reference
17 //
18 // Revision 1.11 2003/01/16 18:04:33 oldi
19 // Bugs eliminated. Now it compiles on Solaris again.
20 // Split residuals for global and primary fit.
21 //
22 // Revision 1.10 2002/11/06 13:45:42 oldi
23 // Flag for clusters not to be used for tracking introduced.
24 // Code clean ups.
25 //
26 // Revision 1.9 2002/06/04 13:34:59 oldi
27 // Transformation of local FTPC coordinates in global coordinates introduced.
28 // An additional flag keeps track in which coordinate system the point position
29 // is measured.
30 // 'Tracked' flag is set correctly, now.
31 //
32 // Revision 1.8 2002/04/05 16:50:40 oldi
33 // Cleanup of MomentumFit (StFtpcMomentumFit is now part of StFtpcTrack).
34 // Each Track inherits from StHelix, now.
35 // Therefore it is possible to calculate, now:
36 // - residuals
37 // - vertex estimations obtained by back extrapolations of FTPC tracks
38 // Chi2 was fixed.
39 // Many additional minor (and major) changes.
40 //
41 // Revision 1.7 2002/01/29 11:08:03 oldi
42 // Write() renamed to WriteCluster() resp. WriteTrack() to avoid compiler warnings.
43 // As a result the functions TObject::Write() are available again (directly).
44 //
45 // Revision 1.6 2001/01/25 15:21:51 oldi
46 // Review of the complete code.
47 // Fix of several bugs which caused memory leaks:
48 // - Tracks were not allocated properly.
49 // - Tracks (especially split tracks) were not deleted properly.
50 // - TClonesArray seems to have a problem (it could be that I used it in a
51 // wrong way). I changed all occurences to TObjArray which makes the
52 // program slightly slower but much more save (in terms of memory usage).
53 // Speed up of HandleSplitTracks() which is now 12.5 times faster than before.
54 // Cleanup.
55 //
56 // Revision 1.5 2000/11/10 18:37:46 oldi
57 // New constructor added.
58 // StThreeVector replaced by TVector3 to be able to use ROOT output (e.g. Write()).
59 // Cleanup.
60 //
61 // Revision 1.4 2000/08/01 12:24:04 hummler
62 // add writing to table functionality (ToTable() function)
63 //
64 // Revision 1.3 2000/07/18 21:22:16 oldi
65 // Changes due to be able to find laser tracks.
66 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint
67 // to bundle often called functions
68 // - short functions inlined
69 // - formulas of StFormulary made static
70 // - avoid streaming of objects of unknown size
71 // (removes the bunch of CINT warnings during compile time)
72 // - two or three minor bugs cured
73 //
74 // Revision 1.2 2000/06/13 14:49:25 oldi
75 // Added SetTrackedFlag(Bool_t tracked) and GetTrackedFlag() to take care of the
76 // bit 5 of mFlags.
77 // Changed SetUsage(Bool_t f) to change the bit 5 of mFlags, too.
78 //
79 // Revision 1.1 2000/05/11 15:14:49 oldi
80 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent
81 //
82 
84 // //
85 // StFtpcPoint class - representation of one FTPC cluster for the FTPC trackers. //
86 // //
88 
89 #ifndef STAR_StFtpcPoint
90 #define STAR_StFtpcPoint
91 
92 #include "TObject.h"
93 #include "TObjArray.h"
94 #include "TVector3.h"
95 #include "TMath.h"
96 
97 #include "StDetectorId.h"
98 #include "StFtpcTrack.hh"
99 
100 class StFtpcHitCollection;
101 class StFtpcHit;
102 class StFtpcTrack;
103 
104 class StFtpcPoint : public TObject {
105 
106 private:
107 
108  StFtpcHit *mStEventHit; // pointer to the corresponding hit in StEvent
109 
110  TVector3 mCoord; // vector of cluster coordinates
111  TVector3 mError; // vector of errors on cluster coordinates
112 
113  Bool_t mGlobalCoord; // flag that indicates if the hit is stored in global or local (FTPC) coordinates
114  Bool_t mUsed; // flag that indicates if the hit is assigned to a track
115  Int_t mHitNumber; // number of this cluster in this event
116  Int_t mNextHitNumber; // number of next hit on same track
117  Int_t mTrackNumber; // track number to which this cluster belongs to
118 
119  // additional input variables from cluster finder
120 
121  Float_t mPadPos; // pad position of hit
122  Float_t mTimePos; // time position of hit
123  Float_t mPadPosSigma; // sigma pad position of hit
124  Float_t mTimePosSigma; // sigma time position of hit
125  Long_t mPadRow; // FTPC row number
126  Long_t mSector; // FTPC readout sector number
127  Long_t mNumberPads; // number of pads in cluster
128  Long_t mNumberBins; // number of consecutive timebins in cluster
129  Long_t mMaxADC; // cluster peak height (adc channels)
130  Long_t mCharge; // cluster charge (adc channels)
131  Long_t mFlags; // bit0:unfolded, bit1:unfold failed,
132  // bit2:saturated, bit3:bad shape,
133  // bit4:cut off, bit5:tracked,
134  // bit6:global coords, bit7:don't use for tracking
135  Double_t mSigmaPhi; // cluster sigma in pad direction
136  Double_t mSigmaR; // cluster sigma in drift direction
137 
138 
139  // Residuals
140  Double_t mXPrimResidual; // x distance of measured point to primary momentum fit
141  Double_t mYPrimResidual; // y distance of measured point to primary momentum fit
142  Double_t mRPrimResidual; // r of measured point to r of primary momentum fit
143  Double_t mPhiPrimResidual; // angle of measured point to angle of primary momentum fit
144  Double_t mXGlobResidual; // x distance of measured point to global momentum fit
145  Double_t mYGlobResidual; // y distance of measured point to global momentum fit
146  Double_t mRGlobResidual; // r of measured point to r of global momentum fit
147  Double_t mPhiGlobResidual; // angle of measured point to angle of global momentum fit
148 
149 public:
150 
151  StFtpcPoint(); // default constructor
152  StFtpcPoint(Long_t row,
153  Long_t sector,
154  Long_t n_pads,
155  Long_t n_bins,
156  Long_t max_adc,
157  Long_t charge,
158  Float_t padpos,
159  Float_t timepos,
160  Float_t padpossigma,
161  Float_t timepossigma,
162  Double_t x,
163  Double_t y,
164  Double_t z,
165  Double_t x_err,
166  Double_t y_err,
167  Double_t z_err,
168  Double_t s_phi,
169  Double_t s_r,
170  Long_t flags); // constructor to be filled directly from the cluster finder
171  StFtpcPoint(const StFtpcPoint &point); // copy constructor
172  StFtpcPoint(Double_t *x, Int_t row); // constructor which take an arbitrary point as input
173  virtual ~StFtpcPoint(); // destructor
174 
175  // coordinate transformations
176  void TransformFtpc2Global();
177  void TransformGlobal2Ftpc();
178  void SetStFtpcHitCoord();
179 
180  virtual Int_t ToStEvent(StFtpcHitCollection *ftpcHitColl); // writes cluster to StFtpcHit class within StEvent
181 
182  // getter
183  StFtpcHit* GetStFtpcHit() { return mStEventHit; }
184 
185  TVector3 GetCoord() { return mCoord; }
186  TVector3 GetError() { return mError; }
187 
188  Double_t GetX() const { return mCoord.X(); }
189  Double_t GetY() const { return mCoord.Y(); }
190  Double_t GetZ() const { return mCoord.Z(); }
191  Double_t GetRadius() const { return TMath::Sqrt(mCoord.X()*mCoord.X() + mCoord.Y()*mCoord.Y()); }
192  Double_t GetXerr() const { return mError.X(); }
193  Double_t GetYerr() const { return mError.Y(); }
194  Double_t GetZerr() const { return mError.Z(); }
195  Double_t GetSigmaPhi() const { return mSigmaPhi; }
196  Double_t GetSigmaR() const { return mSigmaR; }
197 
198  StFtpcTrack *GetTrack(TObjArray *tracks) const;
199  void SetTrackedFlag(Bool_t tracked);
200  Bool_t GetTrackedFlag();
201  void SetGlobalFlag(Bool_t global);
202  Bool_t GetGlobalFlag();
203  void SetUnusableForTrackingFlag(Bool_t global);
204  Bool_t GetUnusableForTrackingFlag();
205 
206  Bool_t IsUsable();
207  Bool_t IsUnusable();
208  Bool_t IsInGlobalCoord() { return GetGlobalFlag(); }
209  Bool_t GetUsage() { return GetTrackedFlag(); }
210  Int_t GetHitNumber() const { return mHitNumber; }
211  Int_t GetNextHitNumber() const { return mNextHitNumber; }
212  Int_t GetTrackNumber() const { return mTrackNumber; }
213  Float_t GetPadPos() const { return mPadPos; }
214  Float_t GetTimePos() const { return mTimePos; }
215  Float_t GetPadPosSigma() const { return mPadPosSigma; }
216  Float_t GetTimePosSigma() const { return mTimePosSigma; }
217  Long_t GetPadRow() const { return mPadRow; }
218  Long_t GetSector() const { return mSector; }
219  Long_t GetNumberPads() const { return mNumberPads; }
220  Long_t GetNumberBins() const { return mNumberBins; }
221  Long_t GetMaxADC() const { return mMaxADC; }
222  Long_t GetCharge() const { return mCharge; }
223  Long_t GetFlags() const { return mFlags; }
224  Int_t GetDetectorId() const;
225  Long_t GetHardwarePosition() const;
226 
227  Double_t GetXPrimResidual() const { return mXPrimResidual; }
228  Double_t GetYPrimResidual() const { return mYPrimResidual; }
229  Double_t GetRPrimResidual() const { return mRPrimResidual; }
230  Double_t GetPhiPrimResidual() const { return mPhiPrimResidual; }
231  Double_t GetXGlobResidual() const { return mXGlobResidual; }
232  Double_t GetYGlobResidual() const { return mYGlobResidual; }
233  Double_t GetRGlobResidual() const { return mRGlobResidual; }
234  Double_t GetPhiGlobResidual() const { return mPhiGlobResidual; }
235 
236  // setter
237  void SetStFtpcHit(StFtpcHit* f) { mStEventHit = f; }
238 
239  void SetX(Double_t f) { mCoord.SetX(f); }
240  void SetY(Double_t f) { mCoord.SetY(f); }
241  void SetZ(Double_t f) { mCoord.SetZ(f); }
242  void SetXerr(Double_t f) { mError.SetX(f); }
243  void SetYerr(Double_t f) { mError.SetY(f); }
244  void SetZerr(Double_t f) { mError.SetZ(f); }
245 
246  void SetGlobalCoord(Bool_t f) { SetGlobalFlag(f); }
247  void SetUsage(Bool_t f) { SetTrackedFlag(f); }
248  void SetHitNumber(Int_t f) { mHitNumber = f; }
249  void SetNextHitNumber(Int_t f) { mNextHitNumber = f; }
250  void SetTrackNumber(Int_t f) { mTrackNumber = f; }
251  void SetPadPos(Float_t f) { mPadPos = f; }
252  void SetTimePos(Float_t f) { mTimePos = f; }
253  void SetPadPosSigma(Float_t f) { mPadPosSigma = f; }
254  void SetTimePosSigma(Float_t f){ mTimePosSigma = f; }
255  void SetPadRow(Long_t f) { mPadRow = f; }
256  void SetSector(Long_t f) { mSector = f; }
257  void SetNumberPads(Long_t f) { mNumberPads = f; }
258  void SetNumberBins(Long_t f) { mNumberBins = f; }
259  void SetMaxADC(Long_t f) { mMaxADC = f; }
260  void SetCharge(Long_t f) { mCharge = f; }
261  void SetFlags(Long_t f) { mFlags = f; }
262  void SetSigmaPhi(Double_t f) { mSigmaPhi = f; }
263  void SetSigmaR(Double_t f) { mSigmaR = f; }
264 
265  void SetResidualsToZero();
266  void SetXPrimResidual(Double_t f) { mXPrimResidual = f; }
267  void SetYPrimResidual(Double_t f) { mYPrimResidual = f; }
268  void SetRPrimResidual(Double_t f) { mRPrimResidual = f; }
269  void SetPhiPrimResidual(Double_t f){ mPhiPrimResidual = f; }
270  void SetXGlobResidual(Double_t f) { mXGlobResidual = f; }
271  void SetYGlobResidual(Double_t f) { mYGlobResidual = f; }
272  void SetRGlobResidual(Double_t f) { mRGlobResidual = f; }
273  void SetPhiGlobResidual(Double_t f){ mPhiGlobResidual = f; }
274 
275  ClassDef(StFtpcPoint, 1) //Ftpc point class
276 };
277 
278 
279 
280 #endif