StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiStEventFiller.cxx
1 /***************************************************************************
2  *
3  * $Id: StiStEventFiller.cxx,v 2.124 2020/01/27 21:27:45 genevb Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, Mar 2002
6  ***************************************************************************
7  *
8  * $Log: StiStEventFiller.cxx,v $
9  * Revision 2.124 2020/01/27 21:27:45 genevb
10  * Add short tracks toward ETOF when there, remove toward EEMC when not there
11  *
12  * Revision 2.123 2018/06/29 21:46:33 smirnovd
13  * Revert iTPC-related changes committed on 2018-06-20 through 2018-06-28
14  *
15  * Revert "NoDead option added"
16  * Revert "Fill mag field more carefully"
17  * Revert "Assert commented out"
18  * Revert "Merging with TPC group code"
19  * Revert "Remove too strong assert"
20  * Revert "Restore removed by mistake line"
21  * Revert "Remove not used anymore file"
22  * Revert "iTPCheckIn"
23  *
24  * Revision 2.121 2018/04/30 23:18:11 smirnovd
25  * [Cosmetic] Minor changes in various files
26  *
27  * - Renamed data member s/m/mMass/ in StikalmanTrack
28  * - Changes in white space
29  * - Return STAR code
30  *
31  * Revision 2.120 2018/04/10 11:32:10 smirnovd
32  * Minor corrections across multiple files
33  *
34  * - Remove ClassImp macro
35  * - Change white space
36  * - Correct windows newlines to unix
37  * - Remove unused debugging
38  * - Correct StTpcRTSHitMaker header guard
39  * - Remove unused preprocessor directives in StiCA
40  * - Minor changes in status and debug print out
41  * - Remove using std namespace from StiKalmanTrackFinder
42  * - Remove includes for unused headers
43  *
44  * Revision 2.119 2016/06/30 18:33:48 perev
45  * simplifacation
46  *
47  * Revision 2.117.2.4 2016/06/29 20:09:06 perev
48  * Small simplificatoins
49  *
50  * Revision 2.117.2.3 2016/06/03 16:07:15 smirnovd
51  * Sync with MAIN branch as of 2016-05-31
52  *
53  * Revision 2.118 2016/04/13 23:09:13 perev
54  * -opt2 proble solved. Array A[1] removed
55  *
56  * Revision 2.117 2015/12/28 23:50:27 perev
57  * Remove assert temporary
58  *
59  * Revision 2.116 2015/12/21 19:41:31 perev
60  * bug #3166 assert vertex closer to 0,0 <9 removed
61  *
62  * Revision 2.115 2015/12/20 01:46:56 fisyak
63  * Move back commits done by mistake
64  *
65  * Revision 2.113 2015/12/19 03:40:50 perev
66  * assert rxy<4 ==> <9 temporary
67  *
68  * Revision 2.112 2015/12/18 03:50:06 perev
69  * *** empty log message ***
70  *
71  * Revision 2.111 2015/12/03 19:12:24 perev
72  * Remove redundant GTrack error: mFlag: is Negative
73  *
74  * Revision 2.110 2015/03/27 20:13:43 perev
75  * Add printout of good track hits
76  *
77  * Revision 2.109 2015/03/24 16:37:28 perev
78  * fix printout hit: to hits:
79  *
80  * Revision 2.108 2015/03/21 02:16:53 perev
81  * By Lidia request, addet printing number of used hits detector by detector
82  * No any modification of any algorithmes
83  *
84  * Revision 2.107 2015/01/23 20:07:08 perev
85  * Debug++
86  *
87  * Revision 2.106 2014/07/03 00:37:51 perev
88  * c++11 fix
89  *
90  * Revision 2.105 2013/04/10 22:14:20 fisyak
91  * Roll back to version 04/04/2013
92  *
93  * Revision 2.103 2013/01/28 21:51:17 fisyak
94  * Correct ranking
95  *
96  * Revision 2.102 2013/01/18 15:03:37 fisyak
97  * Fix TrackData data name clash with StiPPVertexFinder
98  *
99  * Revision 2.101 2013/01/17 15:57:26 fisyak
100  * Add handles for debugging
101  *
102  * Revision 2.100 2012/11/09 18:28:10 perev
103  * fillpull development
104  *
105  * Revision 2.99 2012/09/16 21:38:42 fisyak
106  * use of Tpc West Only and East Only tracks, clean up
107  *
108  * Revision 2.98 2012/05/07 14:56:14 fisyak
109  * Add StKFVertexMaker
110  *
111  * Revision 2.97 2011/10/17 00:14:34 fisyak
112  * Move handles for IdTruth to StEvent
113  *
114  * Revision 2.96 2011/07/19 19:07:20 perev
115  * Remove previous tracks & vertices in StEvrent added
116  *
117  * Revision 2.95 2011/05/27 18:25:33 genevb
118  * Propagate StTrack::key => Int_t to other codes
119  *
120  * Revision 2.94 2011/04/01 15:52:21 fisyak
121  * Enlarge array for possible candidates, add requirement that dominant track should have > 2 good hits
122  *
123  * Revision 2.93 2011/03/31 22:11:24 fisyak
124  * Propagate IdTruth to StEvent
125  *
126  * Revision 2.92 2011/01/26 20:11:54 perev
127  * track id into StiPull
128  *
129  * Revision 2.91 2010/09/01 21:26:15 fisyak
130  * switch from direct access to public members to methods
131  *
132  * Revision 2.90 2010/01/27 21:43:49 perev
133  * Add _nPrimTracks for case of fiterr
134  *
135  * Revision 2.89 2009/10/18 22:47:29 perev
136  * assert instead of skip
137  *
138  * Revision 2.88 2009/10/16 14:56:02 fisyak
139  * Add check that pHit exists
140  *
141  * Revision 2.87 2009/10/15 03:29:30 perev
142  * Add primary vertex number and charge(GVB)
143  *
144  * Revision 2.86 2009/08/19 21:27:57 perev
145  * Account time of flight for StiPulls
146  *
147  * Revision 2.85 2009/03/16 13:50:14 fisyak
148  * Move out all Sti Chairs into StDetectorDb
149  *
150  * Revision 2.84 2008/08/22 13:32:52 fisyak
151  * add one more digit in trakc flag, mFlag=zxyy, where z = 1 for pile up track in TPC (otherwise 0)
152  *
153  * Revision 2.83 2008/04/03 20:04:05 fisyak
154  * Straighten out DB access via chairs
155  *
156  * Revision 2.82 2007/10/17 15:32:35 fisyak
157  * rename Hft => Pxl
158  *
159  * Revision 2.81 2007/04/16 22:47:18 perev
160  * aux.mPt is +ve
161  *
162  * Revision 2.80 2007/03/21 17:51:36 fisyak
163  * adjust for ROOT 5.14
164  *
165  * Revision 2.79 2006/12/19 19:46:09 perev
166  * Filling pull tracks added
167  *
168  * Revision 2.78 2006/12/18 01:30:39 perev
169  * fillPulls reorganized
170  *
171  * Revision 2.77 2006/08/31 03:25:58 fisyak
172  * Make cut for EEMC pointing track based on StTrackDetectorInfo instead of StTrackFitTraits
173  *
174  * Revision 2.76 2006/08/29 22:18:37 fisyak
175  * move filling of StTrackDetectorInfo into fillTrack
176  *
177  * Revision 2.75 2006/08/28 17:02:23 fisyak
178  * Add +x11 short tracks pointing to EEMC, clean up StiDedxCalculator
179  *
180  * Revision 2.74 2006/06/16 21:28:57 perev
181  * FillStHitErr method added and called
182  *
183  * Revision 2.73 2006/05/31 03:59:04 fisyak
184  * Add Victor's dca track parameters, clean up
185  *
186  * Revision 2.72 2006/04/07 18:00:30 perev
187  * Back to the latest Sti
188  *
189  * Revision 2.69 2006/02/14 18:56:18 perev
190  * setGlobalDca==>setDca
191  *
192  * Revision 2.68 2006/01/19 22:29:57 jeromel
193  * kMaxId -> kMaxDetectorId
194  *
195  * Revision 2.67 2005/12/08 00:06:27 perev
196  * BugFix, Instead of vertex, first hit was used
197  *
198  * Revision 2.66 2005/08/18 22:31:47 perev
199  * More tests
200  *
201  * Revision 2.65 2005/08/17 22:04:36 perev
202  * PoinCount cleanup
203  *
204  * Revision 2.64 2005/08/16 21:09:06 perev
205  * remeve 5fit cut
206  *
207  * Revision 2.63 2005/08/16 20:37:23 perev
208  * remove small pt cut
209  *
210  * Revision 2.62 2005/08/14 01:24:40 perev
211  * test for nhits<5 removed
212  *
213  * Revision 2.61 2005/08/04 04:04:19 perev
214  * Cleanup
215  *
216  * Revision 2.60 2005/07/21 21:50:24 perev
217  * First/last point of track filled from node now
218  *
219  * Revision 2.59 2005/07/20 17:34:08 perev
220  * MultiVertex
221  *
222  * Revision 2.58 2005/05/12 18:32:20 perev
223  * Temprary hack, save residuals
224  *
225  * Revision 2.57 2005/04/11 17:42:39 perev
226  * Temporary residuals saving added
227  *
228  * Revision 2.56 2005/03/24 17:51:16 perev
229  * print error code added
230  *
231  * Revision 2.55 2005/03/17 06:33:20 perev
232  * TPT like errors implemented
233  *
234  * Revision 2.54 2005/02/25 17:43:15 perev
235  * StTrack::setKey(...StiTrack::getId()) now
236  *
237  * Revision 2.53 2005/02/17 23:19:03 perev
238  * NormalRefangle + Error reseting
239  *
240  * Revision 2.52 2005/02/07 18:34:16 fisyak
241  * Add VMC dead material
242  *
243  * Revision 2.51 2005/01/17 03:56:56 pruneau
244  * change track container to vector
245  *
246  * Revision 2.50 2005/01/17 01:32:13 perev
247  * parameters protected
248  *
249  * Revision 2.49 2004/12/21 20:46:00 perev
250  * Cleanup. All known bugs fixed
251  *
252  * Revision 2.48 2004/12/02 22:14:53 calderon
253  * Only fill the fitTraits.chi2[1] data member for primaries.
254  * It holds node->getChi2() from the innerMostHitNode, which will be the
255  * vertex for primaries.
256  *
257  * Revision 2.47 2004/12/02 04:18:06 pruneau
258  * chi2[1] now set to incremental chi2 at inner most hit or vertex
259  *
260  * Revision 2.46 2004/12/01 15:35:46 pruneau
261  * removed throw and replaced with continue
262  *
263  * Revision 2.45 2004/11/08 15:34:16 pruneau
264  * fix of the chi2 calculation
265  *
266  * Revision 2.44 2004/10/27 03:25:54 perev
267  * Version V3V
268  *
269  * Revision 2.43 2004/10/26 06:45:41 perev
270  * version V2V
271  *
272  * Revision 2.42 2004/10/14 02:21:34 calderon
273  * Updated code in StTrackDetectorInfo, now only increment the reference count
274  * for globals, not for primaries. So fillTrackDetectorInfo changed to reflect
275  * this.
276  *
277  * Revision 2.41 2004/10/01 01:13:51 calderon
278  * Added bug fix from Marco:
279  * flag%100 -> flag/100.
280  *
281  * Revision 2.40 2004/08/17 20:04:28 perev
282  * small leak fixed, delete physicalHelix,originD
283  *
284  * Revision 2.39 2004/08/17 04:53:05 calderon
285  * When filling fit traits for primary tracks, set the new flag
286  * mPrimaryVertexUsedInFit.
287  *
288  * Revision 2.38 2004/08/10 14:21:13 calderon
289  * Use the firstHit from the dynamic_cast, to avoid a compiler warning
290  * for an unused variable.
291  *
292  * Revision 2.37 2004/08/06 22:23:29 calderon
293  * Modified the code to use the setNumberOfxxxPoints(unsigned char,StDetectorId)
294  * methods of StTrack, StTrackDetectorInfo, StTrackFitTraits, and to use
295  * the maxPointCount(unsigned int detId) method of StiKalmanTrack.
296  *
297  * Revision 2.36 2004/08/06 02:29:20 andrewar
298  * Modifed call to getMaxPointCount
299  *
300  * Revision 2.35 2004/08/05 05:25:25 calderon
301  * Fix the assignment of the first point for primaries. Now,
302  * the logic for both globals and primaries is that the first
303  * point is the first element of the stHits() vector that
304  * can actually be casted to an StHit (the vertex will fail this test,
305  * all other hits coming from detectors will satisfy it).
306  *
307  * Revision 2.34 2004/07/30 18:49:18 calderon
308  * For running in production, Yuri's dEdx Maker will fill the Pid Traits,
309  * so the filling of Pid Traits in the filler is no longer needed:
310  * it actually causes confusion because the V0 finders will loop over
311  * the PID traits vector and find the first one, so they won't find
312  * the trait created by the dEdx Maker. It is best to just comment
313  * out the filling of the Pid Traits here.
314  *
315  * Revision 2.33 2004/07/07 19:33:48 calderon
316  * Added method fillFlags. Flags tpc, tpc+svt (globals and primaries) and flags -x02 tracks with less than 5 total fit points
317  *
318  * Revision 2.32 2004/04/21 21:36:24 calderon
319  * Correction in the comments about the encoded method.
320  *
321  * Revision 2.31 2004/03/31 00:27:29 calderon
322  * Modifications for setting the fit points based on the chi2<chi2Max algorithm.
323  * -Distinguish between points and fit points, so I added a function for each.
324  * -Points is done as it was before, just counting the stHits for a given
325  * detector id.
326  * -Fit points is done the same with the additional condition that each
327  * StiKalmanTrackNode has to satisfy the chi2 criterion.
328  *
329  * Revision 2.30 2004/03/29 00:52:20 andrewar
330  * Added key value to StTrack fill. Key is simply the size of the
331  * StTrackNode container at the time the track is filled.
332  *
333  * Revision 2.29 2004/03/23 23:12:36 calderon
334  * Added an "accept" function to filter unwanted tracks from Sti into StEvent.
335  * The current method just looks for tracks with a negative length, since
336  * these were causing problems for the vertex finder (length was nan). The
337  * nan's have been trapped (one hopes!) in StiKalmanTrack, and for these
338  * cases the return value is negative, so we can filter them out with a
339  * simple length>0 condition.
340  *
341  * Revision 2.28 2004/03/19 19:33:23 andrewar
342  * Restored primary filling logic. Now taking parameters at the
343  * vertex for Primary tracks.
344  *
345  * Revision 2.27 2004/01/27 23:40:46 calderon
346  * The filling of the impactParameter() for global tracks is done now
347  * only after finding the vertex. The
348  * StPhysicalHelix::distance(StThreeVectorD) method is used for both globals
349  * and primaries, the only difference is where the helix is obtained:
350  * - globals - helix from StTrack::geometry(), which was filled from the
351  * innermost hit node, which should be a hit at the time.
352  * - primaries - helix from innermost hit node, which should be the vertex
353  * at the time it is called.
354  *
355  * Revision 2.26 2003/12/11 03:44:29 calderon
356  * set the length right again, it had dissappeared from the code...
357  *
358  * Revision 2.25 2003/11/26 04:02:53 calderon
359  * track->getChi2() returns the sum of chi2 for all sti nodes. In StEvent,
360  * chi2(0) should be chi2/dof, so we need to divide by
361  * dof=track->getPointCount()-5;
362  *
363  * Revision 2.24 2003/09/07 03:49:10 perev
364  * gcc 3.2 + WarnOff
365  *
366  * Revision 2.23 2003/09/02 17:59:59 perev
367  * gcc 3.2 updates + WarnOff
368  *
369  * Revision 2.22 2003/08/21 21:21:56 andrewar
370  * Added trap for non-finite dEdx. Added logic to fillGeometry so
371  * info is for innerMostHitNode on a detector, not vertex (note:
372  * Primaries only)
373  *
374  * Revision 2.21 2003/08/05 18:26:15 andrewar
375  * DCA track update logic modified.
376  *
377  * Revision 2.20 2003/07/01 20:25:28 calderon
378  * fillGeometry() - use node->getX(), as it should have been since the
379  * beginning
380  * impactParameter() - always use the innermos hit node, not just for globals
381  * removed extra variables which are no longer used.
382  *
383  * Revision 2.19 2003/05/15 03:50:26 andrewar
384  * Disabled call to filldEdxInfo for the SVT. Checks need to be
385  * applied to make sure the detector is active before calculator
386  * is called, but for the review filling this info is unnecessary.
387  *
388  * Revision 2.18 2003/05/14 00:04:35 calderon
389  * The array of 15 floats containing the covariance matrix has a different
390  * order in Sti than in StEvent. In Sti the array is counted starting from
391  * the first row, column go to next column until you hit the diagonal,
392  * jump to next row starting from first column. In StEvent the array is
393  * counted starting from the first row, column go to the next row until you
394  * hit the end, jump to next column starting from diagonal.
395  * The filling of the fitTraits was fixed to reflect this.
396  *
397  * Revision 2.17 2003/05/12 21:21:39 calderon
398  * switch back to getting the chi2 from track->getChi2()
399  * Covariance matrix is still obtained from node->get(), and the values
400  * are not as expected in StEvent, so this will still need to change.
401  *
402  * Revision 2.16 2003/05/08 22:23:33 calderon
403  * Adding a check for finiteness of node origin and node curvature. If any
404  * of the numbers is not finite, the code will abort().
405  *
406  * Revision 2.15 2003/04/29 18:48:52 pruneau
407  * *** empty log message ***
408  *
409  * Revision 2.14 2003/04/29 15:28:10 andrewar
410  * Removed hacks to get helicity right; switch now done at source
411  * (StiKalmanTrackNode).
412  *
413  * Revision 2.13 2003/04/25 21:42:47 andrewar
414  * corrected DCA bug and added temp fix for helicity problem. This will
415  * have to be modified when the helicity convention in StiStKalmanTrack
416  * is updated.
417  *
418  * Revision 2.12 2003/04/04 14:48:34 pruneau
419  * *** empty log message ***
420  *
421  * Revision 2.11 2003/03/14 19:02:55 pruneau
422  * various updates - DCA is a bitch
423  *
424  * Revision 2.10 2003/03/13 21:20:10 pruneau
425  * bug fix in filler fixed.
426  *
427  * Revision 2.9 2003/03/13 18:59:44 pruneau
428  * various updates
429  *
430  * Revision 2.8 2003/03/13 16:01:48 pruneau
431  * remove various cout
432  *
433  * Revision 2.7 2003/03/13 15:15:52 pruneau
434  * various
435  *
436  * Revision 2.6 2003/03/12 17:58:05 pruneau
437  * fixing stuff
438  *
439  * Revision 2.5 2003/02/25 16:56:20 pruneau
440  * *** empty log message ***
441  *
442  * Revision 2.4 2003/02/25 14:21:10 pruneau
443  * *** empty log message ***
444  *
445  * Revision 2.3 2003/01/24 06:12:28 pruneau
446  * removing centralized io
447  *
448  * Revision 2.2 2003/01/23 05:26:02 pruneau
449  * primaries rec reasonable now
450  *
451  * Revision 2.1 2003/01/22 21:12:15 calderon
452  * Restored encoded method, uses enums but stores the value in constructor
453  * as a data member so bit operations are only done once.
454  * Fixed warnings.
455  *
456  * Revision 2.0 2002/12/04 16:50:59 pruneau
457  * introducing version 2.0
458  *
459  * Revision 1.21 2002/09/20 02:19:32 calderon
460  * Quick hack for getting code for review:
461  * The filler now checks the global Dca for the tracks and only fills
462  * primaries when dca<3 cm.
463  * Also removed some comments so that the production log files are not swamped
464  * with debug info.
465  *
466  * Revision 1.20 2002/09/12 22:27:15 andrewar
467  * Fixed signed curvature -> StHelixModel conversion bug.
468  *
469  * Revision 1.19 2002/09/05 05:47:36 pruneau
470  * Adding Editable Parameters and dynamic StiOptionFrame
471  *
472  * Revision 1.18 2002/08/29 21:09:22 andrewar
473  * Fixed seg violation bug.
474  *
475  * Revision 1.17 2002/08/22 21:46:00 pruneau
476  * Made a fix to StiStEventFiller to remove calls to StHelix and StPhysicalHelix.
477  * Currently there is one instance of StHelix used a calculation broker to
478  * get helix parameters such as the distance of closest approach to the main
479  * vertex.
480  *
481  * Revision 1.16 2002/08/19 19:33:00 pruneau
482  * eliminated cout when unnecessary, made helix member of the EventFiller
483  *
484  * Revision 1.15 2002/08/12 21:39:56 calderon
485  * Introduced fillPidTraits, which uses the values obtained from
486  * Andrews brand new dEdxCalculator to create two instances of an
487  * StTrackPidTraits object and pass it to the track being filled.
488  *
489  * Revision 1.14 2002/08/12 15:29:21 andrewar
490  * Added dedx calculators
491  *
492  * Revision 1.13 2002/06/28 23:30:56 calderon
493  * Updated with changes debugging for number of primary tracks added.
494  * Merged with Claude's latest changes, but restored the tabs, othewise
495  * cvs diff will not give useful information: everything will be different.
496  *
497  * Revision 1.12 2002/06/26 23:05:31 pruneau
498  * changed macro
499  *
500  * Revision 1.11 2002/06/25 15:09:16 pruneau
501  * *** empty log message ***
502  *
503  * Revision 1.10 2002/06/18 18:08:34 pruneau
504  * some cout statements removed/added
505  *
506  * Revision 1.9 2002/06/05 20:31:15 calderon
507  * remove some redundant statements, the call to
508  * StTrackNode::addTrack()
509  * already calls
510  * track->SetNode(this), so I don't need to do it again
511  *
512  * Revision 1.8 2002/05/29 19:14:45 calderon
513  * Filling of primaries, in
514  * StiStEventFiller::fillEventPrimaries()
515  *
516  * Revision 1.7 2002/04/16 19:46:44 pruneau
517  * must catch exception
518  *
519  * Revision 1.6 2002/04/16 13:11:30 pruneau
520  * *** empty log message ***
521  *
522  * Revision 1.5 2002/04/09 16:03:13 pruneau
523  * Included explicit extension of tracks to the main vertex.
524  *
525  * Revision 1.4 2002/04/03 16:35:03 calderon
526  * Check if primary vertex is available in StiStEventFiller::impactParameter(),
527  * if not, return DBL_MAX;
528  *
529  * Revision 1.3 2002/03/28 04:29:49 calderon
530  * First test version of Filler
531  * Currently fills only global tracks with the following characteristics
532  * -Flag is set to 101, as most current global tracks are. This is not
533  * strictly correct, as this flag is supposed to mean a tpc only track, so
534  * really need to check if the track has svt hits and then set it to the
535  * appropriate flag (501 or 601).
536  * -Encoded method is set with bits 15 and 1 (starting from bit 0). Bit 1
537  * means Kalman fit.
538  * Bit 15 is an as-yet unused track-finding bit, which Thomas said ITTF
539  * could grab.
540  * -Impact Parameter calculation is done using StHelix and the primary vertex
541  * from StEvent
542  * -length is set using getTrackLength, which might still need tweaking
543  * -possible points is currently set from getMaxPointCount which returns the
544  * total, and it is not
545  * what we need for StEvent, so this needs to be modified
546  * -inner geometry (using the innermostHitNode -> Ben's transformer ->
547  * StPhysicalHelix -> StHelixModel)
548  * -outer geometry, needs inside-out pass to obtain good parameters at
549  * outermostHitNode
550  * -fit traits, still missing the probability of chi2
551  * -topology map, filled from StuFixTopoMap once StDetectorInfo is properly set
552  *
553  * This version prints out lots of messages for debugging, should be more quiet
554  * when we make progress.
555  *
556  **************************************************************************/
557 //ROOT
558 #include "RVersion.h"
559 #if ROOT_VERSION_CODE < 331013
560 #include "TCL.h"
561 #else
562 #include "TCernLib.h"
563 #endif
564 //std
565 #include "Stiostream.h"
566 #include <algorithm>
567 #include <stdexcept>
568 using namespace std;
569 
570 // SCL
571 #include "StPhysicalHelix.hh"
572 #include "StThreeVector.hh"
573 #include "StThreeVectorF.hh"
574 #include "PhysicalConstants.h"
575 #include "SystemOfUnits.h"
576 #include "StTrackDefinitions.h"
577 #include "StTrackMethod.h"
578 #include "StDedxMethod.h"
579 
580 //StEvent
581 #include "StPrimaryVertex.h"
582 #include "StEventTypes.h"
583 #include "StDetectorId.h"
584 #include "StHelix.hh"
585 #include "StDcaGeometry.h"
586 #include "StHit.h"
587 
588 
589 #include "StEventUtilities/StEventHelper.h"
590 #include "StEventUtilities/StuFixTopoMap.cxx"
591 //Sti
592 #include "Sti/StiTrackContainer.h"
593 #include "Sti/StiKalmanTrack.h"
594 #include "StDetectorDbMaker/StiKalmanTrackFitterParameters.h"
596 #include "StiUtilities/StiDebug.h"
597 #include "StiUtilities/StiPullEvent.h"
598 
599 //StiMaker
600 #include "StiMaker/StiStEventFiller.h"
601 #include "TMath.h"
602 #include "StTrack2FastDetectorMatcher.h"
603 #include "Sti/StiHitTest.h"
604 #define NICE(angle) StiKalmanTrackNode::nice((angle))
605 map<StiKalmanTrack*, StTrackNode*> StiStEventFiller::mTrkNodeMap;
606 map<StTrackNode*, StiKalmanTrack*> StiStEventFiller::mNodeTrkMap;
607 StiStEventFiller *StiStEventFiller::fgStiStEventFiller = 0;
608 
609 //_____________________________________________________________________________
610 StiStEventFiller::StiStEventFiller() : mEvent(0), mTrackStore(0), mFastDetectorMatcher(0)
611 {
612  fgStiStEventFiller = this;
613  mUseAux = 0;
614  mAux = 0;
615  mGloPri = 0;
616  mPullEvent=0;
617 
618  originD = new StThreeVectorD(0,0,0);
619  physicalHelix = new StPhysicalHelixD(0.,0.,0.,*originD,-1);
620 
621 
622  //mResMaker.setLimits(-1.5,1.5,-1.5,1.5,-10,10,-10,10);
623  //mResMaker.setDetector(kSvtId);
624 
625  // encoded method = 16 bits = 12 finding and 4 fitting, Refer
626  // to StTrackMethod.h and StTrackDefinitions.h in pams/global/inc/
627  // and StEvent/StEnumerations.h
628  // For the IT tracks use:
629  // Fitting: kITKalmanFitId (should be something like 7, but don't hardwire it)
630  // Finding: tpcOther (should be 9th LSB, or shift the "1" 8 places to the left, but also don't hardwire it)
631  // so need this bit pattern:
632  // finding 000000010000
633  // fitting 0111
634  // 256 + 7 = 263;
635  unsigned short bit = 1 << tpcOther; // shifting the "1" exactly tpcOther places to the left
636  mStiEncoded = kITKalmanFitId + bit; // adding that to the proper fitting Id
637  mFastDetectorMatcher = new StTrack2FastDetectorMatcher();
638 }
639 //_____________________________________________________________________________
640 StiStEventFiller::~StiStEventFiller()
641 {
642  delete physicalHelix; physicalHelix=0;
643  delete originD; originD =0;
644  SafeDelete(mFastDetectorMatcher);
645  cout <<"StiStEventFiller::~StiStEventFiller()"<<endl;
646 }
647 //_____________________________________________________________________________
699 //_____________________________________________________________________________
701 {
702  mFastDetectorMatcher->Clear();
703  mFastDetectorMatcher->fillArrays(e);
704  //cout << "StiStEventFiller::fillEvent() -I- Started"<<endl;
705  mGloPri=0;
706  if (e==0 || t==0)
707  {
708  cout <<"StiStEventFiller::fillEvent(). ERROR:\t"
709  <<"Null StEvent ("<<e<<") || StiTrackContainer ("<<t<<"). Exit"<<endl;
710  return;
711  }
712  mEvent = e;
713  StEventHelper::Remove(mEvent,"StSPtrVecTrackNode");
714  StEventHelper::Remove(mEvent,"StSPtrVecPrimaryVertex");
715 
716  if (mUseAux) { mAux = new StiAux; e->Add(mAux);}
717  mTrackStore = t;
718  memset(mUsedHits,0,sizeof(mUsedHits));
719  memset(mUsedGits,0,sizeof(mUsedGits));
720  mTrkNodeMap.clear(); // need to reset for this event
721  mNodeTrkMap.clear();
722  StSPtrVecTrackNode& trNodeVec = mEvent->trackNodes();
723  StSPtrVecTrackDetectorInfo& detInfoVec = mEvent->trackDetectorInfo();
724  int errorCount=0;
725 
726  int fillTrackCount1=0;
727  int fillTrackCount2=0;
728  int fillTrackCountG=0;
729  StErrorHelper errh;
730  mTrackNumber=0;
731  for (int trackIt = 0;trackIt <(int)mTrackStore->size(); trackIt++)
732  {
733  StiKalmanTrack* kTrack = static_cast<StiKalmanTrack*>((*mTrackStore)[trackIt]);
734  if (!accept(kTrack)) continue; // get rid of riff-raff
735  mTrackNumber++;
737  fillDetectorInfo(detInfo,kTrack,true); //3d argument used to increase/not increase the refCount. MCBS oct 04.
738  // track node where the new StTrack will reside
739  StTrackNode* trackNode = new StTrackNode;
740  // actual filling of StTrack from StiKalmanTrack
741  StGlobalTrack* gTrack = new StGlobalTrack;
742  try
743  {
744  fillTrackCount1++;
745  fillTrack(gTrack,kTrack,detInfo);
746  // filling successful, set up relationships between objects
747  detInfoVec.push_back(detInfo);
748  //cout <<"Setting key: "<<(unsigned short)(trNodeVec.size())<<endl;
749  gTrack->setKey(kTrack->getId());
750  gTrack->setIdTruth();
751  trackNode->addTrack(gTrack);
752  trNodeVec.push_back(trackNode);
753  // reuse the utility to fill the topology map
754  // this has to be done at the end as it relies on
755  // having the proper track->detectorInfo() relationship
756  // and a valid StDetectorInfo object.
757  //cout<<"Tester: Event Track Node Entries: "<<trackNode->entries()<<endl;
758  StTrackNode* node = trNodeVec.back();
759  mTrkNodeMap.insert(pair<StiKalmanTrack*,StTrackNode*> (kTrack,node) );
760  mNodeTrkMap.insert(pair<StTrackNode*,StiKalmanTrack*> (node,kTrack) );
761  if (trackNode->entries(global)<1)
762  cout << "StiStEventFiller::fillEvent() -E- Track Node has no entries!! -------------------------" << endl;
763  int ibad = gTrack->bad();
764  if (ibad) {
765  errh.Add(ibad);
766  if (errh.Say(ibad).Contains("Negative")) continue;
767  printf("GTrack error: %s\n",errh.Say(ibad).Data());
768  continue;
769  }
770  fillTrackCount2++;
771 if (kTrack->getPointCount(kTpcId)>10)
772 StiHftHits::hftHist("HFTAfterAll",kTrack);//???????????????????????
773  fillPulls(kTrack,gTrack,0);
774  if (kTrack->getPointCount()<15) continue;
775  fillTrackCountG++;
776 
777  }
778  catch (runtime_error & rte )
779  {
780  cout << "StiStEventFiller::fillEvent() -W- runtime-e filling track"<<rte.what() << endl;
781  delete trackNode;
782  delete detInfo;
783  delete gTrack;
784  }
785  catch (...)
786  {
787  cout << "StiStEventFiller::fillEvent() -W- Unknown exception filling track."<<endl;
788  delete trackNode;
789  delete detInfo;
790  delete gTrack;
791  }
792  }
793  if (errorCount>4)
794  cout << "There were "<<errorCount<<"runtime_error while filling StEvent"<<endl;
795 
796  cout <<"StiStEventFiller::fillEvent() -I- Number of filled as global(1):"<< fillTrackCount1<<endl;
797  cout <<"StiStEventFiller::fillEvent() -I- Number of filled as global(2):"<< fillTrackCount2<<endl;
798  cout <<"StiStEventFiller::fillEvent() -I- Number of filled GOOD globals:"<< fillTrackCountG<<endl;
799  errh.Print();
800  for (int ij=1; ij<=mUsedHits[0]; ij++) {
801  if (!mUsedHits[ij]) continue;
802  const char *det = detectorNameById((StDetectorId)ij);
803  cout <<"StiStEventFiller::fillEvent() -I- Number of used hits:"<< det << "(" << ij << ") :"<<mUsedHits[ij]
804  << " per track:"<<double(mUsedHits[ij])/fillTrackCount2 <<endl;
805  }
806  for (int ij=1; ij<=mUsedGits[0]; ij++) {
807  if (!mUsedGits[ij]) continue;
808  const char *det = detectorNameById((StDetectorId)ij);
809  cout <<"StiStEventFiller::fillEvent() -I- Number of GOOD hits:"<< det << "(" << ij << ") :"<<mUsedGits[ij]
810  << " per track:"<<double(mUsedHits[ij])/fillTrackCountG <<endl;
811  }
812 
813 
814  return;
815 }
816 //_____________________________________________________________________________
817 void StiStEventFiller::fillEventPrimaries()
818 {
819  //cout <<"StiStEventFiller::fillEventPrimaries() -I- Started"<<endl;
820  mGloPri=1;
821  if (!mTrkNodeMap.size())
822  {
823  cout <<"StiStEventFiller::fillEventPrimaries(). ERROR:\t"
824  << "Mapping between the StTrackNodes and the StiKalmanTracks is empty. Exit." << endl;
825  return;
826  }
827  //Added residual maker...aar
828  StPrimaryVertex* vertex = 0;
829  StSPtrVecTrackDetectorInfo& detInfoVec = mEvent->trackDetectorInfo();
830  cout << "StiStEventFiller::fillEventPrimaries() -I- Tracks in container:" << mTrackStore->size() << endl;
831  int mTrackN=0,mVertN=0;
832  int fillTrackCount1=0;
833  int fillTrackCount2=0;
834  int fillTrackCountG=0;
835  StErrorHelper errh;
836  int nTracks = mTrackStore->size();
837  StiKalmanTrack *kTrack = 0;
838  StPrimaryTrack *pTrack = 0;
839  StGlobalTrack *gTrack = 0;
840  StTrackNode *nTRack = 0;
841  mTrackNumber=0;
842  for (mTrackN=0; mTrackN<nTracks;++mTrackN) {
843  kTrack = (StiKalmanTrack*)(*mTrackStore)[mTrackN];
844  if (!accept(kTrack)) continue;
845  map<StiKalmanTrack*, StTrackNode*>::iterator itKtrack = mTrkNodeMap.find(kTrack);
846  if (itKtrack == mTrkNodeMap.end()) continue;//Sti global was rejected
847  mTrackNumber++;
848 
849  nTRack = (*itKtrack).second;
850  assert(nTRack->entries()<=10);
851  assert(nTRack->entries(global));
852 
853  //double globalDca = nTRack->track(global)->impactParameter();
854  //Even though this is filling of primary tracks, there are certain
855  // quantities that need to be filled for global tracks that are only known
856  // after the vertex is found, such as dca. Here we can fill them.
857  //
858  gTrack = static_cast<StGlobalTrack*>(nTRack->track(global));
859  assert(gTrack->key()==kTrack->getId());
860  float minDca = 1e10; //We do not know which primary. Use the smallest one
861 
862  pTrack = 0;
863  for (mVertN=0; (vertex = mEvent->primaryVertex(mVertN));mVertN++) {
864  StThreeVectorD vertexPosition = vertex->position();
865  double zPrim = vertexPosition.z();
866  // loop over StiKalmanTracks
867  float globalDca = impactParameter(gTrack,vertexPosition);
868  if (fabs(minDca) > fabs(globalDca)) minDca = globalDca;
869 
870  if (!kTrack->isPrimary()) continue;
871  StiKalmanTrackNode *lastNode = kTrack->getLastNode();
872  StiHit *pHit = lastNode->getHit();
873  assert (pHit);
874  if (fabs(pHit->z_g()-zPrim)>0.1) continue;//not this primary
875 
876  fillTrackCount1++;
877  // detector info
879  fillDetectorInfo(detInfo,kTrack,false); //3d argument used to increase/not increase the refCount. MCBS oct 04.
880 // double rxy = detInfo->firstPoint().perp();
881 // assert(rxy < 9);
882  auto myDif = (detInfo->firstPoint()-vertexPosition);
883 //?? assert(myDif.mag()<0.01);
884 
885  StPrimaryTrack* pTrack = new StPrimaryTrack;
886  pTrack->setKey( gTrack->key());
887  nTRack->addTrack(pTrack); // StTrackNode::addTrack() calls track->setNode(this);
888  fillTrack(pTrack,kTrack, detInfo);
889  // set up relationships between objects
890  detInfoVec.push_back(detInfo);
891 
892  vertex->addDaughter(pTrack);
893  fillPulls(kTrack,gTrack,1);
894  int ibad = pTrack->bad();
895  errh.Add(ibad);
896  if (ibad) {
897 //VP printf("PTrack error: %s\n",errh.Say(ibad).Data());
898 //VP throw runtime_error("StiStEventFiller::fillEventPrimaries() StTrack::bad() non zero");
899  continue;
900  }
901 // rxy = pTrack->geometry()->origin().perp();
902 // assert(rxy<9);
903  fillTrackCount2++;
904  if (kTrack->getPointCount()<15) break;
905  if (pTrack->geometry()->momentum().mag()<0.1) break;
906  fillTrackCountG++;
907  break;
908  } //end of verteces
909  kTrack->setDca(minDca);
910  gTrack->setImpactParameter(minDca);
911  if (pTrack) pTrack->setImpactParameter(minDca);
912 
913  } // kalman track loop
914  for (mVertN=0; (vertex = mEvent->primaryVertex(mVertN));mVertN++) {vertex->setTrackNumbers();}
915 
916  mTrkNodeMap.clear(); // need to reset for the next event
917  cout <<"StiStEventFiller::fillEventPrimaries() -I- Primaries (1):"<< fillTrackCount1 <<endl;
918  cout <<"StiStEventFiller::fillEventPrimaries() -I- Primaries (2):"<< fillTrackCount2 <<endl;
919  cout <<"StiStEventFiller::fillEventPrimaries() -I- GOOD:"<< fillTrackCountG <<endl;
920  errh.Print();
921  return;
922 }
923 //_____________________________________________________________________________
928 //_____________________________________________________________________________
930 {
931  //cout << "StiStEventFiller::fillDetectorInfo() -I- Started"<<endl;
932  int dets[kMaxDetectorId][3];
933  track->getAllPointCount(dets,kMaxDetectorId-1);
934  int nTotHits = dets[0][2];
935  int nTpcHits = dets[kTpcId][2];
936  for (int i=1;i<kMaxDetectorId;i++) {
937  if (!dets[i][1]) continue;
938  detInfo->setNumberOfPoints(dets[i][1],static_cast<StDetectorId>(i));
939  }
940  StiKTNIterator tNode = track->rbegin();
941  StiKTNIterator eNode = track->rend();
942  StiKalmanTrackNode *lastNode=0,*fistNode=0;
943  for (;tNode!=eNode;++tNode)
944  {
945  StiKalmanTrackNode *node = &(*tNode);
946  if(!node->isValid()) continue;
947 
948  StiHit *stiHit = node->getHit();
949  if (!stiHit) continue;
950 
951  if (node->getChi2()>1000) continue;
952  if (!node->isFitted()) continue;
953 
954  const StiDetector *detector = node->getDetector();
955  assert(detector == stiHit->detector());
956  assert(!detector || stiHit->timesUsed());
957  if (!fistNode) fistNode = node;
958  lastNode = node;
959  if (!detector) continue;
960 
961 // Count used hits for tracks tpc hits >10
962  if (nTpcHits > 10) {
963  int gid = detector->getGroupId();
964  if (mUsedHits[0]<gid) mUsedHits[0]=gid;
965  mUsedHits[gid]++;
966  if (nTotHits>=15) {
967  if (mUsedGits[0]<gid) mUsedGits[0]=gid;
968  mUsedGits[gid]++;
969  }
970  }
971  StHit *hh = (StHit*)stiHit->stHit();
972  if (!hh) continue;
973  assert(detector->getGroupId()==hh->detector());
974 #if 0
975 // Fill StHit errors for Gene
976  FillStHitErr(hh,node);
977 #endif
978  detInfo->addHit(hh,refCountIncr);
979  if (!refCountIncr) continue;
980  hh->setFitFlag(1);
981 //Kind of HACK, save residials into StiHack
982  fillResHack(hh,stiHit,node);
983  }
984  assert(lastNode && fistNode && (lastNode != fistNode));
985 
986  StThreeVectorF posL(lastNode->x_g(),lastNode->y_g(),lastNode->z_g());
987  detInfo->setLastPoint (posL);
988  StThreeVectorF posF(fistNode->x_g(),fistNode->y_g(),fistNode->z_g());
989  detInfo->setFirstPoint(posF);
990 
991 
992  //cout << "StiStEventFiller::fillDetectorInfo() -I- Done"<<endl;
993 }
994 
995 //_____________________________________________________________________________
996 void StiStEventFiller::fillGeometry(StTrack* gTrack, StiKalmanTrack* track, bool outer)
997 {
998  //cout << "StiStEventFiller::fillGeometry() -I- Started"<<endl;
999  assert(gTrack);
1000  assert(track) ;
1001 
1002  StiKalmanTrackNode* node = track->getInnOutMostNode(outer,3);
1003  StiHit *ihit = node->getHit();
1004  StThreeVectorF origin(node->x_g(),node->y_g(),node->z_g());
1005  StThreeVectorF hitpos(ihit->x_g(),ihit->y_g(),ihit->z_g());
1006  if (node->getDetector()) {
1007  double dif = (hitpos-origin).mag();
1008 
1009  if (dif>3.) {
1010  dif = node->z_g()-ihit->z_g();
1011  double nowChi2 = node->evaluateChi2(ihit);
1012  printf("***Track(%d) DIFF TOO BIG %g chi2 = %g %g\n",track->getId(),dif,node->getChi2(),nowChi2);
1013  printf("H=%g %g %g N =%g %g %g\n",ihit->x() ,ihit->y() ,ihit->z()
1014  ,node->getX(),node->getY(),node->getZ());
1015  const StMeasuredPoint *mp = ihit->stHit();
1016  printf("H=%g %g %g N =%g %g %g\n",mp->position().x(),mp->position().y(),mp->position().z()
1017  ,origin.x(),origin.y(),origin.z());
1018 
1019  assert(fabs(dif)<50.);
1020  }
1021  }
1022  // making some checks. Seems the curvature is infinity sometimes and
1023  // the origin is sometimes filled with nan's...
1024 
1025  int ibad = origin.bad();
1026  if (ibad) {
1027  cout << "StiStEventFiller::fillGeometry() Encountered non-finite numbers!!!! Bail out completely!!! " << endl;
1028  cout << "StThreeVectorF::bad() = " << ibad << endl;
1029  cout << "Last node had:" << endl;
1030  cout << "Ref Position " << node->getRefPosition() << endl;
1031  cout << "node->getY() " << node->getY() << endl;
1032  cout << "node->getZ() " << node->getZ() << endl;
1033  cout << "Ref Angle " << node->getAlpha() << endl;
1034  cout << "origin " << origin << endl;
1035  cout << "curvature " << node->getCurvature() << endl;
1036  abort();
1037  }
1038  StTrackGeometry* geometry =new StHelixModel(short(track->getCharge()),
1039  node->getPsi(),
1040  fabs(node->getCurvature()),
1041  node->getDipAngle(),
1042  origin,
1043  node->getGlobalMomentumF(),
1044  node->getHelicity());
1045 
1046  if (outer)
1047  gTrack->setOuterGeometry(geometry);
1048  else
1049  gTrack->setGeometry(geometry);
1050 
1051 
1052  return;
1053 }
1054 
1055 //_____________________________________________________________________________
1056 // void StiStEventFiller::fillTopologyMap(StTrack* gTrack, StiKalmanTrack* track){
1057 // cout << "StiStEventFiller::fillTopologyMap()" << endl;
1058 // int map1,map2;
1059 // map1 = map2 = 0;
1060 // // change: add code to set the bits appropriately here
1061 
1062 // StTrackTopologyMap topomap(map1,map2);
1063 // gTrack->setTopologyMap(topomap);
1064 // return;
1065 // }
1066 
1067 //_____________________________________________________________________________
1068 void StiStEventFiller::fillFitTraits(StTrack* gTrack, StiKalmanTrack* track){
1069  // mass
1070  // this makes no sense right now... double massHyp = track->getMass(); // change: perhaps this mass is not set right?
1071  unsigned short geantIdPidHyp = 9999;
1072  //if (.13< massHyp<.14)
1073  geantIdPidHyp = 9;
1074  // chi square and covariance matrix, plus other stuff from the
1075  // innermost track node
1076  StiKalmanTrackNode* node = track->getInnerMostHitNode(3);
1077  float x[6],covMFloat[15];
1078  node->getGlobalTpt(x,covMFloat);
1079  float chi2[2];
1080  //get chi2/dof
1081  chi2[0] = track->getChi2();
1082  assert(chi2[0]<100);
1083  chi2[1] = -999; // change: here goes an actual probability, need to calculate?
1084  // December 04: The second element of the array will now hold the incremental chi2 of adding
1085  // the vertex for primary tracks
1086  if (gTrack->type()==primary) {
1087  assert(node->getDetector()==0);
1088  chi2[1]=node->getChi2();
1089  }
1090 
1091  // setFitTraits uses assignment operator of StTrackFitTraits, which is the default one,
1092  // which does a memberwise copy. Therefore, constructing a local instance of
1093  // StTrackFitTraits is fine, as it will get properly copied.
1094  StTrackFitTraits fitTraits(geantIdPidHyp,0,chi2,covMFloat);
1095  // Now we have to use the new setters that take a detector ID to fix
1096  // a bug. There is no encoding anymore.
1097 
1098  int dets[kMaxDetectorId][3];
1099  track->getAllPointCount(dets,kMaxDetectorId-1);
1100 
1101  for (int i=1;i<kMaxDetectorId;i++) {
1102  if (!dets[i][2]) continue;
1103  fitTraits.setNumberOfFitPoints((unsigned char)dets[i][2],(StDetectorId)i);
1104  }
1105  if (gTrack->type()==primary) {
1106  fitTraits.setPrimaryVertexUsedInFit(true);
1107  }
1108  gTrack->setFitTraits(fitTraits);
1109  return;
1110 }
1111 
1144 
1146 {
1147  Int_t flag = 0;
1148  if (gTrack->type()==global) {
1149  flag = 101; //change: make sure flag is ok
1150  }
1151  else if (gTrack->type()==primary) {
1152  flag = 301;
1153  }
1154  StTrackFitTraits& fitTrait = gTrack->fitTraits();
1155  //int tpcFitPoints = fitTrait.numberOfFitPoints(kTpcId);
1156  int svtFitPoints = fitTrait.numberOfFitPoints(kSvtId);
1157  int ssdFitPoints = fitTrait.numberOfFitPoints(kSsdId);
1158  int pxlFitPoints = fitTrait.numberOfFitPoints(kPxlId);
1159  int istFitPoints = fitTrait.numberOfFitPoints(kIstId);
1160  // int totFitPoints = fitTrait.numberOfFitPoints();
1164 
1165  // first case is default above, tpc only = 101 and tpc+vertex = 301
1166  // next case is:
1167  // if the track has svt points, it will be an svt+tpc track
1168  // (we assume that the ittf tracks start from tpc, so we don't
1169  // use the "svt only" case.)
1170  if (svtFitPoints+ssdFitPoints+pxlFitPoints+istFitPoints>0) {
1171  if (gTrack->type()==global) {
1172  flag = 501; //svt+tpc
1173  }
1174  else if (gTrack->type()==primary) {
1175  flag = 601; //svt+tpc+primary
1176  }
1177  }
1178  const StTrackDetectorInfo *dinfo = gTrack->detectorInfo();
1179  if (dinfo) {
1180  Int_t NoTpcFitPoints = dinfo->numberOfPoints(kTpcId);
1181  Int_t NoFtpcWestId = dinfo->numberOfPoints(kFtpcWestId);
1182  Int_t NoFtpcEastId = dinfo->numberOfPoints(kFtpcEastId);
1183  // Check that it could be TPC pile-up track, i.e. in the same half TPC (West East)
1184  // there are more than 2 hits with wrong Z -position
1185  if (NoTpcFitPoints >= 11) {
1186  const StPtrVecHit& hits = dinfo->hits(kTpcId);
1187  Int_t Nhits = hits.size();
1188  Int_t NoWrongSignZ = 0;
1189  Int_t NoPositiveSignZ = 0;
1190  Int_t NoNegativeSignZ = 0;
1191  Int_t NoPromptHits = 0;
1192  Double_t zE = -200, zW = 200;
1193  Int_t rE = 0, rW = 0;
1194  Int_t nW = 0, nE = 0;
1195  for (Int_t i = 0; i < Nhits; i++) {
1196  const StTpcHit *hit = (StTpcHit *) hits[i];
1197  Double_t z = hit->position().z();
1198  Int_t sector = hit->sector();
1199  if (sector <= 12) nW++;
1200  else nE++;
1201  Int_t row = hit->padrow();
1202  if ((z < -1.0 && sector <= 12) ||
1203  (z > 1.0 && sector > 12)) NoWrongSignZ++;
1204  else {
1205  if (z < -1.0) {NoNegativeSignZ++; if (z > zE) {zE = z; rE = row;}}
1206  if (z > 1.0) {NoPositiveSignZ++; if (z < zW) {zW = z; rW = row;}}
1207  }
1208  if (TMath::Abs(209.4 - TMath::Abs(z)) < 3.0) NoPromptHits++;
1209  }
1210  if (NoWrongSignZ >= 2) gTrack->setPostCrossingTrack();
1211  else {
1212  if (NoPromptHits == 1) gTrack->setPromptTrack();
1213  if (NoPositiveSignZ >= 2 && NoNegativeSignZ >=2) {
1214  if (zW - zE < 10 ||
1215  TMath::Abs(rW - rE) < 3)
1216  gTrack->setMembraneCrossingTrack();
1217  }
1218  }
1219  if (nW > 0 && nE == 0) gTrack->setWestTpcOnly();
1220  if (nW == 0 && nE > 0) gTrack->setEastTpcOnly();
1221  }
1222  if (NoTpcFitPoints < 11 && NoFtpcWestId < 5 && NoFtpcEastId < 5) {
1223  // hardcoded number correspondant to __MIN_HITS_TPC__ 11 in StMuFilter.cxx
1224  //keep most sig. digit, set last digit to 2, and set negative sign
1225  gTrack->setRejected();
1226  flag = - ((flag/100)*100 + 2); // -x02
1227 
1228  // Deciding which short tracks to keep based on event time.
1229  // Hardcoded times are not optimal, and will need revisiting
1230  // when EEMC is turned back on after BES-II, eTOF stays or goes?
1231  int evtTime = mEvent->time();
1232  bool doShort2EMC = (evtTime < 1538352000 || evtTime > 1633046400); // t < 2018-10-01 or t > 2021-10-01
1233  bool doShort2ETOF = (evtTime > 1525910400); // 2018-05-10 < t < (no end)
1234 
1235  if ((doShort2EMC || doShort2ETOF) && gTrack->geometry()) {
1236  const StThreeVectorF &momentum = gTrack->geometry()->momentum();
1237  const float eta = momentum.pseudoRapidity();
1238  if (TMath::Abs(eta) > 0.5) {
1239  const StTrackDetectorInfo *dinfo = gTrack->detectorInfo();
1240  const StPtrVecHit& hits = dinfo->hits();
1241  Int_t Nhits = hits.size();
1242  Bool_t ShortTrack2EMC = kFALSE;
1243  Bool_t ShortTrack2ETOF = kFALSE;
1244  for (Int_t i = 0; i < Nhits; i++) {
1245  const StHit *hit = hits[i];
1246  if (doShort2EMC && eta > 0.5 && hit->position().z() > 150.0) {
1247  ShortTrack2EMC = kTRUE;
1248  break;
1249  }
1250  if (doShort2ETOF && eta < -0.5 && hit->position().z() < -150.0) {
1251  ShortTrack2ETOF = kTRUE;
1252  break;
1253  }
1254  }
1255  if (ShortTrack2EMC) {
1256  gTrack->setShortTrack2EMC();
1257  flag = (TMath::Abs(flag)/100)*100+11; // +x11
1258  } else if (ShortTrack2ETOF) {
1259  gTrack->setShortTrack2ETOF();
1260  flag = (TMath::Abs(flag)/100)*100+12; // +x12
1261  }
1262  }
1263  }
1264  }
1265  }
1266 
1267  gTrack->setFlag( flag);
1268  if (gTrack->type()==global) {
1269  // Match with fast detectors
1270  StPhysicalHelixD hlx = gTrack->outerGeometry()->helix();
1272  mFastDetectorMatcher->matchTrack2FastDetectors(&hlx,&t);
1273  if (t.btofBin > 0) {
1274  if (t.mBtof > 0) gTrack->setToFMatched();
1275  else gTrack->setToFNotMatched();
1276  }
1277  if (t.ctbBin > 0) {
1278  if (t.mCtb > 0) gTrack->setCtbMatched();
1279  else gTrack->setCtbNotMatched();
1280  }
1281  if (t.bemcBin > 0 || t.eemcBin > 0) {
1282  Int_t W = 0;
1283  if (t.bemcBin > 0) {
1284  W = StBemcHitList::instance()->getFired(t.bemcBin);
1285  if (W > 0) gTrack->setBemcMatched();
1286  else gTrack->setBemcNotMatched();
1287  } else if (t.eemcBin > 0) {
1288  W = StEemcHitList::instance()->getFired(t.eemcBin);
1289  if (W > 0) gTrack->setEemcMatched();
1290  else gTrack->setEemcNotMatched();
1291  }
1292  if (W > 0) {
1293  UInt_t fext = gTrack->flagExtension();
1294  if (W > 7) W = 7;
1295  fext &= ~7;
1296  fext += W;
1297  gTrack->setFlagExtension(fext);
1298  }
1299  }
1300  } else if (gTrack->type()==primary) {
1301  StTrackNode *n = gTrack->node();
1302  assert(n);
1303  StTrack *t = n->track(global);
1304  assert(t);
1305  gTrack->setFlagExtension(t->flagExtension());
1306  }
1307 }
1308 //_____________________________________________________________________________
1309 void StiStEventFiller::fillTrack(StTrack* gTrack, StiKalmanTrack* track,StTrackDetectorInfo* detInfo )
1310 {
1311 
1312  //cout << "StiStEventFiller::fillTrack()" << endl;
1313  // encoded method = 16 bits = 12 fitting and 4 finding, for the moment use:
1314  // kKalmanFitId
1315  // bit 15 for finding, (needs to be changed in StEvent).
1316  // change: make sure bits are ok, are the bits set up one in each position and nothing else?
1317  // this would mean that the encoded method is wasting space!
1318  // the problem is that in principle there might be combinations of finders for each tracking detector
1319  // but the integrated tracker will use only one for all detectors maybe
1320  // so need this bit pattern:
1321  // finding 100000000000
1322  // fitting 0010
1323  // 32768 + 2 = 32770;
1324  //
1325  // above is no longer used, instead use kITKalmanfitId as fitter and tpcOther as finding method
1326 
1327  gTrack->setEncodedMethod(mStiEncoded);
1328  double tlen = track->getTrackLength();
1329  assert(tlen >0.0 && tlen<1000.);
1330  gTrack->setLength(tlen);// someone removed this, grrrr!!!!
1331  gTrack->setSeedQuality(track->getSeedHitCount());
1332  // Follow the StDetectorId.h enumerations...
1333  // can't include them from here in order not to
1334  // create a package dependence...
1335  int dets[kMaxDetectorId][3];
1336  track->getAllPointCount(dets,kMaxDetectorId-1);
1337  for (int i=1;i<kMaxDetectorId;i++) {
1338  if(!dets[i][0]) continue;
1339  gTrack->setNumberOfPossiblePoints((unsigned char)dets[i][0],(StDetectorId)i);
1340  }
1341  fillGeometry(gTrack, track, false); // inner geometry
1342  fillGeometry(gTrack, track, true ); // outer geometry
1343  fillFitTraits(gTrack, track);
1344  gTrack->setDetectorInfo(detInfo);
1345  StuFixTopoMap(gTrack);
1346  fillFlags(gTrack);
1347  if (!track->isPrimary()) fillDca(gTrack,track);
1348  return;
1349 }
1350 //_____________________________________________________________________________
1351 bool StiStEventFiller::accept(StiKalmanTrack* track)
1352 {
1353 // int nPossiblePoints = track->getMaxPointCount(0);
1354 // int nMeasuredPoints = track->getPointCount (0);
1355  int nFittedPoints = track->getFitPointCount(0);
1356  if (nFittedPoints < 5 ) return 0;
1357 #if 0
1358  if (nFittedPoints < 10 && nFittedPoints*2 < nPossiblePoints)return 0;
1359  if(track->getPt()<=0.1) return 0;
1360 #endif
1361  if(track->getTrackLength()<=0) return 0;
1362  if(track->getChi2()>100) return 0;
1363  // insert other filters for riff-raff we don't want in StEvent here.
1364 
1365 
1366  return 1;
1367 }
1368 //_____________________________________________________________________________
1369 double StiStEventFiller::impactParameter(StiKalmanTrack* track
1370  ,StThreeVectorD &vertexPosition)
1371 {
1372  StiKalmanTrackNode* node;
1373 
1374  node = track->getInnerMostNode(2); // ...
1375 
1376 
1377  originD->setX(node->x_g());
1378  originD->setY(node->y_g());
1379  originD->setZ(node->z_g());
1380 
1381 
1382  physicalHelix->setParameters(fabs(node->getCurvature()),
1383  node->getDipAngle(),
1384  node->getPhase(),
1385  *originD,
1386  node->getHelicity());
1387 
1388 
1389  //cout <<"PHelix: "<<*physicalHelix<<endl;
1390  return physicalHelix->distance(vertexPosition);
1391 }
1392 //_____________________________________________________________________________
1393 double StiStEventFiller::impactParameter(StTrack* track, StThreeVectorD &vertex)
1394 {
1395  StPhysicalHelixD helix = track->geometry()->helix();
1396 
1397  //cout <<"PHelix: "<<helix<<endl;
1398  return helix.distance(vertex);
1399 }
1400 //_____________________________________________________________________________
1401  void StiStEventFiller::fillResHack(StHit *hh,const StiHit *stiHit, const StiKalmanTrackNode *node)
1402  {
1403 
1404  if (!mAux) return;
1405  StiAux_t aux;
1406 // local frame
1407  aux.xnl[0] = node->getX();
1408  aux.xnl[1] = node->getY();
1409  aux.xnl[2] = node->getZ();
1410 
1411  aux.xhl[0] = stiHit->x();
1412  aux.xhl[1] = stiHit->y();
1413  aux.xhl[2] = stiHit->z();
1414 
1415  aux.ca = node->getEta();
1416  aux.rho = node->getCurvature();
1417  aux.nYY = node->getCyy();
1418  aux.nZZ = node->getCzz();
1419  aux.hYY = node->getEyy();
1420  aux.hZZ = node->getEzz();
1421 
1422  aux.unl[0] = node->getX();
1423  aux.unl[1] = node->unTouched().mPar[0];
1424  aux.unl[2] = node->unTouched().mPar[1];
1425  aux.uYY = sqrt(node->unTouched().mErr[0]);
1426  aux.uZZ = sqrt(node->unTouched().mErr[2]);
1427 
1428 
1429  // global frame
1430  aux.xng[0] = node->x_g();
1431  aux.xng[1] = node->y_g();
1432  aux.xng[2] = node->z_g();
1433 
1434  aux.xhg[0] = stiHit->x_g();
1435  aux.xhg[1] = stiHit->y_g();
1436  aux.xhg[2] = stiHit->z_g();
1437  aux.psi = node->getPsi();
1438  aux.dip = node->getDipAngle();
1439  // invariant
1440  double chi2 = node->getChi2();if (chi2>1000) chi2=1000;
1441  aux.chi2 = chi2;
1442  int id = mAux->AddIt(&aux);
1443  assert(id);
1444  hh->setId(id);
1445  assert(hh->id());
1446 //mAux->PrintIt(id);
1447 
1448 
1449 }
1450 //_____________________________________________________________________________
1451 void StiStEventFiller::fillDca(StTrack* stTrack, StiKalmanTrack* track)
1452 {
1453  StGlobalTrack *gTrack = dynamic_cast<StGlobalTrack*>(stTrack);
1454  assert(gTrack);
1455 
1456  StiKalmanTrackNode *tNode = track->getInnerMostNode();
1457  if (!tNode->isDca()) return;
1458  const StiNodePars &pars = tNode->fitPars();
1459  const StiNodeErrs &errs = tNode->fitErrs();
1460  float alfa = tNode->getAlpha();
1461  Float_t setp[7] = {(float)pars.y(), (float)pars.z(), (float)pars.eta()
1462  ,(float)pars.ptin(), (float)pars.tanl(), (float)pars.curv(), (float)pars.hz()};
1463  setp[2]+= alfa;
1464  Float_t sete[15];
1465  for (int i=1,li=1,jj=0;i< kNPars;li+=++i) {
1466  for (int j=1;j<=i;j++) {sete[jj++]=errs.G()[li+j];}}
1467  StDcaGeometry *dca = new StDcaGeometry;
1468  gTrack->setDcaGeometry(dca);
1469  dca->set(setp,sete);
1470 
1471 }
1472 //_____________________________________________________________________________
1473 void StiStEventFiller::FillStHitErr(StHit *hh,const StiKalmanTrackNode *node)
1474 {
1475  double stiErr[6],stErr[6];
1476  memcpy(stiErr,node->hitErrs(),sizeof(stiErr));
1477  double alfa = node->getAlpha();
1478  double c = cos(alfa);
1479  double s = sin(alfa);
1480  double T[3][3]={{c,-s, 0}
1481  ,{s, c, 0}
1482  ,{0, 0, 1}};
1483 
1484  TCL::trasat(T[0],stiErr,stErr,3,3);
1485  StThreeVectorF f3(sqrt(stErr[0]),sqrt(stErr[2]),sqrt(stErr[5]));
1486  hh->setPositionError(f3);
1487 }
1488 //_____________________________________________________________________________
1489 void StiStEventFiller::fillPulls(StiKalmanTrack* track,const StGlobalTrack *gTrack, int gloPri)
1490 {
1491 enum dcaEmx {kImpImp,
1492  kZImp, kZZ,
1493  kPsiImp, kPsiZ, kPsiPsi,
1494  kPtiImp, kPtiZ, kPtiPsi, kPtiPti,
1495  kTanImp, kTanZ, kTanPsi, kTanPti, kTanTan};
1496 
1497  //cout << "StiStEventFiller::fillDetectorInfo() -I- Started"<<endl;
1498  if (!mPullEvent) return;
1499  if (gloPri && track->isPrimary()!=1) return;
1500  const StDcaGeometry *myDca = gTrack->dcaGeometry();
1501  if (!myDca) return;
1502 
1503  int dets[kMaxDetectorId][3];
1504  track->getAllPointCount(dets,kMaxDetectorId-1);
1505  StiPullTrk aux;
1506  aux.mVertex = (unsigned char)track->isPrimary();
1507  aux.mTrackNumber=track->getId();
1508  aux.nAllHits = dets[0][2];
1509  aux.nTpcHits = dets[kTpcId][2];
1510  aux.nSvtHits = dets[kSvtId][2];
1511  aux.nSsdHits = dets[kSsdId][2];
1512  aux.nPxlHits = dets[kPxlId][2];
1513  aux.nIstHits = dets[kIstId][2];
1514  aux.mL = (unsigned char)track->getTrackLength();
1515  aux.mChi2 = track->getChi2();
1516  aux.mCurv = myDca->curvature();
1517  aux.mPt = myDca->pt();
1518  aux.mPsi = myDca->psi();
1519  aux.mDip = myDca->dipAngle();
1520  StThreeVectorF v3 = myDca->origin();
1521  aux.mRxy = v3.perp();
1522  aux.mPhi = v3.phi();
1523  aux.mZ = v3.z();
1524 
1525  const float *errMx = myDca->errMatrix();
1526  aux.mPtErr = sqrt(errMx[kPtiPti])*aux.mPt*aux.mPt;
1527  double c2dip = myDca->tanDip(); c2dip = 1./(1.+c2dip*c2dip);
1528  aux.mPsiErr = sqrt(errMx[kPsiPsi]);
1529  aux.mDipErr = sqrt(errMx[kTanTan])*c2dip;
1530  aux.mRxyErr = sqrt(errMx[kImpImp]);
1531  aux.mZErr = sqrt(errMx[kZZ]);
1532 
1533  aux.mIdTruTk = gTrack->idTruth();
1534  aux.mQaTruTk = gTrack->qaTruth();
1535  mPullEvent->Add(aux,gloPri);
1536 
1537 
1538  StiKTNIterator tNode = track->rbegin();
1539  StiKTNIterator eNode = track->rend();
1540  for (;tNode!=eNode;++tNode)
1541  {
1542  StiKalmanTrackNode *node = &(*tNode);
1543  if(!node->isValid()) continue;
1544 
1545  StiHit *stiHit = node->getHit();
1546  if (!stiHit) continue;
1547 
1548  if (node->getChi2()>1000) continue;
1549  if (!node->isFitted()) continue;
1550 
1551  const StiDetector *detector = node->getDetector();
1552  assert(detector == stiHit->detector());
1553  assert(!detector || stiHit->timesUsed());
1554  StHit *hh = (StHit*)stiHit->stHit();
1555  fillPulls(hh,stiHit,node,track,dets,gloPri);
1556  if (gloPri) continue;
1557  fillPulls(hh,stiHit,node,track,dets,2);
1558  }
1559 }
1560 //_____________________________________________________________________________
1561  void StiStEventFiller::fillPulls(StHit *stHit,const StiHit *stiHit
1562  ,const StiKalmanTrackNode *node
1563  ,const StiKalmanTrack *track
1564  ,int dets[1][3],int gloPriRnd)
1565 {
1566  double x,y,z,r,xp,yp,zp,rp;
1567  float untErrs[3];
1568 
1569  const StiNodeInf *inf = 0;
1570  if (gloPriRnd==2) {
1571  inf = node->getInfo();
1572  if (!inf) return;
1573  }
1574  double timeFlight = node->getTime();
1575  const StiNodeErrs &mFE = (inf)? inf->mPE : node->fitErrs();
1576  const StiNodePars &mFP = (inf)? inf->mPP : node->fitPars();
1577  StiHitErrs mHrr;
1578  memcpy(mHrr.G(), (inf)? inf->mHrr.G() : node->hitErrs(),sizeof(StiHitErrs));
1579 
1580  StiPullHit aux;
1581 // local frame
1582 // local HIT
1583  aux.mIdTruth = stHit->idTruth();
1584  aux.mQaTruth = stHit->qaTruth();
1585 
1586  aux.mVertex = (unsigned char)track->isPrimary();
1587  aux.nHitCand = node->getHitCand();
1588  aux.iHitCand = node->getIHitCand();
1589  if (!aux.nHitCand) aux.nHitCand=1;
1590  aux.lXHit = stiHit->x();
1591  aux.lYHit = stiHit->y(timeFlight);
1592  aux.lZHit = stiHit->z(timeFlight);
1593  aux.lYHitErr = sqrt(mHrr.hYY);
1594  aux.lZHitErr = sqrt(mHrr.hZZ);
1595  aux.lHitEmx[0] = mHrr.hYY;
1596  aux.lHitEmx[1] = mHrr.hZY;
1597  aux.lHitEmx[2] = mHrr.hZZ;
1598 
1599 // local FIT
1600  aux.lXFit = mFP.x();
1601  aux.lYFit = mFP.y();
1602  aux.lZFit = mFP.z();
1603  aux.lYFitErr = sqrt(mFE._cYY);
1604  aux.lZFitErr = sqrt(mFE._cZZ);
1605  aux.lFitEmx[0] = mFE._cYY;
1606  aux.lFitEmx[1] = mFE._cZY;
1607  aux.lFitEmx[2] = mFE._cZZ;
1608 // assert(fabs(aux.lYFit-aux.lYHit)>1e-10 || fabs(aux.lXHit)<4);
1609 
1610 // local Pull
1611  xp = aux.lXHit;
1612  yp = (inf)? mFP.y(): (double)node->unTouched().mPar[0];
1613  zp = (inf)? mFP.z(): (double)node->unTouched().mPar[1];
1614  aux.lYPul = aux.lYHit-yp;
1615  aux.lZPul = aux.lZHit-zp;
1616  if (fabs(aux.lYPul)>10) StiDebug::Break(-1);
1617  if (fabs(aux.lZPul)>10) StiDebug::Break(-1);
1618  if (!inf) {TCL::ucopy(node->unTouched().mErr,untErrs,3);}
1619  else {TCL::ucopy(aux.lFitEmx ,untErrs,3);}
1620  //#ifdef YF /* I don't know why these parameters are not set */
1621  assert(untErrs[0]>=0);
1622  assert(untErrs[2]>=0);
1623  //#endif
1624  TCL::vadd(untErrs,aux.lHitEmx,aux.lPulEmx,3);
1625  aux.lYPulErr = sqrt(aux.lPulEmx[0]);
1626  aux.lZPulErr = sqrt(aux.lPulEmx[2]);
1627 
1628  aux.lPsi = mFP.eta();
1629  aux.lDip = atan(mFP.tanl());
1630 
1631 // global frame
1632  double alfa = node->getAlpha();
1633  float F[2][2];
1634 
1635 // global Hit
1636  x = stiHit->x(); y = stiHit->y(timeFlight); z = stiHit->z(timeFlight);
1637  r = sqrt(x*x+y*y);
1638 
1639  aux.gRHit = r;
1640  aux.gPHit = atan2(stiHit->y_g(),stiHit->x_g());
1641  aux.gZHit = stiHit->z_g();
1642  memset(F[0],0,sizeof(F));
1643  F[0][0]= x/(r*r);
1644  F[1][1]= 1;
1645  TCL::trasat(F[0],aux.lHitEmx,aux.gHitEmx,2,2);
1646  aux.gPHitErr = sqrt(aux.gHitEmx[0]);
1647  aux.gZHitErr = sqrt(aux.gHitEmx[2]);
1648 
1649 
1650 // global Fit
1651  x = mFP.x(); y = mFP.y();z = mFP.z();
1652  r = sqrt(x*x+y*y);
1653  aux.gRFit = r;
1654  aux.gPFit = NICE(atan2(y,x)+alfa);
1655  aux.gZFit = z;
1656 
1657  memset(F[0],0,sizeof(F));
1658  F[0][0]= x/(r*r);
1659  F[1][1]= 1;
1660  TCL::trasat(F[0],aux.lFitEmx,aux.gFitEmx,2,2);
1661  aux.gPFitErr = sqrt(aux.gFitEmx[0]);
1662  aux.gZFitErr = sqrt(aux.gFitEmx[2]);
1663 
1664 // global Pull
1665  rp = sqrt(xp*xp+yp*yp);
1666  aux.gPPul = ((aux.gPHit-alfa)-atan2(yp,xp))*rp;
1667  aux.gZPul = aux.lZHit-zp;
1668  memset(F[0],0,sizeof(F));
1669  F[0][0]= xp/(rp*rp);
1670  F[1][1]= 1;
1671  TCL::trasat(F[0],untErrs,aux.gPulEmx,2,2);
1672  TCL::vadd(aux.gHitEmx,aux.gPulEmx,aux.gPulEmx,3);
1673 // Now account that Phi ==> R*Phi
1674  aux.gPulEmx[0]*= rp*rp;
1675  aux.gPulEmx[1]*= rp;
1676  aux.gPPulErr = sqrt(aux.gPulEmx[0]);
1677  aux.gZPulErr = sqrt(aux.gPulEmx[2]);
1678 
1679  aux.gPsi = node->getPsi();
1680  aux.gDip = node->getDipAngle();
1681 
1682  // invariant
1683  aux.mCurv = mFP.curv();
1684  aux.mPt = fabs(1./mFP.ptin());
1685  aux.mCharge = stHit->charge();
1686  aux.mChi2 = node->getChi2();
1687  aux.mNormalRefAngle = alfa;
1688  aux.mHardwarePosition=0;
1689  aux.mDetector=0;
1690  aux.mTrackNumber=track->getId();
1691  aux.nAllHits = dets[0][2];
1692  aux.nTpcHits = dets[kTpcId][2];
1693  aux.nSvtHits = dets[kSvtId][2];
1694  aux.nSsdHits = dets[kSsdId][2];
1695  aux.nPxlHits = dets[kPxlId][2];
1696  aux.nIstHits = dets[kIstId][2];
1697  const StiDetector *stiDet = stiHit->detector();
1698  if (stiDet) {
1699  aux.mHardwarePosition=stHit->hardwarePosition();
1700  aux.mDetector=stHit->detector();
1701  const StiPlacement *place = stiDet->getPlacement();
1702  aux.mNormalRadius = place->getNormalRadius();
1703  aux.mNormalYOffset = place->getNormalYoffset();
1704  aux.mZCenter = 0;
1705  }
1706  mPullEvent->Add(aux,gloPriRnd);
1707 
1708 }
StiKalmanTrackNode * getInnOutMostNode(int inot, int qua) const
Same for getNNodes(qua)
void setParameters(double c, double dip, double phase, const StThreeVector< double > &o, int h)
starting point
Definition: StHelix.cc:139
StiKalmanTrackNode * getInnerMostHitNode(int qua=0) const
Accessor method returns the inner most hit node associated with the track.
Definition of Kalman Track.
static void hftHist(const char *tit, const StiKalmanTrack *tk)
Definition: StiHitTest.cxx:86
void fillFlags(StTrack *track)
Definition: StHit.h:125
StiKalmanTrackNode * getLastNode() const
Accessor method returns the last node associated with the track.
void getAllPointCount(int count[1][3], int maxDetId) const
Returns all the PointCount far all detectors and types of nodes.
Definition: StiHit.h:51
const Float_t & x() const
Return the local x, y, z values.
Definition: StiHit.h:67
StThreeVectorF getGlobalMomentumF() const
const StiDetector * detector() const
Definition: StiHit.h:96
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
Definition: StHelix.cc:240
Float_t x_g() const
Return the global x, y, z values.
Definition: StiHit.h:73
int getFitPointCount(int detectorId=0) const
Returns the number of hits associated and used in the fit of this track.
StiKalmanTrackNode * getInnerMostNode(int qua=0) const
Accessor method returns the inner most node associated with the track.
int getPointCount(int detectorId=0) const
Return the number of hits associated with this track.
Definition of Kalman Track.
static float * trasat(const float *a, const float *s, float *r, int m, int n)
Definition: TCernLib.cxx:540
UInt_t timesUsed() const
Return the number of times this hit was assigned to a track.
Definition: StiHit.h:108
double getChi2() const
UShort_t getSeedHitCount() const
number of hits used to seed the track
int isPrimary() const
double evaluateChi2(const StiHit *hit)
double getTrackLength() const
double getCurvature() const
Calculates and returns the tangent of the track pitch angle at this node.
void fillEvent(StEvent *e, StiTrackContainer *t)
void getGlobalTpt(float x[6], float e[15])
Extract state information from this node in TPT representation.
const StMeasuredPoint * stHit() const
Definition: StiHit.h:104
double getPt() const
Calculates and returns the transverse momentum of the track at the inner most node.
int getCharge() const
void fillDetectorInfo(StTrackDetectorInfo *detInfo, StiKalmanTrack *kTrack, bool refCountIncr)