StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrack.h
1 
5 /***************************************************************************
6  *
7  * $Id: StTrack.h,v 2.39 2020/01/27 21:28:31 genevb Exp $
8  *
9  * Author: Thomas Ullrich, Sep 1999
10  ***************************************************************************
11  *
12  * Description:
13  *
14  * Note the following: with the arrival of ITTF it is now possible to
15  * store the numberOfPossiblePoints for every detector individually. Before
16  * that and because of the way the tables were defined TPC and FTPC were
17  * one and the same. This caused confusion. However, since we have to
18  * stay backwards compatible the "old way" is still working.
19  * mNumberOfPossiblePoints ==> seedQuality
20  * mNumberOfPossiblePointsTpc
21  * mNumberOfPossiblePointsFtpcWest
22  * mNumberOfPossiblePointsFtpcEast
23  * mNumberOfPossiblePointsSvt
24  * mNumberOfPossiblePointsSsd
25  * are the ones that count
26  * --------------------------------------------------------------------------
27  * The track flag (mFlag accessed via flag() method) definitions with ITTF
28  * (flag definition in EGR era can be found at
29  * http://www.star.bnl.gov/STAR/html/all_l/html/dst_track_flags.html)
30  *
31  * mFlag= zxyy, where z = 1 for pile up track in TPC (otherwise 0)
32  * x indicates the detectors included in the fit and
33  * yy indicates the status of the fit.
34  * Positive mFlag values are good fits, negative values are bad fits.
35  *
36  * The first digit indicates which detectors were used in the refit:
37  *
38  * x=1 -> TPC only
39  * x=3 -> TPC + primary vertex
40  * x=5 -> SVT + TPC
41  * x=6 -> SVT + TPC + primary vertex
42  * x=7 -> FTPC only
43  * x=8 -> FTPC + primary
44  * x=9 -> TPC beam background tracks
45  *
46  * The last two digits indicate the status of the refit:
47  * = +x01 -> good track
48  *
49  * = -x01 -> Bad fit, outlier removal eliminated too many points
50  * = -x02 -> Bad fit, not enough points to fit
51  * = -x03 -> Bad fit, too many fit iterations
52  * = -x04 -> Bad Fit, too many outlier removal iterations
53  * = -x06 -> Bad fit, outlier could not be identified
54  * = -x10 -> Bad fit, not enough points to start
55  *
56  * = +x11 -> Short track pointing to EEMC
57  * = +x12 -> Short track pointing to ETOF
58  *
59  ***************************************************************************
60  *
61  * $Log: StTrack.h,v $
62  * Revision 2.39 2020/01/27 21:28:31 genevb
63  * Add short tracks toward ETOF
64  *
65  * Revision 2.38 2017/05/04 00:59:36 perev
66  * Add Fts
67  *
68  * Revision 2.37 2016/11/28 21:00:24 ullrich
69  * Added StExtGeometry features.
70  *
71  * Revision 2.36 2015/10/09 17:46:15 ullrich
72  * Changed type of mIdTruth from ushort to int.
73  *
74  * Revision 2.35 2015/05/13 17:06:14 ullrich
75  * Added hooks and interfaces to Sst detector (part of HFT).
76  *
77  * Revision 2.34 2013/07/23 11:21:49 jeromel
78  * Undo past week changes
79  *
80  * Revision 2.32 2013/04/10 19:15:53 jeromel
81  * Step back from StEvent changes - previous change recoverable [Thomas OK-ed]
82  *
83  * Revision 2.30 2013/01/15 23:21:06 fisyak
84  * improve printouts
85  *
86  * Revision 2.29 2012/09/16 21:36:09 fisyak
87  * Handlers for Tpc Only West and Only East bits
88  *
89  * Revision 2.28 2012/05/07 14:42:58 fisyak
90  * Add handilings for Track to Fast Detectors Matching
91  *
92  * Revision 2.27 2011/10/13 21:25:27 perev
93  * setting IdTruth from the hits is added
94  *
95  * Revision 2.26 2011/04/26 21:41:29 fisyak
96  * Make mKey Int_t instead of UShort_t (no. of tracks might be more that 64k)
97  *
98  * Revision 2.25 2011/03/31 19:29:01 fisyak
99  * Add IdTruth information for tracks and vertices
100  *
101  * Revision 2.24 2010/08/31 20:00:09 fisyak
102  * Clean up, add mSeedQuality
103  *
104  * Revision 2.23 2009/11/23 16:34:07 fisyak
105  * Cleanup, remove dependence on dst tables, clean up software monitors
106  *
107  * Revision 2.22 2008/08/26 12:47:38 fisyak
108  * add track pule up flag description
109  *
110  * Revision 2.21 2007/10/11 21:51:40 ullrich
111  * Added member to handle number of possible points fpr PXL and IST.
112  *
113  * Revision 2.20 2006/08/28 17:03:54 fisyak
114  * Add track flag definitions from EGR (we suppose that this will be primary information from now)
115  *
116  * Revision 2.19 2004/08/05 22:24:51 ullrich
117  * Changes to the handling of numberOfPoints() to allow ITTF more flexibility.
118  *
119  * Revision 2.18 2004/07/15 16:36:26 ullrich
120  * Removed all clone() declerations and definitions. Use StObject::clone() only.
121  *
122  * Revision 2.17 2003/10/31 16:00:04 ullrich
123  * Added setKey() method.
124  *
125  * Revision 2.16 2003/10/30 20:07:32 perev
126  * Check of quality added
127  *
128  * Revision 2.15 2002/03/14 17:42:15 ullrich
129  * Added method to set mNumberOfPossiblePoints.
130  *
131  * Revision 2.14 2002/02/22 22:56:52 jeromel
132  * Doxygen basic documentation in all header files. None of this is required
133  * for QM production.
134  *
135  * Revision 2.13 2001/09/28 22:20:50 ullrich
136  * Added helix geometry at last point.
137  *
138  * Revision 2.12 2001/05/30 17:45:55 perev
139  * StEvent branching
140  *
141  * Revision 2.11 2001/04/05 04:00:45 ullrich
142  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
143  *
144  * Revision 2.10 2001/03/24 03:34:59 perev
145  * clone() -> clone() const
146  *
147  * Revision 2.9 2001/03/16 20:56:46 ullrich
148  * Added non-const version of fitTraits().
149  *
150  * Revision 2.8 1999/12/01 15:58:10 ullrich
151  * New decoding for dst_track::method. New enum added.
152  *
153  * Revision 2.7 1999/11/30 23:20:32 didenko
154  * temporary solution to get library compiled
155  *
156  * Revision 2.6 1999/11/29 17:32:45 ullrich
157  * Added non-const method pidTraits().
158  *
159  * Revision 2.5 1999/11/15 18:48:22 ullrich
160  * Adapted new enums for dedx and track reco methods.
161  *
162  * Revision 2.4 1999/11/05 15:27:07 ullrich
163  * Added non-const versions of several methods
164  *
165  * Revision 2.3 1999/11/04 13:32:03 ullrich
166  * Added non-const versions of some methods
167  *
168  * Revision 2.2 1999/11/01 12:45:06 ullrich
169  * Modified unpacking of point counter
170  *
171  * Revision 2.1 1999/10/28 22:27:24 ullrich
172  * Adapted new StArray version. First version to compile on Linux and Sun.
173  *
174  * Revision 2.0 1999/10/12 18:42:56 ullrich
175  * Completely Revised for New Version
176  *
177  *
178  **************************************************************************/
179 #ifndef StTrack_hh
180 #define StTrack_hh
181 #include "StObject.h"
182 #include "StContainers.h"
183 #include "StEnumerations.h"
184 #include "StTrackTopologyMap.h"
185 #include "StFunctional.h"
186 #include "StTrackFitTraits.h"
187 class StTrack;
188 ostream& operator<<(ostream& os, const StTrack& t);
189 
191 class StVertex;
192 class StTrackGeometry;
193 class StExtGeometry;
194 class StTrackDetectorInfo;
195 class StTrackPidTraits;
196 class StTrackNode;
197 
198 class StTrack : public StObject {
199 public:
200  StTrack();
201  StTrack(const StTrack&);
202  StTrack & operator=(const StTrack&);
203  virtual ~StTrack();
204 
205  virtual StTrackType type() const = 0;
206  virtual const StVertex* vertex() const = 0;
207  virtual int key() const { return mKey; }
208  short flag() const;
209  unsigned int flagExtension() const { return mFlagExtension; }
210  unsigned short encodedMethod() const;
211  bool finderMethod(StTrackFinderMethod) const;
212  StTrackFittingMethod fittingMethod() const;
213  float impactParameter() const;
214  float length() const;
215  unsigned short numberOfPossiblePoints() const;
216  unsigned short numberOfPossiblePoints(StDetectorId) const;
217  const StTrackTopologyMap& topologyMap() const;
218  StTrackGeometry* geometry();
219  const StTrackGeometry* geometry() const;
220  StTrackGeometry* outerGeometry();
221  const StTrackGeometry* outerGeometry() const;
222  StExtGeometry* extGeometry() {return mExtGeometry;}
223  const StExtGeometry* extGeometry() const {return mExtGeometry;}
224  StTrackDetectorInfo* detectorInfo();
225  const StTrackDetectorInfo* detectorInfo() const;
226  StTrackFitTraits& fitTraits();
227  const StTrackFitTraits& fitTraits() const;
228  const StSPtrVecTrackPidTraits& pidTraits() const;
229  StSPtrVecTrackPidTraits& pidTraits();
230  StPtrVecTrackPidTraits pidTraits(StDetectorId) const;
231  const StParticleDefinition* pidTraits(StPidAlgorithm&) const;
232  StTrackNode* node();
233  const StTrackNode* node() const;
234 
235  unsigned short seedQuality() const {return mSeedQuality;}
236  bool isCtbMatched() const {return testBit(kCtbMatched);}
237  bool isToFMatched() const {return testBit(kToFMatched);}
238  bool isBToFMatched() const {return testBit(kToFMatched);}
239  bool isBemcMatched() const {return testBit(kBemcMatched);}
240  bool isEemcMatched() const {return testBit(kEemcMatched);}
241 
242  bool isCtbNotMatched() const {return testBit(kCtbNotMatched);}
243  bool isToFNotMatched() const {return testBit(kToFNotMatched);}
244  bool isBToFNotMatched() const {return testBit(kToFNotMatched);}
245  bool isBemcNotMatched() const {return testBit(kBemcNotMatched);}
246  bool isEemcNotMatched() const {return testBit(kEemcNotMatched);}
247 
248  bool isDecayTrack() const {return testBit(kDecayTrack);}
249  bool isPromptTrack() const {return testBit(kPromptTrack);}
250  bool isPostXTrack() const {return testBit(kPostXTrack);}
251  bool isMembraneCrossingTrack() const {return testBit(kXMembrane);}
252  bool isShortTrack2EMC() const {return testBit(kShortTrack2EMC);}
253  bool isRejected() const {return testBit(kRejectedTrack);}
254  bool isWestTpcOnly() const {return testBit(kWestTpcOnlyTrack);}
255  bool isEastTpcOnly() const {return testBit(kEastTpcOnlyTrack);}
256 
257  virtual void setCtbMatched() {setBit(kCtbMatched);}
258  virtual void setToFMatched() {setBit(kToFMatched);}
259  virtual void setBToFMatched() {setBit(kToFMatched);}
260  virtual void setBemcMatched() {setBit(kBemcMatched);}
261  virtual void setEemcMatched() {setBit(kEemcMatched);}
262 
263  virtual void setCtbNotMatched() {setBit(kCtbNotMatched);}
264  virtual void setToFNotMatched() {setBit(kToFNotMatched);}
265  virtual void setBToFNotMatched() {setBit(kToFNotMatched);}
266  virtual void setBemcNotMatched() {setBit(kBemcNotMatched);}
267  virtual void setEemcNotMatched() {setBit(kEemcNotMatched);}
268  virtual void setDecayTrack() {setBit(kDecayTrack);}
269  virtual void setPromptTrack() {setBit(kPromptTrack);}
270  virtual void setPostCrossingTrack() {setBit(kPostXTrack);}
271  virtual void setMembraneCrossingTrack(){setBit(kXMembrane);}
272  virtual void setShortTrack2EMC() {reSetBit(kRejectedTrack); setBit(kShortTrack2EMC);}
273  virtual void setShortTrack2ETOF() {reSetBit(kRejectedTrack); setBit(kShortTrack2ETOF);}
274  virtual void setRejected() {setBit(kRejectedTrack);}
275  virtual void setWestTpcOnly() {setBit(kWestTpcOnlyTrack);}
276  virtual void setEastTpcOnly() {setBit(kEastTpcOnlyTrack);}
277  virtual void setFlagExtension(unsigned int i){mFlagExtension = i;}
278  void setFlag(short);
279  void setKey(int val) { mKey = val; }
280  void setEncodedMethod(UShort_t);
281  void setImpactParameter(float);
282  void setLength(float);
283  void setTopologyMap(const StTrackTopologyMap&);
284  void setGeometry(StTrackGeometry*);
285  void setOuterGeometry(StTrackGeometry*);
286  void addExtGeometry(StExtGeometry* extGeo);
287  void setFitTraits(const StTrackFitTraits&);
288  void addPidTraits(StTrackPidTraits*);
289  void setDetectorInfo(StTrackDetectorInfo*);
290  void setNode(StTrackNode*);
291  int bad() const;
292  void setNumberOfPossiblePoints(unsigned char, StDetectorId);
293  void setSeedQuality(UShort_t qa) {mSeedQuality = qa;}
294  int idTruth() const { return mIdTruth;}
295  int qaTruth() const { return mQuality; }
296  int idParentVx() const {return mIdParentVx;}
297  void setIdTruth(int idtru,int qatru=0) {mIdTruth = idtru; mQuality = static_cast<unsigned short>(qatru);}
298  void setIdTruth(); //setting on hits info
299  void setIdParentVx(int id) {mIdParentVx = id;}
300  //----- bit manipulation
301  void setBit(unsigned int f, bool set) {(set) ? setBit(f) : reSetBit(f);}
302  void setBit(unsigned int f) { mFlagExtension |= f; }
303  void reSetBit(unsigned int f) { mFlagExtension &= ~(f); }
304  bool testBit(unsigned int f) const { return (bool) ((mFlagExtension & f) != 0); }
305  int testBits(unsigned int f) const { return (int) (mFlagExtension & f); }
306  void invertBit(unsigned int f) { mFlagExtension ^= f; }
307  void Print(Option_t *option="") const {cout << option << *this << endl; }
308 
309 protected:
310  void setNumberOfPossiblePoints(UShort_t); // obsolete
311  Char_t mBeg[1];
312  Int_t mKey;
313  Short_t mFlag;
314  UInt_t mFlagExtension; // bit wise fast detector matching status
315  UShort_t mEncodedMethod;
316  UShort_t mSeedQuality; // ITTF: this is seed quality
317  UChar_t mNumberOfPossiblePointsTpc;
318  UChar_t mNumberOfPossiblePointsFtpcWest;
319  UChar_t mNumberOfPossiblePointsFtpcEast;
320  UChar_t mNumberOfPossiblePointsSvt;
321  UChar_t mNumberOfPossiblePointsSsd;
322  UChar_t mNumberOfPossiblePointsSst;
323  UChar_t mNumberOfPossiblePointsPxl;
324  UChar_t mNumberOfPossiblePointsIst;
325  UChar_t mNumberOfPossiblePointsFts;
326  Float_t mImpactParameter;
327  Float_t mLength;
328  StTrackGeometry* mGeometry;
329  StTrackGeometry* mOuterGeometry;
330  StExtGeometry* mExtGeometry;
331  Int_t mIdTruth; // MC track id
332  UShort_t mQuality; // quality of this information (percentage of hits coming from the above MC track)
333  Int_t mIdParentVx; // MC Parent vertex Id
334  Char_t mEnd[1];
335  StTrackTopologyMap mTopologyMap;
336  StTrackFitTraits mFitTraits;
337 
338 // StTrackDetectorInfo *mDetectorInfo; //$LINK
339 // StTrackNode *mNode; //$LINK
340 #ifdef __CINT__
341  StObjLink mDetectorInfo;
342  StObjLink mNode;
343 #else
344  StLink<StTrackDetectorInfo> mDetectorInfo;
345  StLink<StTrackNode> mNode;
346 #endif //__CINT__
347 
348  StSPtrVecTrackPidTraits mPidTraitsVec;
349 
350  ClassDef(StTrack,12)
351 };
352 #endif