StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPrimaryTrack.cxx
1 /***************************************************************************
2  *
3  * $Id: StPrimaryTrack.cxx,v 2.15 2013/07/23 11:21:49 jeromel Exp $
4  *
5  * Author: Thomas Ullrich, Sep 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StPrimaryTrack.cxx,v $
13  * Revision 2.15 2013/07/23 11:21:49 jeromel
14  * Undo past week changes
15  *
16  * Revision 2.13 2013/04/10 19:15:53 jeromel
17  * Step back from StEvent changes - previous change recoverable [Thomas OK-ed]
18  *
19  * Revision 2.11 2013/01/15 23:21:05 fisyak
20  * improve printouts
21  *
22  * Revision 2.10 2012/10/23 20:18:33 fisyak
23  * Add/modify print outs
24  *
25  * Revision 2.9 2012/05/07 14:42:57 fisyak
26  * Add handilings for Track to Fast Detectors Matching
27  *
28  * Revision 2.8 2009/11/23 16:34:06 fisyak
29  * Cleanup, remove dependence on dst tables, clean up software monitors
30  *
31  * Revision 2.7 2004/07/15 16:36:24 ullrich
32  * Removed all clone() declerations and definitions. Use StObject::clone() only.
33  *
34  * Revision 2.6 2001/05/30 17:45:54 perev
35  * StEvent branching
36  *
37  * Revision 2.5 2001/03/24 03:34:52 perev
38  * clone() -> clone() const
39  *
40  * Revision 2.4 2000/04/03 15:12:50 ullrich
41  * Fixed bug in vertex(). Always returned 0 instead of
42  * data member mVertex.
43  *
44  * Revision 2.3 1999/11/09 15:44:08 ullrich
45  * Removed method unlink() and all calls to it.
46  *
47  * Revision 2.2 1999/10/28 22:26:10 ullrich
48  * Adapted new StArray version. First version to compile on Linux and Sun.
49  *
50  * Revision 2.1 1999/10/13 19:45:00 ullrich
51  * Initial Revision
52  *
53  **************************************************************************/
54 #include "TClass.h"
55 #include "TString.h"
56 #include "StPrimaryTrack.h"
57 #include "StPrimaryVertex.h"
58 #include "StTrackGeometry.h"
59 ClassImp(StPrimaryTrack)
60 
61 static const char rcsid[] = "$Id: StPrimaryTrack.cxx,v 2.15 2013/07/23 11:21:49 jeromel Exp $";
62 StPrimaryTrack::StPrimaryTrack(): mVertex(0) {/* noop */}
63 const StVertex* StPrimaryTrack::vertex() const{ return mVertex; }
64 void StPrimaryTrack::setVertex(StVertex* val) {
65  StPrimaryVertex *p = dynamic_cast<StPrimaryVertex*>(val);
66  if (p) mVertex = p;
67 }
68 
69 void StPrimaryTrack::Streamer(TBuffer &R__b)
70 {
71  // Stream an object of class .
72 
73  if (R__b.IsReading()) {
74  UInt_t R__s, R__c;
75  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
76  if (R__v > 1) {
77  Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
78  return;
79  }
80  //====process old versions before automatic schema evolution
81  StTrack::Streamer(R__b);
82 
83 // R__b >> mVertex;
84  R__b >> (StPrimaryVertex*&)mVertex;
85 
86  R__b.CheckByteCount(R__s, R__c, Class());
87  //====end of old versions
88 
89  } else {
90  Class()->WriteBuffer(R__b,this);
91  }
92 }
93 //________________________________________________________________________________
94 ostream& operator<<(ostream& os, const StPrimaryTrack& track) {
95  os << *((StTrack *) &track);
96  Double_t charge = track.geometry()->charge();
97  StThreeVectorD g3 = track.geometry()->momentum(); // p of global track
98  os << Form(" q/pT %8.3f eta %8.3f phi %8.3f",
99  charge/g3.perp(),g3.pseudoRapidity(),g3.phi());
100  os << Form(" pxyz %8.3f%8.3f%8.3f",g3.x(),g3.y(),g3.z());
101  Double_t chi2_0 = track.fitTraits().chi2(0); if (chi2_0 > 9999.) chi2_0 = 9999.;
102  Double_t chi2_1 = track.fitTraits().chi2(1); if (chi2_1 > 9999.) chi2_1 = 9999.;
103  os << Form(" NF %2d chi2 %8.3f/%8.3f", track.fitTraits().numberOfFitPoints(),chi2_0,chi2_1);
104 #if 0
105  if (track.idTruth())
106  os << Form(" IdT:%5i Q:%3i", track.idTruth(), track.qaTruth());
107 #endif
108  return os;
109 }